.getOWLObjectPropertyAssertionAxiom(hasWife, john, mary);
// We now need to add this assertion to our ontology. To do this, we
// apply an ontology change to the ontology via the OWLOntologyManager.
// First we create the change object that will tell the manager that we
// want to add the axiom to the ontology
AddAxiom addAxiom1 = new AddAxiom(ont, axiom1);
// Now we apply the change using the manager.
manager.applyChange(addAxiom1);
// Now we want to add the other facts/assertions to the ontology John
// hasSon Bill Get a refernece to the hasSon property
OWLObjectProperty hasSon = factory.getOWLObjectProperty(IRI
.create(ontologyIRI + "#hasSon"));
// Create the assertion, John hasSon Bill
OWLAxiom axiom2 = factory.getOWLObjectPropertyAssertionAxiom(hasSon,
john, bill);
// Apply the change
manager.applyChange(new AddAxiom(ont, axiom2));
// John hasDaughter Susan
OWLObjectProperty hasDaughter = factory.getOWLObjectProperty(IRI
.create(ontologyIRI + "#hasDaughter"));
OWLAxiom axiom3 = factory.getOWLObjectPropertyAssertionAxiom(
hasDaughter, john, susan);
manager.applyChange(new AddAxiom(ont, axiom3));
// John hasAge 33 In this case, hasAge is a data property, which we need
// a reference to
OWLDataProperty hasAge = factory.getOWLDataProperty(IRI
.create(ontologyIRI + "#hasAge"));
// We create a data property assertion instead of an object property
// assertion
OWLAxiom axiom4 = factory.getOWLDataPropertyAssertionAxiom(hasAge,
john, 33);
manager.applyChange(new AddAxiom(ont, axiom4));
// In the above code, 33 is an integer, so we can just pass 33 into the
// data factory method. Behind the scenes the OWL API will create a
// typed constant that it will use as the value of the data property
// assertion. We could have manually created the constant as follows:
OWLDatatype intDatatype = factory.getIntegerOWLDatatype();