"Could not parse ontology" that was included into other ontology(owl-api) - java

I try to load an ontology (test.owl) that includes bfo.owl.
Versions of the used APIs:
OWL-API 3.4.3
hermit 1.3.8.4
It is possible to open the test ontology with Protégé 5.
But when I try to load test.owl with my code, I get the error message below, which I don't understand. Is there anybody out there who can help me understanding the message and finding a way to load the ontology?
org.semanticweb.owlapi.model.UnloadableImportException: Could not load imported ontology: http://purl.obolibrary.org/obo/bfo/2014-05-03/bfo.owl Cause: Problem parsing http://purl.obolibrary.org/obo/bfo/2014-05-03/bfo.owl
Could not parse ontology. Either a suitable parser could not be found, or parsing failed. See parser logs below for explanation.
The following parsers were tried:
1) RDFXMLParser
2) OWLXMLParser
3) OWLFunctionalSyntaxOWLParser
4) TurtleOntologyParser
5) OWLOBOParser
6) KRSS2OWLParser
7) ManchesterOWLSyntaxOntologyParser
Detailed logs:
--------------------------------------------------------------------------------
Parser: RDFXMLParser
org.xml.sax.SAXParseException; systemId: http://purl.obolibrary.org/obo/bfo/2014-05-03/bfo.owl; lineNumber: 1; columnNumber: 50; Leerstellen erforderlich zwischen publicId und systemId.
--------------------------------------------------------------------------------
Parser: OWLXMLParser
org.xml.sax.SAXParseException; systemId: http://purl.obolibrary.org/obo/bfo/2014-05-03/bfo.owl; lineNumber: 1; columnNumber: 50; Leerstellen erforderlich zwischen publicId und systemId
Sorry for having the second part of the error message in a different style - but as I am not allowed to have more than 2 links in a text (due to lack of reputation) and I still wanted you to be able to test the link to bfo.owl, I had to be creative.

Owlapi 3.4 is ancient and many bugs have been fixed since. Protégé 5 uses 4.2.5.
There is a HermiT release compatible with owlapi 4, search Maven Central for version 1.3.8.413 (I curated the fork, it's released under net.sourceforge.owlapi).
This is also the HermiT version bundled with Protege 5.

Related

Error with PDF scraping using Tabulizer library

I'm trying to extract tables from several pdf files and used the Tabulizer library. However, as I use the extract_tables function, I keep getting this error:
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, :
java.lang.IllegalAccessException: class RJavaTools cannot access a member of class java.util.ArrayList$Itr (in module java.base) with modifiers "public".
I have macOS Big Sur(M1, 2020) and have the latest version of Java and R installed. I would appreciate any help and guidance.
Here is the code that I used:
library(tabulizer)
library(rJava) library(pdftools)
setwd(file.path(dirname(rstudioapi::getActiveDocumentContext()$path),'Input Files'))
pdf_files<- list.files(pattern = ".pdf$")
pdf_joined<- pdf_combine(pdf_files,output = "joined.pdf")
f <- "joined.pdf"
out1 <- extract_tables(f)

Why xerces shows me "org.xml.sax.SAXParseException: Invalid content was found starting with element"?

I created a test XML that is attached below and that I validate against the following XSD:
http://www.nltaxonomie.nl/nt12/bd/20171213/validation/bd-axes.xsd
And it results in the following java error:
Caused by: org.xml.sax.SAXParseException; lineNumber: 17; columnNumber: 53; cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://www.nltaxonomie.nl/nt12/bd/20180919/dictionary/bd-data-ext2":MessageSourceType}'. One of '{"http://www.xbrl.org/2003/instance":item, "http://www.xbrl.org/2003/instance":tuple, "http://www.xbrl.org/2003/instance":context, "http://www.xbrl.org/2003/instance":unit, "http://www.xbrl.org/2003/linkbase":footnoteLink}' is expected.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
Can you please explain why?
How should I analyse these kind of errors, I always have a hard time understanding these errors.
Details:
I create a javax.xml.validation.Validator instance through
final SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
factory.setResourceResolver(resourceResolver);
validator = factory.newSchema(createSchemaSources()).newValidator()
validator.validate(createdXML)
Created XML:
<xbrli:xbrl xmlns:bd-domain-members="http://www.nltaxonomie.nl/nt12/bd/20171213/dictionary/bd-domain-members" xmlns:xbrl-syntax-extension="http://www.nltaxonomie.nl/2011/xbrl/xbrl-syntax-extension" xmlns:bd-t="http://www.nltaxonomie.nl/nt12/bd/20171213/dictionary/bd-tuples" xmlns:iso4217="http://www.xbrl.org/2003/iso4217" xmlns:bd-t-ext2="http://www.nltaxonomie.nl/nt12/bd/20180919/dictionary/bd-tuples-ext2" xmlns:xbrldt="http://xbrl.org/2005/xbrldt" xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:XLink="http://www.xbrl.org/2003/XLink" xmlns:bd-domains="http://www.nltaxonomie.nl/nt12/bd/20171213/validation/bd-domains" xmlns:bd-i="http://www.nltaxonomie.nl/nt12/bd/20171213/dictionary/bd-data" xmlns:xbrldi="http://xbrl.org/2006/xbrldi" xmlns:nl-common-data="http://www.nltaxonomie.nl/nt12/sbr/20170515/dictionary/nl-common-data" xmlns:bd-i-ext2="http://www.nltaxonomie.nl/nt12/bd/20180919/dictionary/bd-data-ext2" xmlns:bd-axes-ext2="http://www.nltaxonomie.nl/nt12/bd/20180919/validation/bd-axes-ext2" xmlns:bd-domain-members-ext2="http://www.nltaxonomie.nl/nt12/bd/20180919/dictionary/bd-domain-members-ext2" xmlns:linkbase="http://www.xbrl.org/2003/linkbase" xmlns:bd-axes="http://www.nltaxonomie.nl/nt12/bd/20171213/validation/bd-axes" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="nl">
<linkbase:schemaRef xlink:type="simple" xlink:href="http://www.nltaxonomie.nl/nt12/bd/20180919/entrypoints/bd-rpt-tsl-2019.xsd" xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase"/>
<xbrli:context id="cc_371">
<xbrli:entity>
<xbrli:identifier scheme="www.belastingdienst.nl/identificatie">610946109</xbrli:identifier>
</xbrli:entity>
<xbrli:period>
<xbrli:startDate>2019-01-01</xbrli:startDate>
<xbrli:endDate>2019-12-31</xbrli:endDate>
</xbrli:period>
</xbrli:context>
<bd-i:SoftwarePackageName contextRef="cc_371">BSTYAYyXqdLDfsqYyaKvamVvLqdjek</bd-i:SoftwarePackageName>
<bd-i:SoftwarePackageVersion contextRef="cc_371">hP</bd-i:SoftwarePackageVersion>
<bd-i:SoftwareVendorAccountNumber contextRef="cc_371">vWRSMzSI</bd-i:SoftwareVendorAccountNumber>
<bd-i:TaxReturnMessageType contextRef="cc_371">0084</bd-i:TaxReturnMessageType>
<bd-i-ext2:MessageSourceType contextRef="cc_371">48</bd-i-ext2:MessageSourceType>
<bd-i-ext2:MessageIdentification contextRef="cc_371">ottZieoUAieKCcAFQHpF</bd-i-ext2:MessageIdentification>
<bd-i-ext2:TaxPayerSignatureIndication contextRef="cc_371">1</bd-i-ext2:TaxPayerSignatureIndication>
<bd-i:CohabitationPeriodTaxYearEnd contextRef="cc_371">2018-05-10+02:00</bd-i:CohabitationPeriodTaxYearEnd>
</xbrli:xbrl>

org.xml.sax.SAXNotRecognizedException when running runnable jar with java 8

I am exporting my project as runnable jar and execute in java 8 environment. But I am getting
org.xml.sax.SAXNotRecognizedException: http://javax.xml.XMLConstants/feature/sec
ure-processing
at org.apache.xerces.parsers.AbstractSAXParser.setFeature(Unknown Source
)
at org.apache.xerces.jaxp.SAXParserImpl.setFeatures(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParserImpl(Unknown
Source)
I tried with xercesImpl.2.11.0 and got :
javax.xml.bind.UnmarshalException - with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 63; columnNumber: 9; The string "--"
is not permitted within comments.]
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalExcept
ion(AbstractUnmarshallerImpl.java)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.cr
eateUnmarshalException(UnmarshallerImpl.java:)
Please provide a solution?
Below error comes if something is wrong in your XML or HTML:
The string "--" is not permitted within comments.
An HTML comment begins with "<!--", ends with "-->" and does not contain "--" or ">" anywhere in the comment.
Go through this URL(HTML Comments) for more details.

docx4j : "No suitable JAXB implementation available" runtime error Java 1.5

I am using docx4j to parse docx file.
I downloaded all JARs from docx4j site docx4j downloads.
When I used it in code, it gives runtime error at very first line of code: -
WordprocessingMLPackage template = WordprocessingMLPackage.load(new FileInputStream(new File("Global_OPO_Profile_EN.docx")));
Exception is:
INFO org.docx4j.utils.Log4jConfigurator .configure line 45 - Since your log4j configuration (if any) was not found, docx4j has configured log4j automatically.
ERROR org.docx4j.jaxb.Context .<clinit> line 64 - PANIC! No suitable JAXB implementation available
javax.xml.bind.JAXBException: Unable to locate jaxb.properties for package org.docx4j.relationships
at javax.xml.bind.ContextFinder.searchcontextPath(ContextFinder.java:205)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:149)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:281)
at org.docx4j.jaxb.NamespacePrefixMapperUtils.getPrefixMapper(NamespacePrefixMapperUtils.java:47)
at org.docx4j.jaxb.Context.<clinit>(Context.java:56)
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:658)
at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:206)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:193)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:301)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:245)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:195)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:178)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:172)
at com.atos.docx4jtest.Docx4iTest.main(Docx4iTest.java:15)
INFO org.docx4j.jaxb.Context .<clinit> line 76 - loading Context jc
ERROR org.docx4j.jaxb.Context .<clinit> line 102 - Cannot initialize context
javax.xml.bind.JAXBException: Unable to locate jaxb.properties for package org.docx4j.wml
at javax.xml.bind.ContextFinder.searchcontextPath(ContextFinder.java:205)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:149)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:281)
at org.docx4j.jaxb.Context.<clinit>(Context.java:77)
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:658)
at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:206)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:193)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:301)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:245)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:195)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:178)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:172)
at com.atos.docx4jtest.Docx4iTest.main(Docx4iTest.java:15)
ERROR org.docx4j.openpackaging.contenttype.ContentTypeManager .parseContentTypesFile line 690 - java.lang.NullPointerException
org.docx4j.openpackaging.exceptions.InvalidFormatException: Bad [Content_Types].xml
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:691)
at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:206)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:193)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:301)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:245)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:195)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:178)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:172)
at com.atos.docx4jtest.Docx4iTest.main(Docx4iTest.java:15)
Caused by: java.lang.NullPointerException
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:658)
... 8 more
Java 1.5 does not include JAXB, so you need to download the JAXB reference implementation, and add it to your class path.

XML validation error message always display

I am a Java developer. I'm working with a legacy system which is using Strtus1.2.9. After I added some jar file to this system and started the Tomcat, some error message display in the console. It seems like some of old xml file can not pass the parse. The tracback is like the following:
ERROR - Digester.error(1463) | Parse Error at line 396 column 35: Element type "var-value" must be declared.
org.xml.sax.SAXParseException: Element type "var-value" must be declared.
at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1213)
at org.apache.xerces.validators.common.XMLValidator.reportRecoverableXMLError(XMLValidator.java:1807)
at org.apache.xerces.validators.common.XMLValidator.validateElementAndAttributes(XMLValidator.java:3633)
at org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1229)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1171)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at org.apache.commons.digester.Digester.parse(Digester.java:1591)
at org.apache.commons.validator.ValidatorResources.<init>(ValidatorResources.java:159)
at org.apache.struts.validator.ValidatorPlugIn.initResources(ValidatorPlugIn.java:237)
at org.apache.struts.validator.ValidatorPlugIn.init(ValidatorPlugIn.java:162)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:869)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
It seems like some xml has DTD version compatible issue. Why this error never display before. I just add these new jar files:
antlr-runtime-3.1.3.jar
drools-api-5.1.0.jar
drools-compiler-5.1.0.jar
drools-core-5.1.0.jar
drools-decisiontables-5.1.0.jar
drools-templates-5.1.0.jar
flatworm-2.0.1.jar
freemarker.jar
jxl-2.6.10.jar
jxls-reader-0.9.6.jar
mvel2-2.0.16.jar
xml-apis.jar

Categories