Question

So I have this .rdf that I have loaded onto Stardog and then I am using Pubby running over Jetty, to browse the triple store.

In my rdf file, I have several blank nodes which is given a blank node identifier by stardog. So this is a snippet of the rdf file.

<kbp:ORG rdf:about="http://somehostname/resource/res1">
<kbp:canonical_mention>
<rdf:Description>
    <kbp:mentionStart rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">1234</kbp:mentionStart>
    <kbp:mentionEnd rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">1239</kbp:mentionEnd>
    </rdf:Description>
</kbp:canonical_mention>

So basically I have some resource "res1" which has links to blank node which has a mention start and mention end offset value.

The snippet of the config.ttl file for Pubby is shown below.

conf:dataset [
    # SPARQL endpoint URL of the dataset
conf:sparqlEndpoint <http://localhost:5822/xxx/query>;
    #conf:sparqlEndpoint <http://localhost:5822/foaf/query>;
    # Default graph name to query (not necessary for most endpoints)
    conf:sparqlDefaultGraph <http://dbpedia.org>;
    # Common URI prefix of all resource URIs in the SPARQL dataset
conf:datasetBase <http://somehostname/>;
...
...

So the key thing is the datasetBase which maps URIs to URL.

When I try to map this, there is an "Anonymous node" link but upon clicking, nothing is displayed. My guess is, this is because the blank node has some identifier like _:bnode1234 which is not mapped by Pubby.

I wanted to know if anyone out there knows how to map these blank nodes.

(Note: If I load this rdf as a static rdf file directly onto Pubby, it works fine. But when I use stardog as a triple store, this mapping doesn't quite work)

Was it helpful?

Solution

It probably works in Pubby because they are keeping the BNode id's available; generally, the SPARQL spec does not guarantee or require that BNode identifiers are persistent. That is, you can issue the same query multiple times, which brings back the same result set (including bnodes) and the identifiers can be different each time. Similarly, a bnode identifier in a query is treated like a variable, it does not mean you are querying for that specific bnode.

Thus, Pubby is probably being helpful and making that work which is why using it directly works as opposed to a third party database.

Stardog does support the Jena/ARQ trick of putting a bnode identifier in angle brackets, that is, <_:bnode1234> which is taken to mean, the bnode with the identifier "bnode1234". If you can get Pubby to use that syntax in queries for bnodes, it will probably work.

But generally, I think this is something you will have to take up with the Pubby developers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top