@Deprecated public static <T> Set<T> makeSet(final int size) { return SetUtils.create(size); }
@Deprecated public static <T> Set<T> makeSet(final Collection<? extends T> a) { return SetUtils.create(a); } }
@Deprecated public static <T> Set<T> makeSet() { return SetUtils.create(); }
@Deprecated public static <T> Set<T> makeSet(final Collection<? extends T> a) { return SetUtils.create(a); } }
/** * @param c1 A Collection of sets * @param c2 A Collection of sets * @return the union of two collections */ public static <T> Set<T> union(final Collection<? extends T> c1, final Collection<? extends T> c2) { final Set<T> set = create(); set.addAll(c1); set.addAll(c2); return set; }
public void addEquivalent(final T t) { if (_equivalents.size() < 2)// Equivalents of size [0, 1] are immutable collections. _equivalents = SetUtils.create(_equivalents); _equivalents.add(t); }
/** * @return the intersection of two collections * @param c1 A Collection of sets * @param c2 A Collection of sets */ public static <T> Set<T> intersection(final Collection<? extends T> c1, final Collection<? extends T> c2) { final Set<T> set = create(); set.addAll(c1); set.retainAll(c2); return set; }
/** * @param c1 A Collection of sets * @param c2 A Collection of sets * @return the union of two collections */ public static <T> Set<T> union(final Collection<? extends T> c1, final Collection<? extends T> c2) { final Set<T> set = create(); set.addAll(c1); set.addAll(c2); return set; }
public static <K, V> boolean add(final Map<K, Set<V>> map, final K key, final V value) { Set<V> values = map.get(key); if (values == null) { values = SetUtils.create(); map.put(key, values); } return values.add(value); }
public static <K, V> boolean addAll(final Map<K, Set<V>> map, final K key, final Collection<V> value) { Set<V> values = map.get(key); if (values == null) { values = SetUtils.create(); map.put(key, values); } return values.addAll(value); }
public ConceptInfo(final ATermAppl c, final boolean storeSuccessors, final boolean noTriggers) { _concept = c; _successors = storeSuccessors ? new MultiValueMap<>() : null; _predecessors.clear(); _triggers = noTriggers ? null : SetUtils.create(); }
private void absorbSubClass(final ATermAppl sub, final ATermAppl sup, final Set<ATermAppl> explanation) { _logger.fine(() -> "Absorb: subClassOf(" + ATermUtils.toString(sub) + ", " + ATermUtils.toString(sup) + ")"); final Set<ATermAppl> terms = SetUtils.create(); terms.add(nnf(sub)); terms.add(nnf(negate(sup))); absorbAxiom(terms, SetUtils.create(explanation)); }
private void absorbSubClass(final ATermAppl sub, final ATermAppl sup, final Set<ATermAppl> explanation) { _logger.fine(() -> "Absorb: subClassOf(" + ATermUtils.toString(sub) + ", " + ATermUtils.toString(sup) + ")"); final Set<ATermAppl> terms = SetUtils.create(); terms.add(nnf(sub)); terms.add(nnf(negate(sup))); absorbAxiom(terms, SetUtils.create(explanation)); }
@SafeVarargs final protected static <E extends OWLObject> void assertEquals(final NodeSet<E> actual, final Set<E>... expected) { final Set<Set<E>> expectedSet = SetUtils.create(expected); final Iterable<Node<E>> it = actual.nodes()::iterator; for (final Node<E> node : it) { final Set<E> entities = node.entities().collect(Collectors.toSet()); assertTrue("Unexpected value: " + entities + "\tremaing:{" + expectedSet + "}", expectedSet.remove(entities)); } assertTrue("Missing values: " + expectedSet, expectedSet.isEmpty()); }
@Test public void testEquivalentObjectPropertiesAxiom() { testExplanation(_factory.getOWLEquivalentObjectPropertiesAxiom(SetUtils.create(_op1, _op2))); }
@Test public void testIntersectionOf() { testConversion(_factory.getOWLObjectIntersectionOf(SetUtils.create(_c1, _c2))); }
@Test public void testEquivalentDataPropertiesAxiom() { testExplanation(_factory.getOWLEquivalentDataPropertiesAxiom(SetUtils.create(_dp1, _dp2))); }
@Test public void testDisjointWithSome2() { classes(_A, _B, _C, _D, _E, _F, _G); objectProperties(_p, _q, _r, _s); _kb.addSubClass(_A, some(_p, and(_B, _C))); _kb.addDisjointClass(_B, _C); final Taxonomy<ATermAppl> hierarchy = getHierarchy(); assertEquals(SetUtils.create(_A), hierarchy.getEquivalents(ATermUtils.BOTTOM)); }
@Test public void testDisjointRange() { classes(_A, _B, _C, _D, _E, _F, _G); objectProperties(_p, _q, _r, _s); _kb.addRange(_p, _C); _kb.addSubClass(_A, some(_p, _B)); _kb.addDisjointClass(_B, _C); final Taxonomy<ATermAppl> hierarchy = getHierarchy(); assertEquals(SetUtils.create(_A), hierarchy.getEquivalents(ATermUtils.BOTTOM)); }
@Test public void testDisjoint() { classes(_A, _B, _C, _D, _E, _F, _G); objectProperties(_p, _q, _r, _s); _kb.addSubClass(and(_A, _B), ATermUtils.BOTTOM); _kb.addSubClass(_A, _B); _kb.addDisjointClass(_C, _D); _kb.addEquivalentClass(_C, _D); final Taxonomy<ATermAppl> hierarchy = getHierarchy(); assertEquals(SetUtils.create(_A, _C, _D), hierarchy.getEquivalents(ATermUtils.BOTTOM)); }