W3C home > Mailing lists > Public > www-rdf-comments@w3.org > April to June 2002

Re: determining the cardinality of a container

From: Brian McBride <bwm@hplb.hpl.hp.com>
Date: Fri, 26 Apr 2002 09:43:57 +0100
Message-Id: <5.1.0.14.0.20020426093105.02d33bd0@0-mail-1.hpl.hp.com>
To: waterson@netscape.com (Chris Waterson) (by way of "Ralph R. Swick" <swick@w3.org>), www-rdf-comments@w3.org
Hi Chris,

My apologies for the delayed response.

If I understand correctly, you would like to be able to write code like:

   for int i=1, container.getProp(RDF.size).getInt() {
     ...
   }

The question here is what does the size property of the container 
represent.  An application may have a partial description of a container, 
so whilst the application knows about the first n elements say, there may 
be more.  Does the RDF.size property represent the number of elements in 
the container as a whole, or the the number the application knows about.

RDFCore are discussing the problem of 'closing' containers right now.  The 
idea of closure is that RDF gives you no way to determine whether you know 
all the members of container, or whether there might be more somewhere you 
don't know about.  One approach to this is to add a property that indicates 
the number of members in the container.  This is not the front running 
option right now, but even if it were, I don't think it would help you that 
much since it would indicate the number of members in the container, not 
the number that your application might know about right now.

I suggest what you are trying to do is a matter for an implementation to 
deal with.  An RDF api could choose to track the number of members it knows 
about.  In the Jena api we do something like:

   NodeIterator iter = container.iterator();
   while (iterator.hasNext()) {
     ...
   }

which is the typical naive loop in java.

Brian



At 06:32 03/04/2002 -0500, Chris Waterson wrote:
>[freed from spam trap -rrs]
>
>Date: Tue, 2 Apr 2002 18:50:52 -0500 (EST)
>Message-ID: <3CAA458B.4090406@netscape.com>
>From: waterson@netscape.com (Chris Waterson)
>MIME-Version: 1.0
>To: www-rdf-comments@w3.org
>
>Not sure if this has been discussed already, apologies in advance if it has.
>
>There ought to be a provision for determining the number of elements
>`contained in' an RDF container. This is useful, for example, when
>performing a naive iteration over the elements in the container.
>
>chris
Received on Friday, 26 April 2002 04:53:39 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 21 September 2012 14:16:30 GMT