How to serve hash URIs from a (Virtuoso) SPARQL endpoint?

Dear all,

  the data we would like to publish have hash URIs.  We have translated them
to RDF and store the RDF in a Virtuoso triple store with a SPARQL endpoint.

Now, when a client requests application/rdf+xml from a cool URI like
http://our.server/data/document#fragment, it actually makes a request for
http://our.server/data/document.  In the resulting RDF/XML it expects to find
the desired information unter rdf:ID="fragment" or
rdf:about="http://...#fragment", i.e. resolving everything behind the # is up
to the client.  That is, the RDF/XML document the server returns for
http://our.server/data/document must contain all triples relevant for
<http://our.server/data/document> and for any
<http://our.server/data/document#whatever> – i.e. we would essentially like
our SPARQL endpoint to emulate the behavior of a stupid web server serving a
static http://.../document.rdf file, which contains all those triples.

So far, our solution is that we rewrite the cool URI into the following query
to the SPARQL endpoint:

construct { ?s ?p ?o }
where { ?s ?p ?o .
    filter(
        ?s = "http://our.server/data/document"
            ||
        regex(?s,"^http://our.server/data/document#"))
}

That works, it's even efficient – but I wonder whether there is any better way
of doing it.

Thanks for your feedback,

Christoph

-- 
Christoph Lange, Jacobs Univ. Bremen, http://kwarc.info/clange, Skype duke4701

Received on Wednesday, 19 May 2010 11:44:25 UTC