pdsinterop / php-solid-server

Standalone Solid Server written in PHP by PDS Interop
https://pdsinterop.org/php-solid-server/
MIT License
46 stars 7 forks source link

SPARQL update is parsed as turtle, but they are in fact different #48

Open ylebre opened 3 years ago

ylebre commented 3 years ago

See: https://www.w3.org/TeamSubmission/turtle/#sec-diff-sparql

These differences are subtle, but just big enough that they trip up the EasyRDF parser in some cases.


10. Turtle compared to SPARQL (Informative)

the SPARQL Query Language for RDF (SPARQL) uses a Turtle/N3 style syntax for the Triple patterns including the same forms of abbreviated forms given here.

SPARQL includes at least the following syntax that is not in Turtle (not a complete list):

  1. RDF Literals are allowed in triple subjects
  2. Variables are allowed in any part of the triple of the form ?name or $name
  3. Long literals can use use single quote (') characters: ''' ... '''
  4. The constants allowed for XSD booleans: true and false are case independent. In Turtle they are not, only lowercase forms are allowed.
  5. SPARQL allows '.'s in names in all positions apart from the first or last. These would correspond to rules:
    name ::= nameStartChar ( ( nameChar | '.' )\* nameChar )?  
    prefixName ::= ( nameStartChar - '\_' ) ( ( nameChar | ' .' )\* nameChar )?
  6. SPARQL allows digits in the first character of the PN_LOCAL lexical token. In Turtle, the only ascii characters allowed in a nameStartChar[30] are [A-Z] | "_" | [a-z].
  7. Turtle allows prefix and base declarations[30] anywhere outside of a triple. In SPARQL, they are only allowed in the Prologue (at the start of the SPARQL query).

For further information see the Syntax for IRIs and SPARQL Grammar sections of the SPARQL query document SPARQLQ.

[30] nameStartChar ::= [A-Z] \ "_" \ [a-z] \ [#x00C0-#x00D6] \ [#x00D8-#x00F6] \ [#x00F8-#x02FF] \ [#x0370-#x037D] \ [#x037F-#x1FFF] \ [#x200C-#x200D] \ [#x2070-#x218F] \ [#x2C00-#x2FEF] \ [#x3001-#xD7FF] \ [#xF900-#xFDCF] \ [#xFDF0-#xFFFD] \ [#x10000-#xEFFFF]