From e252f248ce3136c1a23c39882f7c8efc4bd13824 Mon Sep 17 00:00:00 2001 From: Victor Charpenay Date: Tue, 27 Jun 2023 10:46:37 +0200 Subject: [PATCH 1/2] feat: create scenario for CRUD actions --- domains/disinformation/crud-actions/README.md | 28 +++++++++++ .../disinformation/crud-actions/dataset.ttl | 42 +++++++++++++++++ domains/disinformation/crud-actions/onto.ttl | 46 +++++++++++++++++++ 3 files changed, 116 insertions(+) create mode 100644 domains/disinformation/crud-actions/README.md create mode 100644 domains/disinformation/crud-actions/dataset.ttl create mode 100644 domains/disinformation/crud-actions/onto.ttl diff --git a/domains/disinformation/crud-actions/README.md b/domains/disinformation/crud-actions/README.md new file mode 100644 index 00000000..6e1ec095 --- /dev/null +++ b/domains/disinformation/crud-actions/README.md @@ -0,0 +1,28 @@ +# CRUD Actions + +## Description + +Most basic Web interfaces follow the Create/Replace/Update/Delete pattern to manipulate resources. A forum, for instance, may expose actions to create or edit (replace) a post, to create a response to a post or even to create or delete a new discussion space dedicated to a particular topic. + +## Competency Questions + + +| ID | Question in natural language | Example of answer | +|---|---|---| +| q1 | What request to send to post a message? | POST /posts | +| q2 | What request to send to edit a post? | PUT /posts/123 | +| q3 | What request to send to delete a peviously posted message? | DELETE /posts/123 | + +Editing a post may either be executed as a single update operation, as a replace operation or as a sequence of delete and create operations. In case the three options have different side effects, an agent should be informed of the side effects of each action. + +## Glossary + +* [**CreateAction**](https://purl.org/hmas/CreateAction): Action to create a new resource. +* [**ReplaceAction**](https://purl.org/hmas/ReplaceAction): Action to replace an existing resource. +* [**UpdateAction**](https://purl.org/hmas/UpdateAction): Action to update the representation of an existing resource by adding statements to it. +* [**DeleteAction**](https://purl.org/hmas/DeleteAction): Action to delete an existing resource. + +### Recommendations + +- On-going actions can be described as temporal entities with the [PROV-O](https://www.w3.org/TR/prov-o/) and [OWL Time](https://www.w3.org/TR/owl-time/) ontologies. Action specification can be given as SHACL shapes on `prov:Activity` instances. +- [DublinCore terms](http://purl.org/dc/terms/) can capture the fact that a resource has a new version after every action. diff --git a/domains/disinformation/crud-actions/dataset.ttl b/domains/disinformation/crud-actions/dataset.ttl new file mode 100644 index 00000000..c80348a2 --- /dev/null +++ b/domains/disinformation/crud-actions/dataset.ttl @@ -0,0 +1,42 @@ +@prefix : . +@prefix owl: . +@prefix rdfs: . +@prefix time: . +@prefix prov: . +@prefix dct: . +@prefix sioc: . +@prefix sh: . + +:CreatePostAction + a sh:NodeShape, owl:Class ; + rdfs:subClassof :CreateAction ; + sh:property [ + sh:path [ sh:inversePath prov:wasGeneratedBy ] ; + sh:class sioc:Post + ] . + +:CreateAnswerAction + a sh:NodeShape, owl:Class ; + rdfs:subClassof :CreateAction ; + sh:property [ + sh:path [ sh:inversePath prov:wasGeneratedBy ] ; + sh:and ( + [ + sh:classs sioc:Post + ] + [ + sh:property [ + sh:path [ sh:inversePath sioc:has_reply ] ; + sh:minCount 1 + ] + ] + ) + ] . + +:DeleteForumAction + a sh:NodeShape, owl:Class ; + rdfs:subClassof :DeleteAction ; + sh:property [ + sh:path prov:used ; + sh:class sioc:Forum + ] . diff --git a/domains/disinformation/crud-actions/onto.ttl b/domains/disinformation/crud-actions/onto.ttl new file mode 100644 index 00000000..96cf61e9 --- /dev/null +++ b/domains/disinformation/crud-actions/onto.ttl @@ -0,0 +1,46 @@ +@prefix : . +@prefix owl: . +@prefix rdfs: . +@prefix time: . +@prefix prov: . +@prefix dct: . +@prefix sioc: . +@prefix sh: . + +:interaction a owl:Ontology . + +:CreateAction + a sh:NodeShape, owl:Class ; + sh:property [ + sh:path [ sh:inversePath prov:wasGeneratedBy ] ; + sh:node [ + sh:property [ + sh:path [ sh:inversePath dct:isReplacedBy ] ; + sh:maxCount 0 + ] + ] + ] ; + rdfs:isDefinedBy :interaction . + +:ReplaceAction + a sh:NodeShape, owl:Class ; + sh:property [ + sh:path ( [ sh:inversePath prov:wasGeneratedBy ] dct:isReplacedBy ) ; + sh:equals prov:used + ] ; + rdfs:isDefinedBy :interaction . + +# TODO UpdateAction (to POST new triples to an existing resource) + +:DeleteAction + a sh:NodeShape, owl:Class ; + sh:property [ + sh:path prov:used ; + sh:node [ + sh:property [ + sh:path dct:isReplacedBy ; + sh:maxCount 0 + ] + ] + ] ; + rdfs:isDefinedBy :interaction . From 05f5c1833465c881c96fddc739415e3f24ca8bfc Mon Sep 17 00:00:00 2001 From: Victor Charpenay Date: Tue, 27 Jun 2023 11:32:09 +0200 Subject: [PATCH 2/2] feat: expand crud-action scenario --- domains/disinformation/crud-actions/README.md | 9 +++++---- domains/disinformation/crud-actions/dataset.ttl | 7 ++++--- domains/disinformation/crud-actions/onto.ttl | 10 ++++++++++ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/domains/disinformation/crud-actions/README.md b/domains/disinformation/crud-actions/README.md index 6e1ec095..c10aaf77 100644 --- a/domains/disinformation/crud-actions/README.md +++ b/domains/disinformation/crud-actions/README.md @@ -6,12 +6,13 @@ Most basic Web interfaces follow the Create/Replace/Update/Delete pattern to man ## Competency Questions - | ID | Question in natural language | Example of answer | |---|---|---| -| q1 | What request to send to post a message? | POST /posts | -| q2 | What request to send to edit a post? | PUT /posts/123 | -| q3 | What request to send to delete a peviously posted message? | DELETE /posts/123 | +| q1_1 | What request to send to post a message? | POST /topics/random/posts | +| q1_2 | What request to send to respond to a post? | POST /topics/random/posts/123/answers | +| q2 | What request to send to edit a post? | PUT /topics/random/posts/123 | +| q3 | What request to send to delete a peviously posted message? | DELETE /topics/random/posts/123 | +| q4 | What request to send to add a user to some forum? | POST /topics/random | Editing a post may either be executed as a single update operation, as a replace operation or as a sequence of delete and create operations. In case the three options have different side effects, an agent should be informed of the side effects of each action. diff --git a/domains/disinformation/crud-actions/dataset.ttl b/domains/disinformation/crud-actions/dataset.ttl index c80348a2..914114eb 100644 --- a/domains/disinformation/crud-actions/dataset.ttl +++ b/domains/disinformation/crud-actions/dataset.ttl @@ -1,4 +1,5 @@ @prefix : . +@prefix ex: . @prefix owl: . @prefix rdfs: . @prefix time: . @@ -7,7 +8,7 @@ @prefix sioc: . @prefix sh: . -:CreatePostAction +ex:CreatePostAction a sh:NodeShape, owl:Class ; rdfs:subClassof :CreateAction ; sh:property [ @@ -15,7 +16,7 @@ sh:class sioc:Post ] . -:CreateAnswerAction +ex:CreateAnswerAction a sh:NodeShape, owl:Class ; rdfs:subClassof :CreateAction ; sh:property [ @@ -33,7 +34,7 @@ ) ] . -:DeleteForumAction +ex:DeleteForumAction a sh:NodeShape, owl:Class ; rdfs:subClassof :DeleteAction ; sh:property [ diff --git a/domains/disinformation/crud-actions/onto.ttl b/domains/disinformation/crud-actions/onto.ttl index 96cf61e9..89fb95ac 100644 --- a/domains/disinformation/crud-actions/onto.ttl +++ b/domains/disinformation/crud-actions/onto.ttl @@ -9,6 +9,8 @@ :interaction a owl:Ontology . +# TODO should prov:used statements be specialized to better capture actions? + :CreateAction a sh:NodeShape, owl:Class ; sh:property [ @@ -44,3 +46,11 @@ ] ] ; rdfs:isDefinedBy :interaction . + +:initiated + a owl:ObjectProperty ; + rdfs:comment "The form submitted to a server initiates activity (performed on the server) that transforms resources" ; + rdfs:domain hctl:Form ; + rdfs:range prov:Activity . + +# TODO improve relationship between signifiers/forms and actions \ No newline at end of file