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: SPARQL Update over model

2017-02-16 Thread Julien Plu
Ok I found the trick:

Dataset ds = DatasetFactory.create();
ds.addNamedModel("http://3cixty.com/cotedazur/test;,
RDFDataMgr.loadModel("myfile")));

Thanks a lot for the hint!!

--
Julien Plu

PhD Student at Eurecom.
Personal webpage: http://jplu.developpez.com
FOAF file : http://jplu.developpez.com/julien
Email address : julien@eurecom.fr && *plu.jul...@gmail.com
*
Phone : +33493008103
Twitter : @julienplu

2017-02-16 18:44 GMT+01:00 Julien Plu :

> Sorry but I don't understand how to use the DatasetFactory to do what I'm
> looking for, is there such method that takes two parameters, one is the
> name of the graph and the other is the model?
>
> --
> Julien Plu
>
> PhD Student at Eurecom.
> Personal webpage: http://jplu.developpez.com
> FOAF file : http://jplu.developpez.com/julien
> Email address : julien@eurecom.fr && *plu.jul...@gmail.com
> *
> Phone : +33493008103 <04%2093%2000%2081%2003>
> Twitter : @julienplu
>
> 2017-02-16 17:13 GMT+01:00 A. Soroka :
>
>> Try starting with:
>>
>> https://jena.apache.org/documentation/javadoc/arq/org/apache
>> /jena/query/DatasetFactory.html
>>
>> (I probably should have said that to begin with.)
>>
>> ---
>> A. Soroka
>> The University of Virginia Library
>>
>> > On Feb 16, 2017, at 11:11 AM, Julien Plu > ez.com> wrote:
>> >
>> > Thanks! I will try to use
>> > https://jena.apache.org/documentation/javadoc/arq/org/apache
>> /jena/sparql/core/DatasetGraphBase.html
>> > seems to be what I'm looking for.
>> >
>> > --
>> > Julien Plu
>> >
>> > PhD Student at Eurecom.
>> > Personal webpage: http://jplu.developpez.com
>> > FOAF file : http://jplu.developpez.com/julien
>> > Email address : julien@eurecom.fr && *plu.jul...@gmail.com
>> > *
>> > Phone : +33493008103
>> > Twitter : @julienplu
>> >
>> > 2017-02-16 17:01 GMT+01:00 A. Soroka :
>> >
>> >> A model holds exactly one graph. Perhaps you want to be using a dataset
>> >> [1]?
>> >>
>> >> ---
>> >> A. Soroka
>> >> The University of Virginia Library
>> >>
>> >> [1] https://www.w3.org/TR/rdf11-concepts/#section-dataset
>> >>
>> >>> On Feb 16, 2017, at 10:59 AM, Julien Plu > >> developpez.com> wrote:
>> >>>
>> >>> Hello,
>> >>>
>> >>> I'm trying to make a SPARQL update query over a model, the problem is
>> >> that
>> >>> the query has to delete a triple belonging to a specific graph:
>> >>>
>> >>> PREFIX dc:
>> >>> DELETE {
>> >>>   GRAPH  {
>> >>>   <
>> >>> http://data.linkedevents.org/event/51f5ecc8-55b4-3a1b-98de-5
>> 5e4448ab7bf>
>> >>> dc:identifier ?o .
>> >>>   }
>> >>>   } WHERE {
>> >>>   GRAPH  {
>> >>>   <
>> >>> http://data.linkedevents.org/event/51f5ecc8-55b4-3a1b-98de-5
>> 5e4448ab7bf>
>> >>> dc:identifier ?o .
>> >>>   }
>> >>> }
>> >>>
>> >>> which apparently has no effect when we proceed that way:
>> >>>
>> >>> Model model = RDFDataMgr.loadModel("file.ttl");
>> >>> UpdateAction.parseExecute(sparql_query, model);
>> >>>
>> >>> I suppose it is normal as I never created the graph in the model.
>> >>> Nevertheless when I do:
>> >>>
>> >>> Model model = ModelFactory.createModelForGraph(new
>> >>> SimpleGraphMaker().createGraph("http://3cixty.com/cotedazur/test;));
>> >>> model.read("file.ttl");
>> >>> UpdateAction.parseExecute(sparql_query, model);
>> >>>
>> >>> It has no effect as well. Can someone guide me on how to do such thing
>> >>> properly?
>> >>>
>> >>> Thanks in advance.
>> >>>
>> >>> Regards.
>> >>> --
>> >>> Julien Plu
>> >>>
>> >>> PhD Student at Eurecom.
>> >>> Personal webpage: http://jplu.developpez.com
>> >>> FOAF file : http://jplu.developpez.com/julien
>> >>> Email address : julien@eurecom.fr && *plu.jul...@gmail.com
>> >>> *
>> >>> Phone : +33493008103
>> >>> Twitter : @julienplu
>> >>
>> >>
>>
>>
>


Re: SPARQL Update over model

2017-02-16 Thread Julien Plu
Sorry but I don't understand how to use the DatasetFactory to do what I'm
looking for, is there such method that takes two parameters, one is the
name of the graph and the other is the model?

--
Julien Plu

PhD Student at Eurecom.
Personal webpage: http://jplu.developpez.com
FOAF file : http://jplu.developpez.com/julien
Email address : julien@eurecom.fr && *plu.jul...@gmail.com
*
Phone : +33493008103
Twitter : @julienplu

2017-02-16 17:13 GMT+01:00 A. Soroka :

> Try starting with:
>
> https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/query/
> DatasetFactory.html
>
> (I probably should have said that to begin with.)
>
> ---
> A. Soroka
> The University of Virginia Library
>
> > On Feb 16, 2017, at 11:11 AM, Julien Plu  developpez.com> wrote:
> >
> > Thanks! I will try to use
> > https://jena.apache.org/documentation/javadoc/arq/org/
> apache/jena/sparql/core/DatasetGraphBase.html
> > seems to be what I'm looking for.
> >
> > --
> > Julien Plu
> >
> > PhD Student at Eurecom.
> > Personal webpage: http://jplu.developpez.com
> > FOAF file : http://jplu.developpez.com/julien
> > Email address : julien@eurecom.fr && *plu.jul...@gmail.com
> > *
> > Phone : +33493008103
> > Twitter : @julienplu
> >
> > 2017-02-16 17:01 GMT+01:00 A. Soroka :
> >
> >> A model holds exactly one graph. Perhaps you want to be using a dataset
> >> [1]?
> >>
> >> ---
> >> A. Soroka
> >> The University of Virginia Library
> >>
> >> [1] https://www.w3.org/TR/rdf11-concepts/#section-dataset
> >>
> >>> On Feb 16, 2017, at 10:59 AM, Julien Plu  >> developpez.com> wrote:
> >>>
> >>> Hello,
> >>>
> >>> I'm trying to make a SPARQL update query over a model, the problem is
> >> that
> >>> the query has to delete a triple belonging to a specific graph:
> >>>
> >>> PREFIX dc:
> >>> DELETE {
> >>>   GRAPH  {
> >>>   <
> >>> http://data.linkedevents.org/event/51f5ecc8-55b4-3a1b-98de-
> 55e4448ab7bf>
> >>> dc:identifier ?o .
> >>>   }
> >>>   } WHERE {
> >>>   GRAPH  {
> >>>   <
> >>> http://data.linkedevents.org/event/51f5ecc8-55b4-3a1b-98de-
> 55e4448ab7bf>
> >>> dc:identifier ?o .
> >>>   }
> >>> }
> >>>
> >>> which apparently has no effect when we proceed that way:
> >>>
> >>> Model model = RDFDataMgr.loadModel("file.ttl");
> >>> UpdateAction.parseExecute(sparql_query, model);
> >>>
> >>> I suppose it is normal as I never created the graph in the model.
> >>> Nevertheless when I do:
> >>>
> >>> Model model = ModelFactory.createModelForGraph(new
> >>> SimpleGraphMaker().createGraph("http://3cixty.com/cotedazur/test;));
> >>> model.read("file.ttl");
> >>> UpdateAction.parseExecute(sparql_query, model);
> >>>
> >>> It has no effect as well. Can someone guide me on how to do such thing
> >>> properly?
> >>>
> >>> Thanks in advance.
> >>>
> >>> Regards.
> >>> --
> >>> Julien Plu
> >>>
> >>> PhD Student at Eurecom.
> >>> Personal webpage: http://jplu.developpez.com
> >>> FOAF file : http://jplu.developpez.com/julien
> >>> Email address : julien@eurecom.fr && *plu.jul...@gmail.com
> >>> *
> >>> Phone : +33493008103
> >>> Twitter : @julienplu
> >>
> >>
>
>


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)




Re: SPARQL Update over model

2017-02-16 Thread A. Soroka
Try starting with:

https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/query/DatasetFactory.html

(I probably should have said that to begin with.)

---
A. Soroka
The University of Virginia Library

> On Feb 16, 2017, at 11:11 AM, Julien Plu 
>  wrote:
> 
> Thanks! I will try to use
> https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/sparql/core/DatasetGraphBase.html
> seems to be what I'm looking for.
> 
> --
> Julien Plu
> 
> PhD Student at Eurecom.
> Personal webpage: http://jplu.developpez.com
> FOAF file : http://jplu.developpez.com/julien
> Email address : julien@eurecom.fr && *plu.jul...@gmail.com
> *
> Phone : +33493008103
> Twitter : @julienplu
> 
> 2017-02-16 17:01 GMT+01:00 A. Soroka :
> 
>> A model holds exactly one graph. Perhaps you want to be using a dataset
>> [1]?
>> 
>> ---
>> A. Soroka
>> The University of Virginia Library
>> 
>> [1] https://www.w3.org/TR/rdf11-concepts/#section-dataset
>> 
>>> On Feb 16, 2017, at 10:59 AM, Julien Plu > developpez.com> wrote:
>>> 
>>> Hello,
>>> 
>>> I'm trying to make a SPARQL update query over a model, the problem is
>> that
>>> the query has to delete a triple belonging to a specific graph:
>>> 
>>> PREFIX dc:
>>> DELETE {
>>>   GRAPH  {
>>>   <
>>> http://data.linkedevents.org/event/51f5ecc8-55b4-3a1b-98de-55e4448ab7bf>
>>> dc:identifier ?o .
>>>   }
>>>   } WHERE {
>>>   GRAPH  {
>>>   <
>>> http://data.linkedevents.org/event/51f5ecc8-55b4-3a1b-98de-55e4448ab7bf>
>>> dc:identifier ?o .
>>>   }
>>> }
>>> 
>>> which apparently has no effect when we proceed that way:
>>> 
>>> Model model = RDFDataMgr.loadModel("file.ttl");
>>> UpdateAction.parseExecute(sparql_query, model);
>>> 
>>> I suppose it is normal as I never created the graph in the model.
>>> Nevertheless when I do:
>>> 
>>> Model model = ModelFactory.createModelForGraph(new
>>> SimpleGraphMaker().createGraph("http://3cixty.com/cotedazur/test;));
>>> model.read("file.ttl");
>>> UpdateAction.parseExecute(sparql_query, model);
>>> 
>>> It has no effect as well. Can someone guide me on how to do such thing
>>> properly?
>>> 
>>> Thanks in advance.
>>> 
>>> Regards.
>>> --
>>> Julien Plu
>>> 
>>> PhD Student at Eurecom.
>>> Personal webpage: http://jplu.developpez.com
>>> FOAF file : http://jplu.developpez.com/julien
>>> Email address : julien@eurecom.fr && *plu.jul...@gmail.com
>>> *
>>> Phone : +33493008103
>>> Twitter : @julienplu
>> 
>> 



Re: SPARQL Update over model

2017-02-16 Thread Julien Plu
Thanks! I will try to use
https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/sparql/core/DatasetGraphBase.html
seems to be what I'm looking for.

--
Julien Plu

PhD Student at Eurecom.
Personal webpage: http://jplu.developpez.com
FOAF file : http://jplu.developpez.com/julien
Email address : julien@eurecom.fr && *plu.jul...@gmail.com
*
Phone : +33493008103
Twitter : @julienplu

2017-02-16 17:01 GMT+01:00 A. Soroka :

> A model holds exactly one graph. Perhaps you want to be using a dataset
> [1]?
>
> ---
> A. Soroka
> The University of Virginia Library
>
> [1] https://www.w3.org/TR/rdf11-concepts/#section-dataset
>
> > On Feb 16, 2017, at 10:59 AM, Julien Plu  developpez.com> wrote:
> >
> > Hello,
> >
> > I'm trying to make a SPARQL update query over a model, the problem is
> that
> > the query has to delete a triple belonging to a specific graph:
> >
> > PREFIX dc:
> > DELETE {
> >GRAPH  {
> ><
> > http://data.linkedevents.org/event/51f5ecc8-55b4-3a1b-98de-55e4448ab7bf>
> > dc:identifier ?o .
> >}
> >} WHERE {
> >GRAPH  {
> ><
> > http://data.linkedevents.org/event/51f5ecc8-55b4-3a1b-98de-55e4448ab7bf>
> > dc:identifier ?o .
> >}
> > }
> >
> > which apparently has no effect when we proceed that way:
> >
> > Model model = RDFDataMgr.loadModel("file.ttl");
> > UpdateAction.parseExecute(sparql_query, model);
> >
> > I suppose it is normal as I never created the graph in the model.
> > Nevertheless when I do:
> >
> > Model model = ModelFactory.createModelForGraph(new
> > SimpleGraphMaker().createGraph("http://3cixty.com/cotedazur/test;));
> > model.read("file.ttl");
> > UpdateAction.parseExecute(sparql_query, model);
> >
> > It has no effect as well. Can someone guide me on how to do such thing
> > properly?
> >
> > Thanks in advance.
> >
> > Regards.
> > --
> > Julien Plu
> >
> > PhD Student at Eurecom.
> > Personal webpage: http://jplu.developpez.com
> > FOAF file : http://jplu.developpez.com/julien
> > Email address : julien@eurecom.fr && *plu.jul...@gmail.com
> > *
> > Phone : +33493008103
> > Twitter : @julienplu
>
>


Re: SPARQL Update over model

2017-02-16 Thread A. Soroka
A model holds exactly one graph. Perhaps you want to be using a dataset [1]?

---
A. Soroka
The University of Virginia Library

[1] https://www.w3.org/TR/rdf11-concepts/#section-dataset

> On Feb 16, 2017, at 10:59 AM, Julien Plu 
>  wrote:
> 
> Hello,
> 
> I'm trying to make a SPARQL update query over a model, the problem is that
> the query has to delete a triple belonging to a specific graph:
> 
> PREFIX dc:
> DELETE {
>GRAPH  {
><
> http://data.linkedevents.org/event/51f5ecc8-55b4-3a1b-98de-55e4448ab7bf>
> dc:identifier ?o .
>}
>} WHERE {
>GRAPH  {
><
> http://data.linkedevents.org/event/51f5ecc8-55b4-3a1b-98de-55e4448ab7bf>
> dc:identifier ?o .
>}
> }
> 
> which apparently has no effect when we proceed that way:
> 
> Model model = RDFDataMgr.loadModel("file.ttl");
> UpdateAction.parseExecute(sparql_query, model);
> 
> I suppose it is normal as I never created the graph in the model.
> Nevertheless when I do:
> 
> Model model = ModelFactory.createModelForGraph(new
> SimpleGraphMaker().createGraph("http://3cixty.com/cotedazur/test;));
> model.read("file.ttl");
> UpdateAction.parseExecute(sparql_query, model);
> 
> It has no effect as well. Can someone guide me on how to do such thing
> properly?
> 
> Thanks in advance.
> 
> Regards.
> --
> Julien Plu
> 
> PhD Student at Eurecom.
> Personal webpage: http://jplu.developpez.com
> FOAF file : http://jplu.developpez.com/julien
> Email address : julien@eurecom.fr && *plu.jul...@gmail.com
> *
> Phone : +33493008103
> Twitter : @julienplu



SPARQL Update over model

2017-02-16 Thread Julien Plu
Hello,

I'm trying to make a SPARQL update query over a model, the problem is that
the query has to delete a triple belonging to a specific graph:

PREFIX dc:
DELETE {
GRAPH  {
<
http://data.linkedevents.org/event/51f5ecc8-55b4-3a1b-98de-55e4448ab7bf>
dc:identifier ?o .
}
} WHERE {
GRAPH  {
<
http://data.linkedevents.org/event/51f5ecc8-55b4-3a1b-98de-55e4448ab7bf>
dc:identifier ?o .
}
}

which apparently has no effect when we proceed that way:

Model model = RDFDataMgr.loadModel("file.ttl");
UpdateAction.parseExecute(sparql_query, model);

I suppose it is normal as I never created the graph in the model.
Nevertheless when I do:

Model model = ModelFactory.createModelForGraph(new
SimpleGraphMaker().createGraph("http://3cixty.com/cotedazur/test;));
model.read("file.ttl");
UpdateAction.parseExecute(sparql_query, model);

It has no effect as well. Can someone guide me on how to do such thing
properly?

Thanks in advance.

Regards.
--
Julien Plu

PhD Student at Eurecom.
Personal webpage: http://jplu.developpez.com
FOAF file : http://jplu.developpez.com/julien
Email address : julien@eurecom.fr && *plu.jul...@gmail.com
*
Phone : +33493008103
Twitter : @julienplu


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


Re: SPARQL Query from one Fuseki server to another Fuseki server

2017-02-16 Thread Sandor Kopacsi

Thank you Osma,

It works fine, I only had to replace /sparql with /ds/query.

Best Regards,
Sandor


Am 16.02.2017 um 13:12 schrieb Osma Suominen:

Hi Sandor,

You need to do a federated query. See the SPARQL 1.1 Query spec. 
Something like this:


SELECT *
WHERE {
  SERVICE  {
GRAPH  {
  ?s ?p ?o
}
  }
}

-Osma

16.02.2017, 14:08, Sandor Kopacsi kirjoitti:

Dear list-member,

I have two Fuseki servers running on two different machines. In one of
them there are several named graphs containing a lot of concepts.

I would like to run a query from another Fuseki server to select all (or
later just some) triplets from this dataset using a query like this:

SELECT *
FROM 
WHERE {GRAPH 
{?s ?p ?o . }
}

but it provides empty set:

-
| s | p | o |
=
-

What is wrong?

Thanks in advance,
Sandor






--
Dr. Sandor Kopacsi
IT Software Designer

Vienna University Computer Center
Universitätsstraße 7 (NIG)
A-1010 Vienna

Phone:  +43-1-4277-14176
Mobile: +43-664-60277-14176



Re: SPARQL Query from one Fuseki server to another Fuseki server

2017-02-16 Thread Osma Suominen

Sorry I meant SPARQL 1.1 Federated Query spec:
http://www.w3.org/TR/sparql11-federated-query/

-Osma

16.02.2017, 14:12, Osma Suominen kirjoitti:

Hi Sandor,

You need to do a federated query. See the SPARQL 1.1 Query spec.
Something like this:

SELECT *
WHERE {
  SERVICE  {
GRAPH  {
  ?s ?p ?o
}
  }
}

-Osma

16.02.2017, 14:08, Sandor Kopacsi kirjoitti:

Dear list-member,

I have two Fuseki servers running on two different machines. In one of
them there are several named graphs containing a lot of concepts.

I would like to run a query from another Fuseki server to select all (or
later just some) triplets from this dataset using a query like this:

SELECT *
FROM 
WHERE {GRAPH 
{?s ?p ?o . }
}

but it provides empty set:

-
| s | p | o |
=
-

What is wrong?

Thanks in advance,
Sandor







--
Osma Suominen
D.Sc. (Tech), Information Systems Specialist
National Library of Finland
P.O. Box 26 (Kaikukatu 4)
00014 HELSINGIN YLIOPISTO
Tel. +358 50 3199529
osma.suomi...@helsinki.fi
http://www.nationallibrary.fi


Re: SPARQL Query from one Fuseki server to another Fuseki server

2017-02-16 Thread Osma Suominen

Hi Sandor,

You need to do a federated query. See the SPARQL 1.1 Query spec. 
Something like this:


SELECT *
WHERE {
  SERVICE  {
GRAPH  {
  ?s ?p ?o
}
  }
}

-Osma

16.02.2017, 14:08, Sandor Kopacsi kirjoitti:

Dear list-member,

I have two Fuseki servers running on two different machines. In one of
them there are several named graphs containing a lot of concepts.

I would like to run a query from another Fuseki server to select all (or
later just some) triplets from this dataset using a query like this:

SELECT *
FROM 
WHERE {GRAPH 
{?s ?p ?o . }
}

but it provides empty set:

-
| s | p | o |
=
-

What is wrong?

Thanks in advance,
Sandor




--
Osma Suominen
D.Sc. (Tech), Information Systems Specialist
National Library of Finland
P.O. Box 26 (Kaikukatu 4)
00014 HELSINGIN YLIOPISTO
Tel. +358 50 3199529
osma.suomi...@helsinki.fi
http://www.nationallibrary.fi


SPARQL Query from one Fuseki server to another Fuseki server

2017-02-16 Thread Sandor Kopacsi

Dear list-member,

I have two Fuseki servers running on two different machines. In one of 
them there are several named graphs containing a lot of concepts.


I would like to run a query from another Fuseki server to select all (or 
later just some) triplets from this dataset using a query like this:


SELECT *
FROM 
WHERE {GRAPH 
{?s ?p ?o . }
}

but it provides empty set:

-
| s | p | o |
=
-

What is wrong?

Thanks in advance,
Sandor

--

Dr. Sandor Kopacsi
IT Software Designer

Vienna University Computer Center



Re: LocalName

2017-02-16 Thread Andy Seaborne



On 16/02/17 10:47, Lorenz B. wrote:

1. you could use REGEX
2. I really suggest to use the rdfs:label (or something similar) if
exists for the human readable name of a URI


Good suggestions.




Hi,

I have a question about striving the local name out of the URI.

SO for example,

the URI I print it out looks like the following:
http://example.com/resource/authors/%28Zhou%29_Bryan_Bai


if I apply:

String localName = resource.getLocalName();

the value of localName is : _Bryan_Bai .
How do I get the value as Zhou_Bryan_Bai


A local name follows the rules for XML qnames.

They can not start with a digit.

They can not contain %

so the longest is "_Bryan_Bai"

Andy



Thanks in Advance!



Re: LocalName

2017-02-16 Thread Lorenz B.
1. you could use REGEX
2. I really suggest to use the rdfs:label (or something similar) if
exists for the human readable name of a URI

> Hi,
>
> I have a question about striving the local name out of the URI.
>
> SO for example,
>
> the URI I print it out looks like the following:
> http://example.com/resource/authors/%28Zhou%29_Bryan_Bai
> 
>
> if I apply:
>
> String localName = resource.getLocalName();
>
> the value of localName is : _Bryan_Bai .
> How do I get the value as Zhou_Bryan_Bai
>
> Thanks in Advance!
>
-- 
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center



Re: Remove class

2017-02-16 Thread Lorenz B.
Put the inferred model in a default model

> *materialize the model M1 to M2
>
> Lorenz, I do not understand it. How to materialize model 1 to 2.?
>
> On Wed, Feb 15, 2017 at 6:08 PM, Lorenz Buehmann <
> buehm...@informatik.uni-leipzig.de> wrote:
>
>> As I said, materialize the model M1 to M2 and then you can change the
>> triples in M2. But understand, if you run the inferencing step again,
>> the "old" classes will be added in addition to what you added manually.
>>
>>
>> On 15.02.2017 14:06, tina sani wrote:
>>> Hello Lorenz, so no way to remove or replace these classes?
>>> setOntClass also not working, I have tried it.
>>>
>>>
>>> On Wed, Feb 15, 2017 at 3:50 PM, Lorenz Buehmann <
>>> buehm...@informatik.uni-leipzig.de> wrote:
>>>
 In general, you cannot remove inferred statements - those are given by
 data + rules.

 Indeed, you can remove statements on a materialized inferred model, but
 implicitly the class assertion does still exist.


 On 15.02.2017 13:11, tina sani wrote:
> For example, I have added some classes for an individual using rules.
> emplyee 1 is type of Manager, Programmer, Worker.
>
> Can I replace these classes with one class like
> if (empl1.hasOntclass(manager) && (emp1.hasOntClass(programmer) &
> (emp1.hasOntClass(worker)  then emp1 should be type of one class
>> Employee
> and replace/remove these three classes.?
>
> There is one method, I dont know if it is suitable here to apply?
>
> Individual.removeOntClass(Resource)
> 

>>
-- 
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center