From 938c323dd2cd1624ef23d00782cb42c76212e097 Mon Sep 17 00:00:00 2001 From: Clemens Date: Fri, 30 Jun 2023 15:01:51 +0200 Subject: [PATCH] added activitystreams2 namespace --- .../activity_pub_poc/activitystreams2.clj | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.clj diff --git a/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.clj b/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.clj new file mode 100644 index 0000000..797674a --- /dev/null +++ b/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.clj @@ -0,0 +1,56 @@ +(ns org.domaindrivenarchitecture.activity-pub-poc.core + (:require [clojure.spec.alpha :as s])) + +(s/def ::Object (s/keys + :req-un [::id ::type] ;type darf nicht "Link" sein + :opt-un [::attributedTo ::und-mehr])) +(s/def ::id any?) +(s/def ::type any?);(fn [s] (s/or (uri? s) (= s "Link")))) + +(s/def ::Link (s/keys + :req-un [::type] ; type muss "Link" sein + :opt-un [::attributedTo ::und-mehr])) + +(s/def ::Relationship (s/keys :req-un [::object ::und-mehr])) + +; #### ACTIVITY #### +(s/def ::Activity (s/merge + ::Object + (s/keys + :req-un [::actor ::object] + :opt-un [::result ::target ::origin ::instrument + ::verb]))) +; "IntransitiveActivity" erbt von Activity, aber ohne ::object + +(s/def ::actor (s/* (s/or ::Object ::Link))) +(s/def ::attributedTo (s/* (s/or ::Object ::Link))) + +(s/def ::object (s/* (s/or ::Object ::Link))) + +(s/def ::result (s/* (s/or ::Object ::Link))) + +(s/def ::target (s/* (s/or ::Object ::Link))) + +(s/def ::origin (s/* (s/or ::Object ::Link))) + +(s/def ::instrument (s/* (s/or ::Object ::Link))) + +(s/def ::verb (s/* uri?)) + +(s/def ::instrument (s/* (s/or ::Object ::Link))) + + + + +; #### LIKE #### +(s/def ::Like ::Activity) + +; Was beim Type Activity optional und required ist, ist abhängig vom Aktivitätstyp. +; Bspw brauch ein Like einen actor und den type "Like" und (xor) target/object. +; Aber die "IntransitiveActivity" (die alles von Activity erbt außer "object") vom Type "Question" besitzt keinen "actor". + +(def maybeLike? + {:id "https://social.bla/alyssa#likes/RANDOMHASH", + :type "Like", + :actor "https://social.bla/alyssa", + :object "https://chatty.bla/ben/posts/234s23-2g34234-2hhj536"}) \ No newline at end of file