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

Description


Container elements rdf:Bag, rdf:Alt and rdf:Seq can have optional ID attribute. With its help whole container can be identified. This example uses this attribute in rdf:Bag element. Notice # in the about attribute as this is a reference to an element with ID attribute.

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="#RDbooks">
          <lib:firstName>Roald</lib:firstName>
          <lib:surname>Dahl</lib:surname>
     </lib:Author>
          
     <rdf:Description about="#JCbooks">
          <rdf:type resource="http://www.zvon.org/library/Author"/>
          <lib:firstName>Joseph</lib:firstName>
          <lib:surname>Conrad</lib:surname>
     </rdf:Description>
          
     <rdf:Bag ID="RDbooks">
          <rdf:_1 resource="Matilda"/>
          <rdf:_2 resource="The BFG"/>
     </rdf:Bag>

     <rdf:Bag ID="JCbooks">
          <rdf:li resource="Heart of Darkness"/>
          <rdf:li resource="Lord Jim"/>
          <rdf:li resource="The Secret Agent"/>
     </rdf:Bag>          

                    
</rdf:RDF>

Output Top

Roald Dahl wrote :
Matilda
The BFG

Joseph Conrad wrote :
Heart of Darkness
Lord Jim
The Secret Agent