新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> 本版讨论Semantic Web(语义Web,语义网或语义万维网, Web 3.0)及相关理论,如:Ontology(本体,本体论), OWL(Web Ontology Langauge,Web本体语言), Description Logic(DL, 描述逻辑),RDFa,Ontology Engineering等。
    [返回] 中文XML论坛 - 专业的XML技术讨论区W3CHINA.ORG讨论区 - Web新技术讨论『 Semantic Web(语义Web)/描述逻辑/本体 』 → 用RDF表达时间(一) 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 12681 个阅读者浏览上一篇主题  刷新本主题   平板显示贴子 浏览下一篇主题
     * 贴子主题: 用RDF表达时间(一) 举报  打印  推荐  IE收藏夹 
       本主题类别: Ontology Language | RDF/RDFS    
     admin 帅哥哟,离线,有人找我吗?
      
      
      
      威望:9
      头衔:W3China站长
      等级:计算机硕士学位(管理员)
      文章:5255
      积分:18406
      门派:W3CHINA.ORG
      注册:2003/10/5

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给admin发送一个短消息 把admin加入好友 查看admin的个人资料 搜索admin在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 点击这里发送电邮给admin  访问admin的主页 引用回复这个贴子 回复这个贴子 查看admin的博客楼主
    发贴心情 用RDF表达时间(四)

    Representing Time in RDF Part 4

    Approach 3: Reified Relations

    In this approach I reify every triple that is time-dependent. That means every triple is split out into its constituent parts which will obviously lead to an explosion of triples.
    Scenario 1

    In this scenario I use thing:maria to refer to Maria, and I state the fact of her being a foaf:Person as a piece of timeless information. Facts about her name are reified and time interval information is attached. The URIs thing:mariaUnmarried and thing:mariaMarried represent the reified triples holding her name before and after marriage:

    @prefix bio: <http://purl.org/vocab/bio/0.1/> .
    @prefix foaf: <http://xmlns.com/foaf/0.1/> .
    @prefix time: <http://www.w3.org/2006/time#> .
    @prefix ex: <http://example.org/ex#> .
    @prefix thing: <http://example.org/thing#> .

    thing:maria a foaf:Person .

    thing:mariaUnmarried
      ex:subject thing:maria ;
      ex:property foaf:name ;
      ex:value "Maria Smith" ;
      time:start "1867" ;
      time:end "1888" .

    thing:mariaMarried
      ex:subject thing:maria ;
      ex:property foaf:name ;
      ex:value "Maria Johnson" ;
      time:start "1888" ;
      time:end "9999" .

    Original file: a3s1.ttl

    Facts about her name are reified using custom reification predicates, not the standard RDF ones. I do this to allow more flexibility in the use of these predicates without requiring that their subject is always an RDF statement. Potentially I could have multiple occurrences of ex:subject, ex:property or ex:value which would allow more compact descriptions to be created. For example I could have a description where multiple objects are included for the same predicate and subject.

    The query in this case is straighforward and quite similar to the query for Approach 1.

    prefix bio: <http://purl.org/vocab/bio/0.1/>
    prefix foaf: <http://xmlns.com/foaf/0.1/>
    prefix time: <http://www.w3.org/2006/time#>
    prefix xsd:  <http://www.w3.org/2001/XMLSchema#>
    prefix ex: <http://example.org/ex#>
    prefix thing: <http://example.org/thing#>

    select ?name where {
      ?p ex:subject thing:maria .
      ?p ex:property foaf:name .
      ?p time:start ?start .
      ?p time:end ?end .
      ?p ex:value ?name .
      filter (xsd:integer(?start) <= 1891 && xsd:integer(?end) >= 1891) .
    }

    Original file: a3s1.sq

    I simply search for resources that represent reified triples that hold in 1891. Then I select the ex:value of the resulting resource.
    Scenario 2

    For simplicity I start of by treating the place name information as timeless, only reifying the information about relationships between the places:

    @prefix bio: <http://purl.org/vocab/bio/0.1/> .
    @prefix foaf: <http://xmlns.com/foaf/0.1/> .
    @prefix time: <http://www.w3.org/2006/time#> .
    @prefix ex: <http://example.org/ex#> .
    @prefix thing: <http://example.org/thing#> .

    thing:oxfordshire
      a ex:County ;
      foaf:name "Oxfordshire" .

    thing:gloucestershire
      a ex:County ;
      foaf:name "Gloucestershire" .

    thing:widford
      a ex:Parish ;
      foaf:name "Widford" .

    thing:widfordInGloucestershire
      ex:subject thing:widford ;
      ex:property ex:partOf ;
      ex:value thing:gloucestershire ;
      time:start "1837" ;
      time:end "1844" .

    thing:widfordInOxfordshire
      ex:subject thing:widford ;
      ex:property ex:partOf ;
      ex:value thing:oxfordshire ;
      time:start "1844" ;
      time:end "9999" .

    Original file: a3s2.ttl

    The query is again very simple and reminiscent of Approach 1:

    prefix bio: <http://purl.org/vocab/bio/0.1/>
    prefix foaf: <http://xmlns.com/foaf/0.1/>
    prefix time: <http://www.w3.org/2006/time#>
    prefix xsd:  <http://www.w3.org/2001/XMLSchema#>
    prefix ex: <http://example.org/ex#>
    prefix thing: <http://example.org/thing#>

    select ?name where {
      ?p ex:subject thing:widford .
      ?p ex:property ex:partOf .
      ?p time:start ?start .
      ?p time:end ?end .
      ?p ex:value ?x .
      ?x foaf:name ?name
      filter (xsd:integer(?start) <= 1841 && xsd:integer(?end) >= 1841) .
    }

    Original file: a3s2.sq

    However, a more realistic approach would be to model the names of the places as time-dependent triples which means reifying them. I introduce some new resources thing:widfordName, thing:oxfordshireName and thing:gloucestershireName to represent the reified forms of those triples. Now the data is much more verbose:

    @prefix bio: <http://purl.org/vocab/bio/0.1/> .
    @prefix foaf: <http://xmlns.com/foaf/0.1/> .
    @prefix time: <http://www.w3.org/2006/time#> .
    @prefix ex: <http://example.org/ex#> .
    @prefix thing: <http://example.org/thing#> .

    thing:oxfordshire a ex:County .

    thing:gloucestershire a ex:County .

    thing:widford a ex:Parish .

    thing:widfordInGloucestershire
      ex:subject thing:widford ;
      ex:property ex:partOf ;
      ex:value thing:gloucestershire ;
      time:start "1837" ;
      time:end "1844" .

    thing:widfordInOxfordshire
      ex:subject thing:widford ;
      ex:property ex:partOf ;
      ex:value thing:oxfordshire ;
      time:start "1844" ;
      time:end "9999" .

    thing:widfordName
      ex:subject thing:widford ;
      ex:property foaf:name ;
      ex:value "Widford" ;
      time:start "1837" ;
      time:end "9999" .

    thing:oxfordshireName
      ex:subject thing:oxfordshire ;
      ex:property foaf:name ;
      ex:value "Oxfordshire" ;
      time:start "1837" ;
      time:end "9999" .

    thing:gloucestershireName
      ex:subject thing:gloucestershire ;
      ex:property foaf:name ;
      ex:value "Gloucestershire" ;
      time:start "1837" ;
      time:end "9999" .

    Original file: a3s2a.ttl

    Also the query becomes more complex:

    prefix bio: <http://purl.org/vocab/bio/0.1/>
    prefix foaf: <http://xmlns.com/foaf/0.1/>
    prefix time: <http://www.w3.org/2006/time#>
    prefix xsd:  <http://www.w3.org/2001/XMLSchema#>
    prefix ex: <http://example.org/ex#>
    prefix thing: <http://example.org/thing#>

    select ?name where {
      ?p ex:subject thing:widford .
      ?p ex:property ex:partOf .
      ?p time:start ?start .
      ?p time:end ?end .
      ?p ex:value ?x .
      filter (xsd:integer(?start) <= 1841 && xsd:integer(?end) >= 1841) .

      ?p2 ex:subject ?x .
      ?p2 ex:property foaf:name .
      ?p2 time:start ?start2 .
      ?p2 time:end ?end2 .
      ?p2 ex:value ?name .
      filter (xsd:integer(?start2) <= 1841 && xsd:integer(?end2) >= 1841) .
    }

    Original file: a3s2a.sq

    Each triple being selected requires its time interval information to be specified sepearately which is reminiscent of Approach 2
    Scenario 3

    Once again for simplicity I keep the place name information timeless. I introduce new resources for the reified statements about the residence of the person over time:

    @prefix bio: <http://purl.org/vocab/bio/0.1/> .
    @prefix foaf: <http://xmlns.com/foaf/0.1/> .
    @prefix time: <http://www.w3.org/2006/time#> .
    @prefix ex: <http://example.org/ex#> .
    @prefix thing: <http://example.org/thing#> .

    thing:lymeRegis
      a ex:Town ;
      foaf:name "Lyme Regis" .

    thing:charmouth
      a ex:Town ;
      foaf:name "Charmouth" .

    thing:hastings
      a ex:Town ;
      foaf:name "Hastings" .

    thing:anon a foaf:Person .

    thing:anonInLymeRegis
      ex:subject thing:anon ;
      ex:property ex:residence ;
      ex:value thing:lymeRegis ;
      time:intervalBefore thing:anonInCharmouth ;
      time:intervalContains "1844" .

    thing:anonInCharmouth
      ex:subject thing:anon ;
      ex:property ex:residence ;
      ex:value thing:charmouth ;
      time:intervalAfter thing:anonInLymeRegis ;
      time:intervalBefore thing:anonInHastings ;
      time:intervalContains "1871" .

    thing:anonInHastings
      ex:subject thing:anon ;
      ex:property ex:residence ;
      ex:value thing:hastings ;
      time:intervalAfter thing:anonInCharmouth ;
      time:intervalContains "1881" .

    Original file: a3s3.ttl

    The query is straightforward although quite verbose. If the place name triples were also reified then this query would suddenly become much more complex:

    prefix bio: <http://purl.org/vocab/bio/0.1/>
    prefix foaf: <http://xmlns.com/foaf/0.1/>
    prefix time: <http://www.w3.org/2006/time#>
    prefix xsd:  <http://www.w3.org/2001/XMLSchema#>
    prefix ex: <http://example.org/ex#>
    prefix thing: <http://example.org/thing#>

    select ?nameBefore ?nameAfter where {
      ?pBefore ex:subject thing:anon .
      ?pBefore ex:property ex:residence .
      ?pBefore ex:value ?placeBefore .
      ?placeBefore foaf:name ?nameBefore .

      ?pBefore time:intervalContains ?dateBefore .
      filter (xsd:integer(?dateBefore) <= 1874) .

      ?pAfter ex:subject thing:anon .
      ?pAfter ex:property ex:residence .
      ?pAfter ex:value ?placeAfter .
      ?placeAfter foaf:name ?nameAfter .

      ?pAfter time:intervalContains ?dateAfter .
      filter (xsd:integer(?dateAfter) > 1874) .

      ?pBefore time:intervalBefore ?pAfter .
    }

    Original file: a3s3.sq
    Approach 3 Conclusions

    Approach 3 avoids the domain and range problem experienced by Approach 1 where the conditions were being used with properties whose domains were foaf:Agents. In Approach 3, properties are used with the appropriate resource types when they are timeless and never actually asserted when they are time-dependent. However, this approach is tedious for large quantities of data. The semantics are all locked away behind the reified triples. Once again I don’t know of any reasoners that could work with this kind of data.

    ----------------------------------------------

    -----------------------------------------------

    第十二章第一节《用ROR创建面向资源的服务》
    第十二章第二节《用Restlet创建面向资源的服务》
    第三章《REST式服务有什么不同》
    InfoQ SOA首席编辑胡键评《RESTful Web Services中文版》
    [InfoQ文章]解答有关REST的十点疑惑

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2009/8/11 9:40:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 点击这里发送电邮给Google AdSense  访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/6/29 7:46:03

    本主题贴数7,分页: [1]

     *树形目录 (最近20个回帖) 顶端 
    主题:  用RDF表达时间(一)(8581字) - admin,2009年8月11日
        回复:  嗬!够长。曾经大概地了解过几种程序设计语言对各种对象的处理方式,时间都是一个重要部分。一些语言甚至..(222字) - Humphrey,2009年8月12日
        回复:  用RDF表达时间(六)(2922字) - admin,2009年8月11日
        回复:  用RDF表达时间(五)(6263字) - admin,2009年8月11日
        回复:  用RDF表达时间(四)(9241字) - admin,2009年8月11日
        回复:  用RDF表达时间(三)(11373字) - admin,2009年8月11日
        回复:  用RDF表达时间(二)(8526字) - admin,2009年8月11日

    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    85.938ms