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

Description


RDF defines several container elements. The rdf:Bag element groups together relevant resources. 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.

Source


<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:lib="http://www.zvon.org/library">

     <lib:Author about="RD">
          <lib:firstName>Roald</lib:firstName>
          <lib:surname>Dahl</lib:surname>

          <lib:books>
               <rdf:Bag>
                    <rdf:_1 resource="Matilda"/>
                    <rdf:_2 resource="The BFG"/>
               </rdf:Bag>
          </lib:books> 
     </lib:Author>
          
     <rdf:Description about="JC">
          <rdf:type resource="http://www.zvon.org/library/Author"/>
          <lib:firstName>Joseph</lib:firstName>
          <lib:surname>Conrad</lib:surname>

          <lib:books>
               <rdf:Bag>
                    <rdf:li resource="Heart of Darkness"/>
                    <rdf:li resource="Lord Jim"/>
                    <rdf:li resource="The Secret Agent"/>
               </rdf:Bag>
          </lib:books> 
     </rdf:Description>
          
     <lib:Book about="Matilda" lib:pages="240"/>

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

     <lib:Book about="Heart of Darkness" lib:pages="110"/>
      <lib:Book about="Lord Jim" lib:pages="314"/>
     <lib:Book about="The Secret Agent" lib:pages="249"/>
          
</rdf:RDF>

Output Top

Roald Dahl :
Matilda [ 240 pages ]
The BFG [ 208 pages ]

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