Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scenario crud actions #212

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions domains/disinformation/crud-actions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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_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.

## 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.
43 changes: 43 additions & 0 deletions domains/disinformation/crud-actions/dataset.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@prefix : <https://purl.org/hmas/> .
@prefix ex: <https://example.org/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix time: <http://www.w3.org/2006/time#> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix sioc: <http://rdfs.org/sioc/ns#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .

ex:CreatePostAction
a sh:NodeShape, owl:Class ;
rdfs:subClassof :CreateAction ;
sh:property [
sh:path [ sh:inversePath prov:wasGeneratedBy ] ;
sh:class sioc:Post
] .

ex: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
]
]
)
] .

ex:DeleteForumAction
a sh:NodeShape, owl:Class ;
rdfs:subClassof :DeleteAction ;
sh:property [
sh:path prov:used ;
sh:class sioc:Forum
] .
56 changes: 56 additions & 0 deletions domains/disinformation/crud-actions/onto.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
@prefix : <https://purl.org/hmas/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix time: <http://www.w3.org/2006/time#> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix sioc: <http://rdfs.org/sioc/ns#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .

:interaction a owl:Ontology .

# TODO should prov:used statements be specialized to better capture actions?

: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 .

: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