add the option for having [value] or value

This commit is contained in:
Michael Jerger 2023-08-02 12:03:12 +02:00
parent 73cf280ad5
commit 69d93a99ff
2 changed files with 34 additions and 20 deletions

View file

@ -51,66 +51,72 @@
(s/and (s/and
::owl/ObjectProperty ::owl/ObjectProperty
::owl/Class ::owl/Class
::Object (sh/seq-spec (s/and
::Link)) ::Object
::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
::owl/FunctionalProperty ::owl/FunctionalProperty
::owl/DeprecatedProperty ::owl/DeprecatedProperty
::xsd/anyURI)) (sh/seq-spec ::xsd/anyURI)))
;http://www.w3.org/ns/activitystreams#bcc ;http://www.w3.org/ns/activitystreams#bcc
(s/def ::bcc (s/def ::bcc
(s/and ::owl/ObjectProperty (s/and ::owl/ObjectProperty
::Object (sh/seq-spec (s/and
::Link)) ::Object
::Link))))
;http://www.w3.org/ns/activitystreams#bto ;http://www.w3.org/ns/activitystreams#bto
(s/def ::bto (s/def ::bto
(s/and ::owl/ObjectProperty (s/and ::owl/ObjectProperty
::Object (sh/seq-spec (s/and
::Link)) ::Object
::Link))))
;http://www.w3.org/ns/activitystreams#cc ;http://www.w3.org/ns/activitystreams#cc
(s/def ::cc (s/def ::cc
(s/and ::owl/ObjectProperty (s/and ::owl/ObjectProperty
::Object (sh/seq-spec (s/and
::Link)) ::Object
::Link))))
;http://www.w3.org/ns/activitystreams#to ;http://www.w3.org/ns/activitystreams#to
(s/def ::to (s/def ::to
(s/and ::owl/ObjectProperty (s/and ::owl/ObjectProperty
::Object (sh/seq-spec (s/and
::Link)) ::Object
::Link))))
;https://www.w3.org/TR/activitystreams-vocabulary/#dfn-type ;https://www.w3.org/TR/activitystreams-vocabulary/#dfn-type
;TODO: this can not be found in the ttl / namespace. Where is this exactly defined? ;TODO: this can not be found in the ttl / namespace. Where is this exactly defined?
(s/def ::type (s/def ::type
(s/or (sh/seq-spec ::xsd/anyURI))
:single-value ::xsd/anyURI
:coll-of-values (s/+ ::xsd/anyURI)))
;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
::Object (sh/seq-spec (s/and
::Link)) ::Object
::Link))))
;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
::owl/Class ::owl/Class
::Object (sh/seq-spec (s/and
::Link)) ::Object
::Link))))
;http://www.w3.org/ns/activitystreams#actor ;http://www.w3.org/ns/activitystreams#actor
(s/def ::actor (s/def ::actor
(s/and (s/and
::owl/ObjectProperty ::owl/ObjectProperty
::owl/Class ::owl/Class
::Object (sh/seq-spec (s/and
::Link)) ::Object
::Link))))

View file

@ -13,6 +13,14 @@
:no-map #(not (map? %)) :no-map #(not (map? %))
:map spec))) :map spec)))
(defn-spec seq-spec s/spec?
"Spec that applies only for map values."
[spec s/spec?]
(s/and
(s/or
:single-value spec
:coll-of-values (s/+ spec))))
(defn-spec (defn-spec
is-functional-property? boolean? is-functional-property? boolean?
"Checks whether spec is a FunctionalProperty." "Checks whether spec is a FunctionalProperty."