MOSIM Plugin - aantakli/AJAN-service GitHub Wiki
The AJAN SBT node extensions described in this section (https://github.com/aantakli/AJAN-service/tree/master/pluginsystem/plugins/MOSIMPlugin) were developed in the EU project MOSIM. For more information visit the MOSIM website.
Two Action Definitions (see chapter AJAN Action) have been implemented for MOSIM as PlauginActions. These Action Definitions are used to execute MInstructions in the CoSimulator. These definitions are introduced in this chapter MOSIM Plugin Action Definitions.
States: SUCCEEDED || FAILED
Description: A SBT MOSIM Abort Instruction is a BT leaf node aborts one or all running MMU Instructions at the CoSimulator. For this the CoSimulator needs the ID of the MMU Instruction to be aborted. If no ID is specified (the result of the used SPARQL 1.1 SELECT query is empty), all MMU Instructions are aborted with this SBT node. For this, the address bt-mosim:host
of the MOSIM CoSimulator must be specified (via SPARQL 1.1 SELECT query with variables: ?host <string>, ?port <integer>), the target MMU Instructions bt-mosim:instructionID
needs to be selected (each via SPARQL 1.1 SELECT query with variables: ?id <string>), as well as the location bt:targetBase
of the RDF representation of the read MInstruction needs to be known to update its state in the Agent Knowledge. If the queries are incorrect, no connection can be made to the CoSimulator, or no refered running MMU Instruction could be found, this node is failing and has the status FAILED, otherwise SUCCEEDED. Usually the needed Instruction are already available to the agent and can be queried via mosim:Instruction
as shown in the following example. The structure of a Instruction in AJAN is shown in the chapter Instruction RDF.
Property (RDF) | Value (RDF) |
---|---|
Namespace (@prefix bt-mosim:) | URL (http://www.ajan.de/behavior/mosim-ns#) |
Type (rdf:type) | Abort Instruction Node (bt-mosim:AbortInstruction) |
Class (rdfs:subClassOf) | Leaf Node (bt:Leaf) |
Label (rdfs:label) | <string> ("some label"^^xsd:string) |
Host (bt-mosim:host) | SELECT Query (bt:SelectQuery); Variables: ?host ?port |
Instruction ID (bt-mosim:instructionID) | SELECT Query (bt:SelectQuery); Variables: ?id |
Target Base (bt:targetBase) | <URI> ("http://..."^^xsd:anyUri) |
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix bt: <http://www.ajan.de/behavior/bt-ns#> .
@prefix ajan: <http://www.ajan.de/ajan-ns#> .
@prefix bt-mosim: <http://www.ajan.de/behavior/mosim-ns#> .
:AbortInstructionX # Instance URI
a bt-mosim:AbortInstruction;
rdfs:label "AbortInstructionX"^^xsd:string ;
bt-mosim:host [
a bt:SelectQuery ;
bt:originBase ajan:AgentKnowledge ;
bt:sparql """
PREFIX mosim: <http://www.dfki.de/mosim-ns#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?host ?port
WHERE {
?cosim rdf:type mosim:CoSimulator .
?cosim mosim:host ?host .
?cosim mosim:port ?port .
}"""^^xsd:string ;
] ;
bt-mosim:instructionID [
a bt:SelectQuery ;
bt:originBase ajan:AgentKnowledge ;
bt:sparql """
PREFIX mosim: <http://www.dfki.de/mosim-ns#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?id
WHERE {
?instruction rdf:type mosim:Instruction .
?instruction mosim:mmu "IdleX" .
?instruction mosim:instructionID ?id .
}"""^^xsd:string ;
] ;
bt:targetBase ajan:AgentKnowledge .
States: SUCCEEDED || FAILED
Description: A SBT MOSIM This node sends recorded Instructions Descriptions of Minstructionss executed by an agent to the High Level Task List Editor (HTLE). For this, this node needs the HTTP/POST endpoint of the HTLE and credentials to receive such instruction descriptions. Furthermore, the location of these instruction descriptions is required. For this, the address bt-mosim:endpointHTLE
of the HTLE (<xsd:anyURI>) and the needed credentials bt-mosim:infoHTLE
(via SPARQL 1.1 SELECT query with variables: ?id <string>) needs to be specified, as well as the location bt:originBase
of the RDF representation of the recorded Instruction Descriptions needs to be known to collect. If the query is incorrect or empty, no connection can be made to the HTLE, or no refered Instruction Description could be found, this node is failing and has the status FAILED, otherwise SUCCEEDED. Usually the needed Instruction Descriptions are already available to the agent and are queried automatically by that node. The structure of a Instruction in AJAN is shown in the chapter Instruction RDF.
Property (RDF) | Value (RDF) |
---|---|
Namespace (@prefix bt-mosim:) | URL (http://www.ajan.de/behavior/mosim-ns#) |
Type (rdf:type) | Send HTLE Logs Node (bt-mosim:SendHTLELogs) |
Class (rdfs:subClassOf) | Leaf Node (bt:Leaf) |
Label (rdfs:label) | <string> ("some label"^^xsd:string) |
HTLE URI (bt-mosim:endpointHTLE) | <xsd:anyURI> (URI of the High Level Task List Editor) |
HTLE Information (bt-mosim:infoHTLE) | SELECT Query (bt:SelectQuery); Variables: ?token ?resultSet |
Origin Base (bt:originBase) | <URI> ("http://..."^^xsd:anyUri) |
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix bt: <http://www.ajan.de/behavior/bt-ns#> .
@prefix ajan: <http://www.ajan.de/ajan-ns#> .
@prefix bt-mosim: <http://www.ajan.de/behavior/mosim-ns#> .
:SendHTLELogsX # Instance URI
a bt-mosim:SendHTLELogs;
rdfs:label "SendHTLELogsX"^^xsd:string ;
bt-mosim:endpointHTLE "https://taskeditor.mosim.eu/api-test.php?action=saveMMUTask"^^xsd:anyURI ;
bt-mosim:infoHTLE [
a bt:SelectQuery ;
bt:originBase ajan:AgentKnowledge ;
bt:sparql """
PREFIX test: <http://test/>
PREFIX mosim: <http://www.dfki.de/mosim-ns#>
SELECT ?token ?resultSet
WHERE {
?avatar rdf:type mosim:Avatar .
?avatar mosim:tokenHLTE ?token .
VALUES ?resultSet { 1 } .
}"""^^xsd:string ;
] ;
bt:targetBase <http://localhost:8090/rdf4j/repositories/dummy_knowledge> .
States: SUCCEEDED || FAILED
Description: A SBT MOSIM Create Callback Server is a BT leaf node that creates a AJAN Thrift endpoint with a specified Port to receive MOSIM specific events. These events mostly come from the so-called CoSimulator and indicate the status of an MInstruction. This node fails if a port that is already in use for the endpoint to be created. To specify a port a SPARQL 1.1 SELECT query is used which contains ?port <integer> in the SELECT part. This node reads out ?port to create said endpoint. If more than one integer data is bound with ?port, the first entry is used for the port. If no data is bound with ?port or the value is not an integer this node returns FAILED.
Property (RDF) | Value (RDF) |
---|---|
Namespace (@prefix bt-mosim:) | URL (http://www.ajan.de/behavior/mosim-ns#) |
Type (rdf:type) | Create Callback Server Node (bt-mosim:CreateCallbackServer) |
Class (rdfs:subClassOf) | Leaf Node (bt:Leaf) |
Label (rdfs:label) | <string> ("some label"^^xsd:string) |
Callback (bt-mosim:callback) | SELECT Query (bt:SelectQuery); Variables: ?port |
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix bt: <http://www.ajan.de/behavior/bt-ns#> .
@prefix ajan: <http://www.ajan.de/ajan-ns#> .
@prefix bt-mosim: <http://www.ajan.de/behavior/mosim-ns#> .
:CreateCallbackServerX # Instance URI
a bt-mosim:CreateCallbackServer;
rdfs:label "CreateCallbackServerX"^^xsd:string ;
bt-mosim:callback [
a bt:SelectQuery ;
bt:originBase ajan:AgentKnowledge ;
bt:sparql """
SELECT ?port
WHERE {
VALUES ?port {8093}
}"""^^xsd:string ;
] .
States: SUCCEEDED || FAILED
Description: A SBT MOSIM Delete Callback Server is a BT leaf node that deletes a AJAN Thrift endpoint with a specified Port. This node fails if the selected port does not exist. To specify a port a SPARQL 1.1 SELECT query is used which contains ?port <integer> in the SELECT part. This node reads out ?port to create said endpoint. If more than one integer data is bound with ?port, the first entry is used for the port. If no data is bound with ?port or the value is not an integer this node returns FAILED.
Property (RDF) | Value (RDF) |
---|---|
Namespace (@prefix bt-mosim:) | URL (http://www.ajan.de/behavior/mosim-ns#) |
Type (rdf:type) | Delete Callback Server Node (bt-mosim:DeleteCallbackServer) |
Class (rdfs:subClassOf) | Leaf Node (bt:Leaf) |
Label (rdfs:label) | <string> ("some label"^^xsd:string) |
Callback (bt-mosim:callback) | SELECT Query (bt:SelectQuery); Variables: ?port |
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix bt: <http://www.ajan.de/behavior/bt-ns#> .
@prefix ajan: <http://www.ajan.de/ajan-ns#> .
@prefix bt-mosim: <http://www.ajan.de/behavior/mosim-ns#> .
:DeleteCallbackServerX # Instance URI
a bt-mosim:DeleteCallbackServer;
rdfs:label "DeleteCallbackServerX"^^xsd:string ;
bt-mosim:callback [
a bt:SelectQuery ;
bt:originBase ajan:AgentKnowledge ;
bt:sparql """
SELECT ?port
WHERE {
VALUES ?port {8093}
}"""^^xsd:string ;
] .
States: SUCCEEDED || FAILED
Description: A SBT MOSIM Register Listener node registers an AJAN Thrift endpoint created with an SBT Create Callback Server node with a specified MOSIM CoSimulator, binding a MOSIM event type with that endpoint. For this several parameters of the node have to be set: (1) the MOSIM event type bt-mosim:eventType
as ; (2) the AJAN Thrift endpoint port bt-mosim:callback
to bind (via SPARQL 1.1 SELECT query with variable: ?port <integer>); (3) the location bt-mosim:host
of the CoSimulator to use (via SPARQL 1.1 SELECT query with variables: ?host <string>, ?port <integer>); and a target base bt:targetBase
of the agent must be specified. This node fails, thus it returns FAILED, if: the used SPARQL 1.1 SELECT queries do not output tables with the requested variables and data types; if no event type has been defined; or no connection to the selected CoSimulator can be established. Otherwise it returns SUCCEEDED. Usually the host information of the CoSimulator are already available to the agent and can be queried via mosim:CoSimulator
as shown in the following example. The target base is used to store the specified information about the event and the used CoSimulator in the agent knowledge. An example of that stored information is presented in chapter CoSimulator RDF
Property (RDF) | Value (RDF) |
---|---|
Namespace (@prefix bt-mosim:) | URL (http://www.ajan.de/behavior/mosim-ns#) |
Type (rdf:type) | Register Listener Node (bt-mosim:RegisterListener) |
Class (rdfs:subClassOf) | Leaf Node (bt:Leaf) |
Label (rdfs:label) | <string> ("some label"^^xsd:string) |
Event Type (bt-mosim:eventType) | <string> ("some label"^^xsd:string |
Host (bt-mosim:host) | SELECT Query (bt:SelectQuery); Variables: ?host ?port |
Callback (bt-mosim:callback) | SELECT Query (bt:SelectQuery); Variables: ?port |
Target Base (bt:targetBase) | <URI> ("http://..."^^xsd:anyUri) |
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix bt: <http://www.ajan.de/behavior/bt-ns#> .
@prefix ajan: <http://www.ajan.de/ajan-ns#> .
@prefix bt-mosim: <http://www.ajan.de/behavior/mosim-ns#> .
:RegisterListenerX # Instance URI
a bt-mosim:RegisterListener;
rdfs:label "RegisterListenerX"^^xsd:string ;
bt-mosim:eventType "end" ;
bt-mosim:host [
a bt:SelectQuery ;
bt:originBase ajan:AgentKnowledge ;
bt:sparql """
PREFIX mosim: <http://www.dfki.de/mosim-ns#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?host ?port
WHERE {
?cosim rdf:type mosim:CoSimulator .
?cosim mosim:host ?host .
?cosim mosim:port ?port .
}"""^^xsd:string ;
] ;
bt-mosim:callback [
a bt:SelectQuery ;
bt:originBase ajan:AgentKnowledge ;
bt:sparql """
PREFIX mosim: <http://www.dfki.de/mosim-ns#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?port
WHERE {
?a rdf:type mosim:Avatar .
?a mosim:clPort ?port .
}"""^^xsd:string ;
] ;
bt:targetBase ajan:AgentKnowledge .
States: SUCCEEDED || FAILED
Description: A SBT MOSIM Unregister Listener node unregisters an AJAN Thrift endpoint registered with an SBT Register Listener node at a specified MOSIM CoSimulator. For this several parameters of the node have to be set: (1) the MOSIM previously restistered event type bt-mosim:eventType
as <string>; (2) the previously restistered AJAN Thrift endpoint port bt-mosim:callback
to unbind (via SPARQL 1.1 SELECT query with variable: ?port <integer>); (3) the location bt-mosim:host
of the targeted CoSimulator (via SPARQL 1.1 SELECT query with variables: ?host <string>, ?port <integer>); and a target base bt:targetBase
of the agent must be specified. This node fails, thus it returns FAILED, if: the used SPARQL 1.1 SELECT queries do not output tables with the requested variables and data types; if no event type has been defined; or no connection to the selected CoSimulator can be established. Otherwise it returns SUCCEEDED. The target base is used to delete previously stored information about the event and the used CoSimulator in the agent knowledge.
Property (RDF) | Value (RDF) |
---|---|
Namespace (@prefix bt-mosim:) | URL (http://www.ajan.de/behavior/mosim-ns#) |
Type (rdf:type) | Register Listener Node (bt-mosim:UnregisterListener) |
Class (rdfs:subClassOf) | Leaf Node (bt:Leaf) |
Label (rdfs:label) | <string> ("some label"^^xsd:string) |
Event Type (bt-mosim:eventType) | <string> ("some label"^^xsd:string |
Host (bt-mosim:host) | SELECT Query (bt:SelectQuery); Variables: ?host ?port |
Callback (bt-mosim:callback) | SELECT Query (bt:SelectQuery); Variables: ?port |
Target Base (bt:targetBase) | <URI> ("http://..."^^xsd:anyUri) |
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix bt: <http://www.ajan.de/behavior/bt-ns#> .
@prefix ajan: <http://www.ajan.de/ajan-ns#> .
@prefix bt-mosim: <http://www.ajan.de/behavior/mosim-ns#> .
:UnregisterListenerX # Instance URI
a bt-mosim:UnregisterListener;
rdfs:label "UnregisterListenerX"^^xsd:string ;
bt-mosim:eventType "end" ;
bt-mosim:host [
a bt:SelectQuery ;
bt:originBase ajan:AgentKnowledge ;
bt:sparql """
SELECT ?host ?port
WHERE {
VALUES (?host ?port) { ("http://localhost", 9011) }
}"""^^xsd:string ;
] ;
bt-mosim:callback [
a bt:SelectQuery ;
bt:originBase ajan:AgentKnowledge ;
bt:sparql """
SELECT ?port
WHERE {
VALUES ?port {8093}
}"""^^xsd:string ;
] ;
bt:targetBase ajan:AgentKnowledge .
States: SUCCEEDED || FAILED
Description: A SBT MOSIM Get Available MMUs node reads available MMUs from a specified MOSIM Register Service (Launcher) and stores their description in the form of RDF into the agent's knowledge base (bt:targetBase). For this, the address bt-mosim:host
of the MOSIM Register Service must be specified (via SPARQL 1.1 SELECT query with variables: ?host <string>, ?port <integer>), as well as the location bt:targetBase
of the read MMU Descriptions. If the result of said query is empty, the query itself is incorrect, or no connection can be made to the Register Service, this node is missing and has the status FAILED, otherwise SUCCEEDED. Usually the host information of the Register Service are already available to the agent and can be queried via mosim:Registry
as shown in the following example. The structure of an MMU Description in AJAN is shown the chapter MMUDescription RDF using the UnityLocomotionMMU.
Property (RDF) | Value (RDF) |
---|---|
Namespace (@prefix bt-mosim:) | URL (http://www.ajan.de/behavior/mosim-ns#) |
Type (rdf:type) | Register Listener Node (bt-mosim:GetAvailableMMUs) |
Class (rdfs:subClassOf) | Leaf Node (bt:Leaf) |
Label (rdfs:label) | <string> ("some label"^^xsd:string) |
Host (bt-mosim:host) | SELECT Query (bt:SelectQuery); Variables: ?host ?port |
Target Base (bt:targetBase) | <URI> ("http://..."^^xsd:anyUri) |
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix bt: <http://www.ajan.de/behavior/bt-ns#> .
@prefix ajan: <http://www.ajan.de/ajan-ns#> .
@prefix bt-mosim: <http://www.ajan.de/behavior/mosim-ns#> .
:GetAvailableMMUsX # Instance URI
a bt-mosim:GetAvailableMMUs;
rdfs:label "GetAvailableMMUsX"^^xsd:string ;
bt-mosim:host [
a bt:SelectQuery ;
bt:originBase ajan:AgentKnowledge ;
bt:sparql """
PREFIX mosim: <http://www.dfki.de/mosim-ns#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?host ?port
WHERE {
?scene rdf:type mosim:Registry .
?scene mosim:host ?host .
?scene mosim:port ?port .
}"""^^xsd:string ;
] ;
bt:targetBase ajan:AgentKnowledge .
States: SUCCEEDED || FAILED
Description: A SBT MOSIM Get Scene node reads available MSceneObjects from a specified MOSIM Scene Service and stores their description in the form of RDF into the agent's knowledge base (bt:targetBase). For this, the address bt-mosim:host
of the MOSIM Scene Service must be specified (via SPARQL 1.1 SELECT query with variables: ?host <string>, ?port <integer>), as well as the location bt:targetBase
of the read MSceneObjects. If the result of said query is empty, the query itself is incorrect, or no connection can be made to the Scene Service, this node is failing and has the status FAILED, otherwise SUCCEEDED. Usually the host information of the Scene Service are already available to the agent and can be queried via mosim:Scene
as shown in the following example. The structure of an MSceneObject in AJAN is shown in the chapter MSceneObject RDF.
Property (RDF) | Value (RDF) |
---|---|
Namespace (@prefix bt-mosim:) | URL (http://www.ajan.de/behavior/mosim-ns#) |
Type (rdf:type) | Register Listener Node (bt-mosim:GetScene) |
Class (rdfs:subClassOf) | Leaf Node (bt:Leaf) |
Label (rdfs:label) | <string> ("some label"^^xsd:string) |
Host (bt-mosim:host) | SELECT Query (bt:SelectQuery); Variables: ?host ?port |
Target Base (bt:targetBase) | <URI> ("http://..."^^xsd:anyUri) |
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix bt: <http://www.ajan.de/behavior/bt-ns#> .
@prefix ajan: <http://www.ajan.de/ajan-ns#> .
@prefix bt-mosim: <http://www.ajan.de/behavior/mosim-ns#> .
:GetSceneX # Instance URI
a bt-mosim:GetScene;
rdfs:label "GetSceneX"^^xsd:string ;
bt-mosim:host [
a bt:SelectQuery ;
bt:originBase ajan:AgentKnowledge ;
bt:sparql """
PREFIX mosim: <http://www.dfki.de/mosim-ns#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?host ?port
WHERE {
?scene rdf:type mosim:Scene .
?scene mosim:host ?host .
?scene mosim:port ?port .
}"""^^xsd:string ;
] ;
bt:targetBase ajan:AgentKnowledge .
States: SUCCEEDED || FAILED
Description: A SBT MOSIM MOSIM Get Avatar Transform node reads the current avatar transform which is relevant for path planning. For this, a connection to the MOSIM Skeleton Service (bt-mosim:host
) is established via MSkeletonAccess and the MTransform is queried via the Avatar ID (bt-mosim:avatarID
). The received MTransform is then translated as an RDF dataset and the agent's knowledge base (bt:targetBase
) is updated with this dataset. For this, the Avatar URI and ID bt-mosim:avatarID
must be selected (via SPARQL 1.1 SELECT query with variables: ?uri <string>, ?avatarID <integer>), and the address bt-mosim:host
of the MOSIM Skeleton Service must be specified (via SPARQL 1.1 SELECT query with variables: ?host <string>, ?port <integer>), as well as the location bt:targetBase
of the RDF representation of the read MTransform. If the result of said queries is empty, the query itself is incorrect, no connection can be made to the Skelleton service or the Avatar ID is incorrect, this node is failing and has the status FAILED, otherwise SUCCEEDED. Usually the host adress of the Skeleton Service and the URI of the avatar and its ID are already available to the agent and can be queried via mosim:SkeletonAccess
and mosim:Avatar
as shown in the following example. The structure of an MTransform in AJAN is shown in the chapter MSceneObject RDF.
Property (RDF) | Value (RDF) |
---|---|
Namespace (@prefix bt-mosim:) | URL (http://www.ajan.de/behavior/mosim-ns#) |
Type (rdf:type) | Get Avatar Transform Node (bt-mosim:GetAvatarTransform) |
Class (rdfs:subClassOf) | Leaf Node (bt:Leaf) |
Label (rdfs:label) | <string> ("some label"^^xsd:string) |
Avatar ID (bt-mosim:avatarID) | SELECT Query (bt:SelectQuery); Variables: ?uri ?avatarID |
Host (bt-mosim:host) | SELECT Query (bt:SelectQuery); Variables: ?host ?port |
Target Base (bt:targetBase) | <URI> ("http://..."^^xsd:anyUri) |
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix bt: <http://www.ajan.de/behavior/bt-ns#> .
@prefix ajan: <http://www.ajan.de/ajan-ns#> .
@prefix bt-mosim: <http://www.ajan.de/behavior/mosim-ns#> .
:GetAvatarTransformX # Instance URI
a bt-mosim:GetAvatarTransform;
rdfs:label "GetAvatarTransformX"^^xsd:string ;
bt-mosim:avatarID [
a bt:SelectQuery ;
bt:originBase ajan:AgentKnowledge ;
bt:sparql """
PREFIX mosim: <http://www.dfki.de/mosim-ns#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?uri ?avatarID
WHERE {
?uri rdf:type mosim:Avatar .
?uri mosim:id ?avatarID .
}"""^^xsd:string ;
] ;
bt-mosim:host [
a bt:SelectQuery ;
bt:originBase ajan:AgentKnowledge ;
bt:sparql """
PREFIX mosim: <http://www.dfki.de/mosim-ns#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?host ?port
WHERE {
?cosim rdf:type mosim:SkeletonAccess .
?cosim mosim:host ?host .
?cosim mosim:port ?port .
}"""^^xsd:string ;
] ;
bt:targetBase ajan:AgentKnowledge .
States: SUCCEEDED || FAILED
Description: A SBT MOSIM Get Walk Points node is used to calculate reachable walk points to a MSceneObject. The MOSIM Walk Point Estimation Service is used for this purpose. This service needs the target object, and a list of other MSceneObjects in the scene (excluding the target object) as input. The result of this service is said walk points in the form of MTransforms, which are stored by AJAN as RDF data in the agent's knowledge base. These RDF walk points can then be used for path planning to the target object.
For this, the address bt-mosim:host
of the MOSIM Walk Point Estimation Service must be specified (via SPARQL 1.1 SELECT query with variables: ?host <string>, ?port <integer>), the target object bt:walkTarget
and the other MSceneObjects bt:sceneObjects
needs to be selected (each via SPARQL 1.1 SELECT query with variables: ?object <string>; ?object is the Base64 representation of said MSceneObjects), as well as the location bt:targetBase
of the RDF representation of the read MTransform needs to be known. If the result of said queries is empty, the queries themself are incorrect, no connection can be made to the Walk Point Estimation Service, or no walk points couald be found, this node is failing and has the status FAILED, otherwise SUCCEEDED. Usually the needed MSceneObjects are already available to the agent and can be queried via mosim:MSceneObject
as shown in the following example. The structure of a Walk Point in AJAN is shown in the chapter MWalkPoint RDF.
Property (RDF) | Value (RDF) |
---|---|
Namespace (@prefix bt-mosim:) | URL (http://www.ajan.de/behavior/mosim-ns#) |
Type (rdf:type) | Register Listener Node (bt-mosim:GetWalkPoints) |
Class (rdfs:subClassOf) | Leaf Node (bt:Leaf) |
Label (rdfs:label) | <string> ("some label"^^xsd:string) |
Host (bt-mosim:host) | SELECT Query (bt:SelectQuery); Variables: ?host ?port |
Scene Objects (bt-mosim:sceneObjects) | SELECT Query (bt:SelectQuery); Variables: ?object |
Walk Target (bt-mosim:walkTarget) | SELECT Query (bt:SelectQuery); Variables: ?object |
Target Base (bt:targetBase) | <URI> ("http://..."^^xsd:anyUri) |
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix bt: <http://www.ajan.de/behavior/bt-ns#> .
@prefix ajan: <http://www.ajan.de/ajan-ns#> .
@prefix bt-mosim: <http://www.ajan.de/behavior/mosim-ns#> .
:GetWalkPointsX # Instance URI
a bt-mosim:GetWalkPoints;
rdfs:label "GetWalkPointsX"^^xsd:string ;
bt-mosim:host [
a bt:SelectQuery ;
bt:originBase ajan:AgentKnowledge ;
bt:sparql """
PREFIX mosim: <http://www.dfki.de/mosim-ns#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?host ?port
WHERE {
VALUES ?host { "127.0.0.1" }
VALUES ?port { 8905 }
}"""^^xsd:string ;
] ;
bt-mosim:sceneObjects [
a bt:SelectQuery ;
bt:originBase ajan:AgentKnowledge ;
bt:sparql """
PREFIX mosim: <http://www.dfki.de/mosim-ns#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?object
WHERE {
?scObj rdf:type mosim:MSceneObject .
?scObj rdfs:label ?label .
?scObj mosim:object ?object .
MINUS {
?scObj rdf:type mosim:Part .
}
}"""^^xsd:string ;
] ;
bt-mosim:walkTarget [
a bt:SelectQuery ;
bt:originBase ajan:AgentKnowledge ;
bt:sparql """
PREFIX mosim: <http://www.dfki.de/mosim-ns#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX test: <http://test/>
SELECT ?object
WHERE {
test:WalkTarget rdf:value ?target .
?target rdf:type mosim:MSceneObject .
?target mosim:object ?object .
}"""^^xsd:string ;
] ;
bt:targetBase ajan:AgentKnowledge .
States: SUCCEEDED || FAILED
Description: A SBT MOSIM Path Available node checks whether a path can be determined for a given MWalkPoint and if so, how long it is. The path length is then added to the considered MWalkTarget in the agent knowledge base, for later decision making in the SBT. The MOSIM Path Planning Service is used for this purpose. This service needs the target MWalkTarget object (a MWalkTarget can be queried by the MOSIM Get Walk Points node), the MTransform of the considered avatar (can be queried by the MOSIM Get Avatar Transform node), and a list of other MSceneObjects in the scene (excluding the target object) as input.
For this, the address bt-mosim:host
of the MOSIM Path Planning Service must be specified (via SPARQL 1.1 SELECT query with variables: ?host <string>, ?port <integer>), the target object bt:walkTarget
resource and the avatar resource needs to be read (via SPARQL 1.1 CONSTRUCT query; see the following specifications), the other MSceneObjects bt:sceneObjects
needs to be selected (via SPARQL 1.1 SELECT query with variables: ?object <string>; ?object is the Base64 representation of said MSceneObjects), as well as the location bt:targetBase
of the RDF representation of the read MWalkPoint needs to be known. If the result of said queries is empty, the queries themself are incorrect, no connection can be made to the Walk Point Estimation Service, or no path could be found, this node is failing and has the status FAILED, otherwise SUCCEEDED. Usually the needed MSceneObjects and MWalkPoint are already available to the agent and can be queried via mosim:MSceneObject
, and IFF the mentioned MOSIM Get Walk Points node has been successfully executed before, with mosim:MWalkPoint
as shown in the following example. The structure of a Walk Point in AJAN is shown in the chapter MWalkPoint RDF.
Property (RDF) | Value (RDF) |
---|---|
Namespace (@prefix bt-mosim:) | URL (http://www.ajan.de/behavior/mosim-ns#) |
Type (rdf:type) | Path Available Node (bt-mosim:PathAvailable) |
Class (rdfs:subClassOf) | Leaf Node (bt:Leaf) |
Label (rdfs:label) | <string> ("some label"^^xsd:string) |
Host (bt-mosim:host) | SELECT Query (bt:SelectQuery); Variables: ?host ?port |
Scene Objects (bt-mosim:sceneObjects) | SELECT Query (bt:SelectQuery); Variables: ?object |
Walk Target (bt-mosim:walkTarget) | Construct Query (bt:ConstructQuery) |
Avatar (bt-mosim:avatar) | Construct Query (bt:ConstructQuery) |
Target Base (bt:targetBase) | <URI> ("http://..."^^xsd:anyUri) |
Walk Target (bt-mosim:walkTarget):
PREFIX mosim: <http://www.dfki.de/mosim-ns#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
CONSTRUCT {
?uri rdf:type mosim:MWalkPoint .
?uri mosim:transform ?transform .
?transform mosim:object ?object .
}
WHERE {...}"""^^xsd:string ;
Avatar (bt-mosim:avatar):
PREFIX mosim: <http://www.dfki.de/mosim-ns#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
CONSTRUCT {
?uri rdf:type mosim:Avatar .
?uri mosim:transform ?transform .
?transform mosim:object ?object .
}
WHERE {...}"""^^xsd:string ;
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix bt: <http://www.ajan.de/behavior/bt-ns#> .
@prefix ajan: <http://www.ajan.de/ajan-ns#> .
@prefix bt-mosim: <http://www.ajan.de/behavior/mosim-ns#> .
:PathAvailableX # Instance URI
a bt-mosim:PathAvailable;
rdfs:label "PathAvailableX"^^xsd:string ;
bt-mosim:host [
a bt:SelectQuery ;
bt:originBase ajan:AgentKnowledge ;
bt:sparql """
PREFIX mosim: <http://www.dfki.de/mosim-ns#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?host ?port
WHERE {
VALUES ?host { "127.0.0.1" }
VALUES ?port { 8902 }
}"""^^xsd:string ;
] ;
bt-mosim:sceneObjects [
a bt:SelectQuery ;
bt:originBase ajan:AgentKnowledge ;
bt:sparql """
PREFIX mosim: <http://www.dfki.de/mosim-ns#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?object
WHERE {
?scObj rdf:type mosim:MSceneObject .
?scObj rdfs:label ?label .
?scObj mosim:object ?object .
MINUS {
?scObj rdf:type mosim:Part .
}
}"""^^xsd:string ;
] ;
bt-mosim:walkTarget [
a bt:ConstructQuery ;
bt:originBase ajan:AgentKnowledge ;
bt:sparql """
PREFIX mosim: <http://www.dfki.de/mosim-ns#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
CONSTRUCT {
?uri rdf:type mosim:MWalkPoint .
?uri mosim:transform ?transform .
?transform mosim:object ?object .
}
WHERE {
?uri rdf:type mosim:MWalkPoint .
?uri mosim:transform ?transform .
?transform mosim:object ?object .
{ SELECT ?uri
WHERE {
?uri rdf:type mosim:MWalkPoint .
MINUS {
?uri rdf:type mosim:MWalkPoint .
?uri mosim:pathLength ?length .
}
} LIMIT 1
}
}"""^^xsd:string ;
] ;
bt-mosim:walkTarget [
a bt:ConstructQuery ;
bt:originBase ajan:AgentKnowledge ;
bt:sparql """
PREFIX mosim: <http://www.dfki.de/mosim-ns#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
CONSTRUCT {
?uri rdf:type mosim:Avatar .
?uri mosim:transform ?transform .
?transform mosim:object ?object .
}
WHERE {
?uri rdf:type mosim:Avatar .
?uri mosim:transform ?transform .
?transform mosim:object ?object .
}"""^^xsd:string ;
] ;
bt:targetBase ajan:AgentKnowledge .