新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   >>中国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)/描述逻辑/本体 』 → [分享]在Sesame中使用构成查询的简单规则 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 11867 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: [分享]在Sesame中使用构成查询的简单规则 举报  打印  推荐  IE收藏夹 
       本主题类别: RDF/RDFS    
     Humphrey 帅哥哟,离线,有人找我吗?狮子座1981-7-23
      
      
      威望:1
      等级:研二(搞定了DL,再搞定F-Logic!)
      文章:937
      积分:5743
      门派:W3CHINA.ORG
      注册:2008/3/12

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给Humphrey发送一个短消息 把Humphrey加入好友 查看Humphrey的个人资料 搜索Humphrey在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看Humphrey的博客楼主
    发贴心情 [分享]在Sesame中使用构成查询的简单规则

    Simple rules using construct queries in Sesame
    作者:Jeen Broekstra 2009-10-8
    A while ago I put together a simple rule-based reasoner for Sesame 2 (available in Aduna's Sesame extension SVN). The idea was to have a configurable rule-based reasoner that would reuse Sesame's query engine (in combination with SeRQL/SPARQL CONSTRUCT queries) to perform simple customized entailment.

    The idea is fairly simple: the reasoner works as a stacked SAIL in Sesame's repository configuration (the SAIL is a Sesame internal api that wraps the physical data storage medium). Rules are defined in an RDF format that reuses SeRQL syntax for defining graph patterns. By adding these rules to the Sesame repository the reasoner picks up on them, creates actual SeRQL CONSTRUCT queries out of these rules and then uses Sesame's own query engine to execute the rules, adding the rule result back into the repository.

    For example, a rule defining that an uncle of some person P is the brother of one of the parents of P would look like this (using Turtle syntax):

    ex:defUncle a custom:Rule;
       rdfs:comment "my parent's brother is my uncle";
       custom:head "{X} ex:uncleOf {Y}";
       custom:body "{X} ex:brotherOf {} ex:parentOf {Y}" .
    The reasoner would translate this to the following SeRQL query:
    CONSTRUCT {X} ex:uncleOf {Y}
    FROM {X} ex:brotherOf {} ex:parentOf {Y}
    For those of you not familiar with SeRQL, the SPARQL equivalent would look like this:
    CONSTRUCT {?X ex:uncleOf ?Y }
    WHERE {?X ex:brotherOf ?Z.  ?Z  ex:parentOf  ?Y. }
    I've recently returned to this reasoner, for use in the Tiffany project. In this project, we are developing a Research Management System for researchers in the food industry, and one core concept in this system is a hierarchy of Research Questions and associated activities. Each activity is used by at least one team, and we need to keep a number of things up to date. For example, if a Research Question has an associated activity that is used by team X, the research question itself should also be marked as "used by team X". Moreover, if a research question A has a subquestion B, and that subquestion is used by team X, then research question A should also be marked 'used by team X'.
    Previously we tried to support this from code, by explicitly calculating and asserting RDF triples for the 'isUsedBy' relation whenever an activity is linked to (or unlinked from) a research question, or whenever the research question hierarchy is changed. However, the seemingly simple rules for entailment of isUsedBy quickly become devilishly complex when implemented in an imperative fashion. The function that deals with this is well over 100 lines of code. Now, compare that to the rule-based approach:

    tifrule:activityUsedBy a custom:Rule ;
        custom:body "{X} tifn:activity {Y} tifn:isUsedBy {T} " ;
        custom:head "{X} tifn:isUsedBy {T} " .
    tifrule:inheritanceUsedBy a custom:Rule ;
        custom:body "{X} rdf:type {tifn:ResearchQuestion} ;
                         tifn:isUsedBy {T} ,
                 {Y} tifn:hasSubQuestion {X} " ;
        custom:head "{Y} tifn:isUsedBy {T} "
    Simple. And from some early tests I ran, remarkably good performance too.
    Next steps are to investigate how the performance of the approach holds up when I add more rules, and when I start doing many updates on the repository (after all, it's nice if querying is quick, but we also expect users to add new data or update existing information, and that requires that we do not have a large performance penalty for updates).


       收藏   分享  
    顶(0)
      




    ----------------------------------------------
    鸿丰

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

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

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    1,703.125ms