我用Protege创建了一个本体,并保存为RDF Parse Error: Content is not allowed in prolog. [line 1, column 1]
文件。
当我尝试通过Workbench 导入-> RDF -> 上传RDF文件时,将其加载到GraphDB(8.9.0)(受支持的RDF格式是.ttl .rdf .rj .n3 .nt .nq .trig .trix .brf .owl .jsonld以及它们的.gz版本和.zip归档文件)我遇到了错误:
01:00:37.877 [import-task-Accounting-1] ERROR o.e.r.rio.helpers.ParseErrorLogger - [Rio fatal] Content is not allowed in prolog. (1, 1)
01:00:37.879 [import-task-Accounting-1] ERROR c.o.f.impex.FileImportRunnableTask - RDF Parse Error
org.eclipse.rdf4j.rio.RDFParseException: Content is not allowed in prolog. [line 1, column 1]
at org.eclipse.rdf4j.rio.helpers.RDFParserHelper.reportFatalError(RDFParserHelper.java:442)
at org.eclipse.rdf4j.rio.helpers.AbstractRDFParser.reportFatalError(AbstractRDFParser.java:783)
at org.eclipse.rdf4j.rio.rdfxml.RDFXMLParser.reportFatalError(RDFXMLParser.java:1176)
at org.eclipse.rdf4j.rio.rdfxml.RDFXMLParser.fatalError(RDFXMLParser.java:1315)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:180)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1472)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:994)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at org.eclipse.rdf4j.rio.rdfxml.RDFXMLParser.parse(RDFXMLParser.java:265)
at org.eclipse.rdf4j.rio.rdfxml.RDFXMLParser.parse(RDFXMLParser.java:207)
at org.eclipse.rdf4j.repository.util.RDFLoader.loadInputStreamOrReader(RDFLoader.java:286)
at org.eclipse.rdf4j.repository.util.RDFLoader.load(RDFLoader.java:197)
at org.eclipse.rdf4j.repository.base.AbstractRepositoryConnection.add(AbstractRepositoryConnection.java:329)
at com.ontotext.trree.monitorRepository.MonitorRepositoryConnection.add(MonitorRepositoryConnection.java:177)
at com.ontotext.trree.parallel.ParallelRDFLoader.add(ParallelRDFLoader.java:125)
at com.ontotext.trree.parallel.ParallelRDFLoader.add(ParallelRDFLoader.java:54)
at com.ontotext.forest.impex.ParallelAwareImporter.lambda$add$5(ParallelAwareImporter.java:107)
at com.ontotext.forest.impex.ParallelAwareImporter.wrapInBeginCommit(ParallelAwareImporter.java:128)
at com.ontotext.forest.impex.ParallelAwareImporter.add(ParallelAwareImporter.java:89)
at com.ontotext.forest.impex.FileImportRunnableTask.load(FileImportRunnableTask.java:36)
at com.ontotext.forest.impex.ImportRunnableTask.run(ImportRunnableTask.java:82)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
... 29 common frames omitted
。
完整日志:
{{1}}
任何帮助/建议/提示将不胜感激。
答案 0 :(得分:2)
问题在于GraphDB假设.owl
文件是用XML编写的,因此试图以此解析它们。但是,如OWL Conformance (2.2 Tool Conformance)中所述:
一致的OWL 2工具 也可以使用其他序列化来接受本体文档,例如Turtle ...
实际上,OWL本体定义可以具有5种不同的有效格式:函数样式,RDF / XML,OWL / XML,Turtle和Manchester语法。 Protégé决定对其.owl
文件使用Turtle语法,因此GraphDB在尝试将它们解析为XML时出错。
解决方法::只需将文件扩展名从.owl
更改为.ttl
,GraphDB就会很高兴地加载它。
答案 1 :(得分:1)
我的猜测是文件以BOM字符U + FEFF开头:第1行第1列错误。这是一个零宽度的空间,有时用于将文件标记为某些Unicode表示形式UTF-8, UTF-16LE,UTF-16BE。您可以共享文件的第一行吗? 您可以尝试删除文件开头的标记,也可以尝试使用Encoding(Tab)> UTF-8中的Encode:selected将文件保存在Notepad ++中。