Uploaded image for project: 'Blazegraph (by SYSTAP)'
  1. Blazegraph (by SYSTAP)
  2. BLZG-882

Adding Optional removes solutions

    XMLWordPrintable

    Details

      Description

      Running the query over given data returns 3 results. In the middle of the query there is a commented "#optional" keyword. If I un-comment that and rerun the query I get 2 results. This means that changing a graph pattern to be optional somehow produces less solutions.

      select distinct ?p 
      ?age 
      ?name 
      ?type 
      ?post 
      ?postContent
      ?comment 
      ?cperson 
      where
      {
              
              {
                      select ?p
                      where  
                      {
                              ?p a <http://www.example.org/schema/Person> . 
                              optional{?p <http://www.example.org/schema/age> ?age.}
                      }
                      order by desc(?age)
                      LIMIT 1
              }
              optional{?p <http://www.example.org/schema/age> ?age.}
              
              {?p <http://www.example.org/schema/name> ?name.}
              {?p a ?type.}
              
             # OPTIONAL
              {       ?post a <http://www.example.org/schema/Post> . 
                      ?post <http://www.example.org/schema/postedBy> ?p.
                      ?post <http://www.example.org/schema/content> ?postContent.}
              
              OPTIONAL{      
                      ?comment a <http://www.example.org/schema/Comment> .
                      ?comment <http://www.example.org/schema/parentPost> ?post.
                      ?cperson a <http://www.example.org/schema/Person> .
                      ?comment <http://www.example.org/schema/postedBy> ?cperson .
              }
      }
      order by desc(?age)
      

        Attachments

          Activity

            People

            Assignee:
            michaelschmidt michaelschmidt
            Reporter:
            feugen24 feugen24
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: