<rdf:RDF> 是 RDF 文档的根元素。它把 XML 文档定义为一个 RDF 文档。它也包含了对 RDF 命名空间的引用:
<?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> 元素可通过 about 属性标识一个资源。
<rdf:Description> 元素可包含描述资源的那些元素:
<?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> |
属性元素(property elements)也可作为属性(attributes)来被定义(取代元素):
<?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> |
属性元素(property elements)也可作为属性(attributes)来被定义(取代元素):
<?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> |