ZVON > Tutorials > RDF Tutorial
>> Example 12 << | Prev | Next | Contents


RDF defines several container elements. The rdf:Alt element groups together resources which can be arbitrary substituted one for another. The order of resources is not important and it can contain duplicate resources. The individual resources are either individually numbered with rdf:_1, rdf:_2, rdf:_3 ... , or generalized form rdf:li can be used. In our case the library have several copies of the book Matilda. If a user wants to borrow the book, he just wants one of these copies, it does not matter which one.



     <lib:Author about="RD">
                    <rdf:_1 resource="Matilda"/>
                    <rdf:_2 resource="The BFG"/>
     <rdf:Description about="JC">
          <rdf:type resource="http://www.zvon.org/library/Author"/>

                    <rdf:li resource="Heart of Darkness"/>
                    <rdf:li resource="Lord Jim"/>
                    <rdf:li resource="The Secret Agent"/>
     <lib:Book about="Matilda" lib:pages="240">
                    <rdf:li resource="M124"/>
                    <rdf:li resource="M125"/>
                    <rdf:li resource="M126"/>

     <rdf:Description about="The BFG" lib:pages="208">
          <rdf:type resource="http://www.zvon.org/library/Book"/>
          <lib:copy rdf:resource="T458"/>

     <lib:Book about="Heart of Darkness" lib:pages="110">
          <lib:copy rdf:resource="H16"/>
      <lib:Book about="Lord Jim" lib:pages="314">
          <lib:copy rdf:resource="L187"/>
     <lib:Book about="The Secret Agent" lib:pages="249">
          <lib:copy rdf:resource="T360"/>

Output Top

Roald Dahl :
Matilda [ 240 pages; 3 copies ]
The BFG [ 208 pages; 1 copy ]

Joseph Conrad :
Heart of Darkness [ 110 pages; 1 copy ]
Lord Jim [ 314 pages; 1 copy ]
The Secret Agent [ 249 pages; 1 copy ]