(CC/PP)结构和词汇 1.0[7]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 ljp19820721 的 blog

相应的xml:

图 2-3b:使用默认的cc/pp设置文件的xml表达
device profile referencing defaults:
<?xml version="1.0"?>
<rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:ccpp="http://www.w3.org/2002/11/08-ccpp-schema#"
         xmlns:ex="http://www.example.com/schema#">

  <rdf:description
      rdf:about="http://www.example.com/profile#myprofile">

    <ccpp:component>
      <rdf:description
          rdf:about="http://www.example.com/profile#terminalhardware">
        <rdf:type
            rdf:resource="http://www.example.com/schema#hardwareplatform" />
        <ccpp:defaults
            rdf:resource="http://www.example.com/hardwareprofile#hwdefault" />
      </rdf:description>
    </ccpp:component>

    <ccpp:component>
      <rdf:description
          rdf:about="http://www.example.com/profile#terminalsoftware">
        <rdf:type
            rdf:resource="http://www.example.com/schema#softwareplatform" />
        <ccpp:defaults
            rdf:resource="http://www.example.com/softwareprofile#swdefault" />
      </rdf:description>
    </ccpp:component>

    <ccpp:component>
      <rdf:description
          rdf:about="http://www.example.com/profile#terminalbrowser">
        <rdf:type
            rdf:resource="http://www.example.com/schema#browserua" />
        <ccpp:defaults
            rdf:resource="http://www.example.com/terminalprofile#uadefault" />
      </rdf:description>
    </ccpp:component>

  </rdf:description>
</rdf:rdf>
defaults for hardwareplatform:
<?xml version="1.0"?>
<rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:ex="http://www.example.com/schema#">
  <rdf:description
      rdf:about="http://www.example.com/hardwareprofile#hwdefault">
    <rdf:type
        rdf:resource="http://www.example.com/schema#hardwareplatform" />
    <ex:displaywidth>320</ex:displaywidth>
    <ex:displayheight>200</ex:displayheight>
  </rdf:description>
</rdf:rdf>
defaults for softwareplatform:
<?xml version="1.0"?>
<rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:ex="http://www.example.com/schema#">
  <rdf:description
      rdf:about="http://www.example.com/softwareprofile#swdefault">
    <rdf:type
        rdf:resource="http://www.example.com/schema#softwareplatform" />
    <ex:name>epoc</ex:name>
    <ex:version>2.0</ex:version>
    <ex:vendor>symbian</ex:vendor>
  </rdf:description>
</rdf:rdf>
defaults for browserua:
<?xml version="1.0"?>
<rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:ex="http://www.example.com/schema#">
  <rdf:description
      rdf:about="http://www.example.com/terminalprofile#uadefault">
    <rdf:type
        rdf:resource="http://www.example.com/schema#browserua" />
    <ex:name>mozilla</ex:name>
    <ex:version>5.0</ex:version>
    <ex:vendor>symbian</ex:vendor>
    <ex:htmlversionssupported>
      <rdf:bag>
        <rdf:li>3.2</rdf:li>
        <rdf:li>4.0</rdf:li>
      </rdf:bag>
    </ex:htmlversionssupported>
  </rdf:description>
</rdf:rdf>

如果一个给出的属性值直接被赋值给一个组件资源,但同时也在ccpp:defaults所引用的资源中出现,直接的赋值有优先:

图 2-4a:重载一个默认值
[ex:myprofile]
 |
 +--ccpp:component--> [ex:terminalhardware]
                       |
                       +--rdf:type--------> [ex:hardwareplatform]
                       +--ccpp:defaults---> [ex:hwdefault]
                       +--ex:memorymb-------> "32"

[ex:hwdefault]
 |
 +--rdf:type----> [ex:hardwareplatform]
 +--ex:displaywidth--> "320"
 +--ex:displayheight--> "200"
 +--ex:memorymb---> "16"

在这个例子中,默认组件指出有16mb的内存,但是这个值被直接赋值给设置文件组件的memorymb参数重载掉了。因而,在这设置文件中memorymb属性的值是32。

相应的xml:

图 2-4b:重载一个默认值的xml
device profile referencing defaults:
<?xml version="1.0"?>
<rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:ccpp="http://www.w3.org/2002/11/08-ccpp-schema#"
         xmlns:ex="http://www.example.com/schema#">

  <rdf:description
      rdf:about="http://www.example.com/profile#myprofile">

    <ccpp:component>
      <rdf:description
          rdf:about="http://www.example.com/profile#terminalhardware">
        <rdf:type
            rdf:resource="http://www.example.com/schema#hardwareplatform" />
        <ccpp:defaults
            rdf:resource="http://www.example.com/hardwareprofile#hwdefault" />
        <ex:memorymb>32</ex:memorymb>
      </rdf:description>
    </ccpp:component>

  </rdf:description>
</rdf:rdf>
defaults for hardwareplatform:
<?xml version="1.0"?>
<rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:ex="http://www.example.com/schema#">
  <rdf:description
      rdf:about="http://www.example.com/hardwareprofile#hwdefault">
    <rdf:type
        rdf:resource="http://www.example.com/schema#hardwareplatform" />
    <ex:displaywidth>320</ex:displaywidth>
    <ex:displayheight>200</ex:displayheight>
    <ex:memorymb>16</ex:memorymb>
  </rdf:description>
</rdf:rdf>

一个默认参数所指出的资源可能出现在不同的文档中,所以对默认资源应该给出一个直接uri引用。在这种情况下,可以用默认资源标识符的uri部分(不包括碎片标识符部分)来检索包含默认资源描述的rdf文档。因而,如果一个默认资源被称为http://example.com/deviceprofile#hardwareplatform,uri http://example.com/deviceprofile是用来检索rdf文档,这个文档中局部标识符为#hardwareplatform的某一资源将被作为默认值使用。(这样的资源可以在目标文档中使用"about='http://example.com/deviceprofile#hardwareplatform'"或"id='hardwareplatform'"来定义。参见3.5.节)

注意: 个别应用可能允许使用相对uris,不过这些应用需要明确指明如何能正确地找到相应的rdf文档。

2.2 可扩展性和命名空间

cc/pp主要是通过引入新的属性词汇来得到扩展的。

任何使用cc/pp的应用或操作环境都可能会定义它自己的词汇,但是如果定义的词汇能被更普遍的使用,那么就可以实现更广泛的互用性;例如,成像装置,或语音信息装置,或无线存取装置的标准可扩展词汇,等等。因此,本规范标准对可适用到打印和显示代理的特性定义了的一个小的核心词汇表,在可能的情况下强烈推荐使用这些词汇。这个核心词汇是基于ietf规范rfc2534[rfc2534],作为一个例子来说明cc/pp属性词汇该被如何定义。另外一个这样的例子是wap forum uapro规范标准[uaprof]

任何的cc/pp表达式可以使用不同的词汇表中的术语,因而并没有限定要再使用现有的词汇表中的术语而不能为同样信息定义一个新的名字。每个词汇都与一个xml命名空间对应,用于描写那些潜在的rdf和cc/pp结构的名称也是如此。

为了方便地关联名字表单与任意的uri,xml命名空间[xmlnamespaces]定义了相应的符号。虽然rdf图表语法并没有特别指定要使用命名空间,但是rdf图表的xml编序却有这样的指定。在如上所述使用图表符号表现rdf的时候,我们同样使用了命名空间前缀。

cc/pp构架使用xml命名空间机制来为rdf核心元素、cc/pp结构元素和cc/pp属性词汇创造用于识别的uri。考虑一下以下的关于命名空间声明的例子:

图 2-7:命名空间声明的例子
<?xml version="1.0"?>
<rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:ccpp="http://www.w3.org/2002/11/08-ccpp-schema#"
     xmlns:prf="http://www.wapforum.org/profiles/uaprof/ccppschema-20010430#">

本文关键:(CC/PP)结构和词汇 1.0
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top