Class AlteriteModule
java.lang.Object
laas.openrobots.ontology.modules.alterite.AlteriteModule
- All Implemented Interfaces:
IEventConsumer
,IModule
,IServiceProvider
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addForAgent
(String id, Set<String> rawStmts) Add statements in a specific agent cognitive model.void
addForAgent
(String id, Set<String> rawStmts, String memProfile) Add statements in a specific agent cognitive model with a specific memory model.boolean
boolean
void
clearEvent
(String agent, String eventId) void
clearEventsForAgent
(String agent) void
clearForAgent
(String id, Set<String> rawStmts) void
close()
void
consumeEvent
(UUID watcherId, OroEvent e) discriminateForAgent
(String id, Set<String> rawConcepts) protected void
finalize()
findForAgent
(String id, String varName, Set<String> statements) getInfosForAgent
(String id, String lex_resource) Returns the set of asserted and inferred statements whose the given node is part of, in the specifi agent model.A null return is expected if the module doesn't provide any RPC service to register.lookupForAgent
(String agent_id, String id) registerEventForAgent
(String agent, String type, String triggeringType, String variable, List<String> pattern, IEventConsumer consumer) registerEventForAgent
(String agent, String type, String triggeringType, List<String> pattern, IEventConsumer consumer) Eventsvoid
removeForAgent
(String id, Set<String> rawStmts) Deprecated.void
Generic knowledge revision requestboolean
safeAddForAgent
(String id, Set<String> rawStmts) boolean
safeAddForAgent
(String id, Set<String> rawStmts, String memProfile) Adds statements in a specific agent cognitive model with a specific memory model, but only if the statement doesn't cause any inconsistency.void
void
step()
'Step' the module.void
updateForAgent
(String id, Set<String> rawStmts)
-
Constructor Details
-
AlteriteModule
public AlteriteModule(IOntologyBackend oro) throws EventRegistrationException, InvalidModelException -
AlteriteModule
public AlteriteModule(IOntologyBackend oro, Properties serverParameters) throws InvalidModelException - Throws:
InvalidModelException
-
-
Method Details
-
getServiceProvider
Description copied from interface:IModule
A null return is expected if the module doesn't provide any RPC service to register.- Specified by:
getServiceProvider
in interfaceIModule
- Returns:
-
add
- Throws:
InvalidModelException
-
checkAlreadyPresent
-
getAgents
-
listAgents
@RPCMethod(category="agents", desc="Returns the set of agents I\'m aware of (ie, for whom I have a cognitive model).") public Set<String> listAgents() -
consumeEvent
- Specified by:
consumeEvent
in interfaceIEventConsumer
-
checkConsistencyForAgent
@RPCMethod(category="agents", desc="Check the consistency of a specific agent model.") public boolean checkConsistencyForAgent(String id) throws AgentNotFoundException - Throws:
AgentNotFoundException
-
revise
@RPCMethod public void revise(Set<String> statements, String json_policy) throws IllegalStatementException, InvalidPolicyException, OntologyServerException, InconsistentOntologyException Generic knowledge revision request -
addForAgent
@RPCMethod(category="agents", desc="adds one or several statements (triplets S-P-O) to a specific agent model, in long term memory.") public void addForAgent(String id, Set<String> rawStmts) throws IllegalStatementException, AgentNotFoundException Add statements in a specific agent cognitive model.- Parameters:
id
- The id of the agentrawStmts
- a set of statements- Throws:
IllegalStatementException
AgentNotFoundException
- See Also:
-
safeAddForAgent
@RPCMethod(category="agents", desc="try to add news statements to a specific agent model in long term memory, if they don\'t lead to inconsistencies (return false if at least one stmt wasn\'t added).") public boolean safeAddForAgent(String id, Set<String> rawStmts) throws IllegalStatementException, AgentNotFoundException -
addForAgent
@RPCMethod(category="agents", desc="adds one or several statements (triplets S-P-O) to a specific agent model associated with a memory profile.") public void addForAgent(String id, Set<String> rawStmts, String memProfile) throws IllegalStatementException, AgentNotFoundException Add statements in a specific agent cognitive model with a specific memory model.- Parameters:
id
- The id of the agentrawStmts
- a set of statementsmemProfile
- the memory profile- Throws:
IllegalStatementException
AgentNotFoundException
- See Also:
-
safeAddForAgent
@RPCMethod(category="agents", desc="try to add news statements to a specific agent model with a specific memory profile, if they don\'t lead to inconsistencies (return false if at least one stmt wasn\'t added).") public boolean safeAddForAgent(String id, Set<String> rawStmts, String memProfile) throws IllegalStatementException, AgentNotFoundException Adds statements in a specific agent cognitive model with a specific memory model, but only if the statement doesn't cause any inconsistency. If one statement cause an inconsistency, it won't be added, the return value will be "false", and the process continue with the remaining statements.- Parameters:
id
- The id of the agentrawStmts
- a set of statementsmemProfile
- the memory profile- Returns:
- false if at least one statement was not added because it would lead to inconsistencies.
- Throws:
IllegalStatementException
AgentNotFoundException
-
removeForAgent
@RPCMethod(category="agents", desc="removes one or several statements. Deprecated. Use clearForAgent instead.") @Deprecated public void removeForAgent(String id, Set<String> rawStmts) throws IllegalStatementException, OntologyServerException Deprecated. -
clearForAgent
@RPCMethod(category="agents", desc="removes statements from a specific agent model.") public void clearForAgent(String id, Set<String> rawStmts) throws IllegalStatementException, OntologyServerException -
updateForAgent
@RPCMethod(category="agents", desc="updates one or several statements (triplets S-P-O) in a specific agent model, in long term memory.") public void updateForAgent(String id, Set<String> rawStmts) throws IllegalStatementException, InconsistentOntologyException, OntologyServerException -
getInfosForAgent
@RPCMethod(category="agent", desc="returns the set of asserted and inferred statements whose the given node is part of. It represents the usages of a resource.") public Set<String> getInfosForAgent(String id, String lex_resource) throws com.hp.hpl.jena.shared.NotFoundException, AgentNotFoundException Returns the set of asserted and inferred statements whose the given node is part of, in the specifi agent model. It represents the "usages" of a resource.
Usage example:
IOntologyServer myOntology = new OpenRobotsOntology(); Model results = myOntology.getInfos("ns:individual1"); NodeIterator types = results.listObjectsOfProperty(myOntology.createProperty("rdf:type")); for ( ; types.hasNext() ; ) { System.out.println(types.nextNode().toString()); }
This example would print all the types (classes) of the instancens:individual1
.- Parameters:
id
- the agent model to query.lex_resource
- the lexical form of an existing resource.- Returns:
- a RDF model containing all the statements related the the given resource.
- Throws:
com.hp.hpl.jena.shared.NotFoundException
- thrown if the lex_resource doesn't exist in the ontology.AgentNotFoundException
- See Also:
-
findForAgent
@RPCMethod(category="agents", desc="tries to identify a resource given a set of partially defined statements and restrictions in an specific agent model.") public Set<String> findForAgent(String id, String varName, Set<String> statements, Set<String> filters) throws IllegalStatementException, OntologyServerException -
findForAgent
@RPCMethod(category="agents", desc="tries to identify a resource given a set of partially defined statements in an specific agent model.") public Set<String> findForAgent(String id, String varName, Set<String> statements) throws IllegalStatementException, OntologyServerException -
lookupForAgent
@RPCMethod(category="agents", desc="lookup a concept in a specific agent model.") public Set<List<String>> lookupForAgent(String agent_id, String id) throws IllegalStatementException, AgentNotFoundException -
save
@RPCMethod(category="agents", desc="exports the cognitive model of a given agent to an OWL file. The provided path must be writable by the server.") public void save(String id, String path) throws AgentNotFoundException, OntologyServerException -
discriminateForAgent
@RPCMethod(category="agents", desc="returns a list of properties that helps to differentiate individuals for a specific agent.") public List<Set<String>> discriminateForAgent(String id, Set<String> rawConcepts) throws AgentNotFoundException, OntologyServerException, com.hp.hpl.jena.shared.NotFoundException, NotComparableException - Throws:
AgentNotFoundException
OntologyServerException
com.hp.hpl.jena.shared.NotFoundException
NotComparableException
-
registerEventForAgent
@RPCMethod(category="events", desc="registers an event on a specific agent model. Expected parameters are: agent, type, triggering type, event pattern.") public UUID registerEventForAgent(String agent, String type, String triggeringType, List<String> pattern, IEventConsumer consumer) throws AgentNotFoundException, InvalidEventDescriptorException, EventRegistrationException Events -
registerEventForAgent
@RPCMethod(category="events", desc="registers an event on a specific agent model. Expected parameters are: agent, type, triggering type, variable, event pattern.") public UUID registerEventForAgent(String agent, String type, String triggeringType, String variable, List<String> pattern, IEventConsumer consumer) throws AgentNotFoundException, InvalidEventDescriptorException, EventRegistrationException -
clearEventsForAgent
@RPCMethod(category="events", desc="Remove all events associated to a specific model.") public void clearEventsForAgent(String agent) throws AgentNotFoundException - Throws:
AgentNotFoundException
-
clearEvent
@RPCMethod(category="events", desc="Remove one specific event from a specific model.") public void clearEvent(String agent, String eventId) throws OntologyServerException - Throws:
OntologyServerException
-
close
public void close() -
finalize
protected void finalize() -
step
public void step()Description copied from interface:IModule
'Step' the module. At each server main loop iteration, the 'step' method is called. The module can do here its own internal homeworks.
-