Skip to content
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

Adds RDF term equality definitions #161

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
47 changes: 38 additions & 9 deletions spec/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,16 @@ <h3>Triples</h3>

<p>The three components (|s|, |p|, |o|) of an [=RDF triple=] are respectively called the <dfn class=export >subject</dfn>, <dfn class=export >predicate</dfn> and <dfn class=export >object</dfn> of the triple.</p>

<p><dfn>Triple equality</dfn>:
Two triples (|s|, |p|, |o|) and (<var>s'</var>, <var>p'</var>, <var>o'</var>)
are considered equal if and only if all of the following three conditions holds.</p>

<ul>
<li>|s| and <var>s'</var> are [=RDF term equality|equal=].</li>
<li>|p| and <var>p'</var> are [=RDF term equality|equal=].</li>
<li>|o| and <var>o'</var> are [=RDF term equality|equal=].</li>
</ul>


<p class="note">The definition of <a>triple</a> is recursive.
That is, a <a>triple</a> can itself have an
Expand All @@ -599,6 +609,17 @@ <h3>RDF Terms</h3>
nor to a blank node with the <a>blank node identifier</a>
<code>http://example.org/</code>.</p>

<p><dfn>RDF term equality</dfn>:
Two [=RDF terms=] |t| and <var>t'</var> are considered equal if and only if
one of the following four conditions holds:</p>

<ul>
<li>|t| and <var>t'</var> are [=IRIs=] that are [=IRI equality|equal=] (per [=IRI equality=]).</li>
<li>|t| and <var>t'</var> are [=literals=] that are [=literal term equality|equal=] (per [=literal term equality=]).</li>
<li>|t| and <var>t'</var> are [=blank nodes=] that are [=blank node equality|equal=] (per [=blank node equality=]).</li>
<li>|t| and <var>t'</var> are [=triple terms=] that are [=triple equality|equal=] (per [=triple equality=]).</li>
</ul>

<p>The set of <span id="dfn-nodes"><!-- obsolete term--></span><dfn data-lt="node">nodes</dfn> of an <a>RDF graph</a>
is the set of <a>subjects</a> and <a>objects</a> of the <a>asserted triples</a> of the graph.
It is possible for a [=predicate=] [=IRI=] to also occur as a [=node=] in
Expand Down Expand Up @@ -848,6 +869,9 @@ <h3>Blank Nodes</h3>
the set of possible blank nodes is arbitrary. RDF makes no reference to
any internal structure of blank nodes.</p>

<p><dfn>Blank node equality</dfn>:
Two blank nodes are considered equal if and only if they are the same blank node.</p>

<div class="note" id="note-bnode-id">
<p><span id="dfn-blank-node-identifiers"><!-- obsolete term--></span><dfn data-lt="blank node identifier">Blank node identifiers</dfn>
are local identifiers that are used in some
Expand Down Expand Up @@ -877,7 +901,7 @@ <h3>Blank Nodes</h3>
<h3>Triple Terms</h3>

<p>An [=RDF triple=] used as the [=object=] of another [=triple=] is called a <dfn class=export >triple term</dfn>.
In a given [=RDF graph=], a [=triple=] can appear as a [=triple term=], an [=asserted triple=], or both.
In a given [=RDF graph=], a [=triple=] can appear as a [=triple term=], as an [=asserted triple=], or both.
</p>

<p>The set of [=RDF terms=] <dfn class=export data-lt="appear">appearing</dfn> in an [=RDF triple=] |t| is defined inductively as follows:</p>
Expand All @@ -889,6 +913,9 @@ <h3>Triple Terms</h3>

<p>By extension, an [=RDF term=] is said to [=appear=] in an [=RDF graph=] if it appears in an [=asserted triple=] of that graph. An [=RDF triple=] is said to [=appear=] in an [=RDF graph=] if it is either an [=asserted triple=] of that graph or a [=triple term=] [=appearing=] in that graph.</p>

<p>Triple term equality:
Since triple terms are [=triples=], equality of triple terms is the same as [=triple equality=].</p>

<p class="note">Every <a>triple</a> with a <a>triple term</a> as its [=object=] SHOULD
use <code>http://www.w3.org/1999/02/22-rdf-syntax-ns#reifies</code> (<code>rdf:reifies</code>)
as its <a>predicate</a>.
Expand All @@ -913,8 +940,8 @@ <h3>Graph Comparison</h3>
<ul>
<li>|M| is bijective.</li>
<li>For every [=blank node=] |b|, |M|(|b|) is a [=blank node=] (but not necessarily the same as |b|).</li>
<li>For every [=literal=] |lit|, |M|(|lit|) = |lit|.</li>
<li>For every [=IRI=] |iri|, |M|(|iri|) = |iri|.</li>
<li>For every [=literal=] |lit|, |M|(|lit|) is a [=literal=] that is [=literal term equality|equal=] to |lit|.</li>
<li>For every [=IRI=] |iri|, |M|(|iri|) is an [=IRI=] that is [=IRI equality|equal=] to |iri|.</li>
Copy link
Contributor

Choose a reason for hiding this comment

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

I could live with that, but I find it needlessly verbose and confusing. The point here is not to produce a new value that happens to be equal to the argument, the point is to return the argument itself...
I would slightly prefer to keep '=' here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

.. The point here is not to produce a new value that happens to be equal to the argument, the point is to return the argument itself...

In this case, it would actually be a better idea to replace the = by "is" (e.g., "M(iri) is iri" instead of "M(iri) = iri").

Notice, however, that this wording makes a difference for literals: Consider two literals, lit1 and lit2, which both have the same lexical form, both have rdf:langString as their datatype, and one of them has "EN" as its language tag whereas the other one has "en" instead. In this case, lit1 is not lit2, but they are equal according to literal term equality. So, if we say "M(lit) is lit" in this definition here, then M(lit1) cannot return lit2 but must return lit1; in contrast, if the definition says "M(lit) = lit" (and assuming = means literal term equality), then M(lit1) may also return lit2 (as an alternative to returning lit1).

I am not even sure which of these two cases we actually want.

Copy link
Contributor

Choose a reason for hiding this comment

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

In this case, it would actually be a better idea to replace the = by "is" (e.g., "M(iri) is iri" instead of "M(iri) = iri").

Yes, I like that.

Notice, however, that this wording makes a difference for literals:

You gave me a lot to think about with this puzzle :) My conclusion (which I will explain in more detail in the main conversation of this PR) is that this is not (or should not be) an issue.

<li>For every [=triple term=] |tt| of the form (|s|, |p|, |o|), |M|(|tt|) is the triple term ( |M|(|s|), |M|(|p|), |M|(|o|) ).</li>
</ul>

Expand All @@ -925,8 +952,6 @@ <h3>Graph Comparison</h3>
the triple (|s|, |p|, |o|) is in |G| if and only if
the triple ( |M|(|s|), |M|(|p|), |M|(|o|) ) is in <var>G'</var>.</p>

<p>See also: <a>IRI equality</a>, <a>literal term equality</a>.</p>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that I have removed this one because the cross-references to these definitions are integrated directly into the definition above now.


<p>With this definition, <var>M</var> shows how each blank node
in <var>G</var> can be replaced with
a new blank node to give <var>G'</var>. Graph isomorphism
Expand Down Expand Up @@ -1064,9 +1089,12 @@ <h3>RDF Dataset Comparison</h3>
the triple ( |M|(|s|), |M|(|p|), |M|(|o|) ) is in |DG2|.</li>
<li>The [=named graph=] (|n|, |G|) is in |NG1| if and only if
there is a [=named graph=] (<var>n'</var>, <var>G'</var>) in |NG2| such that
|M|(|n|) = <var>n'</var> and
the triple (|s|, |p|, |o|) is in |G| if and only if
the triple ( |M|(|s|), |M|(|p|), |M|(|o|) ) is in <var>G'</var>.</li>
<ul>
<li>|M|(|n|) is [=RDF term equality|equal=] to <var>n'</var> and</li>
<li>the triple (|s|, |p|, |o|) is in |G| if and only if
the triple ( |M|(|s|), |M|(|p|), |M|(|o|) ) is in <var>G'</var>.</li>
</ul>
</li>
</ul>

</section>
Expand Down Expand Up @@ -1989,11 +2017,12 @@ <h2>Changes between RDF 1.1 and RDF 1.2</h2>
Implementations can either follow the advice to normalize to lower case,
use the recommended BCP47 format,
or do something else, as long it is performed consistently.</li>
<li>Added explicit definitions of [=blank node equality=], [=RDF term equality=], and [=triple equality=].</li>
<li>Removed the section on the canonical mapping for the <a>rdf:XMLLiteral</a> datatype.</li>
<li>Refer to the definition and discussion of
<a data-cite="RDF12-SEMANTICS#dfn-recognize">RDF Semantics, "recognizing"</a>
datatype IRIs, instead of <em>Recognized datatype IRIs</em>.</li>
<li>The informal terminolgy "RDF processor" has been removed.</li>
<li>The informal terminology "RDF processor" has been removed.</li>
</ul>

<p class="note">A detailed overview of the differences between RDF versions&nbsp;1.1
Expand Down
Loading