Package com.semedy.reasoner.symboltable
Interface ReasoningSymbolTable
- All Superinterfaces:
AutoCloseable,Closeable,Iterable<Object>,SymbolTable
- All Known Implementing Classes:
AbstractSymbolTable,MultiSymbolTable,ReasoningSymbolTableNotInternalize,ReasoningSymbolTableRAM,SymbolTableBplus,SymbolTableRAM
As an extension of the symbol table it provides methods for matching and substituting terms
-
Method Summary
Modifier and TypeMethodDescriptionCompile a non-ground user term into a non-ground internal term.booleanisCreatedDuringReasoning(long code) indicated for a code, that the corresponding symbol has been created during reasoningbooleanMatch returns for each variable v in t the symbol s v has to be substituted by.booleanmatchArguments(Object t, long[] groundtermarguments, long[] substitutions) Match returns for each variable v in t the symbol s v has to be substituted by to match the arguments of t
with groundtermarguments.longsubstitute(Object t, long[] substitutions) substitutes the variables in an internal term by the codes found in substitutions, internalizes the resulting term and returns the code of the term Attention: do not use this method with same object t in several threads in parallel, it is NOT threadsafe!long[]substituteArguments(Object t, long[] substitutions) substitutes the variables in a compound t by the codes found in substitutions, internalizes the resulting terms and returns the arguments of t.booleanUnifiable returns whether two structures are unifiable This method is cheaper than unify as it delivers no result substitutionsMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface com.semedy.reasoner.api.symboltable.SymbolTable
addSymbolTableIndex, checkSanity, clear, close, commit, createFunctionCode, decodeNonGroundFunction, delete, encode, encodeNotInternalize, encodeWOEncoding, flush, getCode, getExternalDataTypes, getFunctionCode, getFunctionEncoding, getGeoIndex, getTextIndex, getValue, getValueFunction, getValueSymbol, hasIndices, inTransaction, isBulkMode, isEmpty, iterator, lastModificationTime, matchArguments, notifySymbolAdded, recreateSymbolTableIndexes, refreshSearchIndexes, removeAllSymbolTableIndexes, removeNotInternalized, removeSymbolTableIndex, resetTransaction, rollback, setBulkMode, size, substitute, substitute, substituteArguments, transactionBegin, transactionCommit, transactionRollback, unify, unify
-
Method Details
-
createNonGroundFunction
Compile a non-ground user term into a non-ground internal term. This internal term is hidden. It should be used in the internal operations
created by a rule compiler. It must be used for matching operations and for substitution operations (see methods below)- Specified by:
createNonGroundFunctionin interfaceSymbolTable- Parameters:
t- , the user term- Returns:
- term (Function)
- Throws:
IOExceptionSemReasonerException
-
match
boolean match(Object t, long groundterm, long[] substitutions) throws IOException, SemReasonerException Match returns for each variable v in t the symbol s v has to be substituted by.
The result provides for variable position p the code of s.- Specified by:
matchin interfaceSymbolTable- Parameters:
t- , the entity (Variable, Function, Long, Literal)groundterm- , the code of the ground termsubstitutions- , the substitutions substitutions[variable position] is substituted term for variable- Returns:
- true, if match operation was successful
- Throws:
IOExceptionSemReasonerException
-
matchArguments
boolean matchArguments(Object t, long[] groundtermarguments, long[] substitutions) throws IOException, SemReasonerException Match returns for each variable v in t the symbol s v has to be substituted by to match the arguments of t
with groundtermarguments. The result provides for variable position p the code of s- Specified by:
matchArgumentsin interfaceSymbolTable- Parameters:
t- , the entity (Variable, Function, Long, Literal)groundtermarguments- , the codes of the arguments of the ground termsubstitutions- , the substitutions substitutions[variable position] is substituted term for variable- Returns:
- true, if match operation was successful
- Throws:
IOExceptionSemReasonerException
-
substitute
substitutes the variables in an internal term by the codes found in substitutions, internalizes the resulting term and returns the code of the term Attention: do not use this method with same object t in several threads in parallel, it is NOT threadsafe! If you want to do that you have to create a clone of t for every thread!- Specified by:
substitutein interfaceSymbolTable- Parameters:
t- , entity (Variable, Function, Long, Literal)substitutions-- Returns:
- Throws:
IOExceptionSemReasonerException
-
substituteArguments
substitutes the variables in a compound t by the codes found in substitutions, internalizes the resulting terms and returns the arguments of t. Attention: do not use this method with same object t in several threads in parallel, it is NOT threadsafe! If you want to do that you have to create a clone of t for every thread!- Specified by:
substituteArgumentsin interfaceSymbolTable- Parameters:
t- , entity (Variable, Function, Long, Literal)substitutions-- Returns:
- Throws:
IOExceptionSemReasonerException
-
unifiable
Unifiable returns whether two structures are unifiable This method is cheaper than unify as it delivers no result substitutions- Specified by:
unifiablein interfaceSymbolTable- Parameters:
t- , the first entity (Variable, Function, Long, Literal)f- , the second entity (Variable, Function, Long, Literal)- Returns:
- true, if unifiable operation was successful
- Throws:
IOExceptionSemReasonerException
-
isCreatedDuringReasoning
boolean isCreatedDuringReasoning(long code) indicated for a code, that the corresponding symbol has been created during reasoning- Parameters:
code-- Returns:
-