To fetch all the triples from a named graph in my triplestore (OpenLink Virtuoso v6.1), I have written the SPARQL query:
SELECT ?s ?p ?o
WHERE {
GRAPH eg:myGraph {
?s ?p ?o.
}
}
But it seems I can't define the graph URI in the GRAPH declaration; the query doesn't return any triples.
If I use an intermediate variable ?g
instead of the URI of my graph, the request works:
SELECT ?s ?p ?o
WHERE {
FILTER(?g = eg:myGraph).
GRAPH ?g {
?s ?p ?o.
}
}
I don't see the difference between the two queries.
Is my first syntax a wrong query? Is this a subtlety of Virtuoso?