+ "hasAge"));
// For completeness, we will make hasAge functional by adding an axiom
// to state this
OWLFunctionalDataPropertyAxiom funcAx = factory
.getOWLFunctionalDataPropertyAxiom(hasAge);
man.applyChange(new AddAxiom(ont, funcAx));
// Now create the data range which correponds to int greater than 18. To
// do this, we get hold of the int datatype and then restrict it with a
// minInclusive facet restriction.
OWLDatatype intDatatype = factory.getIntegerOWLDatatype();
// Create the value "18", which is an int.
OWLLiteral eighteenConstant = factory.getOWLLiteral(18);
// Now create our custom datarange, which is int greater than or equal
// to 18. To do this, we need the minInclusive facet
OWLFacet facet = MIN_INCLUSIVE;
// Create the restricted data range by applying the facet restriction
// with a value of 18 to int
OWLDataRange intGreaterThan18 = factory.getOWLDatatypeRestriction(
intDatatype, facet, eighteenConstant);
// Now we can use this in our datatype restriction on hasAge
OWLClassExpression thingsWithAgeGreaterOrEqualTo18 = factory
.getOWLDataSomeValuesFrom(hasAge, intGreaterThan18);
// Now we want to say all adults have an age that is greater or equal to
// 18 - i.e. Adult is a subclass of hasAge some int[>= 18] Obtain a
// reference to the Adult class
OWLClass adult = factory.getOWLClass(IRI.create(base + "#Adult"));
// Now make adult a subclass of the things that have an age greater to
// or equal to 18
OWLSubClassOfAxiom ax = factory.getOWLSubClassOfAxiom(adult,
thingsWithAgeGreaterOrEqualTo18);
// Add our axiom to the ontology
man.applyChange(new AddAxiom(ont, ax));
}