next up previous
Next: Containers Up: XML syntax Previous: XML syntax

Descriptions

An RDF document is a list of descriptions. Each description applies usually to one resource, and contains a list of properties. Property values are either URIs, literals or others Descriptions.

In XML, RDF meta-data are embedded in an element named rdf:RDF. This element contains a sequence of elements named rdf:Description. Those elements can have one of the two attributes rdf:about or rdf:ID (but not both).

An element rdf:Description contains a sequence of XML elements. Those elements are interpreted as properties, whose predicate's URI is the expanded name of the element. If the element is empty, it must have an attribute rdf:resource whose value is the object's URI (see $1^{st}$ dc:Creator in fig.3). Else, it can contain plain text (then interpreted as a literal - see dc:Title in fig.3) or a single embedded rdf:Description element (see $2^{nd}$ dc:Creator in fig.3).

Figure 3: XML syntax simple example
<?xml version="1.0" encoding="UTF-8" ?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:dc="http://purl.org/DC/"
         xmlns:os="http://somesite.org/Schema/">
  <rdf:Description about="http://rama.cpe.fr/index.html">
    <dc:Creator rdf:resource="mailto:am@cpe.fr"/>
    <dc:Title> Index of my web site </dc:Title>
    <dc:Creator>
      <rdf:Description about="mailto:champin@cpe.fr">
        <os:worksWith rdf:resource="mailto:am@cpe.fr"/>
      </rdf:Description>
    </dc:Creator>
  </rdf:Description>
</rdf:RDF>
\includegraphics[width=12cm]{img/xml_simple.ps}

In case of ambiguity, the attribute rdf:parseType can be used in property elements with "Resource" or "Literal" value. The later can be used when a literal contains XML tags, to prevent their being parsed as a description.

The syntax may also be abbreviated in two ways:

For example, the following description:

  <rdf:Descritpion ID="fatherOf">
    <rdf:type rdf:resource=
       "http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
    <rdf:label> father of </rdf:label>
    <rdfs:subPropertyOf rdf:resource="#parentOf">
  </rdf:Descritpion>
may be abbreviated into
  <rdf:Property ID="fatherOf" rdfs:label="father of">
    <rdfs:subPropertyOf rdf:resource="#parentOf">
  </rdf:Descritpion>


next up previous
Next: Containers Up: XML syntax Previous: XML syntax
Pierre-Antoine CHAMPIN 2001-04-05