RDFの主要要素
RDFの主要(main)要素は <RDF>およびあるリソースを表現(represent)する<Description>要素です。
<rdf:RDF>要素
<rdf:RDF>は RDF文書(document)のルート(root)要素(element)です。これは XML文書(document)を RDF文書として定義(defines)し、RDFの名前空間(namespace)の参照(reference)も含(includes)んでいます:
<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> . . 説明(description)をここに記入(enter)してください。 . </rdf:RDF>
<rdf:Description>要素
<rdf:Description>要素は、about属性(attribute)を通じてリソースを識別(identify)することができます。
<rdf:Description>要素は、リソース(resource)を説明(describe)する要素を含(include)むことができます:
<?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>
artist、country、company、price そして year これらの要素は、http://www.recshop.fake/cd# という名前空間で定義(defined)されています。この名前空間は RDF(Resource Description Framework)の外に位置(located)しており、RDFの一部(component)ではありません。RDFはこのフレームワーク(framework)のみを定義(defines)しており、artist、country、company、price そして year これらの要素は他の者(company、organization、individualなど)によって定義(defined)される必要があります。
属性(property)を定義(define)するために使用(use)されます。
属性要素(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)もリソース(resources)として定義できます:
上記の例では、属性 artist には値がありませんが、情報を持つリソースを参照しています。
<?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>