Triply-Dev / YASGUI.YASQE-deprecated

Deprecated, see https://github.com/TriplyDB/Yasgui for the Yasgui monorepo
MIT License
73 stars 36 forks source link

YASQE flags correct path syntax as inccorrect #97

Closed wouterbeek closed 7 years ago

wouterbeek commented 7 years ago

YASQE flags correct path syntax inside blank node abbreviation forms as incorrect.

MWE:

prefix : <http://>
select * { :s :p1 :o1 ; :p2 [ :p3/:p4 :o2 ] }

This is correct according to sparql.org and according to the W3C BNF grammar.

LaurensRietveld commented 7 years ago

Pff, horrible, the sparql grammar. Postponing this for now, and will look into it later.

ps. interestingly enough, the other js SPARQL parsers fails on this query specifically as well: https://github.com/RubenVerborgh/SPARQL.js

wouterbeek commented 7 years ago

@LaurensRietveld SPARQL syntax not that bad (compared to GML syntax, that is :-P), let me walk you through it:

First, we use the following rule to introduce an anonymous blank node with square bracket notation:

[101] BlankNodePropertyListPath ::= '[' PropertyListPathNotEmpty ']'

Within the brackets we are then allowed to write a VerbPath followed by an ObjectListPath:

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

For the VerbPath we can quickly walk through a sequence of simple grammar rules that show us that iri '/' iri is legal:

[84] VerbPath         ::= Path
[88] Path             ::= PathAlternative
[89] PathAlternative  ::= PathSequence ( '|' PathSequence )*
[90] PathSequence     ::= PathEltOrInverse ( '/' PathEltOrInverse )*
[92] PathEltOrInverse ::= PathElt | '^' PathElt
[91] PathElt          ::= PathPrimary PathMod?
[94] PathPrimary      ::= iri | 'a' | '!' PathNegatedPropertySet | '(' Path ')'

The ObjectListPath is a simple iri.

LaurensRietveld commented 7 years ago

It seems the YASGUI grammar is correct (and the only sparql.org validator isnt ;)). Your clause [ :p3/:p4 o2] is incorrect. Paths are not allowed there (see https://www.w3.org/TR/sparql11-query/#rPropertyListPathNotEmpty), only ObjectLists