Package com.semedy.reasoner.api.builtin
Class AbstractConnector
java.lang.Object
com.semedy.reasoner.api.builtin.AbstractConnector
- Direct Known Subclasses:
ReasonerConnector,SQLiteConnector
coordinates calls to connectors and performs constraint reasoning for connectors
- Author:
- angele
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidabstract Builtinclone the builtinbooleaneval()Create queries from available restrictions.voidcall back function.abstract String[]get descriptions for the different argumentsabstract intgetArity()get the arity of the builtinstatic List<AbstractConnector>get an instance from each connector type for evaluationabstract Stringget a description for the builtinabstract StringgetName()get the name of the builtinintgetType()get the type of the builtinlonggetUID()abstract longthe weight of the builtin.abstract voidinitialize the builtinvoidinput(long[] input) Feed the built-in with an input tuple.booleanisEvaluable(BitSet grounds, BitSet variableInstantiations, Object[] args) is builtin evaluable with a certain instantiation of variablesbooleanis it a builtin for internal use onlyabstract BitSetobjectGeneratingArguments(BitSet grounds, BitSet variableInstantiations, Object[] args) In which argument position are new objects createdbooleandoes the builtin read the symbol tablevoidsetProperties(Properties prp) set the sytem propertiesvoidsetSymbolTable(SymbolTable symbolTable) set the symbol tablevoidstart(BitSet grounds, BuiltinReceiver receiver) Start feeding the built-in with input values.voidstop()stop feeding the built-in with input valuesbooleandoes the builtin write into the symbol table
-
Constructor Details
-
AbstractConnector
public AbstractConnector()
-
-
Method Details
-
getNumberOfRestrictions
public int getNumberOfRestrictions() -
getConnectorInstances
get an instance from each connector type for evaluation- Returns:
-
writesSymbolTable
public boolean writesSymbolTable()Description copied from interface:Builtindoes the builtin write into the symbol table- Specified by:
writesSymbolTablein interfaceBuiltin- Returns:
- true if it writes to the symbol table
-
setProperties
Description copied from interface:Builtinset the sytem properties- Specified by:
setPropertiesin interfaceBuiltin- Parameters:
prp- , properties
-
setSymbolTable
Description copied from interface:Builtinset the symbol table- Specified by:
setSymbolTablein interfaceBuiltin- Parameters:
symbolTable- , the symbol table
-
readsSymbolTable
public boolean readsSymbolTable()Description copied from interface:Builtindoes the builtin read the symbol table- Specified by:
readsSymbolTablein interfaceBuiltin- Returns:
- true if it reads the symbol table
-
objectGeneratingArguments
public abstract BitSet objectGeneratingArguments(BitSet grounds, BitSet variableInstantiations, Object[] args) throws BuiltinException Description copied from interface:BuiltinIn which argument position are new objects created- Specified by:
objectGeneratingArgumentsin interfaceBuiltin- Parameters:
grounds- , ground argument positionsvariableInstantiations- , instantiated variablesargs- , arguments of the literal- Returns:
- each bit indicates the argument position where new objects are created
- Throws:
BuiltinException
-
isInternal
public boolean isInternal()Description copied from interface:Builtinis it a builtin for internal use only- Specified by:
isInternalin interfaceBuiltin- Returns:
-
isEvaluable
public boolean isEvaluable(BitSet grounds, BitSet variableInstantiations, Object[] args) throws BuiltinException Description copied from interface:Builtinis builtin evaluable with a certain instantiation of variables- Specified by:
isEvaluablein interfaceBuiltin- Parameters:
grounds- , which arguments are groundvariableInstantiations- , which variables are instantiatedargs- , the arguments- Returns:
- was it evaluable
- Throws:
BuiltinException
-
getType
Description copied from interface:Builtinget the type of the builtin -
init
Description copied from interface:Builtininitialize the builtin- Specified by:
initin interfaceBuiltin- Parameters:
args- , the builtin arguments- Throws:
InterruptedExceptionIOExceptionBuiltinException
-
getWeight
Description copied from interface:Builtinthe weight of the builtin. Determines when the builtin is executed in a rule -
getName
Description copied from interface:Builtinget the name of the builtin -
getDescription
Description copied from interface:Builtinget a description for the builtin- Specified by:
getDescriptionin interfaceBuiltin- Returns:
- a description of the built-in
-
getArity
public abstract int getArity()Description copied from interface:Builtinget the arity of the builtin -
getArgumentDescriptions
Description copied from interface:Builtinget descriptions for the different arguments- Specified by:
getArgumentDescriptionsin interfaceBuiltin- Returns:
- a description of the arguments of the built-in
-
evaluationFinished
Description copied from interface:Builtincall back function. Is called when the whole evaluation has been finished- Specified by:
evaluationFinishedin interfaceBuiltin- Throws:
BuiltinExceptionInterruptedException
-
cloneBuiltin
Description copied from interface:Builtinclone the builtin- Specified by:
cloneBuiltinin interfaceBuiltin- Returns:
- the cloned built-in
-
stop
public void stop() throws ReasoningException, InterruptedException, SemReasonerException, IOExceptionDescription copied from interface:Connectorstop feeding the built-in with input values- Specified by:
stopin interfaceConnector- Throws:
InterruptedExceptionSemReasonerExceptionIOExceptionReasoningException
-
start
public void start(BitSet grounds, BuiltinReceiver receiver) throws ReasoningException, InterruptedException, IOException Description copied from interface:ConnectorStart feeding the built-in with input values. Grounds indicates the ground arguments;
receiver catches the results of the evaluation- Specified by:
startin interfaceConnector- Parameters:
grounds- , the arguments which are groundreceiver- , the receiver receiving the results- Throws:
ReasoningExceptionInterruptedExceptionIOException
-
getUID
public long getUID() -
input
Description copied from interface:ConnectorFeed the built-in with an input tuple.
The built-in may produce at any time results,
may be during feeding or may be after calling stop- Specified by:
inputin interfaceConnector- Parameters:
input- encoded input tuple- Throws:
InterruptedExceptionIOExceptionSemReasonerException
-
eval
Create queries from available restrictions.
Check them against older queries for subsumption.
Execute queries.- Returns:
- Throws:
SemReasonerExceptionIOExceptionInterruptedException
-
clearData
public static void clearData()
-