Hello,
   Il would like to create a named graph from a CONSTRUCT query.

The page
https://jena.apache.org/documentation/query/construct-quad.html
says that it is supported since jena-3.0.1. I am using 3.12.0.
I can make the CONSTRUCT clause work without a named graph, but adding
one in the construct leads to an error (cf. below)

This seems to be a topics of interest
https://github.com/w3c/sparql-12/issues/31
The stackoverflow page
https://stackoverflow.com/questions/18345908/construct-into-a-named-graph
gives a cumbersome alternative . The github issue mentions jena as a
working implementation. What am I doing wrong?

Thank you!
olivier



${JENA_HOME}/bin/sparql --version
Jena:       VERSION: 3.12.0
Jena:       BUILD_DATE: 2019-05-27T16:07:27+0000


cat data.ttl
@prefix : <http://www.example.com/> .

:a :r1 :b .
:c :r1 :b .
:d :r1 :e .


cat constructNamedGraph.rq
PREFIX : <http://www.example.com/>

CONSTRUCT {
  GRAPH :g {
    ?s :rel2 ?o .
  }
}

WHERE {
    ?s :r1 ?o .
}


${JENA_HOME}/bin/sparql --data=./data.ttl --query=./constructNamedGraph.rq
Encountered " "graph" "GRAPH "" at line 4, column 3.
Was expecting one of:
    <IRIref> ...
    <PNAME_NS> ...
    <PNAME_LN> ...

Reply via email to