RDF元素

<rdf:RDF> 元素
<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> 元素
<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>


artist、country、company、price 以及 year 这些元素被定义在命名空间 http://www.recshop.fake/cd# 中。此命名空间在 RDF 之外(并非 RDF 的组成部分)。RDF 仅仅定义了这个框架。而 artist、country、company、price 以及 year 这些元素必须被其他人(公司、组织或个人等)进行定义。
属性(property)来定义属性(attribute)
属性元素(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>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值