新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   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等。
    [返回] 计算机科学论坛W3CHINA.ORG讨论区 - Web新技术讨论『 Semantic Web(语义Web)/描述逻辑/本体 』 → [求助]Jena如何抓出SubClass 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 3709 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: [求助]Jena如何抓出SubClass 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     j08102728 帅哥哟,离线,有人找我吗?
      
      
      等级:大二(研究C++)
      文章:40
      积分:259
      门派:XML.ORG.CN
      注册:2007/8/8

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给j08102728发送一个短消息 把j08102728加入好友 查看j08102728的个人资料 搜索j08102728在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看j08102728的博客楼主
    发贴心情 [求助]Jena如何抓出SubClass

    請問各位大大:
    檔案讀入後,
    FileInputStream file=new FileInputStream("ontologytree.owl");
          InputStreamReader is=new InputStreamReader(file);
           Model model=ModelFactory.createDefaultModel();
           model.read(is,null);
          
    接下如何抓出某個"a"的subclass??

       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/11/9 20:41:00
     
     jpz6311whu 帅哥哟,离线,有人找我吗?
      
      
      
      威望:9
      等级:研三(收到微软亚洲研究院的Offer了)(版主)
      文章:1718
      积分:10610
      门派:W3CHINA.ORG
      注册:2005/4/12

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给jpz6311whu发送一个短消息 把jpz6311whu加入好友 查看jpz6311whu的个人资料 搜索jpz6311whu在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看jpz6311whu的博客2
    发贴心情 
    getSubClass
    OntClass getSubClass()Answer a class that is the sub-class of this class. If there is more than one such class, an arbitrary selection is made. If there is no such class, return null.


    Returns:
    A sub-class of this class or null
    Throws:
    OntProfileException - If the Profile.SUB_CLASS_OF() property is not supported in the current language profile.

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

    listSubClasses
    ExtendedIterator listSubClasses()Answer an iterator over all of the classes that are declared to be sub-classes of this class. Each element of the iterator will be an OntClass.


    Returns:
    An iterator over the sub-classes of this class.
    Throws:
    OntProfileException - If the Profile.SUB_CLASS_OF() property is not supported in the current language profile.

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

    listSubClasses
    ExtendedIterator listSubClasses(boolean direct)Answer an iterator over the classes that are declared to be sub-classes of this class. Each element of the iterator will be an OntClass. The distinguishing extra parameter for this method is the flag direct that allows some selectivity over the classes that appear in the iterator. Consider the following scenario:

       :B rdfs:subClassOf :A.
       :C rdfs:subClassOf :A.
       :D rdfs:subClassof :C.
    (so A has two sub-classes, B and C, and C has sub-class D). In a raw model, with no inference support, listing the sub-classes of A will answer B and C. In an inferencing model, rdfs:subClassOf is known to be transitive, so the sub-classes iterator will include D. The direct sub-classes are those members of the closure of the subClassOf relation, restricted to classes that cannot be reached by a longer route, i.e. the ones that are directly adjacent to the given root. Thus, the direct sub-classes of A are B and C only, and not D - even in an inferencing graph. Note that this is not the same as the entailments from the raw graph. Suppose we add to this example:
       :D rdfs:subClassof :A.
    Now, in the raw graph, A has sub-class C. But the direct sub-classes of A remain B and C, since there is a longer path A-C-D that means that D is not a direct sub-class of A. The assertion in the raw graph that A has sub-class D is essentially redundant, since this can be inferred from the closure of the graph.

    Note: This is is a change from the behaviour of Jena 1, which took a parameter closed to compute the closure over transitivity and equivalence of sub-classes. The closure capability in Jena2 is determined by the inference engine that is wrapped with the ontology model. The direct parameter is provided to allow, for exmaple, a level-by-level traversal of the class hierarchy, starting at some given root. Observe that in Jena 1, passing true will tend to increase the number of results returned; in Jena 2 passing true will tend to reduce the number of results.


    Parameters:
    direct - If true, only answer the direcly adjacent classes in the sub-class relation: i.e. eliminate any class for which there is a longer route to reach that child under the sub-class relation.
    Returns:
    an iterator over the resources representing this class's sub-classes
    Throws:
    OntProfileException - If the Profile.SUB_CLASS_OF() property is not supported in the current language profile.

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/11/9 21:55:00
     
     j08102728 帅哥哟,离线,有人找我吗?
      
      
      等级:大二(研究C++)
      文章:40
      积分:259
      门派:XML.ORG.CN
      注册:2007/8/8

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给j08102728发送一个短消息 把j08102728加入好友 查看j08102728的个人资料 搜索j08102728在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看j08102728的博客3
    发贴心情 
    謝謝大大,但大大不好意思!!
    可以寫個範例看一下怎麼用??
    因為剛剛查API,不知道怎麼接收"a"這個值
    然後接收後再去抓這個值的subclass
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/11/9 22:44:00
     
     jpz6311whu 帅哥哟,离线,有人找我吗?
      
      
      
      威望:9
      等级:研三(收到微软亚洲研究院的Offer了)(版主)
      文章:1718
      积分:10610
      门派:W3CHINA.ORG
      注册:2005/4/12

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给jpz6311whu发送一个短消息 把jpz6311whu加入好友 查看jpz6311whu的个人资料 搜索jpz6311whu在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看jpz6311whu的博客4
    发贴心情 
    Thus, in our example ontology, we can print a list the subclasses of Camera as follows:

    OntClass camera = m.getOntClass( camNS + "Camera" );
    for (Iterator i = camera.listSubClasses(); i.hasNext(); ) {
      OntClass c = (OntClass) i.next();
      System.out.print( c.getLocalName() + " " );
    }

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/11/9 23:50:00
     
     j08102728 帅哥哟,离线,有人找我吗?
      
      
      等级:大二(研究C++)
      文章:40
      积分:259
      门派:XML.ORG.CN
      注册:2007/8/8

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给j08102728发送一个短消息 把j08102728加入好友 查看j08102728的个人资料 搜索j08102728在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看j08102728的博客5
    发贴心情 
    感謝大大!!已解決
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/11/10 15:48:00
     
     cooperator 帅哥哟,离线,有人找我吗?
      
      
      等级:大二期末(Java考了96分!)
      文章:61
      积分:400
      门派:XML.ORG.CN
      注册:2007/5/4

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给cooperator发送一个短消息 把cooperator加入好友 查看cooperator的个人资料 搜索cooperator在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看cooperator的博客6
    发贴心情 
    好,学习ing
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/11/13 11:18:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2025/10/10 12:42:18

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

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