// convenience methods to do this
OWLFacetRestriction lt20 = factory.getOWLFacetRestriction(
MAX_EXCLUSIVE, 20);
// Restrict the base type, integer (which is just an XML Schema
// Datatype) with the facet restrictions.
OWLDataRange dataRng = factory.getOWLDatatypeRestriction(
integerDatatype, geq13, lt20);
// Now we have the data range of greater than equal to 13 and less than
// 20 we can use this in a restriction.
OWLDataSomeValuesFrom teenagerAgeRestriction = factory
.getOWLDataSomeValuesFrom(hasAge, dataRng);
// Now make Teenager equivalent to Person and hasAge some int[>=13, <20]
// First create the class Person and hasAge some int[>=13, <20]
OWLClassExpression teenagePerson = factory.getOWLObjectIntersectionOf(
person, teenagerAgeRestriction);
OWLClass teenager = factory.getOWLClass(IRI.create(ontologyIRI
+ "#Teenager"));
OWLEquivalentClassesAxiom teenagerDefinition = factory
.getOWLEquivalentClassesAxiom(teenager, teenagePerson);
manager.addAxiom(ont, teenagerDefinition);
// Do the same for Adult that has an age greater than 21
OWLDataRange geq21 = factory.getOWLDatatypeRestriction(integerDatatype,
factory.getOWLFacetRestriction(MIN_INCLUSIVE, 21));
OWLClass adult = factory
.getOWLClass(IRI.create(ontologyIRI + "#Adult"));
OWLClassExpression adultAgeRestriction = factory
.getOWLDataSomeValuesFrom(hasAge, geq21);
OWLClassExpression adultPerson = factory.getOWLObjectIntersectionOf(
person, adultAgeRestriction);
OWLAxiom adultDefinition = factory.getOWLEquivalentClassesAxiom(adult,
adultPerson);
manager.addAxiom(ont, adultDefinition);
// And finally Child
OWLDataRange notGeq21 = factory.getOWLDataComplementOf(geq21);
OWLClass child = factory
.getOWLClass(IRI.create(ontologyIRI + "#Child"));
OWLClassExpression childAgeRestriction = factory
.getOWLDataSomeValuesFrom(hasAge, notGeq21);
OWLClassExpression childPerson = factory.getOWLObjectIntersectionOf(