Rupert Westenthaler created STANBOL-1204:
--------------------------------------------

             Summary: Entityhub SPARQL query util builds invalid FILTER for 
TextConstraints with multiple OR values and language parameter(s)
                 Key: STANBOL-1204
                 URL: https://issues.apache.org/jira/browse/STANBOL-1204
             Project: Stanbol
          Issue Type: Bug
            Reporter: Rupert Westenthaler
            Assignee: Rupert Westenthaler
             Fix For: 0.12.0


The ongoing work on STANBOL-1202 revealed a bug related to TextConstraints as 
follows

        FieldQuery query = yard.getQueryFactory().createFieldQuery();
        query.setConstraint(field, new TextConstraint(
                Arrays.asList("value1", "value2"), "en"));

The SPARQL query util will encode such a constraint in SPARQL such as

    SELECT [..]
    WHERE { 
        ?id <urn:yard.test:find:field.text> ?v_1  
             FILTER(regex(str(?v_1),"^value1$","i") || 
regex(str(?v_1),"^value2$","i") && (lang(?v_1) = "en")) . 
    }

The FILTER part is wrong is it will apply the `(lang(?v_1) = "en"))` is only 
applied for "value2" while "value1" is accepted for any lanugage.

The correct FILTER part would need to group all regex parts with an additional 
bracket before combining it with the language restriction.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to