I have a problem when performing a query over multiple named graphs. For instance the following works as all triples are in the HVAC-I graph:
PREFIX seas: <https://w3id.org/seas/>
PREFIX prov: <http://www.w3.org/ns/prov#>
SELECT *
FROM NAMED <https://localhost/seas/HVAC>
FROM NAMED <https://localhost/seas/HVAC-I>
WHERE {
GRAPH ?g {
<propURI> seas:evaluation ?eval .
?eval seas:evaluatedValue ?latestVal ;
prov:wasGeneratedAtTime ?latestTime .
OPTIONAL {
?eval prov:wasDerivedFrom ?depEval .
}
}
}
But when I extend the OPTIONAL statement with the following, I get no results (as these triples are in the HVAC graph):
OPTIONAL {
?eval prov:wasDerivedFrom ?depEval .
?depEval ^seas:evaluation ?depProp .
}
Performing the query alone does return a result:
SELECT *
FROM NAMED <https://localhost/seas/HVAC>
WHERE {
GRAPH ?g {
<evalURI> ^seas:evaluation ?prop
}
}
I might have misunderstood the SPARQL syntax, but I believe what I am trying to achieve is not impossible?