On 31/10/13 13:01, Alison Callahan wrote:
Dear all,

I am trying to use Jena TDB (version 0.10.0) and ARQ (version 2.10.1) to
execute SPARQL queries over named graphs and their subgraphs, specifically
such that a SPARQL query to a specific graph will return all triples in
both the named graph and in subgraphs of the named graph that match the
query.

Consider the following example data in TRIG format that I have loaded into
a Jena Dataset :

<http://example.org/test:graph> {
      <http://example.org/test:a> <http://example.org/test_vocabulary:b>
    <http://example.org/test:c> .
      <http://example.org/test:d> <http://example.org/test_vocabulary:b> <
http://example.org/test:e> .
      <http://example.org/test:subgraph> <
http://www.w3.org/2004/03/trix/rdfg-1/subGraphOf> <
http://example.org/test:graph> .
}

  <http://example.org/test:subgraph> {
      <http://example.org/test:f> <http://example.org/test_vocabulary:b> <
http://example.org/test:g> .
      <http://example.org/test:h> <http://example.org/test_vocabulary:b> <
http://example.org/test:i> .
}

When I execute the following query:

SELECT *
FROM <http://test.org/graph>
WHERE {
?s <http://example.org/test_vocabulary:b> ?o .
}

The results returned are:

?s                                       ?o
<http://example.org/test:a> <http://example.org/test:c>
<http://example.org/test:d> <http://example.org/test:e>

However, I would also expect that

<http://example.org/test:f> <http://example.org/test:g> .
<http://example.org/test:h> <http://example.org/test:i> .

should be in the results because it is asserted that <
http://example.org/test:subgraph> is a subGraph of <
http://example.org/test:graph>.

Is this possible using Jena TDB?

Jena does not do any special processing for trix:subGraphOf. As far as the query is concerned, it's just a predciate like any other.

If you want one graph to be the subgraph of the other, you will have to put the contests of the subgraph into the overall graph.

        Andy


Thanks,

Alison


Reply via email to