private static OWLEntity createEntity(final String type, final String entityIRI) { if (CLASS_KEYWORD.equals(type)) return OWL.Class(entityIRI); else if (DATA_TYPE_KEYWORD.equals(type)) return OWL.Datatype(entityIRI); else if (INDIVIDUAL_KEYWORD.equals(type)) return OWL.Individual(entityIRI); else if (DATA_PROPERTY_KEYWORD.equals(type)) return OWL.DataProperty(entityIRI); else if (OBJECT_PROPERTY_KEYWORD.equals(type)) return OWL.ObjectProperty(entityIRI); throw new IllegalArgumentException("Unrecognized type of OWLEntity in module " + type); }
private static OWLEntity createEntity(final String type, final String entityIRI) { if (CLASS_KEYWORD.equals(type)) return OWL.Class(entityIRI); else if (DATA_TYPE_KEYWORD.equals(type)) return OWL.Datatype(entityIRI); else if (INDIVIDUAL_KEYWORD.equals(type)) return OWL.Individual(entityIRI); else if (DATA_PROPERTY_KEYWORD.equals(type)) return OWL.DataProperty(entityIRI); else if (OBJECT_PROPERTY_KEYWORD.equals(type)) return OWL.ObjectProperty(entityIRI); throw new IllegalArgumentException("Unrecognized type of OWLEntity in module " + type); }
@Test public void datatypeDefinition() { final OWLDatatype between5and10 = OWL.Datatype("between5and10"); final OWLDatatype between6and8 = OWL.Datatype("between6and8"); createReasoner(OWL.datatypeDefinition(between5and10, OWL.restrict(XSD.INTEGER, OWL.minInclusive(5), OWL.maxInclusive(10))), OWL.datatypeDefinition(between6and8, OWL.restrict(XSD.INTEGER, OWL.minInclusive(6), OWL.maxInclusive(8))), OWL.equivalentClasses(_A, OWL.some(_dp, between5and10)), OWL.equivalentClasses(_B, OWL.some(_dp, between6and8)), OWL.propertyAssertion(_a, _dp, OWL.constant(9)), OWL.propertyAssertion(_b, _dp, OWL.constant(7))); assertTrue(_reasoner.isEntailed(OWL.subClassOf(_B, _A))); assertTrue(_reasoner.isEntailed(OWL.classAssertion(_a, _A))); assertFalse(_reasoner.isEntailed(OWL.classAssertion(_a, _B))); assertTrue(_reasoner.isEntailed(OWL.classAssertion(_b, _A))); assertTrue(_reasoner.isEntailed(OWL.classAssertion(_b, _B))); }
@Before public void createEntities() { _A = OWL.Class(ontologyURI + "A"); _B = OWL.Class(ontologyURI + "B"); _C = OWL.Class(ontologyURI + "C"); _D = OWL.Class(ontologyURI + "D"); _E = OWL.Class(ontologyURI + "E"); _F = OWL.Class(ontologyURI + "F"); _p = OWL.ObjectProperty(ontologyURI + "p"); _q = OWL.ObjectProperty(ontologyURI + "q"); _r = OWL.ObjectProperty(ontologyURI + "r"); dp = OWL.DataProperty(ontologyURI + "dp"); dq = OWL.DataProperty(ontologyURI + "dq"); dr = OWL.DataProperty(ontologyURI + "dr"); _a = OWL.Individual(ontologyURI + "a"); _b = OWL.Individual(ontologyURI + "b"); _c = OWL.Individual(ontologyURI + "c"); _d = OWL.Individual(ontologyURI + "d"); _dt = OWL.Datatype(ontologyURI + "dt"); _anon1 = OWL.AnonymousIndividual("anon1"); _x = SWRL.variable(ontologyURI + "x"); _y = SWRL.variable(ontologyURI + "y"); _dx = SWRL.variable(ontologyURI + "dx"); }