HyperAgents / hmas

An ontology to describe Hypermedia Multi-Agent Systems, interactions, and organizations.
https://purl.org/hmas/
1 stars 0 forks source link

What alignement with WoT TD vocabulary? #187

Open FabienGandon opened 10 months ago

FabienGandon commented 10 months ago

As discussed in another thread, this issue is open and dedicated to the alignment with the Thing Description (TD) Ontology https://www.w3.org/2019/wot/td

smnmyr commented 10 months ago

Our Signifiers should be aligned with TD:Affordances :-)

danaivach commented 10 months ago

To be handled here: https://github.com/HyperAgents/hmas/blob/master/src/alignment/interaction-td.ttl

Check here for a reference: https://github.com/w3c/sdw-sosa-ssn/blob/gh-pages/ssn/mappings/sosa-om-mapping.ttl

danaivach commented 10 months ago

Examples of Signifiers should be provided that are "generated" based on Interaction Affordances. The translation process and information loss should be checked.

danaivach commented 9 months ago

Generic example.

hMAS resource profile of an artifact:

@prefix hmas: <https://purl.org/hmas/> .
@prefix onto: <https://ci.mines-stetienne.fr/kg/ontology#> .
@prefix hctl: <https://www.w3.org/2019/wot/hypermedia#> .
@prefix pto:   <http://www.productontology.org/id/> .
@prefix htv: <http://www.w3.org/2011/http#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix xs: <https://www.w3.org/2001/XMLSchema#> .
@prefix ex: <http://example.org/> .

ex:ur5Profile a hmas:ResourceProfile;
    hmas:isProfileOf ex:ur5;
    hmas:exposesSignifier ex:gripperMovable .

ex:ur5 a hmas:Artifact, pto:Robotic_arm ;
    hmas:isContainedIn ex:manufacturingWksp .

ex:manufacturingWksp a hmas:Workspace .

ex:gripperMovable a hmas:Signifier ;
    hmas:signifies ex:moveGripperShape .

ex:moveGripperShape a sh:NodeShape;
    sh:class hmas:ActionExecution ;
    sh:property [
        sh:path prov:used ;
        sh:minCount 1;
        sh:maxCount 1 ;
        sh:hasValue ex:httpForm ;
    ] ;
    sh:property [
        sh:path hmas:hasInput;
        sh:qualifiedValueShape ex:gripperJointShape ;
        sh:qualifiedMinCount 1 ;
        sh:qualifiedMaxCount 1
    ] .

ex:gripperJointShape a sh:NodeShape ;
    sh:class onto:GripperJoint ;
    sh:property [
        sh:path onto:hasGripperValue ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
        sh:datatype xs:integer
    ] .

ex:httpForm a hctl:Form;
    htv:methodName "PUT";
    hctl:hasTarget <https://api.interactions.ics.unisg.ch/leubot1/v1.3.4/gripper> ;
    hctl:forContentType "application/ur5+json".

hMAS resource profile of a TD thing:

 @prefix hmas: <https://purl.org/hmas/> .
@prefix onto: <https://ci.mines-stetienne.fr/kg/ontology#> .
@prefix hctl: <https://www.w3.org/2019/wot/hypermedia#> .
@prefix pto:   <http://www.productontology.org/id/> .
@prefix htv: <http://www.w3.org/2011/http#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix xs: <https://www.w3.org/2001/XMLSchema#> .
@prefix ex: <http://example.org/> .
@prefix td: <https://www.w3.org/2019/wot/td#> .
@prefix wotsec: <https://www.w3.org/2019/wot/security#> .
@prefix js: <https://www.w3.org/2019/wot/json-schema#> .

ex:ur5Profile a hmas:ResourceProfile;
    hmas:isProfileOf ex:ur5;
    hmas:exposesSignifier ex:gripperMovable .

ex:ur5 a td:Thing, pto:Robotic_arm ;
    td:title "UR5 Robotic Arm" ;
    td:hasSecurityConfiguration [ a wotsec:NoSecurityScheme ];
    hmas:isContainedIn ex:manufacturingWksp .

ex:manufacturingWksp a hmas:Workspace .

ex:gripperMovable a hmas:Signifier ;
    hmas:signifies ex:moveGripperShape .

ex:moveGripperShape a td:ActionAffordance ;
    td:hasForm ex:httpForm ;
    td:hasInputSchema ex:gripperJointShape .

ex:gripperJointShape a js:ObjectSchema, onto:GripperJointSchema ;
    js:properties [ a js:IntegerSchema, onto:hasGripperValueSchema ;
          js:propertyName "value"
    ] ;
    js:required "value" .

ex:httpForm a hctl:Form;
    htv:methodName "PUT";
    hctl:hasTarget <https://api.interactions.ics.unisg.ch/leubot1/v1.3.4/gripper> ;
    hctl:forContentType "application/ur5+json".
danaivach commented 9 months ago

Example TD thing to Example hMAS artifact and integration to an hMAS resource profile:

ex:ur5 a td:Thing, pto:Robotic_arm ;
   td:title "UR5 Robotic Arm" ;
   td:hasSecurityConfiguration [ a wotsec:NoSecurityScheme ].
ex:ur5Profile a hmas:ResourceProfile;
   hmas:isProfileOf ex:ur5.

ex:ur5 a td:Thing, pto:Robotic_arm ;
   td:title "UR5 Robotic Arm" ;
   td:hasSecurityConfiguration [ a wotsec:NoSecurityScheme ].
danaivach commented 9 months ago

Example exposure of TD interaction affordance and exposure of hMAS signifier. This is the simplest approach for integrating TD Affordances and hMAS signifiers:

ex:ur5 td:hasInteractionAffordance ex:affordance. 
ex:ur5Profile a hmas:ResourceProfile;
   hmas:exposesSignifier [ a hmas:Signifier ; hmas:signifies ex:affordance ];
   hmas:isProfileOf ex:ur5.
danaivach commented 9 months ago

Should a TD property affordance that is readable and writable result to two hMAS action execution shapes? (The same applies for all TD interaction affordances that have forms with more than one operation types) E.g.:

ex:affordance a td:PropertyAffordance, js:IntegerSchema ;
        td:name "example affordance";
    td:hasForm [ a hctl:Form;
            hctl:hasOperationType td:readProperty, td:writeProperty ;
            hctl:hasTarget <https://api.interactions.ics.unisg.ch/example> .
       ] .
ex:behaviorShape1 a sh:NodeShape ;
    sh:class hmas:ActionExecution;
    sh:property [
        sh:path prov:used ;
            sh:minCount 1;
            sh:maxCount 1 ;
            sh:hasValue ex:httpForm1 ;
    ]  ;
      sh:property [
        sh:path hmas:hasInput;
                sh:minCount 1;
            sh:maxCount 1 ;
                sh:datatype xs:integer 
    ] .

ex:httpForm1 a hctl:Form;
    hctl:hasOperationType td:writeProperty;
    hctl:hasTarget <https://api.interactions.ics.unisg.ch/example> .
ex:behaviorShape2 a sh:NodeShape ;
    sh:class hmas:ActionExecution;
    sh:property [
        sh:path prov:used ;
            sh:minCount 1;
            sh:maxCount 1 ;
            sh:hasValue ex:httpForm2 ;
    ]  ;
      sh:property [
        sh:path hmas:hasOutput;
                sh:minCount 1;
            sh:maxCount 1 ;
                sh:datatype xs:integer 
    ] .

ex:httpForm2 a hctl:Form;
    hctl:hasOperationType td:readProperty;
    hctl:hasTarget <https://api.interactions.ics.unisg.ch/example> .

Depending on the scenario, one could use a behavior shape that combine the above alternatives:

ex:alternativeBehaviorShape a sh:NodeShape ;
    sh:class hmas:ActionExecution;
        sh:or (ex:behaviorShape1 ex:behaviorShape2).
danaivach commented 9 months ago

See how the js Data Schemas can be combined or mapped to SHACL Shapes.