From 33404eb853299efec0be660c0cbea27b12a28eb6 Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 28 Jul 2023 11:13:47 +0200 Subject: [PATCH] some rudimentary model of class --- .../domaindrivenarchitecture/activity_pub_poc/owl.cljc | 8 +++++++- .../activity_pub_poc/owl_test.cljc | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/owl.cljc b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/owl.cljc index 7e0ccf6..0113755 100644 --- a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/owl.cljc +++ b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/owl.cljc @@ -3,6 +3,7 @@ is realized in deep implemented." (:require [clojure.spec.alpha :as s] + [org.domaindrivenarchitecture.activity-pub-poc.predicates :as p] [orchestra.core :refer [defn-spec]])) ; Properties:https://www.w3.org/TR/owl-ref/#Property @@ -11,7 +12,12 @@ ;http://www.w3.org/2002/07/owl#Class ;https://www.w3.org/TR/owl-ref/#Class-def -(s/def ::Class any?) +(defn-spec owl-class? boolean? + [elem any?] + (or (p/uri-string? elem) + (map? elem) + (vector? elem))) +(s/def ::Class owl-class?) ;http://www.w3.org/2002/07/owl#DatatypeProperty (s/def ::DatatypeProperty any?) diff --git a/src/test/cljc/org/domaindrivenarchitecture/activity_pub_poc/owl_test.cljc b/src/test/cljc/org/domaindrivenarchitecture/activity_pub_poc/owl_test.cljc index 427751f..ab12947 100644 --- a/src/test/cljc/org/domaindrivenarchitecture/activity_pub_poc/owl_test.cljc +++ b/src/test/cljc/org/domaindrivenarchitecture/activity_pub_poc/owl_test.cljc @@ -11,4 +11,11 @@ (is (sut/functional? ["str"])) (is (not (sut/functional? []))) (is (not (sut/functional? nil))) - (is (not (sut/functional? [1 2])))) \ No newline at end of file + (is (not (sut/functional? [1 2])))) + +(deftest owl-class-predicate + (is (sut/owl-class? "http://some.uri")) + (is (sut/owl-class? {:as "class-definition"})) + (is (sut/owl-class? [])) + (is (not (sut/owl-class? "str"))) + (is (not (sut/owl-class? nil))))