Compare commits

..

No commits in common. "e70edd2f9c6ba94846255c82c734b4597992e857" and "c3cda39e414f7ccf12cd7f2c8404464ffae1158a" have entirely different histories.

6 changed files with 14 additions and 76 deletions

View file

@ -25,7 +25,6 @@
[org.clojars.quoll/raphael "0.1.6"] [org.clojars.quoll/raphael "0.1.6"]
[instaparse "1.4.12"]] [instaparse "1.4.12"]]
:main ^:skip-aot org.domaindrivenarchitecture.activity-pub-poc.core :main ^:skip-aot org.domaindrivenarchitecture.activity-pub-poc.core
:profiles {:test {:test-paths ["src/test/cljc" :profiles {:test {:test-paths ["src/test/clj"]
"src/test/clj"]
:resource-paths ["src/test/resources"] :resource-paths ["src/test/resources"]
:dependencies [[dda/data-test "0.1.1"]]}}) :dependencies [[dda/data-test "0.1.1"]]}})

View file

@ -1,42 +1,12 @@
(ns org.domaindrivenarchitecture.activity-pub-poc.activitystreams2 (ns org.domaindrivenarchitecture.activity-pub-poc.activitystreams2
(:require [clojure.spec.alpha :as s] (:require [clojure.spec.alpha :as s]
[orchestra.core :refer [defn-spec]]
[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.rdf :as rdf]
[org.domaindrivenarchitecture.activity-pub-poc.core :as core]))
(defn-spec
is-functional-property? boolean?
"Checks whether spec is a FunctionalProperty."
[spec keyword?]
(some #(clojure.string/includes? % "FunctionalProperty") (s/describe spec)))
;http://www.w3.org/ns/activitystreams#id ;http://www.w3.org/ns/activitystreams#id
(s/def ;TODO: how do we translate this? rdfs:domain [a owl:Class ; owl:unionOf (as:Link as:Object)]
::id (s/and ::owl/DatatypeProperty (s/def ::id (s/and ::owl/FunctionalProperty
::owl/FunctionalProperty ::owl/DatatypeProperty
::owl/DeprecatedProperty ::owl/DeprecatedProperty
::xsd/anyURI)) core/uri-string?))
;http://www.w3.org/ns/activitystreams#attachment
;TODO: definition in progress
(s/def ::attachment
(s/and ::owl/ObjectProperty))
;http://www.w3.org/ns/activitystreams#result
;TODO: definition in progress
(s/def ::result
(s/and ::owl/ObjectProperty))
;http://www.w3.org/ns/activitystreams#Object
;TODO: definition in progress
(s/def ::Object (s/keys :opt-un [::attachment]))
;http://www.w3.org/ns/activitystreams#Activity
;TODO: definition in progress
(s/def ::Activity
(s/and ::Object
(s/keys :opt-un [::result])))
;http://www.w3.org/ns/activitystreams#Like
(s/def ::Like ::Activity)

View file

@ -1,9 +1,7 @@
(ns org.domaindrivenarchitecture.activity-pub-poc.owl (ns org.domaindrivenarchitecture.activity-pub-poc.owl
"A swallow spec translation implementation of owl. Inheritance of FunctionalProperty "A swallow spec translation implementation of owl. Inheritance of FunctionalProperty
is realized in deep implemented." is realized in deep implemented."
(:require (:require [clojure.spec.alpha :as s]))
[clojure.spec.alpha :as s]
[orchestra.core :refer [defn-spec]]))
; Properties:https://www.w3.org/TR/owl-ref/#Property ; Properties:https://www.w3.org/TR/owl-ref/#Property
; * Datatype properties link individuals to data values. ; * Datatype properties link individuals to data values.
@ -17,22 +15,8 @@
;http://www.w3.org/2002/07/owl#FunctionalProperty ;http://www.w3.org/2002/07/owl#FunctionalProperty
;https://www.w3.org/TR/owl-ref/#FunctionalProperty-def ;https://www.w3.org/TR/owl-ref/#FunctionalProperty-def
(defn-spec (s/def ::FunctionalProperty any?)
functional? boolean?
[elem any?]
(and
(some? elem)
(or
(not (coll? elem))
(and (vector? elem) (= 1 (count elem)))
(and (list? elem) (= 1 (count elem))))))
(s/def ::FunctionalProperty functional?)
;http://www.w3.org/2002/07/owl#DeprecatedProperty ;http://www.w3.org/2002/07/owl#DeprecatedProperty
;https://www.w3.org/TR/owl-ref/#Deprecation ;https://www.w3.org/TR/owl-ref/#Deprecation
(s/def ::DeprecatedProperty any?) (s/def ::DeprecatedProperty any?)
;http://www.w3.org/2002/07/owl#ObjectProperty
;https://www.w3.org/TR/owl-ref/#ObjectProperty
(s/def ::ObjectProperty any?)

View file

@ -1,9 +1,9 @@
(ns org.domaindrivenarchitecture.activity-pub-poc.activitystreams2-legacy-test (ns org.domaindrivenarchitecture.activity-pub-poc.activitystreams2-test
(:require (:require
[clojure.test :refer [deftest is are testing run-tests]] [clojure.test :refer [deftest is are testing run-tests]]
[clojure.spec.test.alpha :as st] [clojure.spec.test.alpha :as st]
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[org.domaindrivenarchitecture.activity-pub-poc.activitystreams2-legacy :as sut])) [org.domaindrivenarchitecture.activity-pub-poc.activitystreams2 :as sut]))
(deftest id-test (deftest id-test
(is (s/valid? ::sut/id "https://social.bla/alyssa/status/RANDOMHASH"))) (is (s/valid? ::sut/id "https://social.bla/alyssa/status/RANDOMHASH")))

View file

@ -5,6 +5,5 @@
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
[org.domaindrivenarchitecture.activity-pub-poc.activitystreams2 :as sut])) [org.domaindrivenarchitecture.activity-pub-poc.activitystreams2 :as sut]))
(deftest shoult-test-spec-for-having-functional-property (deftest id-test
(is (sut/is-functional-property? ::sut/id)) (is true))
(is (not (sut/is-functional-property? ::sut/Like))))

View file

@ -1,14 +0,0 @@
(ns org.domaindrivenarchitecture.activity-pub-poc.owl-test
(:require
[clojure.test :refer [deftest is are testing run-tests]]
[clojure.spec.test.alpha :as st]
[clojure.spec.alpha :as s]
[org.domaindrivenarchitecture.activity-pub-poc.owl :as sut]))
(deftest functional-predicate
(is (sut/functional? "str"))
(is (sut/functional? 2))
(is (sut/functional? ["str"]))
(is (not (sut/functional? [])))
(is (not (sut/functional? nil)))
(is (not (sut/functional? [1 2]))))