- From: Sandro Hawke <sandro@w3.org>
- Date: Tue, 06 Mar 2001 16:50:10 -0500
- To: jos.deroo.jd@belgium.agfa.com, connolly@w3.org, www-rdf-logic@w3.org
> > [Dan Connolly writing:]
> >
> > 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.
But why would there ever be "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.
And without that qualification, this doesn't work. Let's rename and
avoid [] for clarity. You're saying:
7 sum_of_2_part_1 4.
7 sum_of_2_part_2 3.
But it's obviously true (and so may well be said) that
7 sum_of_2_part_1 2.
7 sum_of_2_part_2 5.
So now if I query:
7 sum_of_2_part_1 4.
7 sum_of_2_part_2 ?x.
I get ?x=3 and ?x=5 (and probably every other real number, given some
reasonable axioms about addition).
> > 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.
That works. Expanded out, that's
:anon1 arith:sum 7;
daml:first 3;
daml:rest :anon2.
:anon2 daml:first 4;
daml:rest daml:nil.
In general, I think it's better practice to name the elements of a
tuple (making it what? an "object"? a "record"? an "associative
array"? a relation in its own right?). People are used to anonymous
(positional) parts for the addition relation, but I'll name them
anyway:
:anon1 a arith:BinarySum
arith:left 3
arith:right 4
arith:result :_7
or more generally
:anon1 a rel3:TernaryRelationInstance
rel3:relation arith:sum
rel3:part1 3
rel3:part2 4
rel3:part3 7
> > Dan Connolly, W3C http://www.w3.org/People/Connolly/
Sandro Hawke, W3C http://www.w3.org/People/Sandro/
Received on Tuesday, 6 March 2001 16:50:29 UTC