On 20/07/2019 21:18, Andy Seaborne wrote:
Hi olivier,

The documentation is at:

http://jena.staging.apache.org/documentation/query/construct-quad.html

Actually:
https://jena.apache.org/documentation/query/construct-quad.html

(browser autocomplete! the other link is the staging area, not the published area)


This is an extension - put the query in a file with extension ".arq", or set the syntax to Syntax.syntaxARQ.

The default for .rq and the API is SPARQL 1.1

The default for Fuseki is ARQ-extened syntax.

     Andy

On 19/07/2019 18:06, Olivier Dameron wrote:
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