RubenVerborgh / SPARQL.js

A parser for the SPARQL query language in JavaScript
Other
342 stars 66 forks source link

Incorrect parsing of `PropertyListPathNotEmpty` #173

Closed LaurensRietveld closed 10 months ago

LaurensRietveld commented 1 year ago

I noticed an issue with object lists and property paths where the test cases in the test-suite do not follow the spec. See e.g. this query:

PREFIX dbpedia-owl:<http://dbpedia.org/owl/#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
SELECT ?movie
WHERE {
  ?movie a dbpedia-owl:Film ;
    dbpedia-owl:starring [
      rdfs:label "Brad Pitt"@en ;
      ^dbpedia-owl:starring ?otherMovie
    ] .
}

This query includes a property path pattern (^dbpedia-owl:starring) that is not allowed according to the spec:

[83]    PropertyListPathNotEmpty      ::=   ( VerbPath | VerbSimple ) ObjectListPath ( ';' ( ( VerbPath | VerbSimple ) ObjectList )? )*

I.e., the ObjectListPath rule (which allows property paths) is permitted at the start of PropertyListPathNotEmpty, but not in the trailing part (here, ObjectList is used)

This issue was introduced in https://github.com/RubenVerborgh/SPARQL.js/pull/142

LaurensRietveld commented 10 months ago

never mind, turns out this rule is mentioned in this errata: https://www.w3.org/2013/sparql-errata#errata-query-3

i.e., the behaviour of sparqlJS is correct