comunica / sparqlee

⚙️ SPARQL expression evaluator library - Moved to @comunica/expression-evaluator
https://www.npmjs.com/package/sparqlee
14 stars 7 forks source link

strstarts filter bug #72

Closed Dexagod closed 4 years ago

Dexagod commented 4 years ago

The strstarts filter also matches substrings.

example: http://query.linkeddatafragments.org/#transientDatasources=http%3A%2F%2Ffragments.dbpedia.org%2F2016-04%2Fen&query=SELECT%20%3Fmovie%20%3Ftitle%20%3Fname%0AWHERE%20%7B%0A%20%20%3Fmovie%20dbpedia-owl%3Astarring%20%5B%20rdfs%3Alabel%20%22Brad%20Pitt%22%40en%20%5D%3B%0A%20%20%20%20%20%20%20%20%20rdfs%3Alabel%20%3Ftitle%3B%0A%20%20%20%20%20%20%20%20%20dbpedia-owl%3Adirector%20%5B%20rdfs%3Alabel%20%3Fname%20%5D.%0A%20%20FILTER%20STRSTARTS(%3Ftitle%2C%20%22onkey%22)%0A%20%20FILTER%20LANGMATCHES(LANG(%3Fname)%2C%20%20%22EN%22)%0A%7D

rubensworks commented 4 years ago

Thanks for reporting!

wschella commented 4 years ago

It actually only occurs when comparing langStrings to strings due to a typo (or bad copy-pasta) in

 .onBinaryTyped(
      ['langString', 'string'],
      (arg1: string, arg2: string) => bool(arg1.includes(arg2)),
    )

where it should be bool(arg1.startsWith(arg2)) like the rest of the functions, will make a PR.