关于间接导入的FileNotFoundExeption

时间:2017-09-07 09:09:48

标签: protege

我正在创建一个自定义本体(Ontology A),我得到一个" FileNotFoundException"当我尝试导入我创建的另一个本体(本体B)时,使用"导入特定文件中包含的本体来进行间接导入。"选项。

Ontology B在名为micropublications.owl的文件中本地下载后,成功导入了Micropublications ontology(可以找到here)。导入micropublications.owl时,我使用"导入特定文件中包含的本体。"选项,一切正常。我检查了" import"在保护部分,一切似乎都很好,即有一个特定的"位置"指向实际下载的文件等。

当我尝试在本体A中导入本体B时,它失败并且日志文件包含以下完整堆栈跟踪

2017-09-07 11:28:20.907 [Thread-3] INFO  LastResortExtractor    Exception caught trying to get ontology id for file:/C:/Users/.../OntologyB.owl
org.semanticweb.owlapi.model.UnloadableImportException: Could not load imported ontology: <http://purl.org/mp/> Cause: http://purl.org/mp/
    at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.makeLoadImportRequest(OWLOntologyManagerImpl.java:1709) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
    at org.semanticweb.owlapi.owlxml.parser.OWLImportsHandler.endElement(PARSER_OWLXMLVocabulary.java:3004) ~[na:na]
    at org.semanticweb.owlapi.owlxml.parser.OWLXMLParserHandler.endElement(OWLXMLParserHandler.java:422) ~[na:na]
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609) ~[na:1.8.0_40]
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782) ~[na:1.8.0_40]
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2973) ~[na:1.8.0_40]
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606) ~[na:1.8.0_40]
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117) ~[na:1.8.0_40]
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510) ~[na:1.8.0_40]
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848) ~[na:1.8.0_40]
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777) ~[na:1.8.0_40]
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) ~[na:1.8.0_40]
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213) ~[na:1.8.0_40]
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649) ~[na:1.8.0_40]
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333) ~[na:1.8.0_40]
    at org.semanticweb.owlapi.owlxml.parser.OWLXMLParser.parse(OWLXMLParser.java:60) ~[na:na]
    at uk.ac.manchester.cs.owl.owlapi.OWLOntologyFactoryImpl.loadOWLOntology(OWLOntologyFactoryImpl.java:197) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
    at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.actualParse(OWLOntologyManagerImpl.java:1099) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
    at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:1055) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
    at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntologyFromOntologyDocument(OWLOntologyManagerImpl.java:998) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
    at org.protege.editor.owl.model.repository.extractors.LastResortExtractor.getOntologyId(LastResortExtractor.java:21) ~[protege-editor-owl.jar:na]
    at org.protege.editor.owl.model.repository.MasterOntologyIDExtractor.getOntologyId(MasterOntologyIDExtractor.java:26) [protege-editor-owl.jar:na]
    at org.protege.editor.owl.ui.ontology.imports.wizard.page.AnticipateOntologyIdPage.checkImport(AnticipateOntologyIdPage.java:109) [protege-editor-owl.jar:na]
    at org.protege.editor.owl.ui.ontology.imports.wizard.page.AnticipateOntologyIdPage.lambda$new$163(AnticipateOntologyIdPage.java:44) [protege-editor-owl.jar:na]
    at org.protege.editor.owl.ui.ontology.imports.wizard.page.AnticipateOntologyIdPage$$Lambda$120/769332687.run(Unknown Source) [protege-editor-owl.jar:na]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]
Caused by: org.semanticweb.owlapi.io.OWLOntologyCreationIOException: http://purl.org/mp/
    at uk.ac.manchester.cs.owl.owlapi.OWLOntologyFactoryImpl.loadOWLOntology(OWLOntologyFactoryImpl.java:207) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
    at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.actualParse(OWLOntologyManagerImpl.java:1099) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
    at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:1055) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
    at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:957) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
    at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadImports(OWLOntologyManagerImpl.java:1666) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
    at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.makeLoadImportRequest(OWLOntologyManagerImpl.java:1702) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
    ... 25 common frames omitted
Caused by: java.io.FileNotFoundException: http://purl.org/mp/
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_40]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_40]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_40]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[na:1.8.0_40]
    at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1889) ~[na:1.8.0_40]
    at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1884) ~[na:1.8.0_40]
    at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_40]
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1883) ~[na:1.8.0_40]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1456) ~[na:1.8.0_40]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440) ~[na:1.8.0_40]
    at org.semanticweb.owlapi.io.AbstractOWLParser.getInputStreamFromContentEncoding(AbstractOWLParser.java:165) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
    at org.semanticweb.owlapi.io.AbstractOWLParser.getInputStream(AbstractOWLParser.java:127) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
    at org.semanticweb.owlapi.io.AbstractOWLParser.getInputSource(AbstractOWLParser.java:232) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
    at org.semanticweb.owlapi.rdf.rdfxml.parser.RDFXMLParser.parse(RDFXMLParser.java:72) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
    at uk.ac.manchester.cs.owl.owlapi.OWLOntologyFactoryImpl.loadOWLOntology(OWLOntologyFactoryImpl.java:197) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
    ... 30 common frames omitted
Caused by: java.io.FileNotFoundException: http://purl.org/mp/
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1835) ~[na:1.8.0_40]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440) ~[na:1.8.0_40]
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) ~[na:1.8.0_40]
    at org.semanticweb.owlapi.io.AbstractOWLParser.getInputStream(AbstractOWLParser.java:103) ~[owlapi-osgidistribution.jar:4.2.8.20170104-2310]
    ... 33 common frames omitted
2017-09-07 11:28:20.907 [Thread-3] ERROR AnticipateOntologyIdPage    An error occurred whilst extracting the Ontology Id from the imported ontology: {}
java.lang.NullPointerException: null
    at org.protege.editor.owl.model.repository.MasterOntologyIDExtractor.getOntologyId(MasterOntologyIDExtractor.java:27) ~[protege-editor-owl.jar:na]
    at org.protege.editor.owl.ui.ontology.imports.wizard.page.AnticipateOntologyIdPage.checkImport(AnticipateOntologyIdPage.java:109) [protege-editor-owl.jar:na]
    at org.protege.editor.owl.ui.ontology.imports.wizard.page.AnticipateOntologyIdPage.lambda$new$163(AnticipateOntologyIdPage.java:44) [protege-editor-owl.jar:na]
    at org.protege.editor.owl.ui.ontology.imports.wizard.page.AnticipateOntologyIdPage$$Lambda$120/769332687.run(Unknown Source) [protege-editor-owl.jar:na]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]
2017-09-07 11:28:25.679 [pool-2-thread-1] INFO  AddImportsStrategy    -------------------- Importing ontology and imports closure --------------------

似乎Protege正在以其基URI命名的文件中搜索Micropublications模型,而不是在Ontology B的相应import语句中明确说明的实际文件位置。请注意,Ontology B还导入导致其他原因的其他本体在Ontology A中没问题。

关于出了什么问题的任何想法?

PS我正在使用Protege 5.2.0。

1 个答案:

答案 0 :(得分:1)

我找到了一个可能对其他人有帮助的解决方法。当我在同一个保护窗口中加载本体B和本体A时,我可以使用选项&#34;导入已经加载到工作空间中的本体来导入本体B&#34;一切似乎都在起作用。

希望这是有帮助的