From ada20747269b05f5d9c437b6540cee0afd42b340 Mon Sep 17 00:00:00 2001 From: Clemens Date: Fri, 28 Jul 2023 14:28:45 +0200 Subject: [PATCH] fix merge conflicts --- doc/Translate_ttl_to_spec.md | 23 ++++ .../activity_pub_poc/activitystreams2.cljc | 110 +++++++++++++----- 2 files changed, 102 insertions(+), 31 deletions(-) diff --git a/doc/Translate_ttl_to_spec.md b/doc/Translate_ttl_to_spec.md index 9ffa058..8b09efe 100644 --- a/doc/Translate_ttl_to_spec.md +++ b/doc/Translate_ttl_to_spec.md @@ -91,6 +91,29 @@ Maps to (s/def ::Link (s/keys :opt-un [::id])) ``` +## **rdfs:subClassOf** + +*its* value a **rdfs:subClassOf** *the class* + +If subClassOf links to an other definition we map range same as **a**. + +Example: +```ttl +as:Activity rdfs:subClassOf as:Object ; +``` + +Maps to +```clojure +(s/def ::Object ...) + +(s/def ::Activity + (s/and + ... + ::Object + ...)) +``` + + # Further infos ## RDF/S 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 9d2d0c1..d707134 100644 --- a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.cljc +++ b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.cljc @@ -4,54 +4,85 @@ [org.domaindrivenarchitecture.activity-pub-poc.owl :as owl] [org.domaindrivenarchitecture.activity-pub-poc.xsd :as xsd])) +; TODO gec: what is this needed for? (defn-spec is-functional-property? boolean? "Checks whether spec is a FunctionalProperty." [spec keyword?] (some #(clojure.string/includes? % "FunctionalProperty") (s/describe spec))) +(defn-spec map-class-spec s/spec? + "Spec which checks whether a value is a ::owl/Class + and if it is a map, if it validates the given map-spec." + [map-spec s/spec?] + (s/and + ::owl/Class + (s/or + :no-map #(not (map? %)) + :map map-spec))) + +;======================= + +;http://www.w3.org/ns/activitystreams#object +(s/def ::Object + (s/and + ::owl/Class + (s/keys :opt-un [::id ::type ::attachment]))) + +;http://www.w3.org/ns/activitystreams#Link +(s/def ::Link + (s/and + ::owl/Class + (s/keys :opt-un [::id ::type]))) + ;http://www.w3.org/ns/activitystreams#id -(s/def - ::id (s/and ::owl/DatatypeProperty - ::owl/FunctionalProperty - ::owl/DeprecatedProperty - ::xsd/anyURI)) +(s/def ::id + (s/and ::owl/DatatypeProperty + ::owl/FunctionalProperty + ::owl/DeprecatedProperty + ::xsd/anyURI)) + +;https://www.w3.org/TR/activitystreams-vocabulary/#dfn-type +;TODO: this can not be found in the ttl / namespace. Where is this exactly defined? +(s/def ::type + any?;::xsd/anyURI + ) + + +;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 (s/def ::result (s/and ::owl/ObjectProperty - ::Class - ::Object - ::Link)) - -;http://www.w3.org/ns/activitystreams#attachment -(s/def ::attachment - (s/and - ::owl/ObjectProperty - ::Class - ::Link - ::Object)) + (map-class-spec + (s/or :object ::Object + :link ::Link)))) ;http://www.w3.org/ns/activitystreams#Relationship -;TODO: definition in progress +;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 (s/keys :opt-un [::object]))) - -;http://www.w3.org/ns/activitystreams#Activity -;TODO: definition in progress -(s/def ::Activity - (s/and ::Object - (s/keys :opt-un [::result - ::object]))) + (s/and + ::owl/Class + ::Object + (s/keys :opt-un [::object]))) ;http://www.w3.org/ns/activitystreams#object (s/def ::object (s/and ::owl/ObjectProperty - ::Class - ::Object - ::Link)) + (map-class-spec + (s/or + :object ::Object + :link ::Link)))) ;http://www.w3.org/ns/activitystreams#object (defmulti object-type map?) @@ -72,12 +103,29 @@ (s/and ::Class)) (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)) - -;http://www.w3.org/ns/activitystreams#Like -(s/def ::Like ::Activity) \ No newline at end of file