|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectubiware.core.ReusableAtomicBehavior
public abstract class ReusableAtomicBehavior
ReusableAtomicBehavior provides a base class for all behaviours which this agent is running. These behaviours are normally
instantiated by the UbiwareAgent live cycle. The behaviour implements a function for the agent. Note: when using
addBeliefsN3, removeBeliefsN3, and hasBeliefsN3 with String arguments, one must either use the full URIs or include needed @prefix
statements into the Notation3 string.
| Field Summary | |
|---|---|
protected boolean |
finished
Is this RAB finished? Should it still run? Since every RAB is by default a one shot behavior, initially set to true. |
(package private) java.lang.String |
ID
The ID of this RAB. |
(package private) java.util.Set<java.lang.String> |
linkedContexts
If I understand correctly, the linkedcontexts keeps IDs of contexts which are referenced from inside the rab in order to prevent removal by the Ubiware Agent |
protected UbiwareAgent |
myAgent
Deprecated. This reference is deprecated since RAB's should not depend directly on the implementation of the agent for functionality. |
| Constructor Summary | |
|---|---|
ReusableAtomicBehavior()
Every RAB must have at least a default constructor. |
|
| Method Summary | |
|---|---|
(package private) void |
action()
This method is called by the agent when this RAB must perform its action. |
void |
addBeliefs(java.lang.String contextOrStatementID,
java.util.HashMap<java.lang.String,java.lang.String> vars)
Deprecated. Use the version with S-APL document if possible! |
void |
addBeliefsN3(ubiware.util.saplbuilder.SaplDocument document)
This is the advised way to add S-APL beliefs to the agent. |
boolean |
addBeliefsN3(java.lang.String n3string)
Deprecated. use addBeliefsN3(SaplDocument) instead for type safety |
boolean |
addBeliefsN3(java.lang.String n3string,
boolean doChecks)
Deprecated. use addBeliefsN3(SaplDocument) instead for type safety |
protected void |
addCommand(UbiwareAgentCommand<?> command)
|
ubiware.util.saplbuilder.Resource |
addOnBlackboard(java.lang.Object o)
Add an object to blackboard, return the ID of the created object |
void |
block()
Blocks this behaviour. |
void |
block(long millis)
Blocks this behaviour the specified amount of time. |
protected abstract void |
doAction()
Derived RAB's should implement this method and do their action within it. |
boolean |
done()
|
boolean |
equals(java.lang.Object obj)
Two rab's are only equal if they are the same RAB! |
void |
eraseBeliefs(java.lang.String beliefID)
Erases a statement or a context specified by its ID.: ID can be of a context or a statement |
java.lang.Object |
getFromBlackboard(ubiware.util.saplbuilder.Resource id)
returns an object from blackboard of the UbiwareAgent |
java.util.List<SemanticStatement> |
getStatements(java.lang.String contextID)
Returns the vector of copies of statements in a context container. |
java.util.List<SemanticStatement> |
getStatements(java.lang.String contextID,
java.util.List<java.lang.String> ids)
returns the vector of copies of statements in a context container (+ a fills a vector of their original IDs) |
boolean |
hasBeenExecuted()
Has this RAB been executed at least once? |
BindingsSet |
hasBeliefs(java.lang.String statementID)
Same as hasBeliefs(String, String) with queryContextID set to UbiwareAgent.GENERAL_CONTEXT |
BindingsSet |
hasBeliefs(java.lang.String contextOrStatementID,
java.lang.String queryContextID)
returns possible bindings of variables to beliefs given (with ID can be of a context or a statement) |
BindingsSet |
hasBeliefsN3(ubiware.util.saplbuilder.SaplDocument document)
Returns all possible bindings of variables (from the agents global context G) to the query specified in the S-APL document Returns possible solutions (combinations of bindings of variables) to match beliefs specified in an S-APL (Notation3) string. |
BindingsSet |
hasBeliefsN3(ubiware.util.saplbuilder.SaplDocument document,
java.lang.String queryContextID)
Returns all possible bindings of variables (from the specified queryContext) to the query specified in the S-APL document |
BindingsSet |
hasBeliefsN3(java.lang.String n3string)
Deprecated. Use hasBeliefsN3(SaplDocument, String) instead |
BindingsSet |
hasBeliefsN3(java.lang.String n3string,
java.lang.String queryContextID)
Deprecated. Use hasBeliefsN3(SaplDocument, String) instead |
int |
hashCode()
|
boolean |
hasSucceededTillNow()
returns true iff the RAB has succeeded in its operation up to this point. |
protected abstract void |
initializeRAB(BehaviorStartParameters parameters)
Derived RAB's should implement this method and initialise all the needed parameters to run the RAB. |
void |
moveBeliefs(java.lang.String contextID)
moves all links from a context to General Context and removes the former context |
(package private) int |
onEnd()
Callled by the ubiware agent when this RAB ends, calls in turn onRABEnd |
void |
onRABEnd()
Method called once when this RAB is ended. |
(package private) void |
onStart()
callled by the ubiware agent when this RAB starts, calls in turn this #onRABStart() and this
initializeRAB(BehaviorStartParameters) |
void |
print(java.lang.Object text)
Prints to the screen (and to the log) specified text. |
protected void |
printError(java.lang.String message)
Forwards the message this.getClass().getName() + "error: " + message to print(Object) |
java.lang.String |
produceN3(java.lang.String contextID)
Deprecated. use the version which returns a document instead. |
java.lang.String |
produceN3(java.lang.String contextID,
ProduceN3Options options)
Deprecated. use the version which returns a document instead. |
ubiware.util.saplbuilder.SaplDocument |
produceN3Document(java.lang.String contextID)
|
ubiware.util.saplbuilder.SaplDocument |
produceN3Document(java.lang.String contextID,
ProduceN3Options options)
* Returns an S-APL (Notation3) string corresponding to a sub-graph starting with context container given. |
void |
removeBeliefs(java.lang.String beliefID)
Deprecated. Use the version with S-APL document if possible! |
void |
removeBeliefsN3(ubiware.util.saplbuilder.SaplDocument document)
Remove beliefs according to pattern specified in a S-APL document |
void |
removeBeliefsN3(java.lang.String n3string)
Deprecated. Use removeBeliefsN3(SaplDocument) instead |
void |
removeFromBlackboard(ubiware.util.saplbuilder.Resource id)
Removes an object from blackboard. |
void |
restart()
Restarts a blocked behaviour. |
protected void |
sendMessage(int performative,
ubiware.util.saplbuilder.Resource receiver,
ubiware.util.saplbuilder.SaplDocument messageContent,
java.lang.String ontology,
java.lang.String conversationID)
|
protected void |
sendMessage(int performative,
ubiware.util.saplbuilder.Resource receiver,
java.lang.String messageContent,
java.lang.String ontology,
java.lang.String conversationID)
Deprecated. Use the version with sapl document instead. |
(package private) void |
setAgent(UbiwareAgent agent)
Set the agent which is executing this RAB. |
(package private) void |
setEncapsulatingBehavior(jade.core.behaviours.Behaviour behavior)
Set the behavior which encapsulates this RAB. |
void |
setFailed()
Marks this RAB as being failed, this used to be done by setting the success flag to false ( this.success = false) This
new approach must ensure that once the RAB has been marked as failed, it cannot be marked as a success again. |
void |
setStartParameters(BehaviorStartParameters startParams)
Set the start parameters for this behavior. |
void |
wakeAgent()
Informs the agent that it must wake up its Live behavior to check whether new rules became applicable. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean finished
@Deprecated protected UbiwareAgent myAgent
java.lang.String ID
java.util.Set<java.lang.String> linkedContexts
| Constructor Detail |
|---|
public ReusableAtomicBehavior()
| Method Detail |
|---|
final void action()
protected abstract void doAction()
throws java.lang.Exception
initializeRAB(BehaviorStartParameters)
java.lang.Exceptionfinal void setAgent(UbiwareAgent agent)
agent - final void setEncapsulatingBehavior(jade.core.behaviours.Behaviour behavior)
behavior - public final void setFailed()
this.success = false) This
new approach must ensure that once the RAB has been marked as failed, it cannot be marked as a success again. (The flag can only be
set, not unset)
public final boolean hasSucceededTillNow()
public final void block()
public final void block(long millis)
millis - How many milliseconds should this behavior be blocked.public final void restart()
public final void setStartParameters(BehaviorStartParameters startParams)
setStartParameters in interface ParametrizedAssetstartParams - the parameters.final void onStart()
#onRABStart() and this
initializeRAB(BehaviorStartParameters)
protected abstract void initializeRAB(BehaviorStartParameters parameters)
throws IllegalParameterConfigurationException
parameters - The parameters specified by the user of this RAB.
IllegalParameterConfigurationException - If one of the parameters isn't correctly given.final int onEnd()
public void onRABEnd()
public final boolean done()
public void print(java.lang.Object text)
text - The Object from which the text must be made (using Object.toString())public final void wakeAgent()
@Deprecated
public final void addBeliefs(java.lang.String contextOrStatementID,
java.util.HashMap<java.lang.String,java.lang.String> vars)
contextOrStatementID - the the statement or context which should be copiedvars - The variable association which should be used in the copy action.
@Deprecated
public final boolean addBeliefsN3(java.lang.String n3string,
boolean doChecks)
addBeliefsN3(SaplDocument) instead for type safety
n3string - the S-APL string which must be added to the agent.doChecks - should checks be performed for joining containers
@Deprecated public final boolean addBeliefsN3(java.lang.String n3string)
addBeliefsN3(SaplDocument) instead for type safety
addBeliefsN3(String, boolean) with doChecks set to true
n3string - The string of S-APL which should get added to the agent's beliefs structure.
public final void addBeliefsN3(ubiware.util.saplbuilder.SaplDocument document)
document - The S-APL beliefs' structure which should be added to the agent.@Deprecated public final void removeBeliefs(java.lang.String beliefID)
beliefID - the ID of the context or statement specifying the beliefs to be removed.@Deprecated public final void removeBeliefsN3(java.lang.String n3string)
removeBeliefsN3(SaplDocument) instead
n3string - The String containing the S-APL code to be added to the agent.public final void removeBeliefsN3(ubiware.util.saplbuilder.SaplDocument document)
document - The document containing the S-APL pattern to be removed to the agent.public final void eraseBeliefs(java.lang.String beliefID)
beliefID -
public final BindingsSet hasBeliefs(java.lang.String contextOrStatementID,
java.lang.String queryContextID)
contextOrStatementID - queryContextID -
public final BindingsSet hasBeliefs(java.lang.String statementID)
hasBeliefs(String, String) with queryContextID set to UbiwareAgent.GENERAL_CONTEXT
statementID -
public final BindingsSet hasBeliefsN3(ubiware.util.saplbuilder.SaplDocument document,
java.lang.String queryContextID)
document - The document containing the queryqueryContextID - The context into which matches to the query must be searched.
BindingsSet containing all possible bindings to the variables specified.public final BindingsSet hasBeliefsN3(ubiware.util.saplbuilder.SaplDocument document)
document - The document containing the query
BindingsSet containing all possible bindings to the variables specified.
@Deprecated
public final BindingsSet hasBeliefsN3(java.lang.String n3string,
java.lang.String queryContextID)
hasBeliefsN3(SaplDocument, String) instead
n3string - The String containing the queryqueryContextID - The context into which matches to the query must be searched.
BindingsSet containing all possible bindings to the variables specified.@Deprecated public final BindingsSet hasBeliefsN3(java.lang.String n3string)
hasBeliefsN3(SaplDocument, String) instead
n3string - The String containing the query
BindingsSet containing all possible bindings to the variables specified.public final void moveBeliefs(java.lang.String contextID)
contextID - @Deprecated public final java.lang.String produceN3(java.lang.String contextID)
produceN3(String, ProduceN3Options) with the default options.
contextID - The context for which S-APL must be generated.
@Deprecated
public final java.lang.String produceN3(java.lang.String contextID,
ProduceN3Options options)
contextID - The context ID for which N3 must be produced.options - The options for production.
public final ubiware.util.saplbuilder.SaplDocument produceN3Document(java.lang.String contextID)
public final ubiware.util.saplbuilder.SaplDocument produceN3Document(java.lang.String contextID,
ProduceN3Options options)
contextID - The context ID for which N3 must be produced.options - The options for production.
public final java.util.List<SemanticStatement> getStatements(java.lang.String contextID,
java.util.List<java.lang.String> ids)
contextID - the context which should be copied.ids - This is an in-out parameter! To this list, the IDs of the original statements will be added.
public final java.util.List<SemanticStatement> getStatements(java.lang.String contextID)
contextID - The context ID which should eb copied.
public final ubiware.util.saplbuilder.Resource addOnBlackboard(java.lang.Object o)
o - the Object which should be put on the Blackboard of the UbiwareAgent
public final void removeFromBlackboard(ubiware.util.saplbuilder.Resource id)
id - The ID of the Blackboard objectpublic final java.lang.Object getFromBlackboard(ubiware.util.saplbuilder.Resource id)
UbiwareAgent
id - the id of the Blackboard object
public final boolean hasBeenExecuted()
public int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()public boolean equals(java.lang.Object obj)
equals in class java.lang.ObjectObject.equals(java.lang.Object)protected final void printError(java.lang.String message)
print(Object)
protected void sendMessage(int performative,
ubiware.util.saplbuilder.Resource receiver,
ubiware.util.saplbuilder.SaplDocument messageContent,
java.lang.String ontology,
java.lang.String conversationID)
@Deprecated
protected void sendMessage(int performative,
ubiware.util.saplbuilder.Resource receiver,
java.lang.String messageContent,
java.lang.String ontology,
java.lang.String conversationID)
performative - receiver - messageContent - ontology - conversationID - protected void addCommand(UbiwareAgentCommand<?> command)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||