adjustments

This commit is contained in:
Clemens 2023-07-28 16:08:32 +02:00
parent ada2074726
commit 5588bcd5b8

View file

@ -4,7 +4,6 @@
[org.domaindrivenarchitecture.activity-pub-poc.owl :as owl] [org.domaindrivenarchitecture.activity-pub-poc.owl :as owl]
[org.domaindrivenarchitecture.activity-pub-poc.xsd :as xsd])) [org.domaindrivenarchitecture.activity-pub-poc.xsd :as xsd]))
; TODO gec: what is this needed for?
(defn-spec (defn-spec
is-functional-property? boolean? is-functional-property? boolean?
"Checks whether spec is a FunctionalProperty." "Checks whether spec is a FunctionalProperty."
@ -12,29 +11,70 @@
(some #(clojure.string/includes? % "FunctionalProperty") (s/describe spec))) (some #(clojure.string/includes? % "FunctionalProperty") (s/describe spec)))
(defn-spec map-class-spec s/spec? (defn-spec map-class-spec s/spec?
"Spec which checks whether a value is a ::owl/Class "Spec which checks whether a value is a ::Class
and if it is a map, if it validates the given map-spec." and if it is a map, if it validates the given map-spec."
[map-spec s/spec?] [map-spec s/spec?]
(s/and (s/and
::owl/Class ::Class
(s/or (s/or
:no-map #(not (map? %)) :no-map #(not (map? %))
:map map-spec))) :map map-spec)))
;======================= ;=======================
;TODO: There is no as:Class! Why do we need this?
;Answer jem: I do not want to enhance owl/Class inline from here.
(s/def
::Class
(s/and ::owl/Class))
;=======================
;http://www.w3.org/ns/activitystreams#object ;http://www.w3.org/ns/activitystreams#object
(s/def ::Object (s/def ::Object
(s/and (s/and
::owl/Class ::Class
(s/keys :opt-un [::id ::type ::attachment]))) (s/keys :opt-un [::id ::type ::attachment])))
;http://www.w3.org/ns/activitystreams#Link ;http://www.w3.org/ns/activitystreams#Link
(s/def ::Link (s/def ::Link
(s/and (s/and
::owl/Class ::Class
(s/keys :opt-un [::id ::type]))) (s/keys :opt-un [::id ::type])))
;http://www.w3.org/ns/activitystreams#Activity
;TODO: Define more properties necessary for Like
(s/def ::Activity
(s/and
::Class
::Object
(s/keys :opt-un [::result ::object])))
;http://www.w3.org/ns/activitystreams#Relationship
;We only have this class, since the property "object" is in the domain "Activity" and "Relationship"
; TODO: What means: "as:Relationship a rdf:Statement". Relevant for spec?
(s/def ::Relationship
(s/and
::Class
::Object
(s/keys :opt-un [::object])))
;http://www.w3.org/ns/activitystreams#Like
(s/def ::Like
(s/and
::Class
::Activity))
;http://www.w3.org/ns/activitystreams#attachment
; TODO: Why do we need to model this? Is this necessary for a Like-Activity?
(s/def ::attachment
(s/and
::owl/ObjectProperty
(map-class-spec
(s/or
:object ::Object
:link ::Link))))
;http://www.w3.org/ns/activitystreams#id ;http://www.w3.org/ns/activitystreams#id
(s/def ::id (s/def ::id
(s/and ::owl/DatatypeProperty (s/and ::owl/DatatypeProperty
@ -49,15 +89,6 @@
) )
;http://www.w3.org/ns/activitystreams#Activity
;TODO: Define more properties necessary for Like
(s/def ::Activity
(s/and
::owl/Class
::Object
(s/keys :opt-un [::result ::object])))
;http://www.w3.org/ns/activitystreams#result ;http://www.w3.org/ns/activitystreams#result
(s/def ::result (s/def ::result
(s/and (s/and
@ -66,15 +97,6 @@
(s/or :object ::Object (s/or :object ::Object
:link ::Link)))) :link ::Link))))
;http://www.w3.org/ns/activitystreams#Relationship
;We only have this class, since the property "object" is in the domain "Activity" and "Relationship"
; TODO: What means: "as:Relationship a rdf:Statement". Relevant for spec?
(s/def ::Relationship
(s/and
::owl/Class
::Object
(s/keys :opt-un [::object])))
;http://www.w3.org/ns/activitystreams#object ;http://www.w3.org/ns/activitystreams#object
(s/def ::object (s/def ::object
(s/and (s/and
@ -103,29 +125,9 @@
(s/and ::Class)) (s/and ::Class))
(s/def ::Link link-type) (s/def ::Link link-type)
;http://www.w3.org/ns/activitystreams#attachment
; TODO: Why do we need to model this? Is this necessary for a Like-Activity?
(s/def ::attachment
(s/and
::owl/ObjectProperty
(map-class-spec
(s/or
:object ::Object
:link ::Link))))
;http://www.w3.org/ns/activitystreams#Like
(s/def ::Like
(s/and
::owl/Class
::Activity))
;=============
;TODO: There is no as:Class! Why do we need this?
;Answer jem: I do not want to enhance owl/Class inline from here.
(s/def
::Class
(s/and ::owl/Class))