Uploaded image for project: 'Marmotta (Retired)'
  1. Marmotta (Retired)
  2. MARMOTTA-561

BIND in subexpression and comparison evaluated wrongly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • KiWi Triple Store
    • None

    Description

      The following query is translated wrongly into SQL:

      PREFIX : <http://example.org/> 
      PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
      PREFIX owl: <http://www.w3.org/2002/07/owl#>
      
      SELECT ?z ?s1
      {
        ?s ?p ?o .
        ?p a owl:DatatypeProperty . 
        BIND(?o+1 AS ?z)
        ?s1 ?p1 ?z .
        ?p1 a owl:DatatypeProperty . 
      }
      

      The SQL translation is:

       SELECT P2.subject AS V2, P4_object_V6.ivalue + 1 AS V3
       FROM triples P1
          INNER JOIN nodes AS P1_subject_V1 ON P1.subject = P1_subject_V1.id 
       CROSS JOIN 
        triples P2
          INNER JOIN nodes AS P2_subject_V2 ON P2.subject = P2_subject_V2.id 
          INNER JOIN nodes AS P2_predicate_V1 ON P2.predicate = P2_predicate_V1.id 
          INNER JOIN nodes AS P2_object_V3 ON P2.object = P2_object_V3.id 
       CROSS JOIN 
        triples P3
          INNER JOIN nodes AS P3_subject_V4 ON P3.subject = P3_subject_V4.id 
       CROSS JOIN 
        triples P4
          INNER JOIN nodes AS P4_subject_V5 ON P4.subject = P4_subject_V5.id 
          INNER JOIN nodes AS P4_predicate_V4 ON P4.predicate = P4_predicate_V4.id 
          INNER JOIN nodes AS P4_object_V6 ON P4.object = P4_object_V6.id 
       WHERE P1.deleted = false
            AND P1.predicate = 527741445197750272
            AND P1.object = 527759387686625280
             AND P2.deleted = false
            AND P1.subject = P2.predicate
            AND P4_object_V6.ivalue + 1 = P2.object
             AND P3.deleted = false
            AND P3.predicate = 527741445197750272
            AND P3.object = 527759387686625280
             AND P4.deleted = false
            AND P3.subject = P4.predicate
      

      Note the invalid comparison "P4_object_V6.ivalue + 1 = P2.object"

      Attachments

        Activity

          People

            wastl Sebastian Schaffert
            wastl Sebastian Schaffert
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: