新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   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 api编的程序运行时需要连网? 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 5543 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: 为什么用jena api编的程序运行时需要连网? 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     xirufeng 美女呀,离线,快来找我吧!
      
      
      等级:大二期末(Java考了96分!)
      文章:77
      积分:322
      门派:XML.ORG.CN
      注册:2005/12/12

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给xirufeng发送一个短消息 把xirufeng加入好友 查看xirufeng的个人资料 搜索xirufeng在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看xirufeng的博客楼主
    发贴心情 为什么用jena api编的程序运行时需要连网?

    两个程序还有本体文件见附件



       收藏   分享  
    顶(0)
      




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

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给jpz6311whu发送一个短消息 把jpz6311whu加入好友 查看jpz6311whu的个人资料 搜索jpz6311whu在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看jpz6311whu的博客2
    发贴心情 
    jena本身是基于java的,当然C/S或B/S都可以啦
    你用的那个程序思路是java生成javascript的Dtree的API,最终还是要在Browser里面浏览才看得到的,如果只是在Console里面运行,最多输出的是javascript代码
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/12/29 12:13:00
     
     xirufeng 美女呀,离线,快来找我吧!
      
      
      等级:大二期末(Java考了96分!)
      文章:77
      积分:322
      门派:XML.ORG.CN
      注册:2005/12/12

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给xirufeng发送一个短消息 把xirufeng加入好友 查看xirufeng的个人资料 搜索xirufeng在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看xirufeng的博客3
    发贴心情 
    我不是这个意思
    你有空的话,看看我的程序
    没有涉及到什么树,我这两个程序只是从owl本体中抽取信息而已
    可是如果网络不通的话,会打印异常,说网络没连接上,好象是名字空间的问题。如果通的话,则不会
    但两者均会打印出要抽取的信息。
    还有一个问题,就是我所写的树的信息的数据结构只有四个域——接点ID,父接点ID,接点NAME,还有一个URI,但是下的DTree.js却有好多个域。那Dtree文件用改么
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/12/29 15:50:00
     
     jpz6311whu 帅哥哟,离线,有人找我吗?
      
      
      
      威望:9
      等级:研三(收到微软亚洲研究院的Offer了)(版主)
      文章:1718
      积分:10610
      门派:W3CHINA.ORG
      注册:2005/4/12

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给jpz6311whu发送一个短消息 把jpz6311whu加入好友 查看jpz6311whu的个人资料 搜索jpz6311whu在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看jpz6311whu的博客4
    发贴心情 
    你把报错的详细信息贴出来看看
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/12/29 17:36:00
     
     xirufeng 美女呀,离线,快来找我吧!
      
      
      等级:大二期末(Java考了96分!)
      文章:77
      积分:322
      门派:XML.ORG.CN
      注册:2005/12/12

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给xirufeng发送一个短消息 把xirufeng加入好友 查看xirufeng的个人资料 搜索xirufeng在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看xirufeng的博客5
    发贴心情 
    WARN [main] (OntDocumentManager.java:1004) - An error occurred while attempting
    to read from <http://protege.stanford.edu/plugins/owl/protege> (re-directed via
    the document mgr from <http://protege.stanford.edu/plugins/owl/protege>). Error
    was 'rethrew: protege.stanford.edu'.
    java.net.UnknownHostException: protege.stanford.edu
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)
            at java.net.Socket.connect(Socket.java:426)
            at java.net.Socket.connect(Socket.java:376)
            at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:386)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:602)
            at sun.net.www.http.HttpClient.<init>(HttpClient.java:303)
            at sun.net.www.http.HttpClient.<init>(HttpClient.java:264)
            at sun.net.www.http.HttpClient.New(HttpClient.java:336)
            at sun.net.www.http.HttpClient.New(HttpClient.java:317)
            at sun.net.www.http.HttpClient.New(HttpClient.java:312)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne
    ction.java:481)
            at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection
    .java:472)
            at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
    nection.java:574)
            at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLCon
    nection.java:1169)
            at java.net.URLConnection.getContentEncoding(URLConnection.java:392)
            at com.hp.hpl.jena.ontology.OntDocumentManager.read(OntDocumentManager.j
    ava:968)
            at com.hp.hpl.jena.ontology.OntDocumentManager.loadImport(OntDocumentMan
    ager.java:919)
            at com.hp.hpl.jena.ontology.OntDocumentManager.loadImports(OntDocumentMa
    nager.java:686)
            at com.hp.hpl.jena.ontology.OntDocumentManager.loadImports(OntDocumentMa
    nager.java:635)
            at com.hp.hpl.jena.ontology.impl.OntModelImpl.read(OntModelImpl.java:187
    2)
            at TreeUtil.retrieveNodeInfos(TreeUtil.java:36)
            at TreeUtil.main(TreeUtil.java:93)
    com.hp.hpl.jena.shared.JenaException: rethrew: protege.stanford.edu
            at com.hp.hpl.jena.ontology.OntDocumentManager.read(OntDocumentManager.j
    ava:978)
            at com.hp.hpl.jena.ontology.OntDocumentManager.loadImport(OntDocumentMan
    ager.java:919)
            at com.hp.hpl.jena.ontology.OntDocumentManager.loadImports(OntDocumentMa
    nager.java:686)
            at com.hp.hpl.jena.ontology.OntDocumentManager.loadImports(OntDocumentMa
    nager.java:635)
            at com.hp.hpl.jena.ontology.impl.OntModelImpl.read(OntModelImpl.java:187
    2)
            at TreeUtil.retrieveNodeInfos(TreeUtil.java:36)
            at TreeUtil.main(TreeUtil.java:93)
    Caused by: java.net.UnknownHostException: protege.stanford.edu
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)
            at java.net.Socket.connect(Socket.java:426)
            at java.net.Socket.connect(Socket.java:376)
            at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:386)
            at sun.net.www.http.HttpClient.openServer(HttpClient.java:602)
            at sun.net.www.http.HttpClient.<init>(HttpClient.java:303)
            at sun.net.www.http.HttpClient.<init>(HttpClient.java:264)
            at sun.net.www.http.HttpClient.New(HttpClient.java:336)
            at sun.net.www.http.HttpClient.New(HttpClient.java:317)
            at sun.net.www.http.HttpClient.New(HttpClient.java:312)
            at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne
    ction.java:481)
            at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection
    .java:472)
            at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
    nection.java:574)
            at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLCon
    nection.java:1169)
            at java.net.URLConnection.getContentEncoding(URLConnection.java:392)
            at com.hp.hpl.jena.ontology.OntDocumentManager.read(OntDocumentManager.j
    ava:968)
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/12/29 18:22:00
     
     xirufeng 美女呀,离线,快来找我吧!
      
      
      等级:大二期末(Java考了96分!)
      文章:77
      积分:322
      门派:XML.ORG.CN
      注册:2005/12/12

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给xirufeng发送一个短消息 把xirufeng加入好友 查看xirufeng的个人资料 搜索xirufeng在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看xirufeng的博客6
    发贴心情 
    还有一个问题,就是我所写的树的信息的数据结构只有四个域——接点ID,父接点ID,接点NAME,还有一个URI,但是下的DTree.js却有好多个域。那Dtree文件用改么
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/12/29 18:23:00
     
     jpz6311whu 帅哥哟,离线,有人找我吗?
      
      
      
      威望:9
      等级:研三(收到微软亚洲研究院的Offer了)(版主)
      文章:1718
      积分:10610
      门派:W3CHINA.ORG
      注册:2005/4/12

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给jpz6311whu发送一个短消息 把jpz6311whu加入好友 查看jpz6311whu的个人资料 搜索jpz6311whu在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看jpz6311whu的博客7
    发贴心情 
    JavaScript is forgiving about matching the number of parameters in the function definition
    with the number of parameters passed along from the calling statement. If you define a function with three parameters and the calling statement specifies only two, the third parameter variable value in that function is assigned a null value.

    前面那个上网的问题是没有做镜像:
    Controlling imports processing
    To load an ontology without building the imports closure, call the method setProcessImports( false ) on the document manager object, or set the processImports property in the policy file. To be more selective, it is possible to ignore certain URI's when loading the imported documents. Call the method addIgnoreImport( String uri ) on the document manager object, or set the ignoreImport property in the policy.

    A strength of working with ontologies is that we can reuse work done by other ontologists by importing their published ontologies. Often, however, this means that the ontology is only retrievable by traversing an Internet firewall. Even if this is possible, by using an HTTP proxy, it may impose unacceptable delay in loading an application. In the worst case, an ontology on which our application depends is temporarily or permanently unavailable from the original published URL. To assist with this common problem, the ontology document manager allows 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 duplicated on an internal mirror web site.

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

    <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" />
      <language rdf:resource="http://www.w3.org/2000/01/rdf-schema" />
      <prefix rdf:datatype="&xsd;string">rdfs</prefix>
    </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. Any number of such re-directions may be specified in the policy file, or they can be added to the document manager object directly by calling the various 'add' methods (see the Javadoc for details). As a side-effect, this mechanism also means that ontologies can be named with any legal URI (not necessarily resolvable) - so long as the altURL is itself resolvable.

    Specifying prefixes
    A model keeps a table of URI prefixes that can be used to render URI's in the shortened prefix:name form, which is useful in displaying URI's in a readable way in user interfaces, and is essential in producing legal XML names that denote arbitrary URI's. The ontology model's table of prefixes can be initialized from a table kept by the document manager, which contains the standard prefixes plus any that are declared by in the policy file (or added to subsequently by method calls). To prevent the model's prefix table from being initialized in this way, use the property useDeclaredNsPrefixes in the policy file (with value 'false'), or call the method setUseDeclaredPrefixes on the ontology object.

    Caching models
    The final behaviour that the document manager provides to assist with loading ontology documents is a model cache. Suppose two ontologies, A and B both import ontology C. It would be nice not to have to read C twice when loading A and B. The document manager supports this use case by optionally caching C's model, indexed by C's URI. Then an attempt to import C from B, it previously having been loaded by A, would result in a significant time saving, and a reuse of the same model for C in both A and B.

    To turn model caching on or off, use the policy property cacheModels, or call the method setCacheModels( boolean caching ). The default is caching on. The document manager's current model cache can be cleared at any time by calling clearCache().

    Example
    In the following example, we programmatically declare that the camera ontology is copied locally, and then load it using the public URL. Assume that the constant JENA has been initialized to the directory in which Jena is installed.

    OntModel m = ModelFactory.createOntologyModel();
    OntDocumentManager dm = m.getDocumentManager();
    dm.addAltEntry( "http://www.xfront.com/owl/ontologies/camera/",
                    "file:" + JENA + "examples/data/camera.owl"    );
    m.read( "http://www.xfront.com/owl/ontologies/camera/" );

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/12/29 20:10:00
     
     xirufeng 美女呀,离线,快来找我吧!
      
      
      等级:大二期末(Java考了96分!)
      文章:77
      积分:322
      门派:XML.ORG.CN
      注册:2005/12/12

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给xirufeng发送一个短消息 把xirufeng加入好友 查看xirufeng的个人资料 搜索xirufeng在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看xirufeng的博客8
    发贴心情 
    http://www.xfront.com/owl/ontologies/camera/
    这个怎么确定?
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/12/29 21:13:00
     
     jpz6311whu 帅哥哟,离线,有人找我吗?
      
      
      
      威望:9
      等级:研三(收到微软亚洲研究院的Offer了)(版主)
      文章:1718
      积分:10610
      门派:W3CHINA.ORG
      注册:2005/4/12

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给jpz6311whu发送一个短消息 把jpz6311whu加入好友 查看jpz6311whu的个人资料 搜索jpz6311whu在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看jpz6311whu的博客9
    发贴心情 
    什么怎么确定???
    不明白你问什么??
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/12/30 12:52:00
     
     xirufeng 美女呀,离线,快来找我吧!
      
      
      等级:大二期末(Java考了96分!)
      文章:77
      积分:322
      门派:XML.ORG.CN
      注册:2005/12/12

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给xirufeng发送一个短消息 把xirufeng加入好友 查看xirufeng的个人资料 搜索xirufeng在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看xirufeng的博客10
    发贴心情 
    呵呵,已经解决了,谢谢这位热心师兄!
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/12/30 14:01:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2025/9/27 2:53:45

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

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