Hi,

The result of a CONSTRUCT is an RDF graph and the template must be a "triples template"

[10]    ConstructQuery    ::=
             'CONSTRUCT' ... 'WHERE' '{' TriplesTemplate? '}'  ...

and

[52]    TriplesTemplate   ::=
             TriplesSameSubject ( '.' TriplesTemplate? )?

No GRAPH.

Jena accepts  CONSTRUCT WHERE { GRAPH .... }
in extended mode (Syntax.syntaxARQ) and returns a Dataset.

        Andy


On 16/02/17 14:52, Jean-Marc Vanel wrote:
Hi

I tested with 3.2.0.

The short form for the CONSTRUCT query
https://www.w3.org/TR/sparql11-query/#constructWhere
works, at least syntactically ( I have nothing in the default graph in my
TDB ) :
CONSTRUCT WHERE
 { ?X ?P ?O . }
 LIMIT 10

But adding GRAPH pattern gives a synyax error:
CONSTRUCT WHERE  {
GRAPH ?G {
    ?X ?P ?O .
}
} LIMIT 10

Which does not occur e.g. with Virtuoso.

org.apache.jena.query.QueryParseException: Encountered " "graph" "GRAPH ""
at line 2, column 1.
Was expecting one of:
    <IRIref> ...
    <PNAME_NS> ...
    <PNAME_LN> ...
    <BLANK_NODE_LABEL> ...
    <VAR1> ...
    <VAR2> ...
    "true" ...
    "false" ...
    <INTEGER> ...
    <DECIMAL> ...
    <DOUBLE> ...
    <INTEGER_POSITIVE> ...
    <DECIMAL_POSITIVE> ...
    <DOUBLE_POSITIVE> ...
    <INTEGER_NEGATIVE> ...
    <DECIMAL_NEGATIVE> ...
    <DOUBLE_NEGATIVE> ...
    <STRING_LITERAL1> ...
    <STRING_LITERAL2> ...
    <STRING_LITERAL_LONG1> ...
    <STRING_LITERAL_LONG2> ...
    "(" ...
    <NIL> ...
    "}" ...
    "[" ...
    <ANON> ...

    at
org.apache.jena.sparql.lang.ParserSPARQL11.perform(ParserSPARQL11.java:100)


Reply via email to