/** * Parse an ontology from a given URI. * * @param handler an <code>OWLRDFErrorHandler</code> value * @param uri an <code>URI</code> value * @return an <code>OWLOntology</code> value * @exception ParserException if an error occurs * @exception OWLException if an error occurs */ private OWLOntology parseFromURI(OWLRDFErrorHandler handler, URI uri) throws ParserException, OWLException { parser.setConnection(connection); /* Error handler for the parser */ parser.setOWLRDFErrorHandler(handler); // OWLOntology onto = connection.createOWLOntology( uri,uri ); OWLOntology onto = parser.parseOntology(uri); // message( onto.toString() ); return onto; }
/** Create a new validator. Will report to stdout by default. */ public SwoopSpeciesValidator(SwoopModel model) throws OWLException { myModel = model; /* Sets up a default reporter that writes to stdout. */ setReporter( new SpeciesValidatorReporter() { public void ontology(OWLOntology onto) { // System.out.println( onto.getURI() ); } public void done(String str) { // System.out.println( str ); } public void message(String str) { System.out.println(str); } public void explain(int l, int code, String str) { System.out.println(level(l) + " [" + readableCode(code) + "]:\t" + str); // System.out.println( level( l ) + ":\t" + str ); } }); reservedVocabulary = OWLVocabularyAdapter.INSTANCE.getReservedVocabulary(); classOnlyVocabulary = new HashSet(); classOnlyVocabulary.add(OWLVocabularyAdapter.INSTANCE.getStatement()); classOnlyVocabulary.add(OWLVocabularyAdapter.INSTANCE.getSeq()); classOnlyVocabulary.add(OWLVocabularyAdapter.INSTANCE.getBag()); classOnlyVocabulary.add(OWLVocabularyAdapter.INSTANCE.getAlt()); options = new HashMap(); /* Get a default connection */ connection = OWLManager.getOWLConnection(); parser = new OWLRDFParser(); /* * Tell the parser to ignore annotation content. This is not needed for * validation. */ Map options = new HashMap(); options.put("includeAnnotationContent", new Boolean(false)); parser.setOptions(options); }