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

Description


RDF defines several container elements. The rdf:Seq element groups together resources order of which is significant. 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. For some reason, e.g. to keep one of the copies(M126) in the best possible state, it preffers to lend the first specified book (M124) as often as possible. Compare with Example 12 in which the order was insignificant ant rdf:Alt was 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">
          <lib:copy>
               <rdf:Seq>
                    <rdf:li resource="M124"/>
                    <rdf:li resource="M125"/>
                    <rdf:li resource="M126"/>
               </rdf:Seq>
          </lib:copy>
     </lib:Book>

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

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

Output Top

Roald Dahl :
Matilda [ M124 M125 M126 ]
The BFG [ T458 ]

Joseph Conrad :
Heart of Darkness [ H16 ]
Lord Jim [ L187 ]
The Secret Agent [ T360 ]