Skip to content

Changed semantics of sameValue (RDFterm-equal)? #340

@kasei

Description

@kasei

I believe in the process of updating sameValue, the semantics have changed from the 1.1 definition (RDFterm-equal).

As an example, I’m looking at the semantics of evaluating the expression "a" = 1. Previously, this would fall through the operator mapping table (assuming no extensions) to RDFterm-equal which says this should produce a type error.

However, in the 1.2 draft, the definition of sameValue is much expanded, and the new definition says that this should return false due to step 7:

  1. If term1 and term2 are both literals and the SPARQL processor can determine the values can not be equal, then return FALSE.

In my example, these are both datatypes that conformant systems must understand (xsd:string and xsd:integer), so leaving that to “if … the SPARQL processor can determine” language seems a bit vague to me (both "if" and "can" are of concern here). I understand the need for the “if” to expand past the types that must be supported, but I wonder if we should think about better language that explicitly covers the core types.

I found this while working through a query using NOT IN. In that case (and using the equivalences we provide to a combination of '!', =, and logical-or operations), if all the values are numeric with the addition of a single string in the values list (e.g. 1 NOT IN (1, 2, 3, "a")), then the error from that final comparison bubbles up from the =, through the logical-or, and changes the result of the NOT IN.

I’m not sure I had ever realized before. This understanding makes me think that the 1.1 semantics make NOT IN very dangerous to use unless you have a deep understanding of the language semantics and a clear understanding of exactly what extensions your system has made to the operator mapping table. I think the 1.2 language is clearly better for this case, but the “if the processor can determine” language still seems a bit vague.

What do people think?

(I also don't think this change was discussed in the group and I can't find mention of it in the Changes from 1.1 to 1.2 section.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions