object-or-refernce #1

Merged
jem merged 25 commits from object-or-refernce into main 2023-08-01 07:43:12 +00:00
2 changed files with 102 additions and 31 deletions
Showing only changes of commit ada2074726 - Show all commits

View file

@ -91,6 +91,29 @@ Maps to
(s/def ::Link (s/keys :opt-un [::id])) (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 # Further infos
## RDF/S ## RDF/S

View file

@ -4,54 +4,85 @@
[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."
[spec keyword?] [spec keyword?]
(some #(clojure.string/includes? % "FunctionalProperty") (s/describe spec))) (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 ;http://www.w3.org/ns/activitystreams#id
(s/def (s/def ::id
::id (s/and ::owl/DatatypeProperty (s/and ::owl/DatatypeProperty
::owl/FunctionalProperty ::owl/FunctionalProperty
::owl/DeprecatedProperty ::owl/DeprecatedProperty
::xsd/anyURI)) ::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 ;http://www.w3.org/ns/activitystreams#result
(s/def ::result (s/def ::result
(s/and (s/and
::owl/ObjectProperty ::owl/ObjectProperty
::Class (map-class-spec
::Object (s/or :object ::Object
::Link)) :link ::Link))))
;http://www.w3.org/ns/activitystreams#attachment
(s/def ::attachment
(s/and
::owl/ObjectProperty
::Class
::Link
::Object))
;http://www.w3.org/ns/activitystreams#Relationship ;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/def ::Relationship
(s/and (s/keys :opt-un [::object]))) (s/and
::owl/Class
;http://www.w3.org/ns/activitystreams#Activity ::Object
;TODO: definition in progress (s/keys :opt-un [::object])))
(s/def ::Activity
(s/and ::Object
(s/keys :opt-un [::result
::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
::owl/ObjectProperty ::owl/ObjectProperty
::Class (map-class-spec
::Object (s/or
::Link)) :object ::Object
:link ::Link))))
;http://www.w3.org/ns/activitystreams#object ;http://www.w3.org/ns/activitystreams#object
(defmulti object-type map?) (defmulti object-type map?)
@ -72,12 +103,29 @@
(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? ;TODO: There is no as:Class! Why do we need this?
;Answer jem: I do not want to enhance owl/Class inline from here. ;Answer jem: I do not want to enhance owl/Class inline from here.
(s/def (s/def
::Class ::Class
(s/and ::owl/Class)) (s/and ::owl/Class))
;http://www.w3.org/ns/activitystreams#Like
(s/def ::Like ::Activity)