2

Given a graph:

@prefix da:    <http://example.com/data/> .
@prefix on:    <http://example.com/on/> .

da:Shenaz  on:husband  da:Javed .

da:Rita  on:friend  da:Noor ;
        on:sister  da:Tom .

da:Noor  on:sister  da:Shenaz .

da:Javed  on:child  da:Jaabir .

da:Tom  on:sister  da:James .

da:Jaabir  on:grandFather  da:Rafick .

There is a path between da:Noor and da:James which is da:Noor ^on:friend/on:sister/on:sister da:James . but the following query is returning false

PREFIX da:    <http://example.com/data/> 
PREFIX on:    <http://example.com/on/> 
ASK {
  da:Noor ((<>|!<>)|^(<>|!<>))* da:James .
}

It is a possible bug in Jena, with RDFLib in Python, True is returned

Noor
  • 19,638
  • 38
  • 136
  • 254

1 Answers1

4

For some reason the property path is not evaluated as expected. I tried it with the more simple query:

  PREFIX  :     <http://ex.org/>
  PREFIX  da:   <http://example.com/data/>

  SELECT  ?u
  WHERE
    { da:Noor ^(:p1|!:p1) ?u }

The algebra looks ok, i.e. the path is reversed:

(project (?u)
    (path ?u (alt <http://ex.org/p1> (notoneof <http://ex.org/p1>)) <http://example.com/data/Noor>))

Looks like a bug but I might be wrong indeed. I'll ask on the Jena mailing list and later on post the answer here.

Update:

The problem is with negations when the object itself is grounded - which is the case here due to the reverse operator ^. As per @AndyS' comment, this bug will be fixed in Apache Jena 3.3.0. See JENA-1317

UninformedUser
  • 8,397
  • 1
  • 14
  • 23
  • yes, i think so too, in RDFLib Python, True is returned – Noor Apr 10 '17 at 10:08
  • 3
    Thanks for the details : it'll be fixed in the 3.3.0 release : see https://issues.apache.org/jira/browse/JENA-1317 – AndyS Apr 10 '17 at 17:37