[ 
https://issues.apache.org/jira/browse/MARMOTTA-561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sebastian Schaffert resolved MARMOTTA-561.
------------------------------------------
    Resolution: Fixed

> BIND in subexpression and comparison evaluated wrongly
> ------------------------------------------------------
>
>                 Key: MARMOTTA-561
>                 URL: https://issues.apache.org/jira/browse/MARMOTTA-561
>             Project: Marmotta
>          Issue Type: Bug
>          Components: KiWi Triple Store
>            Reporter: Sebastian Schaffert
>            Assignee: Sebastian Schaffert
>
> The following query is translated wrongly into SQL:
> {code}
> 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 . 
> }
> {code}
> The SQL translation is:
> {code}
>  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
> {code}
> Note the invalid comparison "P4_object_V6.ivalue + 1 = P2.object"



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to