新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   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)/描述逻辑/本体 』 → [讨论] 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 10915 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: [讨论] 举报  打印  推荐  IE收藏夹 
       本主题类别: Ontology Engineering    
     smiles 帅哥哟,离线,有人找我吗?
      
      
      等级:大一(高数修炼中)
      文章:18
      积分:126
      门派:XML.ORG.CN
      注册:2009/3/6

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给smiles发送一个短消息 把smiles加入好友 查看smiles的个人资料 搜索smiles在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看smiles的博客11
    发贴心情 谢谢你的回答

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

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给jpz6311whu发送一个短消息 把jpz6311whu加入好友 查看jpz6311whu的个人资料 搜索jpz6311whu在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看jpz6311whu的博客12
    发贴心情 
    http://jena.sourceforge.net/ontology/index.html
    这里有详细介绍:

    Managing file references
    An advantage of working with ontologies is that we can reuse work done by other ontologists, by importing their published ontologies into our own. Sometimes, however, this means that there is an Internet firewall between the ontology-based application and the source of an imported ontology. Even if it's possible to traverse the firewall through an HTTP proxy, retrieving files from an HTTP connection may impose unacceptable delays when starting an application. In the worst case, we may find that ontology on which our application depends is temporarily or permanently unavailable from the original published URL. To alleviate these commonly experienced problems, you can use the ontology document manager to set up a a local indirection, so that an attempt to import a document from a given published URL means that a local copy of the document is retrieved instead. This may be a file copy, or simply a pointer to a local mirror web site.

    To specify this local redirection in the policy file, use the following declarations:

    <OntologySpec>
      <publicURI rdf:resource="… the public URI to map from…"    />
      <altURL rdf:resource="… the local URL to map to …" />
      <!-- optional ontology language term -->
      <language rdf:resource="… encoding used …" />
      <!-- optional prefix to associate with the public URL -->
      <prefix rdf:datatype="&xsd;string">a prefix</prefix>
    </OntologySpec>
    For example:

    <OntologySpec>
      <!-- local version of the RDFS vocabulary -->
      <publicURI rdf:resource="http://www.w3.org/2000/01/rdf-schema"    />
      <altURL rdf:resource="file:vocabularies/rdf-schema.rdf" />
    </OntologySpec>
    This specifies that an attempt to load the RDFS vocabulary from http://www.w3.org/2000/01/rdf-schema will transparently cause file:vocabularies/rdf-schema.rdf to be fetched instead. You can specify any number of such re-directions in the policy file, or you can add them to the document manager object directly by calling the various setter methods (see the Javadoc for details). As a side-effect, this mechanism also means that ontologies may be named with any legal URI (not necessarily resolvable) - so long as the altURL is itself resolvable.

    Note that the OntDocumentManager is an application of Jena's File Manager. See the notes on FileManager for details of additional options.

    In the following example, I programmatically declare that the ESWC ontology is replicated locally on disk, and then I load it using the public URL. Assume that the constant JENA has been initialised to the directory in which Jena was installed.

    OntModel m = ModelFactory.createOntologyModel();
      OntDocumentManager dm = m.getDocumentManager();
      dm.addAltEntry( "http://www.eswc2006.org/technologies/ontology",
                      "file:" + JENA + "src-examples/data/eswc-2006-09-21.rdf"    );
      m.read( "http://www.eswc2006.org/technologies/ontology" );

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2009/4/7 19:51:00
     
     smiles 帅哥哟,离线,有人找我吗?
      
      
      等级:大一(高数修炼中)
      文章:18
      积分:126
      门派:XML.ORG.CN
      注册:2009/3/6

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给smiles发送一个短消息 把smiles加入好友 查看smiles的个人资料 搜索smiles在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看smiles的博客13
    发贴心情 感激不尽
    谢谢你!
    好好看看。不懂再请教你
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2009/4/7 22:04:00
     
     smiles 帅哥哟,离线,有人找我吗?
      
      
      等级:大一(高数修炼中)
      文章:18
      积分:126
      门派:XML.ORG.CN
      注册:2009/3/6

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给smiles发送一个短消息 把smiles加入好友 查看smiles的个人资料 搜索smiles在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看smiles的博客14
    发贴心情 请有空的高手帮忙
    程序如下:
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.util.Iterator;
    import com.hp.hpl.jena.ontology.OntClass;
    import com.hp.hpl.jena.ontology.OntModel;
    import com.hp.hpl.jena.ontology.OntModelSpec;
    import com.hp.hpl.jena.rdf.model.ModelFactory;
    import com.hp.hpl.jena.ontology.*;

    public class ReadOWL {
     public static void main(String[] args) {
      
      // create the model and import owl file
      OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
      try {
       model.read(new FileInputStream("D:/owlreal.owl"), "");
      } catch (IOException ioe) {
       System.err.println(ioe.toString());
      }
     // System.out.println("ok");
          
        for (Iterator<?> i = model.listClasses(); i.hasNext();)

         {
       
           OntClass c = (OntClass) i.next();
         
       String strClass = c.getModel().getGraph().getPrefixMapping()
         .shortForm(c.getURI());

       System.out.println( strClass);
       
       // to list sub-classes for each class
           for (Iterator<?> k = c.listSubClasses(true); k.hasNext();) {
        System.out.print("  " + "hasSubClass");
        OntClass subclass = (OntClass) k.next();
        String strSubClass = subclass.getModel().getNsURIPrefix(subclass.getURI());
        
        System.out.println(strSubClass);
       }
       // list property for each class
       for (Iterator<?> y = c.listDeclaredProperties(true); y.hasNext();) {
        OntProperty property = (OntProperty) y.next();
        String strPropertyName = property.getModel().getNsURIPrefix(
          property.getURI());
        String strRange = property.getRange().toString();
        String strRangeName = property.getModel().getNsURIPrefix(strRange);
        // show just the "has" Properties
        if (strPropertyName.substring(1).substring(0, 3).equals("has")) {
       //System.out.print("  ");
         System.out.print(strPropertyName);
         System.out.println(strRangeName);
         }
       }
         }
     }
    }
    OWL文件如下:
    <?xml version="1.0" encoding="GBK"?>
    <rdf:RDF
        xmlns:process="http://www.daml.org/services/owl-s/1.1/Process.owl#"
        xmlns:service="http://www.daml.org/services/owl-s/1.1/Service.owl#"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:profile="http://www.daml.org/services/owl-s/1.1/Profile.owl#"
        xmlns:grounding="http://www.daml.org/services/owl-s/1.1/Grounding.owl#"
        xmlns:daml="http://www.daml.org/2001/03/daml+oil#"
        xmlns:expression="http://www.daml.org/services/owl-s/1.1/generic/Expression.owl#"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:list="http://www.daml.org/services/owl-s/1.1/generic/ObjectList.owl#"
        xmlns:owl="http://www.w3.org/2002/07/owl#"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
        xmlns:swrl="http://www.w3.org/2003/11/swrl#"
        xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
      <service:Service rdf:about="file:/D:/WorkSpace/CreateOWL-SFile/ontologyFiles/jiaxidianli1.owl#PayloadService">
        <service:describedBy>
          <process:CompositeProcess rdf:about="file:/D:/WorkSpace/CreateOWL-SFile/ontologyFiles/jiaxidianli1.owl#PayloadProcess"/>
        </service:describedBy>
        <service:supports>
          <grounding:WsdlGrounding rdf:about="file:/D:/WorkSpace/CreateOWL-SFile/ontologyFiles/jiaxidianli1.owl#PayloadGrounding"/>
        </service:supports>
        <service:presents>
          <profile:Profile rdf:about="file:/D:/WorkSpace/CreateOWL-SFile/ontologyFiles/jiaxidianli1.owl#PayloadProfile"/>
        </service:presents>
      </service:Service>
      <profile:Profile rdf:about="file:/D:/WorkSpace/CreateOWL-SFile/ontologyFiles/jiaxidianli1.owl#PayloadProfile">
        <profile:hasInput>
          <process:Input rdf:about="file:/D:/WorkSpace/CreateOWL-SFile/ontologyFiles/jiaxidianli1.owl#平均负荷"/>
        </profile:hasInput>
        <profile:hasOutput>
          <process:Output rdf:about="file:/D:/WorkSpace/CreateOWL-SFile/ontologyFiles/jiaxidianli1.owl#负荷预警信息"/>
        </profile:hasOutput>
        <rdfs:label>Composite Service</rdfs:label>
        <profile:hasInput>
          <process:Input rdf:about="file:/D:/WorkSpace/CreateOWL-SFile/ontologyFiles/jiaxidianli1.owl#最低负荷"/>
        </profile:hasInput>
        <profile:hasInput>
          <process:Input rdf:about="file:/D:/WorkSpace/CreateOWL-SFile/ontologyFiles/jiaxidianli1.owl#最高负荷"/>
        </profile:hasInput>
        <service:presentedBy rdf:resource="file:/D:/WorkSpace/CreateOWL-SFile/ontologyFiles/jiaxidianli1.owl#PayloadService"/>
        <profile:textDescription>Composite Service</profile:textDescription>
      </profile:Profile>
      <process:CompositeProcess rdf:about="file:/D:/WorkSpace/CreateOWL-SFile/ontologyFiles/jiaxidianli1.owl#PayloadProcess">
        <process:hasResult>
          <process:Result/>
        </process:hasResult>
        <service:describes rdf:resource="file:/D:/WorkSpace/CreateOWL-SFile/ontologyFiles/jiaxidianli1.owl#PayloadService"/>
        <process:hasInput rdf:resource="file:/D:/WorkSpace/CreateOWL-SFile/ontologyFiles/jiaxidianli1.owl#最高负荷"/>
        <process:hasInput rdf:resource="file:/D:/WorkSpace/CreateOWL-SFile/ontologyFiles/jiaxidianli1.owl#最低负荷"/>
        <process:composedOf>
          <process:Sequence>
            <process:components>
              <process:ControlConstructList>
                <list:rest rdf:resource="http://www.daml.org/services/owl-s/1.1/generic/ObjectList.owl#nil"/>
                <list:first>
                  <process:Perform>
                    <process:process rdf:resource="file:/D:/WorkSpace/CreateOWL-SFile/ontologyFiles/jiaxidianli1.owl#PayloadProcess"/>
                  </process:Perform>
                </list:first>
              </process:ControlConstructList>
            </process:components>
          </process:Sequence>
        </process:composedOf>
        <process:hasInput rdf:resource="file:/D:/WorkSpace/CreateOWL-SFile/ontologyFiles/jiaxidianli1.owl#平均负荷"/>
        <process:hasOutput rdf:resource="file:/D:/WorkSpace/CreateOWL-SFile/ontologyFiles/jiaxidianli1.owl#负荷预警信息"/>
      </process:CompositeProcess>
      <grounding:WsdlGrounding rdf:about="file:/D:/WorkSpace/CreateOWL-SFile/ontologyFiles/jiaxidianli1.owl#PayloadGrounding">
        <service:supportedBy rdf:resource="file:/D:/WorkSpace/CreateOWL-SFile/ontologyFiles/jiaxidianli1.owl#PayloadService"/>
      </grounding:WsdlGrounding>
    </rdf:RDF>
    为什么解析不出来呢?

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

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给jpz6311whu发送一个短消息 把jpz6311whu加入好友 查看jpz6311whu的个人资料 搜索jpz6311whu在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看jpz6311whu的博客15
    发贴心情 
    代码好乱啊,楼主能整理一下下么,嘿嘿
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2009/4/9 11:14:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/5/19 18:39:14

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

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