Re: plural vs singular properties (a proposal)

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