I want to query on two different named graphs as the default graph with SPARQL:
SELECT *
FROM <graph1>
FROM <graph2>
WHERE {
...
}
My problem is that I don't know the URI of <graph1>
, but I know a specific triple of <graph1>
allowing me to find his URI.
SELECT ?g
WHERE {
GRAPH ?g {
eg:MyKnownURI a eg:Element.
}
}
Currently, I have to perform the second query to get <graph1>
and next, I can perform the first query.
Is there a syntax to perform the two requests in one ?
There is no standard way to change the dataset beign queried after the query starts. This is especially true if FROM is loading from the web.
If you can put all the possible graphs in the datasets, you can use GRAPH. if you can't, then your two step approach is the way to do it.