RDF 的主要元素是 <RDF> 以及可表示某个资源的 <Description> 元素。 < rdf:RDF > is the root element of the RDF document. It defines an XML document as an RDF document. It also contains references to the RDF namespace: The < rdf:Description > element identifies a resource by the about attribute. The < rdf:Description > element can contain those elements that describe the resource: The elements artist, country, company, price, and year are defined in the namespace http://www.recshop.fake /cd#. This namespace is outside of RDF (not part of RDF). RDF only defines this framework. The elements artist, country, company, price, and year must be defined by others (companies, organizations, individuals, etc.). Attribute elements (property elements) can also be defined as attributes (instead of elements) as attributes (attributes): Attribute elements (property elements) can also be defined as attributes (instead of elements) as attributes (attributes): In the above example, the attribute artist has no value, but references a resource that contains information about the artist.< rdf:RDF > element ¶
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
... *Description goes here...*
</rdf:RDF>
< rdf:Description > element ¶
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cd="http://www.recshop.fake/cd#">
<rdf:Description
rdf:about="http://www.recshop.fake/cd/Empire Burlesque">
<cd:artist>Bob Dylan</cd:artist>
<cd:country>USA</cd:country>
<cd:company>Columbia</cd:company>
<cd:price>10.90</cd:price>
<cd:year>1985</cd:year>
</rdf:Description>
</rdf:RDF>
Attribute (property) to define the attribute (attribute) ¶
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cd="http://www.recshop.fake/cd#">
<rdf:Description
rdf:about="http://www.recshop.fake/cd/Empire Burlesque"
cd:artist="Bob Dylan" cd:country="USA"
cd:company="Columbia" cd:price="10.90"
cd:year="1985" />
</rdf:RDF>
Attribute (property) to define the attribute (attribute) ¶
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cd="http://www.recshop.fake/cd#">
<rdf:Description
rdf:about="http://www.recshop.fake/cd/Empire Burlesque">
<cd:artist rdf:resource="http://www.recshop.fake/cd/dylan" />
...
...
</rdf:Description>
</rdf:RDF>