Uploaded image for project: 'Stanbol (Retired)'
  1. Stanbol (Retired)
  2. STANBOL-1204

Entityhub SPARQL query util builds invalid FILTER for TextConstraints with multiple OR values and language parameter(s)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.12.0
    • None
    • None

    Description

      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.

      Attachments

        Activity

          People

            rwesten Rupert Westenthaler
            rwesten Rupert Westenthaler
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: