You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Kevin Dreßler <kv...@gmail.com> on 2019/02/24 15:43:51 UTC

Inverse SPARQL Property Path won't match non-distinct [bug?]

Hello ,

I have come across an unexpected behaviour with inverse property paths, but maybe I am just missing something basic here.
I wrote a query to get from the entries in an RDF list to the resource which has the list as predicate value using inverse property paths.
As I had duplicate entries in the list I expected to get duplicate QuerySolutions as I would when using the normal direction.
However, using inverse property paths seem to result in a behaviour as if I had specified DISTINCT in my query.
Please see the example gist here: https://gist.github.com/kdrsslr/c8711f962a7b793dc48222944fd3ed89 <https://gist.github.com/kdrsslr/c8711f962a7b793dc48222944fd3ed89>

Is there an explanation for this kind of behaviour?

Thanks in advance,
Kevin

Re: Inverse SPARQL Property Path won't match non-distinct [bug?]

Posted by Andy Seaborne <an...@apache.org>.

On 24/02/2019 15:51, Kevin Dreßler wrote:
> Apologies for double posting, but I just tried to delete the "?" modifier as I only needed it in my original query and not in the example provided here.
> After that, it works as expected. So it's not simply tied to inverse property paths but to this combination of inverse property path with optional property path.
> 
> Can anyone make sense of this?

https://www.w3.org/TR/sparql11-query/#defn_evalPP_ZeroOrOnePath

"path?" is any match with 0 or 1 occurrences and it is a set.

It is not "all zero matches union all one matches" as a multiset.

So ? suppresses a duplicate.

     Andy

> 
>> On 24. Feb 2019, at 16:43, Kevin Dreßler <kv...@gmail.com> wrote:
>>
>> Hello ,
>>
>> I have come across an unexpected behaviour with inverse property paths, but maybe I am just missing something basic here.
>> I wrote a query to get from the entries in an RDF list to the resource which has the list as predicate value using inverse property paths.
>> As I had duplicate entries in the list I expected to get duplicate QuerySolutions as I would when using the normal direction.
>> However, using inverse property paths seem to result in a behaviour as if I had specified DISTINCT in my query.
>> Please see the example gist here: https://gist.github.com/kdrsslr/c8711f962a7b793dc48222944fd3ed89 <https://gist.github.com/kdrsslr/c8711f962a7b793dc48222944fd3ed89>
>>
>> Is there an explanation for this kind of behaviour?
>>
>> Thanks in advance,
>> Kevin
> 
> 

Re: Inverse SPARQL Property Path won't match non-distinct [bug?]

Posted by Kevin Dreßler <kv...@gmail.com>.
Apologies for double posting, but I just tried to delete the "?" modifier as I only needed it in my original query and not in the example provided here.
After that, it works as expected. So it's not simply tied to inverse property paths but to this combination of inverse property path with optional property path.

Can anyone make sense of this?

> On 24. Feb 2019, at 16:43, Kevin Dreßler <kv...@gmail.com> wrote:
> 
> Hello ,
> 
> I have come across an unexpected behaviour with inverse property paths, but maybe I am just missing something basic here.
> I wrote a query to get from the entries in an RDF list to the resource which has the list as predicate value using inverse property paths.
> As I had duplicate entries in the list I expected to get duplicate QuerySolutions as I would when using the normal direction.
> However, using inverse property paths seem to result in a behaviour as if I had specified DISTINCT in my query.
> Please see the example gist here: https://gist.github.com/kdrsslr/c8711f962a7b793dc48222944fd3ed89 <https://gist.github.com/kdrsslr/c8711f962a7b793dc48222944fd3ed89>
> 
> Is there an explanation for this kind of behaviour?
> 
> Thanks in advance,
> Kevin