Class AbstractAtomSet
java.lang.Object
fr.lirmm.graphik.integraal.core.atomset.AbstractAtomSet
- All Implemented Interfaces:
AtomSet, CloseableIterable<Atom>
- Direct Known Subclasses:
AbstractImmutableAtomSet, AbstractInMemoryAtomSet
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates an abstract atom set base implementation. -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds all atoms from the specified atom set.booleanaddAll(CloseableIterator<? extends Atom> it) Add the specified atom stream to this atom set.Returns an iterator over all constants in this atom set.booleanReturns true if this atom set contains the specified atom.booleanCompares this atom set with another one by checking mutual containment.booleanReturns a Set of all constants in this atom set.Returns a Set of all literals in this atom set.Returns a Set of all predicates in this atom set.getTerms()Returns a Set of all terms in this atom set.Deprecated.Returns a Set of all variables in this atom set.booleanisEmpty()Returns whether this atom set contains no atom.booleanisSubSetOf(AtomSet atomset) Deprecated.Returns an iterator over all literals in this atom set.Returns an iterator over atoms that match predicate and constants from the specified atom.booleanRemove the specified atom from this this atom set.booleanRemoves all atoms contained in the specified atom set.booleanremoveAll(CloseableIterator<? extends Atom> it) Remove the specified atom stream from this atom set.intsize()This default implementation should be overriden, it is convenient for in memory set, but will be inefficient in some case.toString()Returns an iterator over all variables in this atom set.Methods inherited from class Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface AtomSet
add, atomsByPredicate, atomsByTerm, clear, containsTerm, getFreshSymbolGenerator, iterator, match, predicatesIterator, removeWithoutCheck, termsByPredicatePosition, termsIterator, termsIterator
-
Constructor Details
-
AbstractAtomSet
protected AbstractAtomSet()Creates an abstract atom set base implementation.
-
-
Method Details
-
contains
Description copied from interface:AtomSetReturns true if this atom set contains the specified atom.- Specified by:
containsin interfaceAtomSet- Parameters:
atom- the atom to search for- Returns:
- true if this atom set contains the specified atom.
- Throws:
AtomSetException- if the lookup cannot be performed
-
addAll
Description copied from interface:AtomSetAdd the specified atom stream to this atom set.- Specified by:
addAllin interfaceAtomSet- Parameters:
it- the atom stream to add- Returns:
- true if this atomset changed as a result of the call.
- Throws:
AtomSetException- if the atoms cannot be added
-
addAll
Description copied from interface:AtomSetAdds all atoms from the specified atom set.- Specified by:
addAllin interfaceAtomSet- Parameters:
atomset- the atom set to add- Returns:
- true if this atomset changed as a result of the call.
- Throws:
AtomSetException- if the atoms cannot be added
-
removeAll
Description copied from interface:AtomSetRemove the specified atom stream from this atom set.- Specified by:
removeAllin interfaceAtomSet- Parameters:
it- the atom stream to be removed- Returns:
- true if this atomset changed as a result of the call. In many implementations, the return value is only true since it's time consuming to test the effective modification of the store (e.g. RDBMS, RDF4J...)
- Throws:
AtomSetException- if the atoms cannot be removed
-
remove
Description copied from interface:AtomSetRemove the specified atom from this this atom set.- Specified by:
removein interfaceAtomSet- Parameters:
atom- the atom to be removed- Returns:
- true if this atom set contained the specified atom.
- Throws:
AtomSetException- if the atom cannot be removed
-
removeAll
Description copied from interface:AtomSetRemoves all atoms contained in the specified atom set.- Specified by:
removeAllin interfaceAtomSet- Parameters:
atomset- the atoms to remove- Returns:
- true if this atom set changed as a result of the call
- Throws:
AtomSetException- if the atoms cannot be removed
-
match
Description copied from interface:AtomSetReturns an iterator over atoms that match predicate and constants from the specified atom.- Specified by:
matchin interfaceAtomSet- Parameters:
atom- the atom pattern to match- Returns:
- an iterator over atoms.
- Throws:
AtomSetException- if the match operation fails
-
getTerms
Description copied from interface:AtomSetReturns a Set of all terms in this atom set.- Specified by:
getTermsin interfaceAtomSet- Returns:
- a Set of all terms.
- Throws:
AtomSetException- if the term collection cannot be computed
-
getVariables
Description copied from interface:AtomSetReturns a Set of all variables in this atom set.- Specified by:
getVariablesin interfaceAtomSet- Returns:
- a Set of all variables.
- Throws:
AtomSetException- if the variable collection cannot be computed
-
getConstants
Description copied from interface:AtomSetReturns a Set of all constants in this atom set.- Specified by:
getConstantsin interfaceAtomSet- Returns:
- a Set of all constants.
- Throws:
AtomSetException- if the constant collection cannot be computed
-
getLiterals
Description copied from interface:AtomSetReturns a Set of all literals in this atom set.- Specified by:
getLiteralsin interfaceAtomSet- Returns:
- a Set of all literals.
- Throws:
AtomSetException- if the literal collection cannot be computed
-
variablesIterator
Description copied from interface:AtomSetReturns an iterator over all variables in this atom set. Each term is iterated only once time.- Specified by:
variablesIteratorin interfaceAtomSet- Returns:
- an iterator over all variables.
- Throws:
AtomSetException- if the iterator cannot be produced
-
constantsIterator
Description copied from interface:AtomSetReturns an iterator over all constants in this atom set. Each term is iterated only once time.- Specified by:
constantsIteratorin interfaceAtomSet- Returns:
- an iterator over all constants.
- Throws:
AtomSetException- if the iterator cannot be produced
-
literalsIterator
Description copied from interface:AtomSetReturns an iterator over all literals in this atom set. Each term is iterated only once time.- Specified by:
literalsIteratorin interfaceAtomSet- Returns:
- an iterator over all literals.
- Throws:
AtomSetException- if the iterator cannot be produced
-
getTerms
Deprecated.Description copied from interface:AtomSetThis method is deprecated since 1.3, useAtomSet.getVariables(),AtomSet.getConstants()orAtomSet.getLiterals()instead.
Returns a Set of all terms of the specified type in this atom set.- Specified by:
getTermsin interfaceAtomSet- Parameters:
type- the term type to filter on- Returns:
- a collection of all terms of the specified type in this atom set.
- Throws:
AtomSetException- if the term collection cannot be computed
-
getPredicates
Description copied from interface:AtomSetReturns a Set of all predicates in this atom set.- Specified by:
getPredicatesin interfaceAtomSet- Returns:
- a Set of all predicates.
- Throws:
AtomSetException- if the predicate collection cannot be computed
-
isSubSetOf
Deprecated.Description copied from interface:AtomSetUse AtomSets.contains instead. Check if all atoms of this AtomSet are also contained in the specified AtomSet.- Specified by:
isSubSetOfin interfaceAtomSet- Parameters:
atomset- the candidate superset- Returns:
- true if all atoms of this AtomSet are also contained in the specified atomset, false otherwise.
- Throws:
AtomSetException- if the subset test cannot be performed
-
size
This default implementation should be overriden, it is convenient for in memory set, but will be inefficient in some case.- Specified by:
sizein interfaceAtomSet- Returns:
- the number of atoms in the set
- Throws:
AtomSetException- if the size cannot be computed- See Also:
-
isEmpty
Description copied from interface:AtomSetReturns whether this atom set contains no atom.- Specified by:
isEmptyin interfaceAtomSet- Returns:
- true if this atom set is empty, false otherwise.
- Throws:
AtomSetException- if the emptiness check cannot be performed
-
equals
-
equals
Compares this atom set with another one by checking mutual containment.- Parameters:
other- the other atom set to compare with- Returns:
- true if both atom sets contain the same atoms
-
toString
-