Search code examples
javaparsingontologyowl-api

org.obolibrary.oboformat.parser.OBOFormatParser warn WARNING: LINE: 901 Expected white space at pos: 6 LINE: </rdf:RDF>


I am using a java project to load an ontology from a file (dbpedia_2016-10.owl), add some axioms to this ontology then write to .owl file as a new ontology. Later on in my project, I load the new ontology using loadOntologyFromOntologyDocument(new File("DBpedia_modified.owl")) from OWLOntology and I get this warning in multiple lines: I noticed that the parser is not happy at pos 5 or pos 6, which correponds to the character ::

Jan 04, 2020 12:57:49 PM org.obolibrary.oboformat.parser.OBOFormatParser warn
WARNING: LINE: 84  Expected white space at pos: 5  LINE:
<owl:someValuesFrom rdf:resource="http://dbpedia.org/ontology/MusicGenre"/>
Jan 04, 2020 12:57:49 PM org.obolibrary.oboformat.parser.OBOFormatParser warn
WARNING: LINE: 85  Expected white space at pos: 6  LINE:
</owl:Restriction>

As I am quite new to this area, I don't undestand why the parser is expecting a white space instead of :; my question is how serious the warning is? and how can I fix it? I googled it but I didn't find a proper response.

Thank you in advance for any guidance.


Solution

  • You can ignore this warning. Your file is in an RDF format, and the warning is from the OBO parser.

    If you do not specify which format the ontology uses, OWLAPI will try all available parsers until it finds one that accepts the ontology. The OBO parser is refusing to parse the ontology (correctly), and it is also issuing warnings, which is more than it should do since at that point it should already have thrown an exception.

    Edit: to avoid using the OBO parser, you can select the format that should be used:

    manager.loadOntologyFromOntologyDocument(
            new FileDocumentSource(file, new RDFXMLDocumentFormat()));
    

    This will try only one parser (I'm guessing the format of your file is RDF/XML).