Re: Likely bug: short form for the CONSTRUCT query + GRAPH => syntax error

2017-02-16 Thread Andy Seaborne



On 16/02/17 20:37, Martynas Jusevičius wrote:

It has to be a basic pattern:
https://www.w3.org/TR/sparql11-query/#constructWhere


Yes.

CONSTRUCT WHERE { P } is a short form for

CONSTRUCT { P } WHERE { P }

(In fact, that is how it is executed.)

The restrictions on P used as a template apply.

"CONSTRUCT WHERE" is extract this subgraph where the subgraph 
description is restricted to what is allowed in a tenplate. 
Turtle+Variables.


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


Andy



On Thu, 16 Feb 2017 at 21.31, Jean-Marc Vanel 
wrote:


Indeed adding syntaxARQ brings a progress:
QueryFactory.create(query, Syntax.syntaxARQ)

GRAPH is tolerated,
but OPTIONAL is not:

Exception in thread "main" org.apache.jena.query.QueryParseException:
Encountered " "optional" "OPTIONAL "" at line 9, column 11.
Was expecting one of:
 ...
 ...
 ...
 ...
 ...
 ...
"true" ...
"false" ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
"(" ...
 ...
"}" ...
"[" ...
 ...

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



2017-02-16 17:54 GMT+01:00 Rob Vesse :


As a general comment the short form of construct is very constrained.
Anything other than that simple triple patterns is illegal in the short

form


 Rob

On 16/02/2017 16:45, "Andy Seaborne"  wrote:

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:
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
> "true" ...
> "false" ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
> "(" ...
>  ...
> "}" ...
> "[" ...
>  ...
>
> at
> org.apache.jena.sparql.lang.ParserSPARQL11.perform(
ParserSPARQL11.java:100)
>
>









--
Jean-Marc Vanel

http://www.semantic-forms.cc:9111/display?displayuri=http://jmvanel.free.fr/jmv.rdf%23me
Déductions SARL - Consulting, services, training,
Rule-based programming, Semantic Web
+33 (0)6 89 16 29 52
Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui





Re: Likely bug: short form for the CONSTRUCT query + GRAPH => syntax error

2017-02-16 Thread Martynas Jusevičius
It has to be a basic pattern:
https://www.w3.org/TR/sparql11-query/#constructWhere

On Thu, 16 Feb 2017 at 21.31, Jean-Marc Vanel 
wrote:

> Indeed adding syntaxARQ brings a progress:
> QueryFactory.create(query, Syntax.syntaxARQ)
>
> GRAPH is tolerated,
> but OPTIONAL is not:
>
> Exception in thread "main" org.apache.jena.query.QueryParseException:
> Encountered " "optional" "OPTIONAL "" at line 9, column 11.
> Was expecting one of:
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
> "true" ...
> "false" ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
> "(" ...
>  ...
> "}" ...
> "[" ...
>  ...
>
> at
> org.apache.jena.sparql.lang.ParserSPARQL11.perform(ParserSPARQL11.java:100)
> at
> org.apache.jena.sparql.lang.ParserSPARQL11.parse$(ParserSPARQL11.java:52)
>
>
>
> 2017-02-16 17:54 GMT+01:00 Rob Vesse :
>
> > As a general comment the short form of construct is very constrained.
> > Anything other than that simple triple patterns is illegal in the short
> form
> >
> >  Rob
> >
> > On 16/02/2017 16:45, "Andy Seaborne"  wrote:
> >
> > 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:
> > >  ...
> > >  ...
> > >  ...
> > >  ...
> > >  ...
> > >  ...
> > > "true" ...
> > > "false" ...
> > >  ...
> > >  ...
> > >  ...
> > >  ...
> > >  ...
> > >  ...
> > >  ...
> > >  ...
> > >  ...
> > >  ...
> > >  ...
> > >  ...
> > >  ...
> > > "(" ...
> > >  ...
> > > "}" ...
> > > "[" ...
> > >  ...
> > >
> > > at
> > > org.apache.jena.sparql.lang.ParserSPARQL11.perform(
> > ParserSPARQL11.java:100)
> > >
> > >
> >
> >
> >
> >
> >
> >
>
>
> --
> Jean-Marc Vanel
>
> http://www.semantic-forms.cc:9111/display?displayuri=http://jmvanel.free.fr/jmv.rdf%23me
> Déductions SARL - Consulting, services, training,
> Rule-based programming, Semantic Web
> +33 (0)6 89 16 29 52
> Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui
>


Re: Likely bug: short form for the CONSTRUCT query + GRAPH => syntax error

2017-02-16 Thread Jean-Marc Vanel
Indeed adding syntaxARQ brings a progress:
QueryFactory.create(query, Syntax.syntaxARQ)

GRAPH is tolerated,
but OPTIONAL is not:

Exception in thread "main" org.apache.jena.query.QueryParseException:
Encountered " "optional" "OPTIONAL "" at line 9, column 11.
Was expecting one of:
 ...
 ...
 ...
 ...
 ...
 ...
"true" ...
"false" ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
"(" ...
 ...
"}" ...
"[" ...
 ...

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



2017-02-16 17:54 GMT+01:00 Rob Vesse :

> As a general comment the short form of construct is very constrained.
> Anything other than that simple triple patterns is illegal in the short form
>
>  Rob
>
> On 16/02/2017 16:45, "Andy Seaborne"  wrote:
>
> 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:
> >  ...
> >  ...
> >  ...
> >  ...
> >  ...
> >  ...
> > "true" ...
> > "false" ...
> >  ...
> >  ...
> >  ...
> >  ...
> >  ...
> >  ...
> >  ...
> >  ...
> >  ...
> >  ...
> >  ...
> >  ...
> >  ...
> > "(" ...
> >  ...
> > "}" ...
> > "[" ...
> >  ...
> >
> > at
> > org.apache.jena.sparql.lang.ParserSPARQL11.perform(
> ParserSPARQL11.java:100)
> >
> >
>
>
>
>
>
>


-- 
Jean-Marc Vanel
http://www.semantic-forms.cc:9111/display?displayuri=http://jmvanel.free.fr/jmv.rdf%23me
Déductions SARL - Consulting, services, training,
Rule-based programming, Semantic Web
+33 (0)6 89 16 29 52
Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui


Re: Likely bug: short form for the CONSTRUCT query + GRAPH => syntax error

2017-02-16 Thread Rob Vesse
As a general comment the short form of construct is very constrained. Anything 
other than that simple triple patterns is illegal in the short form

 Rob

On 16/02/2017 16:45, "Andy Seaborne"  wrote:

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:
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
> "true" ...
> "false" ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
>  ...
> "(" ...
>  ...
> "}" ...
> "[" ...
>  ...
>
> at
> 
org.apache.jena.sparql.lang.ParserSPARQL11.perform(ParserSPARQL11.java:100)
>
>







Re: Likely bug: short form for the CONSTRUCT query + GRAPH => syntax error

2017-02-16 Thread Andy Seaborne

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:
 ...
 ...
 ...
 ...
 ...
 ...
"true" ...
"false" ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
"(" ...
 ...
"}" ...
"[" ...
 ...

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




Likely bug: short form for the CONSTRUCT query + GRAPH => syntax error

2017-02-16 Thread Jean-Marc Vanel
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:
 ...
 ...
 ...
 ...
 ...
 ...
"true" ...
"false" ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
 ...
"(" ...
 ...
"}" ...
"[" ...
 ...

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


-- 
Jean-Marc Vanel
http://www.semantic-forms.cc:9111/display?displayuri=http://jmvanel.free.fr/jmv.rdf%23me
Déductions SARL - Consulting, services, training,
Rule-based programming, Semantic Web
+33 (0)6 89 16 29 52
Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui