On 7/20/22 20:59, Andy Seaborne wrote:
On 20/07/2022 17:17, Olivier Dameron wrote:
Dear Jena community,
a FROM in a SPARQL subquery generates an error:
${JENA_HOME}/bin/sparql --data=data.trig
--query=query-subQuery-namedGraph.rq
Encountered " "from" "FROM "" at line 7, column 5.
Was expecting one of:
<IRIref> ...
...
I did not seen any specification that prevents it, and the query runs
fine with virtuoso. Did I miss something or is it a bug?
It is not in
https://www.w3.org/TR/sparql11-query/
https://www.w3.org/TR/sparql11-query/#rSubSelect
ah right, I did not go as far as the grammar (and I should have)
The dataset is fixed at the start of a query.
Did you mean to use GRAPH (use a query pattern on a particular graph)?
hmm this is an excellent point indeed. For future reference in the list,
I believe Andy suggests an alternative formulation:
PREFIX od: <http://www.univ-rennes1.fr/dameron/ontology/rdfTest/>
SELECT ?val
WHERE {
{
SELECT ?val
FROM od:MyGraph
WHERE {
GRAPH od:MyGraph {
od:a od:MyRelation ?val .
}
}
}
}
thank you very much for the insight
olivier
Andy
Thank you
olivier
with query-subQuery-namedGraph.rq:
----------------------------------
PREFIX od: <http://www.univ-rennes1.fr/dameron/ontology/rdfTest/>
SELECT ?val
WHERE {
{
SELECT ?val
FROM od:MyGraph
WHERE {
od:a od:MyRelation ?val .
}
}
}
and data.trig:
--------------
@prefix od: <http://www.univ-rennes1.fr/dameron/ontology/rdfTest/> .
od:a od:MyRelation od:b .
GRAPH od:MyGraph {
od:a od:MyRelation od:c .
}