Search code examples
sparqljenafusekinamed-graphs

SPARQL to a Named Graph in Jena SDB


I want to query my Apache Jena triplestore with SPAQRL. Let's assume there is a named graph "namedGraph" in my dateset. Now I query with the following SPAQRL:

SELECT ?src ?subject ?predicate ?object
WHERE{
    GRAPH ?src{
        ?subject ?predicate ?object
    }
} 

and i get the whole model with <namedGraph> as ?src value. So far, everything is fine, but when I use this SPARQL:

SELECT ?subject ?predicate ?object
WHERE{
    GRAPH <namedGraph>{
        ?subject ?predicate ?object
    }
} 

there is no result. What am I doing wrong? Thanks.


Solution

  • Ok, it was a mistake. I gave my Model a normal name - namedGraph. If you don't provide an URI like http://example/namedGraph Apache Jena initializes this graph with the following default URI: http://server/unset-base/namedGraph.