Named Graph and Dereferentiation

Hi all, some implementations of sparql dereferentiate the content from a uri on FROM NAMED GRAPH.

select *
?s ?p ?o

That would return all triples in example.nt

Why stardog does not do so? Is there a away to query a remote file (eg. .nt)?

There’re two things here: first, Stardog won’t dereference IRIs in FROM NAMED or FROM clauses. Those should be used with named graphs in the data. If you want to query remote sources, you can use the SERVICE keyword (assuming there’s a SPARQL endpoint to serve requests). Second, this query wouldn’t return results even if example.nt was a local named graph. Since your triple pattern is not within a graph ?g {...} block, you should use FROM.


You could get something very close to what you’re looking for with a quick bash command

$> URI="
$> stardog data add myDb --named-graph $URI <(curl -s $URI)

I haven’t had a chance to test it but if it’s not correct it should be close. You might need to be explicit with the file type and add “-format NTRIPLES” . Hope that helps :slight_smile:

By the way, I believe the original query is not correct: when using FROM NAMED (as opposed to FROM) you need to actually name the graph in the query. For example:
SELECT * FROM NAMED <> WHERE { GRAPH <> {?s ?p ?o} }

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.