Interactions-HSG / yggdrasil

A framework for programming distributed hypermedia environments for autonomous agents.
https://interactions-hsg.github.io/yggdrasil/
Apache License 2.0
7 stars 8 forks source link

Wrong WebSub hMAS signifiers #52

Closed danaivach closed 5 days ago

danaivach commented 3 weeks ago

The hMAS signifiers for WebSub do not change across resource profiles, including their IRIs and hub.topic input values:

Proposal

To reproduce Create a workspace or an artifact (I've created the following through the config file) to get its profile (part of it follows):

@base <http://172.27.52.55:8080/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix hctl: <https://www.w3.org/2019/wot/hypermedia#> .
@prefix hmas: <https://purl.org/hmas/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix htv: <http://www.w3.org/2011/http#> .
@prefix websub: <http://www.example.org/websub#> .
@prefix jacamo: <https://purl.org/hmas/jacamo/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema#> .

<workspaces/61/> a hmas:ResourceProfile;
  hmas:exposesSignifier <workspaces/61/#registerArtifact>, <workspaces/61/#leaveWorkspace>,
    <workspaces/61/#makeArtifact>, <workspaces/61/#updateCurrentWorkspace>, <workspaces/61/#getCurrentWorkspace>,
    <#subscribeToWorkspace>, <#unsubscribeFromWorkspace>, <workspaces/61/#createSubWorkspace>,
    <workspaces/61/#joinWorkspace>, <workspaces/61/#deleteCurrentWorkspace>;
  hmas:isProfileOf <workspaces/61/#workspace> .

# The following signifier has an IRI that points to this resource profile:

<workspaces/61/#registerArtifact> a hmas:Signifier;
  hmas:signifies [ a sh:NodeShape;
      sh:class hmas:ActionExecution, jacamo:RegisterArtifact;
      sh:property [
          sh:path prov:used;
          sh:minCount "1"^^xs:int;
          sh:maxCount "1"^^xs:int;
          sh:hasValue <workspaces/61/#registerArtifactForm>
        ], [
          sh:qualifiedValueShape <http://example.org/artifact-rdf>;
          sh:qualifiedMinCount "1"^^xs:int;
          sh:qualifiedMaxCount "1"^^xs:int;
          sh:path hmas:hasInput
        ]
    ] .

# The following signifiers have an IRI that points to the resource profile of the platform:

<#subscribeToWorkspace> a hmas:Signifier;
  hmas:signifies [ a sh:NodeShape;
      sh:class hmas:ActionExecution, jacamo:ObserveWorkspace;
      sh:property [
          sh:path prov:used;
          sh:minCount "1"^^xs:int;
          sh:maxCount "1"^^xs:int;
          sh:hasValue <#webSubForm>
        ], [
          sh:qualifiedValueShape <#webSubSubscribeInput>;
          sh:qualifiedMinCount "1"^^xs:int;
          sh:qualifiedMaxCount "1"^^xs:int;
          sh:path hmas:hasInput
        ]
    ] .

<#webSubForm> a hctl:Form;
  hctl:hasTarget <hub/>;
  htv:methodName "POST";
  hctl:forContentType "application/json" .

<#webSubSubscribeInput> a sh:Shape;
  sh:class websub:websubsubscription;
  sh:property [ a sh:Shape;
      sh:datatype xs:string;
      sh:name "hub.callback";
      sh:description "The callback URL of the WebSub hub";
      sh:minCount "1"^^xs:int;
      sh:maxCount "1"^^xs:int;
      sh:path websub:callback
    ], [ a sh:Shape;
      sh:hasValue "http://172.27.52.55:8080/";
      sh:datatype xs:string;
      sh:name "hub.topic";
      sh:description "The topic of the WebSub hub";
      sh:minCount "1"^^xs:int;
      sh:maxCount "1"^^xs:int;
      sh:path websub:topic
    ], [ a sh:Shape;
      sh:hasValue "subscribe";
      sh:datatype xs:string;
      sh:name "hub.mode";
      sh:description "The mode of the WebSub hub";
      sh:minCount "1"^^xs:int;
      sh:maxCount "1"^^xs:int;
      sh:path websub:mode
    ] .

<#unsubscribeFromWorkspace> a hmas:Signifier;
  hmas:signifies [ a sh:NodeShape;
      sh:class hmas:ActionExecution, jacamo:UnobserveWorkspace;
      sh:property [
          sh:path prov:used;
          sh:minCount "1"^^xs:int;
          sh:maxCount "1"^^xs:int;
          sh:hasValue <#webSubForm>
        ], [
          sh:qualifiedValueShape <#webSubUnsubscribeInput>;
          sh:qualifiedMinCount "1"^^xs:int;
          sh:qualifiedMaxCount "1"^^xs:int;
          sh:path hmas:hasInput
        ]
    ] .

<#webSubUnsubscribeInput> a sh:Shape;
  sh:class websub:websubsubscription;
  sh:property [ a sh:Shape;
      sh:datatype xs:string;
      sh:name "hub.callback";
      sh:description "The callback URL of the WebSub hub";
      sh:minCount "1"^^xs:int;
      sh:maxCount "1"^^xs:int;
      sh:path websub:callback
    ], [ a sh:Shape;
      sh:hasValue "http://172.27.52.55:8080/";
      sh:datatype xs:string;
      sh:name "hub.topic";
      sh:description "The topic of the WebSub hub";
      sh:minCount "1"^^xs:int;
      sh:maxCount "1"^^xs:int;
      sh:path websub:topic
    ], [ a sh:Shape;
      sh:hasValue "unsubscribe";
      sh:datatype xs:string;
      sh:name "hub.mode";
      sh:description "The mode of the WebSub hub";
      sh:minCount "1"^^xs:int;
      sh:maxCount "1"^^xs:int;
      sh:path websub:mode
    ] .
KaiTries commented 2 weeks ago

This should be fixed with #55

The websub Signifiers now also have IRIs that point to the actual resource profile. The topic is now the correct one as specified in the swagger api.

andreiciortea commented 5 days ago

PR #55 was merged, closing this issue