Skip to content

Revise RDFterm-equal and function sameTerm. Rename RDFterm-equal to sameValue. #194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 4, 2025

Conversation

afs
Copy link
Contributor

@afs afs commented Feb 5, 2025

This closes #187.
This closes #25.

Changes:


Preview | Diff

@afs
Copy link
Contributor Author

afs commented Feb 5, 2025

At the moment this is unfinished, work in progress.

It has editor's notes in the text, in a lurid colour, for further changes. These can be seen in the preview.

The diff isn't very useful except to show the changes are only in one area of the document.

cc editors of RDF Concepts -- @gkellogg @pchampin

@afs afs requested review from Tpt, hartig, kasei and rubensworks February 5, 2025 11:08
@afs afs force-pushed the rdf-term-equals branch from 108e37c to 3e4eb6c Compare February 6, 2025 10:27
@afs afs force-pushed the rdf-term-equals branch 7 times, most recently from a7ec54a to 5555e41 Compare February 23, 2025 17:01
@afs afs marked this pull request as ready for review February 24, 2025 16:47
@afs
Copy link
Contributor Author

afs commented Feb 24, 2025

There are still 4 "editors notes" for work to be done - one of them is waiting on w3c/rdf-concepts#154.

@hartig
Copy link
Contributor

hartig commented Feb 24, 2025

There are still 4 "editors notes" for work to be done - one of them is waiting on w3c/rdf-concepts#154.

Okay, I will work on a PR for w3c/rdf-concepts#154 right away (as PR w3c/rdf-concepts#158 is merged now).

@hartig
Copy link
Contributor

hartig commented Feb 25, 2025

There are still 4 "editors notes" for work to be done - one of them is waiting on w3c/rdf-concepts#154.

Okay, I will work on a PR for w3c/rdf-concepts#154 right away (as PR w3c/rdf-concepts#158 is merged now).

The PR for w3c/rdf-concepts#154 is ready; see: w3c/rdf-concepts#161

@afs afs force-pushed the rdf-term-equals branch 3 times, most recently from 7d51235 to 156b28f Compare February 25, 2025 18:35
@afs afs force-pushed the rdf-term-equals branch from 156b28f to 85ef5b7 Compare March 1, 2025 18:55
@afs afs force-pushed the rdf-term-equals branch 3 times, most recently from f4990ef to e305cf3 Compare March 25, 2025 20:50
Copy link
Contributor

@Tpt Tpt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for pushing this and for answering all my nitpicks.

I am still not convinced that the special case for NaN is worth it while sameValue is kept as only a way to define = but it's not a big deal (my bold assumption is that we will never expose sameValue directly).

@afs
Copy link
Contributor Author

afs commented Mar 26, 2025

Bold.

😄

@afs afs requested review from hartig and rubensworks March 27, 2025 09:09
Copy link
Member

@rubensworks rubensworks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor suggestions. Looks good to me in general!

@afs
Copy link
Contributor Author

afs commented Mar 31, 2025

@kasei , @hartig

Is the current state of this PR satisfactory for merge? If so, could you approve it?

@hartig
Copy link
Contributor

hartig commented Mar 31, 2025

Is the current state of this PR satisfactory for merge? If so, could you approve it?

Andy, sorry for having been quiet in this PR recently. I have an important deadline tomorrow and will be able to come back to this PR only later this week.

@afs
Copy link
Contributor Author

afs commented Mar 31, 2025

If appropriate, we can proceed by raising subsequent issues so that merge can proceed.

(for the merge, I will squash commits so we have a commit for the long term record)

@kasei
Copy link
Contributor

kasei commented Apr 1, 2025

@kasei , @hartig

Is the current state of this PR satisfactory for merge? If so, could you approve it?

I'll take a look today.

@kasei
Copy link
Contributor

kasei commented Apr 1, 2025

This looks good to me with one exception: the special handling for "NaN" in §17.4.2.2 sameValue. The content in §17.4.2.2 seems reasonable, and the rationale provided in the following NOTE section is good. However, I'm not sure how you'd ever get into sameValue when trying to evaluate something like "NaN"^^xsd:double = "NaN"^^xsd:float because §17.3 Operator Mapping seems clear that the rule for numeric types (using op:numeric-equal) would take precedence over the fallback rule for RDF terms (using sameValue).

Since this is value-specific, we can't simply add a new row to the operator mapping table, but I think something needs to be done to ensure handling of NaN values ends up using sameValue semantics rather than numeric-equal semantics.

@afs
Copy link
Contributor Author

afs commented Apr 1, 2025

Handling NaNs (any mix double/float) will go to op:numeric-equal.

There is lots of discussion up-thread so I'll try not repeat that all.

Identity isn't equality for NaNs. https://www.w3.org/TR/xmlschema11-2/#equality

"NaN"^^xsd:double is not a consistent point-extension of the number value space R -- it's not an algebraic group under + any longer (there is no inverse). Both op:numeric-less-than(NaN, NaN) and op:numeric-greater-than(NaN, NaN) is false (numeric-greater-than is defined by argument switching, not via fn:not) and op:numeric-equal is false

In a graph matching, two uses of "NaN"^^double" are the same term.

Everywhere else, sameTerm implies sameValue because L2V is a function.

[RDF Concept 5. Datatypes] https://www.w3.org/TR/rdf12-concepts/#section-Datatypes
"Datatypes are used with RDF literals to represent values"

So there is choice here.
graph/value-motivated vs expression/F&O motivated. Two different places where identity/equality happen.

We don't need sameValue to be same as =. We can have sameValue means same element in the value space.

If RDF ever becomes value-centric, including the pattern of reading data and canonicalizing numbers on input,
sameTerm implies sameValue matters.

@kasei
Copy link
Contributor

kasei commented Apr 1, 2025

Sorry. I hadn't been able to follow all the discussion in the thread. Just to be clear - since sameValue isn't exposed as a callable function, is there any practical use to this definition (w.r.t. "NaN" values)? Or is it just to align with the conceptual need for "sameTerm implies sameValue"? I think it's the latter based on the comments above from @Tpt (?). If that's the case, I'm OK with this being merged, though I think it might be a point of confusion to readers of the spec in the future.

@afs
Copy link
Contributor Author

afs commented Apr 1, 2025

is there any practical use to this definition

Currently, no - sameValue is not exposed as a callable function.

is it just to align with the conceptual need for "sameTerm implies sameValue"?

Yes.

a point of confusion to readers of the spec in the future.

Anything to do with NaNs is confusing in the details. Intuitions mislead.

@kasei
Copy link
Contributor

kasei commented Apr 1, 2025

Anything to do with NaNs is confusing in the details. Intuitions mislead.

Agreed. My concern is more around the fact that the document is defining behavior that can't ever be used, though (so not really about NaNs… could be about anything). I'm happy to let this get merged, but it strikes me as really strange to be adding definitions that can't possibly be used/observed in a SPARQL system. Obviously it would be different if sameValue were callable.

@afs
Copy link
Contributor Author

afs commented Apr 2, 2025

Issue #201 for whether sameValue should be callable.

@afs afs force-pushed the rdf-term-equals branch from 04e6b6e to 0391ac4 Compare April 4, 2025 14:02
@afs
Copy link
Contributor Author

afs commented Apr 4, 2025

Squashed authoring, editing and review commits.

@afs afs merged commit dc25411 into main Apr 4, 2025
2 checks passed
@afs afs deleted the rdf-term-equals branch April 4, 2025 14:04
</li>
<li>If <code>term1</code> and <code>term2</code> are both
<a data-cite="RDF12-CONCEPTS#dfn-literal">literals</a>
and the SPARQL processor can determine that their the values are equal,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
and the SPARQL processor can determine that their the values are equal,
and the SPARQL processor can determine that their values are equal,

</li>
<li>If <code>term1</code> and <code>term2</code> are both
<a data-cite="RDF12-CONCEPTS#dfn-literal">literals</a>
and the SPARQL processor can determine the values can not be equal,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
and the SPARQL processor can determine the values can not be equal,
and the SPARQL processor can determine that their values cannot be equal,

Comment on lines +5886 to +5887
can determine that the values of these literals are equal or are not equal.
If the SPARQL processor can not be sure, it returns `error`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
can determine that the values of these literals are equal or are not equal.
If the SPARQL processor can not be sure, it returns `error`.
can determine that the values of these literals are equal or are not equal, respectively.
If the SPARQL processor cannot be sure, it returns `error`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec:substantive Change in the spec affecting its normative content (class 3) –see also spec:bug, spec:new-feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refining RDFTerm-equals Rename 'RDFterm-equal'
6 participants