Skip to content

Commit

Permalink
Merge pull request #160 from w3c/Issue157
Browse files Browse the repository at this point in the history
Unifies definitions of graph isomorphism and dataset isomorphism (alternative proposal)
  • Loading branch information
hartig authored Feb 25, 2025
2 parents 536b67e + c62aff1 commit b8b739d
Showing 1 changed file with 31 additions and 32 deletions.
63 changes: 31 additions & 32 deletions spec/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -901,27 +901,30 @@ <h3>Triple Terms</h3>
<section id="graph-isomorphism">
<h3>Graph Comparison</h3>

<p id="section-graph-equality">Two
<a>RDF graphs</a> <var>G</var> and <var>G'</var> are
<dfn data-lt="graph isomorphism|isomorphic" data-lt-noDefault class="export">isomorphic</dfn>
(that is, they have an identical form)
if there is a bijection <var>M</var>
from the set of all <a>RDF terms</a> into that same set,
such that all of the following properties hold:</p>

<ul>
<li><var>M</var> maps blank nodes to blank nodes.</li>
<li><var>M</var>(<var>lit</var>)=<var>lit</var> for every <a>RDF literal</a> <var>lit</var>.</li>

<li><var>M</var>(<var>iri</var>)=<var>iri</var> for every <a>IRI</a> <var>iri</var>.</li>
<p>This section introduces a notion of graph isomorphism for [=RDF graphs=]
which is based on a mapping between [=RDF terms=]
that maps blank nodes to blank nodes
and is the identity function for IRIs and literals.</p>

<li><var>M</var>(<var>tt</var>) is the triple term ( <var>M</var>(<var>s</var>), <var>M</var>(<var>p</var>), <var>M</var>(<var>o</var>) ) if <var>tt</var> is a triple term of the form ( <var>s</var>, <var>p</var>, <var>o</var> ).</li>
<p>A function |M| from the set of all [=RDF terms=] into that same set
is called an <dfn>isomorphic RDF-term mapping</dfn>
if it is has all of the following properties:</p>

<li>The triple ( <var>s</var>, <var>p</var>, <var>o</var> ) is in <var>G</var> if and
only if the triple ( <var>M</var>(<var>s</var>), <var>M</var>(<var>p</var>), <var>M</var>(<var>o</var>) ) is in
<var>G'</var>.</li>
<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 [=triple term=] |tt| of the form (|s|, |p|, |o|), |M|(|tt|) is the triple term ( |M|(|s|), |M|(|p|), |M|(|o|) ).</li>
</ul>

<p id="section-graph-equality">Two [=RDF graphs=] |G| and <var>G'</var> are
<dfn data-lt="graph isomorphism|isomorphic" data-lt-noDefault class="export">isomorphic</dfn>
(that is, they have the same form)
if there exists an [=isomorphic RDF-term mapping=] |M| such that
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>

<p>With this definition, <var>M</var> shows how each blank node
Expand Down Expand Up @@ -1050,24 +1053,20 @@ <h2>RDF Datasets</h2>
<section id="section-dataset-isomorphism">
<h3>RDF Dataset Comparison</h3>

<p id="section-dataset-equality">Two <a>RDF datasets</a>
(the RDF dataset <var>D1</var> with default graph <var>DG1</var> and any named
graph <var>NG1</var> and the RDF dataset <var>D2</var> with default graph
<var>DG2</var> and any named graph <var>NG2</var>)
<p id="section-dataset-equality">Two <a>RDF datasets</a> |D1| and |D2|
(respectively, with [=default graphs=] |DG1| and |DG2| and sets |NG1| and |NG2| of [=named graphs=])
are <dfn data-lt="dataset isomorphism" class="export">dataset-isomorphic</dfn> if and only if
there is a bijection <var>M</var> between the nodes, triples and graphs in
<var>D1</var> and those in <var>D2</var> such that all of the following properties hold:</p>
there exists an [=isomorphic RDF-term mapping=] |M|
for which all of the following properties hold:</p>

<ul>
<li><var>M</var> maps <a>blank nodes</a> to blank nodes;</li>
<li><var>M</var> is the identity map on <a>literals</a> and URIs;</li>
<li>For every triple &lt;s p o&gt;, <var>M</var>(&lt;s, p, o&gt;)=
&lt;<var>M(s)</var>, <var>M(p)</var>, <var>M(o)</var>&gt;;</li>
<li>For every graph <var>G</var>={t1, ..., tn},
<var>M(G)</var>={<var>M(t1)</var>, ..., <var>M(tn)</var>};</li>
<li><var>DG2</var> = <var>M(DG1)</var>; and</li>
<li>&lt;n, G&gt; is in <var>NG1</var> if and only if
&lt;<var>M(n)</var>, <var>M(G)</var>&gt; is in <var>NG2</var>.
<li>The triple (|s|, |p|, |o|) is in |DG1| if and only if
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>

</section>
Expand Down

0 comments on commit b8b739d

Please sign in to comment.