public static Properties singleton(final String key, final String value) { return new PropertiesBuilder().set(key, value).build(); } }
@Before public void setUp() { final Properties newOptions = PropertiesBuilder.singleton("USE_ANNOTATION_SUPPORT", "true"); savedOptions = OpenlletOptions.setOptions(newOptions); }
@BeforeClass public static void enableTracing() { final Properties newOptions = PropertiesBuilder.singleton("USE_TRACING", "true"); oldOptions = OpenlletOptions.setOptions(newOptions); }
public static Properties singleton(final String key, final String value) { return new PropertiesBuilder().set(key, value).build(); } }
final Properties newOptions = PropertiesBuilder.singleton("USE_TRACING", "true"); final Properties savedOptions = OpenlletOptions.setOptions(newOptions);
public IncJenaConsistencyTests(final boolean ucq, final boolean uic, final boolean uid) { final PropertiesBuilder pb = new PropertiesBuilder(); pb.set("USE_COMPLETION_QUEUE", String.valueOf(ucq)); pb.set("USE_INCREMENTAL_CONSISTENCY", String.valueOf(uic)); pb.set("USE_INCREMENTAL_DELETION", String.valueOf(uid)); _newOptions = pb.build(); }
final Properties newOptions = PropertiesBuilder.singleton("USE_TRACING", "true"); final Properties savedOptions = OpenlletOptions.setOptions(newOptions);
/** * Tests whether PelletOptions.DISABLE_EL_CLASSIFIER can be properly read from a properties file */ @Test public void testDisableELClassifierOptionRead() { Properties newOptions = new PropertiesBuilder().set("DISABLE_EL_CLASSIFIER", "true").build(); final Properties savedOptions = OpenlletOptions.setOptions(newOptions); try { assertTrue(OpenlletOptions.DISABLE_EL_CLASSIFIER); newOptions = new PropertiesBuilder().set("DISABLE_EL_CLASSIFIER", "false").build(); OpenlletOptions.setOptions(newOptions); assertFalse(OpenlletOptions.DISABLE_EL_CLASSIFIER); } finally { OpenlletOptions.setOptions(savedOptions); } }
final Properties newOptions = PropertiesBuilder.singleton("USE_TRACING", "true"); final Properties savedOptions = OpenlletOptions.setOptions(newOptions);
@Test public void testIncrementalTBoxDisjointRemove6() { // test that a disjoint axiom absorbed into range axiom cannot // be removed final Properties newOptions = new PropertiesBuilder().set("USE_TRACING", "true").set("USE_ROLE_ABSORPTION", "true").build(); final Properties savedOptions = OpenlletOptions.setOptions(newOptions); try { final ATermAppl A = ATermUtils.makeTermAppl("A"); final ATermAppl p = ATermUtils.makeTermAppl("p"); final KnowledgeBase kb = new KnowledgeBaseImpl(); kb.addClass(A); kb.addObjectProperty(p); kb.addSubClass(TOP, all(p, A)); final Role r = kb.getRole(p); assertTrue(kb.isConsistent()); assertTrue(r.getRanges().contains(A)); assertFalse(kb.removeAxiom(ATermUtils.makeSub(TOP, all(p, A)))); } finally { OpenlletOptions.setOptions(savedOptions); } }
private void testAutoRealize(final boolean autoRealize) final Properties newOptions = PropertiesBuilder.singleton("AUTO_REALIZE", String.valueOf(autoRealize)); final Properties oldOptions = OpenlletOptions.setOptions(newOptions);
@Test public void testCRonDTP() { // Test for ticket #143 final Properties newOptions = new PropertiesBuilder().set("SILENT_UNDEFINED_ENTITY_HANDLING", "false").build(); final Properties savedOptions = OpenlletOptions.setOptions(newOptions); try { final KnowledgeBase kb = new KnowledgeBaseImpl(); final ATermAppl p = term("p"); final ATermAppl c = and(all(p, value(literal("s"))), min(p, 2, value(literal("l")))); kb.addDatatypeProperty(p); assertFalse(kb.isSatisfiable(c)); } finally { OpenlletOptions.setOptions(savedOptions); } }
private static void testAutoRealize(final boolean autoRealize) { final Properties newOptions = PropertiesBuilder.singleton("AUTO_REALIZE", String.valueOf(autoRealize)); final Properties oldOptions = OpenlletOptions.setOptions(newOptions); try { final String ns = "urn:test:"; final Resource a = ResourceFactory.createResource(ns + "a"); final Resource b = ResourceFactory.createResource(ns + "b"); final Resource A = ResourceFactory.createResource(ns + "A"); final Resource B = ResourceFactory.createResource(ns + "B"); final Resource C = ResourceFactory.createResource(ns + "C"); final Model m = ModelFactory.createDefaultModel(); m.add(A, RDFS.subClassOf, C); m.add(B, RDFS.subClassOf, A); m.add(a, RDF.type, A); m.add(b, RDF.type, B); final OntModel model = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC, m); assertIteratorValues(model.listObjectsOfProperty(a, RDF.type), A, C, OWL.Thing); assertIteratorValues(model.getIndividual(b.getURI()).listRDFTypes(true), B); } finally { OpenlletOptions.setOptions(oldOptions); } }
@Test public void testIncrementalTBoxDisjointRemove5() { // Same as testIncrementalTBoxDisjointRemove4 but // uses n-ary disjointness axioms final Properties newOptions = new PropertiesBuilder().set("USE_TRACING", "true").set("USE_ROLE_ABSORPTION", "true").build(); final Properties savedOptions = OpenlletOptions.setOptions(newOptions); try { final ATermAppl A = ATermUtils.makeTermAppl("A"); final ATermAppl B = ATermUtils.makeTermAppl("B"); final ATermAppl p = ATermUtils.makeTermAppl("p"); final KnowledgeBase kb = new KnowledgeBaseImpl(); kb.addClass(A); kb.addClass(B); kb.addObjectProperty(p); final ATermAppl or1 = or(A, some(p, A)); final ATermAppl or2 = or(B, some(p, B)); kb.addDisjointClass(or1, or2); assertTrue(kb.isConsistent()); final ATermAppl disjoint = ATermUtils.makeDisjoint(or1, or2); assertFalse(kb.removeAxiom(disjoint)); } finally { OpenlletOptions.setOptions(savedOptions); } }
@Test // This tests ticket 148 // Canceling realization with REALIZE_BY_INDIVIDUAL=false throws an NPE public void testRealizeByIndividualsNPE() { final Properties newOptions = PropertiesBuilder.singleton("REALIZE_INDIVIDUAL_AT_A_TIME", "true"); final Properties savedOptions = OpenlletOptions.setOptions(newOptions); try { final ProgressMonitor monitor = new TimedProgressMonitor(1); final OWLOntology ont = loadOntology(OWLManager.createOWLOntologyManager(), _base + "food.owl"); final OpenlletReasoner pellet = OpenlletReasonerFactory.getInstance().createReasoner(ont); final KnowledgeBase kb = pellet.getKB(); kb.classify(); kb.getTaxonomyBuilder().setProgressMonitor(monitor); kb.realize(); assertFalse(kb.isRealized()); } finally { OpenlletOptions.setOptions(savedOptions); } }
@Test public void testIncrementalTBoxDisjointRemove4() { // test that a disjoint axiom absorbed into domain axiom cannot // be removed final Properties newOptions = new PropertiesBuilder().set("USE_TRACING", "true").set("USE_ROLE_ABSORPTION", "true").build(); final Properties savedOptions = OpenlletOptions.setOptions(newOptions); try { final ATermAppl A = ATermUtils.makeTermAppl("A"); final ATermAppl B = ATermUtils.makeTermAppl("B"); final ATermAppl p = ATermUtils.makeTermAppl("p"); final KnowledgeBase kb = new KnowledgeBaseImpl(); kb.addClass(A); kb.addClass(B); kb.addObjectProperty(p); final ATermAppl or1 = or(A, some(p, A)); final ATermAppl or2 = or(B, some(p, B)); final ATermList list = ATermUtils.toSet(new ATerm[] { or1, or2 }, 2); kb.addDisjointClasses(list); assertTrue(kb.isConsistent()); final ATermAppl disjoint = ATermUtils.makeDisjoints(list); assertFalse(kb.removeAxiom(disjoint)); } finally { OpenlletOptions.setOptions(savedOptions); } }
@Test public void testRemoveIndividual() { final Properties newOptions = PropertiesBuilder.singleton("PROCESS_JENA_UPDATES_INCREMENTALLY", "false"); final Properties oldOptions = OpenlletOptions.setOptions(newOptions); try { final String ns = "http://www.example.org/test#"; final OntModel model = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC); final Resource C = model.createClass(ns + "C"); final Property p = model.createObjectProperty(ns + "p"); final Resource i1 = model.createResource(ns + "i1"); final Resource i2 = model.createResource(ns + "i2"); model.add(i1, RDF.type, C); model.add(i1, p, i2); // check consistency model.prepare(); model.remove(i1, p, i2); assertTrue(model.contains(i1, RDF.type, OWL.Thing)); assertFalse(model.contains(i2, RDF.type, OWL.Thing)); model.remove(i1, RDF.type, C); assertFalse(model.contains(i1, RDF.type, OWL.Thing)); } finally { OpenlletOptions.setOptions(oldOptions); } }
@Test public void test485() { final Properties oldOptions = OpenlletOptions.setOptions(PropertiesBuilder.singleton("DISABLE_EL_CLASSIFIER", "true")); try { classes(_A, _B, _C); objectProperties(_p, _q); individuals(_a, _b); _kb.addSubClass(_B, _A); _kb.addSubClass(_C, _A); _kb.addDomain(_p, _B); _kb.addDomain(_q, _A); _kb.addType(_a, _A); _kb.addType(_b, _B); _kb.realize(); assertEquals(SetUtils.create(_A, _B, TOP), IteratorUtils.toSet(new FlattenningIterator<>(_kb.getSuperClasses(some(_p, TOP))))); assertEquals(SetUtils.create(_A, TOP), IteratorUtils.toSet(new FlattenningIterator<>(_kb.getSuperClasses(some(_q, TOP))))); } finally { OpenlletOptions.setOptions(oldOptions); } }