Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Plain literal behaviour #2

Closed
wschella opened this issue Sep 27, 2018 · 3 comments
Closed

Plain literal behaviour #2

wschella opened this issue Sep 27, 2018 · 3 comments
Labels
difficulty:challenging Implementing or fixing this will present a doable challenge priority:medium spec

Comments

@wschella
Copy link
Collaborator

wschella commented Sep 27, 2018

Context

In the SPARQL spec, more spefically operand data types and [operator mapping] there exist the concepts of:

  • plain literals: one of
    • simple literals
    • language tagged literals
  • typed literals with xsd:string type

Problem

The distinction is important, as the string operators only apply to apply to typed literals, and not the plain ones. For example, following expressions are NOT equivalent:
"foo"^^xsd:string != "bar"^^xsd:string and "foo" != "bar".
The first one will evaluate true, the second one should error, since the operator is not defined. A solution to this is to allow simple literals in problematic operators.

A bigger problem however is that the return type the some functions (mainly functions on strings) is dependent on the original type, e.g. a simple literal should be returned when the (first) argument was a simple literal. This is however impossible.

However: the RDF.js spec hides the difference between simple and typed literals, as it automatically adds the xsd:string data type.

Proposal

Concluded from the discussion on the RDF.js repo, we want to consider simple literals as being typed with xsd:string. By extension, the same goes for language tagged literals and rdf:langString.

Any untyped literals we get as input we could type ourselves.

This will give issues with spec tests.

@wschella wschella added difficulty:challenging Implementing or fixing this will present a doable challenge priority:medium spec labels Sep 27, 2018
@wschella
Copy link
Collaborator Author

wschella commented Nov 3, 2018

Behavior mentioned above is implemented, but this should still be documented somewhere.

@wschella
Copy link
Collaborator Author

This does not take into consideration:

17.4.3.1.3 String Literal Return Type

Functions that return a string literal do so with the string literal of the same kind as the first argument (simple literal, plain literal with same language tag, xsd:string). This includes SUBSTR, STRBEFORE and STRAFTER.

The function CONCAT returns a string literal based on the details of all its arguments.

@wschella
Copy link
Collaborator Author

This behavior is implemented and final.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
difficulty:challenging Implementing or fixing this will present a doable challenge priority:medium spec
Projects
None yet
Development

No branches or pull requests

1 participant