@Override public synchronized void addSubProperty(final ATerm sub, final ATermAppl sup) { super.addSubProperty(sub, sup); }
@Override public synchronized void addSubProperty(final ATerm sub, final ATermAppl sup) { super.addSubProperty(sub, sup); }
@Test public void topEquivalent() { final KnowledgeBaseImpl kb = new KnowledgeBaseImpl(); final ATermAppl p = term("concrete"); final ATermAppl r = term("abstract"); final ATermAppl s = term("universal"); kb.addObjectProperty(p); kb.addObjectProperty(r); kb.addObjectProperty(s); kb.addSubProperty(p, r); kb.addSubProperty(r, s); assertTrue(kb.isSubPropertyOf(p, s)); assertTrue(kb.getSubProperties(s).contains(Collections.singleton(p))); kb.addEquivalentProperty(s, TOP_OBJECT_PROPERTY); assertTrue(kb.isSubPropertyOf(p, s)); assertTrue(kb.getSubProperties(s).contains(Collections.singleton(p))); }
@Before public void setUp() { _kb = new KnowledgeBaseImpl(); _x = new AtomIVariable("x"); _y = new AtomIVariable("y"); _z = new AtomDVariable("z"); _kb.addDatatypeProperty(dp1); _kb.addDatatypeProperty(dp2); _kb.addSubProperty(dp1, dp2); _kb.addIndividual(mary); _kb.addIndividual(robert); _kb.addIndividual(victor); _kb.addPropertyValue(dp1, mary, data1); _kb.addPropertyValue(dp2, mary, data2); _kb.addPropertyValue(dp1, robert, data2); _kb.addPropertyValue(dp1, robert, data3); _kb.addPropertyValue(dp2, victor, data4); }
@Test public void topObjectDisjoints() { final KnowledgeBaseImpl kb = new KnowledgeBaseImpl(); final ATermAppl p = term("p"); final ATermAppl subP = term("subP"); final ATermAppl q = term("q"); kb.addObjectProperty(p); kb.addObjectProperty(subP); kb.addObjectProperty(q); kb.addSubProperty(subP, p); kb.addDisjointProperty(p, q); kb.getRoleTaxonomy(true).getTop().print(); kb.getRoleTaxonomy(false).getTop().print(); assertTrue(kb.isDisjointProperty(BOTTOM_OBJECT_PROPERTY, TOP_OBJECT_PROPERTY)); assertTrue(kb.isDisjointProperty(TOP_OBJECT_PROPERTY, BOTTOM_OBJECT_PROPERTY)); assertEquals(singletonSets(BOTTOM_OBJECT_PROPERTY), kb.getDisjointProperties(TOP_OBJECT_PROPERTY)); assertEquals(singletonSets(BOTTOM_OBJECT_PROPERTY, TOP_OBJECT_PROPERTY, p, subP, q), kb.getDisjointProperties(BOTTOM_OBJECT_PROPERTY)); assertEquals(singletonSets(BOTTOM_OBJECT_PROPERTY, q), kb.getDisjointProperties(p)); assertEquals(singletonSets(BOTTOM_OBJECT_PROPERTY, p, subP), kb.getDisjointProperties(q)); assertEquals(singletonSets(BOTTOM_OBJECT_PROPERTY), kb.getDisjointProperties(TOP_OBJECT_PROPERTY, true)); assertEquals(singletonSets(TOP_OBJECT_PROPERTY), kb.getDisjointProperties(BOTTOM_OBJECT_PROPERTY, true)); assertEquals(singletonSets(q), kb.getDisjointProperties(p, true)); assertEquals(singletonSets(p), kb.getDisjointProperties(q, true)); }