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

OPTIONAL fails to return values when / is used

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Done
    • Affects Version/s: BLAZEGRAPH_RELEASE_1_5_3
    • Fix Version/s: BLAZEGRAPH_2_0_0
    • Component/s: Query Engine
    • Labels:
      None

      Description

      This is blocking an implementation I am doing at Syapse, so I set the priority to high.

      I found an apparent bug in the blazegraph implementation of OPTIONAL when "/" is used. It is reproducible with the foaf kb used in http://www.w3.org/TR/2013/REC-sparql11-update-20130321/

      Start by inserting these triples:

      prefix foaf:       <http://xmlns.com/foaf/0.1/> 
      prefix rdf:        <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
      
      INSERT
      { GRAPH <http://test.org> {
      
      _:a  rdf:type        foaf:Person .
      _:a  foaf:name       "Alice" .
      _:a  foaf:mbox       <mailto:alice@example.com> .
      _:a  foaf:mbox       <mailto:alice@work.example> .
      
      _:b  rdf:type        foaf:Person .
      _:b  foaf:name       "Bob" .
      
      _:a foaf:knows _:b .
      _:b foaf:knows _:a .
        }
      } WHERE {}
      

      Alice and Bob know each other. Alice has two email addresses. Bob doesn't have any. (This is slightly extended from the example of OPTIONAL in the document.)

      This should return the email address of a friend, or a blank if there is no email.

      PREFIX foaf: <http://xmlns.com/foaf/0.1/>
      SELECT ?my_name ?friend ?friend_email
      WHERE  { 
        GRAPH <http://test.org> {
            ?friend foaf:knows ?me . ?me foaf:name ?my_name .
            OPTIONAL { ?friend foaf:mbox ?friend_email }
        }
      }
      
      my_name	  friend	friend_email
      Bob	 t92236	<mailto:alice@example.com>
      Bob	 t92236	<mailto:alice@work.example>
      Alice	 t92237	
      

      In this case OPTIONAL works as expected. Bob knows Alice, and Alice has two emails. Alice knows Bob and Bob does not have an email.

      Now replace "?me . ?me" with "/". This should be the same except it does not bind a variable.

      PREFIX foaf: <http://xmlns.com/foaf/0.1/>
      SELECT ?my_name ?friend ?friend_email
      WHERE  { 
        GRAPH <http://test.org> {
            ?friend foaf:knows / foaf:name ?my_name .
            OPTIONAL { ?friend foaf:mbox ?friend_email }
        }
      }
      

      But now only the first two lines are returned. The line for Alice is omitted.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              beebs Brad Bebee
              Reporter:
              paulc Paul Callahan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: