Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-owl] Loading syntactically incorrect files: no exception is thrown

Tania Tudorache tudorache at stanford.edu
Fri May 23 17:07:23 PDT 2008


Hi Elena,

Indeed the error handling in the current version is not easy to use for 
application developers. I think the initial idea was to make the parser 
tolerant to errors, so that it will try to continue the parse until a 
fatal exception occurred. You will see in different parts of the code 
that there is an error list passed around that gathers all the errors. 
At the end of the parse, the error list would contain all the parse 
errors. Unfortunately, the errors argument was ignored in the ProtegeOWL 
load methods.

Ideally, an application should be able to set its own error handler and 
decide what to do with the different types of errors (e.g. warnings and 
errors may be treated differently). I will see what we can do about 
improving the error handling for the next releases.

Tania


Antonenko, Elena wrote:
>
> Hello everyone!
>
> I tried to load a syntactically incorrect file, but no exception has 
> been thrown. Here is my code:
>
> String baseDir = MiscUtils.determineProgramBasePathURI();
> String fileURI = baseDir + 
> "/TestProjects/RobustnessTestProject/sourceOntology_SYNTACTIC_ERRORS.owl";
> JenaOWLModel jenaOWLModel = null;
>
> try {
> jenaOWLModel = ProtegeOWL.createJenaOWLModelFromURI(fileURI);
> } catch (Exception e) {
> System.out.println("Exception caught !!!");
> e.printStackTrace();
> }
> System.out.println("jenaOWLModel = " + jenaOWLModel);
>
>
> The output of program execution is presented in the following. Even 
> though the error message is printed out, the exception is not thrown 
> and the loaded JenaOWLModel is not null. Is it the correct behaviour 
> (because I would expect an exception to be thrown)? I also include the 
> sourceOntology_SYNTACTIC_ERRORS.owl, some elements in it don’t have 
> end tags. I use Build 130.
>
>
> INFO: Start processing ontology: 
> file:/C:/OAN/DIPLOM/EclipseWorkspaceForMaven/MappingTesting/TestProjects/RobustnessTestProject/sourceOntology_SYNTACTIC_ERRORS.owl 
> Time: Thu May 15 18:36:29 CEST 2008
> SEVERE: An error occurred at parsing the OWL ontology
>
> file:/C:/OAN/DIPLOM/EclipseWorkspaceForMaven/MappingTesting/TestProjects/RobustnessTestProject/sourceOntology_SYNTACTIC_ERRORS.owl
>
> at line 12 and column 31.
> Jena parse error message: Element type "owl:Class" must be followed by 
> either attribute specifications, ">" or "/>". -- 
> org.xml.sax.SAXParseException: Element type "owl:Class" must be 
> followed by either attribute specifications, ">" or "/>".
> at 
> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown 
> Source)
> at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
> at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
> at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
> at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown 
> Source)
> at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown 
> Source)
> at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
> Source)
> at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
> at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at com.hp.hpl.jena.rdf.arp.impl.RDFXMLParser.parse(RDFXMLParser.java:106)
> at com.hp.hpl.jena.rdf.arp.ARP.load(ARP.java:143)
> at 
> edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser$1.invokeARP(Unknown 
> Source)
> at 
> edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser.loadTriples(Unknown 
> Source)
> at 
> edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser.run(Unknown 
> Source)
> at 
> edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser.run(Unknown 
> Source)
> at 
> edu.stanford.smi.protegex.owl.jena.parser.ProtegeOWLParser.run(Unknown 
> Source)
> at edu.stanford.smi.protegex.owl.jena.JenaOWLModel.load(Unknown Source)
> at 
> edu.stanford.smi.protegex.owl.ProtegeOWL.createJenaOWLModelFromURI(Unknown 
> Source)
> at 
> org.qualipso.interop.semantics.mappingtesting.core.ProtegeAndJavaAPITests.testLoadingSyntacticallyIncorrectFile(ProtegeAndJavaAPITests.java:92)
> at 
> org.qualipso.interop.semantics.mappingtesting.core.ProtegeAndJavaAPITests.main(ProtegeAndJavaAPITests.java:67)
>
> INFO: [ProtegeOWLParser] Completed triple loading after 90 ms
> jenaOWLModel = JenaOWLModel(KB_232952)
> INFO: [TripleChangePostProcessor] Completed lists after 0 ms
> INFO: [TripleChangePostProcessor] Completed anonymous classes after 0 ms
> INFO: [TripleChangePostProcessor] Completed deprecated classes after 30 ms
> INFO: [TripleChangePostProcessor] Completed properties after 0 ms
> INFO: [TripleChangePostProcessor] Completed named classes after 0 ms
> INFO: ... Loading completed after 130 ms
>
> --------------------------------------------------------------
> sourceOntology_SYNTACTIC_ERRORS.owl:
>
>
> <?xml version="1.0"?>
> <rdf:RDF
> xmlns="http://www.fokus.fraunhofer.de/test/sourceOntology.owl#"
> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
> xmlns:owl="http://www.w3.org/2002/07/owl#"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
> xmlns:swrl="http://www.w3.org/2003/11/swrl#"
> xmlns:swrlb="http://www.w3.org/2003/11/swrlb#"
> xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
> xml:base="http://www.fokus.fraunhofer.de/test/sourceOntology.owl">
> <owl:Ontology rdf:about=""/>
> <owl:Class rdf:ID="Address"/
> <owl:FunctionalProperty rdf:ID="street"
> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
> <rdfs:domain rdf:resource="#Address"/>
> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
> </owl:FunctionalProperty>
> </rdf:RDF>
>
>
> Thanks you very much in advance.
>
> Regards,
> Elena
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> protege-owl mailing list
> protege-owl at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-owl
>
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03 
>   




More information about the protege-owl mailing list