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.boolean
isCreatedDuringReasoning
(long code) indicated for a code, that the corresponding symbol has been created during reasoningboolean
Match returns for each variable v in t the symbol s v has to be substituted by.boolean
matchArguments
(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.long
substitute
(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.boolean
Unifiable 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, spliterator
Methods 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:
createNonGroundFunction
in interfaceSymbolTable
- Parameters:
t
- , the user term- Returns:
- term (Function)
- Throws:
IOException
SemReasonerException
-
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:
match
in 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:
IOException
SemReasonerException
-
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:
matchArguments
in 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:
IOException
SemReasonerException
-
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:
substitute
in interfaceSymbolTable
- Parameters:
t
- , entity (Variable, Function, Long, Literal)substitutions
-- Returns:
- Throws:
IOException
SemReasonerException
-
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:
substituteArguments
in interfaceSymbolTable
- Parameters:
t
- , entity (Variable, Function, Long, Literal)substitutions
-- Returns:
- Throws:
IOException
SemReasonerException
-
unifiable
Unifiable returns whether two structures are unifiable This method is cheaper than unify as it delivers no result substitutions- Specified by:
unifiable
in 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:
IOException
SemReasonerException
-
isCreatedDuringReasoning
boolean isCreatedDuringReasoning(long code) indicated for a code, that the corresponding symbol has been created during reasoning- Parameters:
code
-- Returns:
-