You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Andreas Textor <An...@de.bosch.com.INVALID> on 2019/09/26 08:18:36 UTC
Path expression matching things it should not?
Hi all,
I've found a behaviour with a SPARQL path expression that I find confusing.
Given a graph that contains just the one triple ":foo :prop :bar" (for
any prefix :), I execute the following select query:
select * where { :foo :prop* ?x . }
and get both :foo and :bar as results for ?x, even though there is no
statement :foo :prop :foo. I can even use any other property name/URI in
the path expression and still get :foo as a result.
I found no hint on the expected behaviour of this case in the SPARQL
spec, but this seems not right. Can you please give any hints?
--
Best regards / Mit freundlichen Grüßen / Üdvözlettel / 致以诚挚的问候
*
Andreas Textor*
Bosch Connected Industry – BCI/ESW
Robert Bosch GmbH | Postfach 10 60 50 | 70049 Stuttgart | GERMANY |
www.bosch.com <http://www.bosch.com/>
Mobil+49 162 1836264| Andreas.Textor@de.bosch.com
<ma...@de.bosch.com>
Sitz: Stuttgart, Registergericht: Amtsgericht Stuttgart, HRB 14000;
Aufsichtsratsvorsitzender: Franz Fehrenbach; Geschäftsführung: Dr.
Volkmar Denner,
Prof. Dr. Stefan Asenkerschbaumer, Dr. Rolf Bulander, Dr. Stefan
Hartung, Dr. Markus Heyn, Dr. Dirk Hoheisel,
Christoph Kübel, Uwe Raschke, Peter Tyroller
Re: Path expression matching things it should not?
Posted by "Andreas Textor (BCI/ESW24)" <An...@de.bosch.com.INVALID>.
Thank you for the quick replies!
Thinking about it, this is totally obvious. It does not matter what the
property is that is followed zero times to end up at the start.
On 26.09.19 10:39, Lorenz Buehmann wrote:
> ah and forgot, the formal translation and evaluation is described here:
> https://www.w3.org/TR/sparql11-query/#PropertyPathPatterns
>
> On 26.09.19 10:35, Andy Seaborne wrote:
>> And the "+" operation is "one or more" which would require :prop to be
>> present.
>>
>> On 9/26/19 9:32 AM, Lorenz Buehmann wrote:
>>> * means zero or more
>>>
>>> if you do zero steps from your start node :foo to reach a node ?x, this
>>> ?x is trivially the start node itself
>>>
>>>
>>> On 26.09.19 10:18, Andreas Textor wrote:
>>>> Hi all,
>>>>
>>>> I've found a behaviour with a SPARQL path expression that I find
>>>> confusing.
>>>>
>>>> Given a graph that contains just the one triple ":foo :prop :bar" (for
>>>> any prefix :), I execute the following select query:
>>>>
>>>> select * where { :foo :prop* ?x . }
>>>>
>>>> and get both :foo and :bar as results for ?x, even though there is no
>>>> statement :foo :prop :foo. I can even use any other property name/URI
>>>> in the path expression and still get :foo as a result.
>>>>
>>>> I found no hint on the expected behaviour of this case in the SPARQL
>>>> spec, but this seems not right. Can you please give any hints?
>>>>
>>>>
Re: Path expression matching things it should not?
Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.
ah and forgot, the formal translation and evaluation is described here:
https://www.w3.org/TR/sparql11-query/#PropertyPathPatterns
On 26.09.19 10:35, Andy Seaborne wrote:
> And the "+" operation is "one or more" which would require :prop to be
> present.
>
> On 9/26/19 9:32 AM, Lorenz Buehmann wrote:
>> * means zero or more
>>
>> if you do zero steps from your start node :foo to reach a node ?x, this
>> ?x is trivially the start node itself
>>
>>
>> On 26.09.19 10:18, Andreas Textor wrote:
>>> Hi all,
>>>
>>> I've found a behaviour with a SPARQL path expression that I find
>>> confusing.
>>>
>>> Given a graph that contains just the one triple ":foo :prop :bar" (for
>>> any prefix :), I execute the following select query:
>>>
>>> select * where { :foo :prop* ?x . }
>>>
>>> and get both :foo and :bar as results for ?x, even though there is no
>>> statement :foo :prop :foo. I can even use any other property name/URI
>>> in the path expression and still get :foo as a result.
>>>
>>> I found no hint on the expected behaviour of this case in the SPARQL
>>> spec, but this seems not right. Can you please give any hints?
>>>
>>>
Re: Path expression matching things it should not?
Posted by Andy Seaborne <an...@apache.org>.
And the "+" operation is "one or more" which would require :prop to be
present.
On 9/26/19 9:32 AM, Lorenz Buehmann wrote:
> * means zero or more
>
> if you do zero steps from your start node :foo to reach a node ?x, this
> ?x is trivially the start node itself
>
>
> On 26.09.19 10:18, Andreas Textor wrote:
>> Hi all,
>>
>> I've found a behaviour with a SPARQL path expression that I find
>> confusing.
>>
>> Given a graph that contains just the one triple ":foo :prop :bar" (for
>> any prefix :), I execute the following select query:
>>
>> select * where { :foo :prop* ?x . }
>>
>> and get both :foo and :bar as results for ?x, even though there is no
>> statement :foo :prop :foo. I can even use any other property name/URI
>> in the path expression and still get :foo as a result.
>>
>> I found no hint on the expected behaviour of this case in the SPARQL
>> spec, but this seems not right. Can you please give any hints?
>>
>>
Re: Path expression matching things it should not?
Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.
* means zero or more
if you do zero steps from your start node :foo to reach a node ?x, this
?x is trivially the start node itself
On 26.09.19 10:18, Andreas Textor wrote:
> Hi all,
>
> I've found a behaviour with a SPARQL path expression that I find
> confusing.
>
> Given a graph that contains just the one triple ":foo :prop :bar" (for
> any prefix :), I execute the following select query:
>
> select * where { :foo :prop* ?x . }
>
> and get both :foo and :bar as results for ?x, even though there is no
> statement :foo :prop :foo. I can even use any other property name/URI
> in the path expression and still get :foo as a result.
>
> I found no hint on the expected behaviour of this case in the SPARQL
> spec, but this seems not right. Can you please give any hints?
>
>