From 4ee310596a9898bb226f9e52d796f32dda841df9 Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 28 Jul 2023 17:57:30 +0200 Subject: [PATCH] add actor definition --- .../activity_pub_poc/activitystreams2.cljc | 10 +++++++++- .../activitystreams2_test.cljc | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.cljc b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.cljc index 69b1a66..0be62e1 100644 --- a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.cljc +++ b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.cljc @@ -29,7 +29,7 @@ (s/and ::owl/Class ::Object - (sh/map-spec (s/keys :opt-un [::result ::object])))) + (sh/map-spec (s/keys :opt-un [::result ::object ::actor])))) ;http://www.w3.org/ns/activitystreams#Relationship ;We only have this class, since the property "object" is in the domain "Activity" and "Relationship" @@ -81,3 +81,11 @@ ::owl/Class ::Object ::Link)) + +;http://www.w3.org/ns/activitystreams#actor +(s/def ::actor + (s/and + ::owl/ObjectProperty + ::owl/Class + ::Object + ::Link)) diff --git a/src/test/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2_test.cljc b/src/test/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2_test.cljc index efbc397..9735f68 100644 --- a/src/test/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2_test.cljc +++ b/src/test/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2_test.cljc @@ -35,6 +35,24 @@ :content "This is what he looks like.", :url "http://example.org/cat.jpeg"}]))) +(deftest actor-test + (is (s/valid? ::sut/actor "http://sally.example.org")) + (is (s/valid? ::sut/actor {:type "Person", + :id "http://sally.example.org", + :summary "Sally"})) + (is (s/valid? ::sut/actor ["http://joe.example.org", + {:type "Person", + :id "http://sally.example.org", + :name "Sally"}]))) + +(deftest Activity-test + (is (s/valid? ::sut/Activity + {:type "Activity", + :summary "Sally did something to a note", + :actor {:type "Person", + :name "Sally"}, + :object {:type "Note", + :name "A Note"}}))) (deftest Like-test (is (s/valid? ::sut/Like