You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Michael Brunnbauer <br...@netestate.de> on 2013/09/28 10:58:21 UTC

SPARQL problem

hi all

I wonder if something is wrong with this query or with Fuseki 0.2.5.
All variables except ep2 are bound in the result:

select ?ep ?ep2 ?s ?p ?o where {
 BIND ('X' as ?ep)
 {
  select (?ep as ?ep2) ?s ?p ?o where { ?s ?p ?o } limit 1
 }
}

I tried it also with BIND (?ep as ?ep2) instead of select (?ep as ?ep2) but
without success.

Regards,

Michael Brunnbauer

-- 
++  Michael Brunnbauer
++  netEstate GmbH
++  Geisenhausener Straße 11a
++  81379 München
++  Tel +49 89 32 19 77 80
++  Fax +49 89 32 19 77 89 
++  E-Mail brunni@netestate.de
++  http://www.netestate.de/
++
++  Sitz: München, HRB Nr.142452 (Handelsregister B München)
++  USt-IdNr. DE221033342
++  Geschäftsführer: Michael Brunnbauer, Franz Brunnbauer
++  Prokurist: Dipl. Kfm. (Univ.) Markus Hendel

Re: SPARQL problem

Posted by Andy Seaborne <an...@apache.org>.
On 02/10/13 17:44, Michael Brunnbauer wrote:
>
> Hello Andy,
>
> On Wed, Oct 02, 2013 at 05:18:24PM +0100, Andy Seaborne wrote:
>> Could you raise a JIRA please so this does not get lost?
>
> https://issues.apache.org/jira/browse/JENA-553
>
> I guess it is OK if I go to JIRA directly in the future without posting to
> the list ?

Yes, if there is a complete, minimal example.

Your report is good and I have already managed to see something wrong.

General observation:

The project is getting busier with lists regularly at the upper end of 
volume.  August was the busiest month on both lists since being at 
Apache.  So - efficiency - reports need to be understandable and 
complete and ideally with patches.

Contribute patches!

	Andy

>
> Regards,
>
> Michael Brunnbauer
>


Re: SPARQL problem

Posted by Michael Brunnbauer <br...@netestate.de>.
Hello Andy,

On Wed, Oct 02, 2013 at 05:18:24PM +0100, Andy Seaborne wrote:
> Could you raise a JIRA please so this does not get lost?

https://issues.apache.org/jira/browse/JENA-553

I guess it is OK if I go to JIRA directly in the future without posting to
the list ?

Regards,

Michael Brunnbauer

-- 
++  Michael Brunnbauer
++  netEstate GmbH
++  Geisenhausener Straße 11a
++  81379 München
++  Tel +49 89 32 19 77 80
++  Fax +49 89 32 19 77 89 
++  E-Mail brunni@netestate.de
++  http://www.netestate.de/
++
++  Sitz: München, HRB Nr.142452 (Handelsregister B München)
++  USt-IdNr. DE221033342
++  Geschäftsführer: Michael Brunnbauer, Franz Brunnbauer
++  Prokurist: Dipl. Kfm. (Univ.) Markus Hendel

Re: SPARQL problem

Posted by Andy Seaborne <an...@apache.org>.
Could you raise a JIRA please so this does not get lost?

Thanks

	Andy

On 02/10/13 13:33, Michael Brunnbauer wrote:
>
> Hello Andy,
>
> On Mon, Sep 30, 2013 at 12:33:57PM +0100, Andy Seaborne wrote:
>>> http://www.brunni.de/sparql_turing_machine.txt
>>> http://www.brunni.de/searchsparqlendpoints.txt
>
> Those queries do not work any more after updating from Fuseki 0.2.5 to 1.0.0.
> It seems to be related to the WITH keyword because this minimal example works
> with the default graph but not with WITH:
>
> drop graph <http://mytest>;
> insert data { graph <http://mytest> { _:b0 <http://test> "test" }};
> WITH <http://mytest>
>
> DELETE {
> ?s ?p "test"
> }
> INSERT
> {
> ?s ?p "test1".
> }
> WHERE
> {
> ?s ?p "test"
> }
>
> The triple _:b0 <http://test> "test1" will not show up - but it works on
> the default graph:
>
> drop DEFAULT;
> insert data { _:b0 <http://test> "test" };
> DELETE {
> ?s ?p "test"
> }
> INSERT
> {
> ?s ?p "test1".
> }
> WHERE
> {
> ?s ?p "test"
> }
>
> Regards,
>
> Michael Brunnbauer
>


Re: SPARQL problem

Posted by Michael Brunnbauer <br...@netestate.de>.
Hello Andy,

On Mon, Sep 30, 2013 at 12:33:57PM +0100, Andy Seaborne wrote:
> >http://www.brunni.de/sparql_turing_machine.txt
> >http://www.brunni.de/searchsparqlendpoints.txt

Those queries do not work any more after updating from Fuseki 0.2.5 to 1.0.0.
It seems to be related to the WITH keyword because this minimal example works
with the default graph but not with WITH:

drop graph <http://mytest>;
insert data { graph <http://mytest> { _:b0 <http://test> "test" }};
WITH <http://mytest>

DELETE {
?s ?p "test"
}
INSERT
{
?s ?p "test1".
}
WHERE
{
?s ?p "test"
}

The triple _:b0 <http://test> "test1" will not show up - but it works on
the default graph:

drop DEFAULT;
insert data { _:b0 <http://test> "test" };
DELETE {
?s ?p "test"
}
INSERT
{
?s ?p "test1".
}
WHERE
{
?s ?p "test"
}

Regards,

Michael Brunnbauer

-- 
++  Michael Brunnbauer
++  netEstate GmbH
++  Geisenhausener Straße 11a
++  81379 München
++  Tel +49 89 32 19 77 80
++  Fax +49 89 32 19 77 89 
++  E-Mail brunni@netestate.de
++  http://www.netestate.de/
++
++  Sitz: München, HRB Nr.142452 (Handelsregister B München)
++  USt-IdNr. DE221033342
++  Geschäftsführer: Michael Brunnbauer, Franz Brunnbauer
++  Prokurist: Dipl. Kfm. (Univ.) Markus Hendel

Re: SPARQL problem

Posted by Andy Seaborne <an...@apache.org>.
On 29/09/13 19:13, Michael Brunnbauer wrote:
>
> Hello Andy,
>
> On Sat, Sep 28, 2013 at 09:02:04PM +0100, Andy Seaborne wrote:
>>>   ?ep a void:sparqlEndpoint
>>>   SERVICE SILENT ?ep { ...
>>>
>>> then ?ep is not bound if the federation fails. That a failure causes a
>>> match
>>> with unbound variables is expected but that ?ep is also unbound in this
>>> case
>>> surprised me. This is intended ?
>>
>> Is it? In the latest version?  Assuming ?ep a void:sparqlEndpoint
>> matches something in the local dataset
>>
>> SERVICE SILENT ?ep --> failure
>>
>> evaluates to the join identity (one row, no columns) and ?ep is unbound
>> in that.  This joins with the eval of "?ep a void:sparqlEndpoint".
>>
>> If not, please submit a JIRA with complete minimal example.
>
> Thank you very much for your help so far!
>
> I really should get into SPARQL algebra. Meanwhile I guess that ?ep should
> stay bound if ?ep is bound in the first part of the query and is joined with
> the join identity.
>
> I upgraded to Fuseki 1.0.0 without success regarding this. So here is my JIRA:
>
> https://issues.apache.org/jira/browse/JENA-552

Thanks - and (hopefully!) fixed.

> Completely different topic: Has a "REPEAT WHILE" keyword/feature ever been
> discussed for SPARQL UPDATE in the working group ? See:
>
> http://www.brunni.de/sparql_turing_machine.txt
> http://www.brunni.de/searchsparqlendpoints.txt

No. This gets into the whole area of a SPARQL syntax for something 
rules-ish - obviously a good thing to have but beyond the remit of the 
SPARQL-WG that has just finished.

	Andy

>
> Regards,
>
> Michael Brunnbauer
>


Re: SPARQL problem

Posted by Michael Brunnbauer <br...@netestate.de>.
Hello Andy,

On Sat, Sep 28, 2013 at 09:02:04PM +0100, Andy Seaborne wrote:
> >  ?ep a void:sparqlEndpoint
> >  SERVICE SILENT ?ep { ...
> >
> >then ?ep is not bound if the federation fails. That a failure causes a 
> >match
> >with unbound variables is expected but that ?ep is also unbound in this 
> >case
> >surprised me. This is intended ?
> 
> Is it? In the latest version?  Assuming ?ep a void:sparqlEndpoint 
> matches something in the local dataset
> 
> SERVICE SILENT ?ep --> failure
> 
> evaluates to the join identity (one row, no columns) and ?ep is unbound 
> in that.  This joins with the eval of "?ep a void:sparqlEndpoint".
> 
> If not, please submit a JIRA with complete minimal example.

Thank you very much for your help so far!

I really should get into SPARQL algebra. Meanwhile I guess that ?ep should
stay bound if ?ep is bound in the first part of the query and is joined with 
the join identity.

I upgraded to Fuseki 1.0.0 without success regarding this. So here is my JIRA:

https://issues.apache.org/jira/browse/JENA-552

Completely different topic: Has a "REPEAT WHILE" keyword/feature ever been 
discussed for SPARQL UPDATE in the working group ? See:

http://www.brunni.de/sparql_turing_machine.txt
http://www.brunni.de/searchsparqlendpoints.txt

Regards,

Michael Brunnbauer

-- 
++  Michael Brunnbauer
++  netEstate GmbH
++  Geisenhausener Straße 11a
++  81379 München
++  Tel +49 89 32 19 77 80
++  Fax +49 89 32 19 77 89 
++  E-Mail brunni@netestate.de
++  http://www.netestate.de/
++
++  Sitz: München, HRB Nr.142452 (Handelsregister B München)
++  USt-IdNr. DE221033342
++  Geschäftsführer: Michael Brunnbauer, Franz Brunnbauer
++  Prokurist: Dipl. Kfm. (Univ.) Markus Hendel

Re: SPARQL problem

Posted by Andy Seaborne <an...@apache.org>.
On 28/09/13 14:42, Michael Brunnbauer wrote:
>
> Hello Andy,
>
> On Sat, Sep 28, 2013 at 11:12:28AM +0100, Andy Seaborne wrote:
>> Inner part:
>> BIND ('X' as ?ep)
>
> This is evaluated separately because BIND ends the graph pattern ?
>
> Another question: If I do something like
>
>   ?ep a void:sparqlEndpoint
>   SERVICE SILENT ?ep { ...
>
> then ?ep is not bound if the federation fails. That a failure causes a match
> with unbound variables is expected but that ?ep is also unbound in this case
> surprised me. This is intended ?

Is it? In the latest version?  Assuming ?ep a void:sparqlEndpoint 
matches something in the local dataset

SERVICE SILENT ?ep --> failure

evaluates to the join identity (one row, no columns) and ?ep is unbound 
in that.  This joins with the eval of "?ep a void:sparqlEndpoint".

If not, please submit a JIRA with complete minimal example.

ARQ tries to evaluate using a different algorithm - you can try the 
reference query engine (--engine=ref or call QueryEngineRef.register() 
in code) which is a very simple, and hopefully dependable, bottom-up 
materialising evaluation of a query.  It does not scale.

	Andy

>
> Regards,
>
> Michael Brunnbauer
>


Re: SPARQL problem

Posted by Michael Brunnbauer <br...@netestate.de>.
Hello Andy,

On Sat, Sep 28, 2013 at 11:12:28AM +0100, Andy Seaborne wrote:
> Inner part:
> BIND ('X' as ?ep)

This is evaluated separately because BIND ends the graph pattern ?

Another question: If I do something like

 ?ep a void:sparqlEndpoint
 SERVICE SILENT ?ep { ...

then ?ep is not bound if the federation fails. That a failure causes a match
with unbound variables is expected but that ?ep is also unbound in this case
surprised me. This is intended ?

Regards,

Michael Brunnbauer

-- 
++  Michael Brunnbauer
++  netEstate GmbH
++  Geisenhausener Straße 11a
++  81379 München
++  Tel +49 89 32 19 77 80
++  Fax +49 89 32 19 77 89 
++  E-Mail brunni@netestate.de
++  http://www.netestate.de/
++
++  Sitz: München, HRB Nr.142452 (Handelsregister B München)
++  USt-IdNr. DE221033342
++  Geschäftsführer: Michael Brunnbauer, Franz Brunnbauer
++  Prokurist: Dipl. Kfm. (Univ.) Markus Hendel

Re: SPARQL problem

Posted by Andy Seaborne <an...@apache.org>.
On 28/09/13 09:58, Michael Brunnbauer wrote:
>
> hi all
>
> I wonder if something is wrong with this query or with Fuseki 0.2.5.
> All variables except ep2 are bound in the result:

Yes - that's what I expect.

> select ?ep ?ep2 ?s ?p ?o where {
>   BIND ('X' as ?ep)
>   {
>    select (?ep as ?ep2) ?s ?p ?o where { ?s ?p ?o } limit 1
>   }
> }
>
> I tried it also with BIND (?ep as ?ep2) instead of select (?ep as ?ep2) but
> without success.

Query evaluation is functional - execute the inner parts and combine 
them together.  (1+2) * (4+5) is calc 1+2 and calc 4+5 then pass 3 and 9 
to * to get 27.

Inner part:
BIND ('X' as ?ep)

One row, ?ep is 'X'

Inner part:
select (?ep as ?ep2) ?s ?p ?o where { ?s ?p ?o } limit 1

?ep is unbound so ?ep2 is unbound.


now join them, ?ep is bound on one side (from BIND) not on the other 
(from SELECT).

	Andy



>
> Regards,
>
> Michael Brunnbauer
>


	Andy