W3C home > Mailing lists > Public > www-rdf-interest@w3.org > October 2003

Re: modeling nested containers with items

From: Graham Klyne <GK@ninebynine.org>
Date: Wed, 08 Oct 2003 15:41:02 +0100
Message-Id: <5.1.0.14.2.20031008153250.024c9d40@127.0.0.1>
To: "DuCharme, Bob (LNG-CHO)" <bob.ducharme@lexisnexis.com>, "'www-rdf-interest@w3.org'" <www-rdf-interest@w3.org>

How about something like:

<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:ex="http://example.org/">
   <ex:Container rdf:ID="c1">
      <ex:contains>
         <ex:Item rdf:ID="i1" />
      </ex:contains>
      <ex:contains>
         <ex:Container rdf:ID="c2">
            <ex:contains>
               <ex:Item rdf:ID="i2" />
            </ex:contains>
         </ex:Container>
      </ex:contains>
   </ex:Container>
</rdf:RDF>

(This passes the validator at http://www.w3.org/RDF/Validator/ )

Or, using rdf:Bag:

<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:ex="http://example.org/">
   <rdf:Bag rdf:ID="c1">
      <rdf:li>
         <ex:Item rdf:ID="i1" />
      </rdf:li>
      <rdf:li>
         <rdf:Bag rdf:ID="c2">
            <rdf:li>
               <ex:Item rdf:ID="i2" />
            </rdf:li>
         </rdf:Bag>
      </rdf:li>
   </rdf:Bag>
</rdf:RDF>

for which the following triples are generated:

<http://www.w3.org/RDF/Validator/run/1065624046941#c1> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag> .
<http://www.w3.org/RDF/Validator/run/1065624046941#i1> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Item> .
<http://www.w3.org/RDF/Validator/run/1065624046941#c1> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> 
<http://www.w3.org/RDF/Validator/run/1065624046941#i1> .
<http://www.w3.org/RDF/Validator/run/1065624046941#c2> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag> .
<http://www.w3.org/RDF/Validator/run/1065624046941#i2> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Item> .
<http://www.w3.org/RDF/Validator/run/1065624046941#c2> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> 
<http://www.w3.org/RDF/Validator/run/1065624046941#i2> .
<http://www.w3.org/RDF/Validator/run/1065624046941#c1> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#_2> 
<http://www.w3.org/RDF/Validator/run/1065624046941#c2> .

#g

At 10:27 08/10/03 -0400, DuCharme, Bob (LNG-CHO) wrote:

>I'm having a hard time figuring out an RDF way to model containers that can
>each contain items and/or other containers. A filesystem directory/file
>structure and a bookmark folder/bookmark structure are good examples.
>Assuming that each container and each item can have properties (e.g.
>"created" in the example below), how could I represent the following in RDF?
>My attempts at using RDF containers have been bumping into those striping
>issues. Or is even attempting to use RDF here a case of barking up the wrong
>tree?
>
>
>    <container id="i1" created="20031001">
>       <item id="i2" created="20031001"/>
>       <item id="i3" created="20031003"/>
>       <container id="i4" created="20031002">
>          <item id="i5" created="20031002"/>
>          <item id="i6" created="20031003"/>
>          <item id="i7" created="20031001"/>
>          <container id="i8" created="20031003">
>             <item id="i9" created="20031004"/>
>          </container>
>          <container id="i10" 20031004"/>
>       </container>
>    </container>
>
>thanks,
>
>Bob

------------
Graham Klyne
GK@NineByNine.org
Received on Wednesday, 8 October 2003 10:44:00 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:52:02 GMT