assertEquals(2, classes.size());
}
@Test
public void testSWRL() throws OWLException {
OWLOntologyManager m = create();
OWLOntology o = m.createOntology(EXAMPLE_IRI);
// Get hold of references to class A and class B.
OWLClass clsA = df.getOWLClass(IRI.create(EXAMPLE_IRI + "#A"));
OWLClass clsB = df.getOWLClass(IRI.create(EXAMPLE_IRI + "#B"));
SWRLVariable var = df.getSWRLVariable(IRI.create(EXAMPLE_IRI + "#x"));
Set<SWRLClassAtom> body = Collections.singleton(df.getSWRLClassAtom(
clsA, var));
Set<SWRLClassAtom> head = Collections.singleton(df.getSWRLClassAtom(
clsB, var));
SWRLRule rule = df.getSWRLRule(body, head);
m.applyChange(new AddAxiom(o, rule));
OWLObjectProperty prop = df.getOWLObjectProperty(IRI.create(EXAMPLE_IRI
+ "#propA"));
OWLObjectProperty propB = df.getOWLObjectProperty(IRI
.create(EXAMPLE_IRI + "#propB"));
SWRLObjectPropertyAtom propAtom = df.getSWRLObjectPropertyAtom(prop,
var, var);
SWRLObjectPropertyAtom propAtom2 = df.getSWRLObjectPropertyAtom(propB,
var, var);
Set<SWRLAtom> antecedent = new HashSet<>();
antecedent.add(propAtom);
antecedent.add(propAtom2);
SWRLRule rule2 = df.getSWRLRule(antecedent,
Collections.singleton(propAtom));
m.applyChange(new AddAxiom(o, rule2));
}