diff options
Diffstat (limited to 'src/test/java/uk/ac/ox/cs/hermit/HermitTester.java')
| -rw-r--r-- | src/test/java/uk/ac/ox/cs/hermit/HermitTester.java | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/test/java/uk/ac/ox/cs/hermit/HermitTester.java b/src/test/java/uk/ac/ox/cs/hermit/HermitTester.java new file mode 100644 index 0000000..dc70284 --- /dev/null +++ b/src/test/java/uk/ac/ox/cs/hermit/HermitTester.java | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | package uk.ac.ox.cs.hermit; | ||
| 2 | |||
| 3 | import org.semanticweb.HermiT.Configuration; | ||
| 4 | import org.semanticweb.HermiT.Reasoner; | ||
| 5 | import org.semanticweb.HermiT.model.Atom; | ||
| 6 | import org.semanticweb.HermiT.model.DLClause; | ||
| 7 | import org.semanticweb.HermiT.model.DLOntology; | ||
| 8 | import org.semanticweb.HermiT.structural.OWLClausification; | ||
| 9 | import org.semanticweb.owlapi.model.IRI; | ||
| 10 | import org.semanticweb.owlapi.model.OWLAxiom; | ||
| 11 | import org.semanticweb.owlapi.model.OWLClass; | ||
| 12 | import org.semanticweb.owlapi.model.OWLDataFactory; | ||
| 13 | import org.semanticweb.owlapi.model.OWLNamedIndividual; | ||
| 14 | import org.semanticweb.owlapi.model.OWLOntology; | ||
| 15 | import org.semanticweb.owlapi.reasoner.Node; | ||
| 16 | |||
| 17 | import uk.ac.ox.cs.pagoda.owl.OWLHelper; | ||
| 18 | |||
| 19 | public class HermitTester { | ||
| 20 | |||
| 21 | public static void main(String[] args) { | ||
| 22 | OWLOntology onto = OWLHelper.loadOntology("imported.owl"); | ||
| 23 | Reasoner hermit = new Reasoner(onto); | ||
| 24 | OWLDataFactory f = onto.getOWLOntologyManager().getOWLDataFactory(); | ||
| 25 | OWLClass concept = f.getOWLClass(IRI.create("http://semantics.crl.ibm.com/univ-bench-dl.owl#Query12")); | ||
| 26 | |||
| 27 | for (OWLOntology o: onto.getImportsClosure()) { | ||
| 28 | System.out.println(o.containsEntityInSignature(concept)); | ||
| 29 | for (OWLAxiom axiom: o.getAxioms()) | ||
| 30 | if (axiom.getClassesInSignature().contains(concept)) | ||
| 31 | System.out.println(axiom); | ||
| 32 | } | ||
| 33 | |||
| 34 | for (Node<OWLNamedIndividual> node : hermit.getInstances(concept, false)) | ||
| 35 | for (OWLNamedIndividual i: node.getEntities()) { | ||
| 36 | System.out.println(i.toStringID()); | ||
| 37 | } | ||
| 38 | |||
| 39 | // clausifierTest(); | ||
| 40 | } | ||
| 41 | |||
| 42 | @SuppressWarnings("unused") | ||
| 43 | private static void clausifierTest() { | ||
| 44 | OWLOntology onto = OWLHelper.loadOntology("/users/yzhou/ontologies/travel.owl"); | ||
| 45 | OWLClausification clausifier = new OWLClausification(new Configuration()); | ||
| 46 | DLOntology dlOntology = (DLOntology)clausifier.preprocessAndClausify(onto, null)[1]; | ||
| 47 | |||
| 48 | for (DLClause clause: dlOntology.getDLClauses()) | ||
| 49 | System.out.println(clause); | ||
| 50 | for (Atom atom : dlOntology.getPositiveFacts()) | ||
| 51 | System.out.println(atom); | ||
| 52 | |||
| 53 | } | ||
| 54 | |||
| 55 | } | ||
