ZVON > Tutorials > RDF Tutorial

Contents

 Example 1  rdf:Description is a container for informations about a resource identified by the about attribute. In this case each resource is a book, its identification (URI) is its name. Each book has an author and the specified number of pages.
 Example 2  The same information as in example 1 could be given in this way, if default namespace syntax is used for RDF element.
 Example 3  In RDF elements inside Description element and attributes of Description element with the same name as these elements are equivalent. This example is therefore equivalent in RDF terms with example 1 and example 2.
 Example 4  This example shows a permited combination according to example 1 and example 3. It still express the same information as the previous examples.
 Example 5  Atribute rdf:resource can be used to insert informations about a resource defined by other rdf:Description element.
 Example 6  You can use rdf:Description directly in other rdf:Description elements. This example is equivalent with example 5
 Example 7  This example rewrites example 6 using abbreviated syntax.
 Example 8  The element rdf:type specifies that given rdf:Description element conforms to some specified definition. In our case there are definitions of the element Author, with two children, firstName and surname and of the element Book.
 Example 9  The rdf:type in example 8 can be abbreviated in the following way: the rdf:Description tag is substituted by the element with the same name as the one in the equivalent rdf:type attribute.
 Example 10  In this example the syntaxes of example 8 and example 9 are combined.
 Example 11  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.
 Example 12  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.
 Example 13  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
 Example 14  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.
 Example 15  In the previous example 14 we said that the author wrote a collection of given books. We did not speak about individual books only about the collection. In this example we want to say who is the author of each book. We will use aboutEach instead of about attribute.
 Example 16  The attribute aboutEachPrefix used in rdf:Description element creates a bag of all resources URI of which starts with given string.