function terms in Euler, n3, and RDF [was: gedcom-relation example]

> We have been playing a bit with your GEDCOM example.
> We actually rewrote it in N3 and the relations are at
> http://www.agfa.com/w3c/euler/gedcom-relations.n3

The gedcom example got me looking around the Euler
stuff again, and it reminded me of something I find odd there...
the use of statements that seem to "return" values, ala
functional terms; e.g.

| {<#x> :in {<#x> :list <#b>}} log:forAll <#b>, <#x>.
-- http://www.agfa.com/w3c/euler/lists.axiom.n3

It seems that {<#x> :list <#b>} is being used as a term, as if :list
is a 2-place function that returns a list. That doesn't really fit
in RDF does it? RDF only has predicates, not functions, no?

Ah... this is actually documented:

| Operations are described with {subject operator object} log:implies
result. statements.
| Operators are e:plus, e:minus, e:star, e:slash, e:lt, e:lte, e:gt, e:gte,
e:eq, and e:neq.
-- http://www.agfa.com/w3c/euler/

The lt, lte, gte, eq, and neq symbols fit; they're relations. But e:plus
doesn't;
plus, as a relation, is ternary: plus(4, 3, 7) meaning "7 is the sum of 4
and 3."
In playing around with n3, we came up with a couple idioms for this.

One is to encode "a sum of 4 and 3" as [a :Sum; :of 4; :and 3], combined
with knowledge that there is exactly one such sum. If you make the domain
of :of and :and be :Sum (aka :Integer) and recall that = denotes
daml:equivalentTo,
you can write "the sum of 4 and 3 is 7" as
  [ :of 4; :and 3 ] = 7.

The other idiom is somewhat more traditional, making use of the list
syntax-sugar in n3, where (a b) denotes the same thing
as [ daml:first a; daml:rest [ daml:first b; daml:rest daml:nil ]].
Using that, we can write "the pair 3,4 has sum 7: as
  (3 4) :sum 7.

Oops... I've been using decimal numerals as terms, which isn't (yet?) part
of n3.
So that should actually be
  (i:_3 i:_4) :sum i:_7.
or some such.


McDermott's proposal a while ago had another approach to functional terms in
RDF,
but it used more than syntactic sugar...
http://lists.w3.org/Archives/Public/www-rdf-logic/2000Dec/0044.html
http://www.cs.yale.edu/homes/dvm/daml/proposal.html

> --
> Jos De Roo, Agfa http://www.agfa.com/w3c/jdroo/

--
Dan Connolly, W3C http://www.w3.org/People/Connolly/

Received on Sunday, 4 March 2001 19:24:02 UTC