protected void loadOntology() { try { manager = OWLManager.createOWLOntologyManager(); URI physicalURI = URI.create(PREFERENCES.getOntologyURL()); // Now do the loading ontology = manager.loadOntologyFromPhysicalURI(physicalURI); manager.setPhysicalURIForOntology(ontology, physicalURI); } catch (final Exception e) { Runnable runnable = new Runnable() { public void run() { JOptionPane.showMessageDialog( null, "Could not create the ontology. (This probably happened\n" + "because the ontology could not be accessed due to network\n" + "problems.)\n" + "[" + e.getMessage() + "]", "Error", JOptionPane.ERROR_MESSAGE); System.exit(1); } }; SwingUtilities.invokeLater(runnable); } }
/** * OWL 2 RL Test Case Premise Ontology Checker. * * <p>Assuming that the ontology meets the OWL 2 RL syntactic restrictions defined in [1], this * class checks that the ontology also meets the restrictions defined for O1 from Theorem PR1 [1]. * * <p>" - neither O1 nor O2 contains a IRI that is used for more than one type of entity (i.e., no * IRIs is used both as, say, a class and an individual); - O1 does not contain * SubAnnotationPropertyOf, AnnotationPropertyDomain, and AnnotationPropertyRange axioms;" * * <p>[1] http://www.w3.org/2007/OWL/wiki/Profiles#OWL_2_RL * * @author Stuart Taylor * @version 2009-07-15 */ public class OWL2RLTestCasePremiseChecker extends AbstractOWLSyntaxChecker implements OWLSyntaxChecker { private final OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); public void check(OWLOntology ontology) { Set<OWLOntology> importsClosure = manager.getImportsClosure(ontology); for (OWLOntology o : importsClosure) { // FIXME find a version of OWL API that supports annotation property domain, range and // subsumption... // for (OWLAxiom axiom : o.getLogicalAxioms()) { // AxiomChecker checker = new AxiomChecker(); // axiom.accept(checker); // // if (!checker.isValid()) // unsupported(axiom); // // } for (OWLEntity entity : o.getReferencedEntities()) { if (o.isPunned(entity.getURI())) { valid = false; if (lazyMode) throw new OWLSyntaxException("Punned URI: " + entity.getURI()); } } } } public String getLanguageName() { return "OWL 2 RL Test Case Premise Ontology"; } private class AxiomChecker extends AbstractChecker implements OWLAxiomVisitor { public void visit(OWLSubClassAxiom axiom) {} public void visit(OWLNegativeObjectPropertyAssertionAxiom axiom) {} public void visit(OWLAntiSymmetricObjectPropertyAxiom axiom) {} public void visit(OWLReflexiveObjectPropertyAxiom axiom) {} public void visit(OWLDisjointClassesAxiom axiom) {} public void visit(OWLDataPropertyDomainAxiom axiom) {} public void visit(OWLImportsDeclaration axiom) {} public void visit(OWLAxiomAnnotationAxiom axiom) {} public void visit(OWLObjectPropertyDomainAxiom axiom) {} public void visit(OWLEquivalentObjectPropertiesAxiom axiom) {} public void visit(OWLNegativeDataPropertyAssertionAxiom axiom) {} public void visit(OWLDifferentIndividualsAxiom axiom) {} public void visit(OWLDisjointDataPropertiesAxiom axiom) {} public void visit(OWLDisjointObjectPropertiesAxiom axiom) {} public void visit(OWLObjectPropertyRangeAxiom axiom) {} public void visit(OWLObjectPropertyAssertionAxiom axiom) {} public void visit(OWLFunctionalObjectPropertyAxiom axiom) {} public void visit(OWLObjectSubPropertyAxiom axiom) {} public void visit(OWLDisjointUnionAxiom axiom) {} public void visit(OWLDeclarationAxiom axiom) {} public void visit(OWLEntityAnnotationAxiom axiom) {} public void visit(OWLOntologyAnnotationAxiom axiom) {} public void visit(OWLSymmetricObjectPropertyAxiom axiom) {} public void visit(OWLDataPropertyRangeAxiom axiom) {} public void visit(OWLFunctionalDataPropertyAxiom axiom) {} public void visit(OWLEquivalentDataPropertiesAxiom axiom) {} public void visit(OWLClassAssertionAxiom axiom) {} public void visit(OWLEquivalentClassesAxiom axiom) {} public void visit(OWLDataPropertyAssertionAxiom axiom) {} public void visit(OWLTransitiveObjectPropertyAxiom axiom) {} public void visit(OWLIrreflexiveObjectPropertyAxiom axiom) {} public void visit(OWLDataSubPropertyAxiom axiom) {} public void visit(OWLInverseFunctionalObjectPropertyAxiom axiom) {} public void visit(OWLSameIndividualsAxiom axiom) {} public void visit(OWLObjectPropertyChainSubPropertyAxiom axiom) {} public void visit(OWLInverseObjectPropertiesAxiom axiom) {} public void visit(SWRLRule rule) {} } }