# Re: N3/CWM formulae, how they relate to graph nodes, and graph comparison

From: Karsten Otto <otto@math.fu-berlin.de>
Date: Fri, 25 Apr 2003 11:15:29 +0200 (CEST)
To: Graham Klyne <gk@ninebynine.org>
cc: RDF interest group <www-rdf-interest@w3.org>
Message-ID: <Pine.LNX.4.44.0304251036450.28807-100000@hobbes.inf.fu-berlin.de>
```
Hello,

sorry for replying this late, I am currently in the middle of trying to
catch up with my e-mail after vacation.

> [snip]
>
> In Notation3, we have expressions like:
>
>     ex:f1 :- { ex:s1 ex:p1 ex:o1 . } .
>
> which I understand to mean that the formula node is also identified by the
> URI ex:f1.  Which suggests that either:
>    (a) the URI and formula (subgraph) are somehow bound together, or
>    (b) the formula is a property (in the RDF sense) of the URI node.
> or something else that I haven't thought of.
>
I recently had a similar problem with regard to the [] notation in N3.
I found the :- operatr, but no proper explanation of it, only the
example given in DesignIssues [1] :

" :- anonnode (to allow two anonymous forms to be given eg
[ a :Truth; :- { :sky :color :blue } ]) "

which seems to imply that the blank node is the same for the subject of
the [], and the context identifier in the formula. Using a quad notation,
with the fourth field specifying the context identifier:

_:x rdf:type :Truth NIL .
:sky :color :blue _:x .

There is just one anonymous node, not two that are releated in some way.
In other words, the :- operator seems to combine two blank nodes into one,
other than the = operator, which just generates a daml:equivalent
statement.

> Lacking any particular vocabulary to suggest (b), I have previously gone
> along with (a).  But now a realize this raises another question:  does it
> make sense to have the following in the same graph?:
>
>     ex:f1 :- { ex:s1 ex:p1 ex:o1 . } .
>
> and
>
>     ex:f1 :- { ex:s2 ex:p2 ex:o2 . } .
>
> i.e. two different formulae associated with the same URI?  If so, are they
> the same node or are they different nodes.  Saying they're the same node
> leads me to conclusion (b) above (or some other approach I haven't thought
> of), and hence to ask what is the vocabulary that relates a formula to a
> node.  Saying they're different nodes seems to lead to a breakdown of the
> idea that a URI (alone) always denotes a single given concept.
>

Consider a more simple example: Let's say you had stated

_:x :- { ex:s1 ex:p1 ex:o1 . } .
_:x :- { ex:s2 ex:p2 ex:o2 . } .

or, for that matter

{ ex:s1 ex:p1 ex:o1 . } :- { ex:s2 ex:p2 ex:o2 . } .

This works nicely in accordance to my interpretation above, you simply
combine the two nodes together, and basically get

{ ex:s1 ex:p1 ex:o1 . ex:s2 ex:p2 ex:o2 . } .

This also works if you have [] nodes instead of {}.

Now, if you use a non-anonymous node with the :- operator, matters
become difficult. It means that your anonymous node is not anonymous at
all, but in fact a named node! The mechanism still works, but it is
somewhat counter-intuitive. Consider:

ex:a :- [ ex:p1 ex:o1 . ] .

becomes

ex:a ex:p1 ex:o1 .

> How are other people treating the node/formula relationship (if at all)?
>
I am using the comination interpretation of :- as described above.

> In case all this seems rather abstract, it has arisen because I've obtained
> some unexpected results when comparing graphs that contain formulae:
>
>      { base1:s1 base1:p1 base1:o1 .
>        base2:s2 base1:p1 base2:o2 .
>        base3:s3 base1:p1 base3:o3 . } base2:p2 base2:f2 .
>
> and
>
>      { base1:s1 base1:p1 base1:o1 . } base2:p2 base2:f2 .
>
> would reasonably seem to be different RDF graphs, but what about:
>
>      base1:f1 :-
>      { base1:s1 base1:p1 base1:o1 .
>        base2:s2 base1:p1 base2:o2 .
>        base3:s3 base1:p1 base3:o3 . } base2:p2 base2:f2 .
>
> and
>
>      base1:f1 :-
>      { base1:s1 base1:p1 base1:o1 . } base2:p2 base2:f2 .
>
> ?
>
> The algorithm I use to compare graphs, based on Jeremy Carroll's paper [3],
> looks for a bijection between graph nodes, where (per [2]) "M(uri)=uri for
> all RDF URI references uri which are nodes of either graph.", so both of
> the above pairs of graphs compare as equivalent.  This seems surprising to
> me, so I'm trying to figure out what I should try and fix.
>
I am not very knowledgeable about graph matching, but using the
interpretation described, this result makes sense.

In the second case, both formulae are identified by the same context
identifier base1:f1, so no surprise there. In the first example, you
actually have two different blank nodes for the formulae. The result
depends on your matching algorithm: If you try to match blank nodes
"by description" (or in the case of formulae "by contents"), you get
a match too.

Regards,
Karsten Otto

[1] http://www.w3.org/DesignIssues/Notation3.html
```
Received on Friday, 25 April 2003 05:15:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:51:58 GMT