W3C home > Mailing lists > Public > semantic-web@w3.org > April 2007

Re: plural vs singular properties (a proposal)

From: Chris Dollin <chris.dollin@hp.com>
Date: Mon, 23 Apr 2007 14:36:21 +0100
To: semantic-web@w3.org
Message-Id: <200704231436.21569.chris.dollin@hp.com>

On Monday 23 April 2007 13:52, Eyal Oren wrote:

> Now, for Sandro's proposal, in ActiveRDF properties return either singular 
> values (e.g. a foaf:Person) or an Array of values, depending on the number 
> of triples that carry that property for the given subject. Since we're 
> using a dynamic language such multi-typing is no problem:

I disagree.

It's no problem to /do/, it's a problem to /use/. Because:

>   # in one case we might return a single value
>   eyal.foaf::knows ==> renaud
>   # but with a different data set an array
>   eyal.foaf::knows ==> [renaud, armin, stefan]

... you don't, in general, know how many items you've got, and so
don't know whether to expect a singleton or a collection. (Yes,
of course you can test, but then every point of access becomes a
type-test, No Biscuit.)
>   # if you as programmer want an array in any case you can ask for it
>   eyal.foaf::all_knows ==> [renaud]

Whereas this is easier to work with: you /always/ get an array, which
you can iterate over. If you want exactly one value, you can check the
size of the array. 

> I personally find this quite ok, without the need for plural properties?

I'd much rather be able to have the method names express that I
expect one thing vs a collection of things (and have expect-one
explode if there's more than one property value. Or none, in
languages (like Java) with second-class nils.)

An alternative in friendly languages is to have an optional parameter
expressing the plurality of the property in suitable fashion.

"The path to the web becomes deeper and wider."               - October Project

Hewlett-Packard Limited registered office:                Cain Road, Bracknell,
registered no: 690597 England                                    Berks RG12 1HN
Received on Monday, 23 April 2007 13:36:06 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:49:34 UTC