From 7e60392a75c91cd9b4618171c922d32555ada8dd Mon Sep 17 00:00:00 2001 From: Clemens Date: Fri, 21 Jul 2023 13:41:52 +0200 Subject: [PATCH] Added some logic --- .../activity_pub_poc/activitystreams2.cljc | 14 ++++++++++++++ .../activity_pub_poc/owl.cljc | 2 +- .../activity_pub_poc/predicates.cljc | 6 ++++++ .../activity_pub_poc/rdf.cljc | 12 ++++++++++++ .../activity_pub_poc/rdfs.cljc | 15 +++++++++++++++ .../activity_pub_poc/xsd.cljc | 8 ++++++++ 6 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.cljc create mode 100644 src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/predicates.cljc create mode 100644 src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/rdf.cljc create mode 100644 src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/rdfs.cljc create mode 100644 src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/xsd.cljc diff --git a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.cljc b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.cljc new file mode 100644 index 0000000..9114f18 --- /dev/null +++ b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.cljc @@ -0,0 +1,14 @@ +(ns org.domaindrivenarchitecture.activity-pub-poc.activitystreams2 + (:require [clojure.spec.alpha :as s] + [org.domaindrivenarchitecture.activity-pub-poc.owl :as owl] + [org.domaindrivenarchitecture.activity-pub-poc.core :as core])) + +;http://www.w3.org/ns/activitystreams#id +;TODO: how do we translate this? rdfs:domain [a owl:Class ; owl:unionOf (as:Link as:Object)] +; Der token 'a' in einer ttl definition entspricht dem RDF-Prädikat rdf:type. +; Siehe: https://www.w3.org/TR/turtle/#sec-iri UND https://www.w3.org/TR/rdf12-schema/#ch_type +; => (R, rdf:type, C) => C instanceof rdfs:Class & R instanceof C +(s/def ::id (s/and ::owl/FunctionalProperty + ::owl/DatatypeProperty + ::owl/DeprecatedProperty + core/uri-string?)) \ No newline at end of file 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 a78c43d..cb1a30a 100644 --- a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/owl.cljc +++ b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/owl.cljc @@ -5,7 +5,7 @@ ; Properties:https://www.w3.org/TR/owl-ref/#Property ; * Datatype properties link individuals to data values. -; * Object properties link individuals to data values. +; * Object properties link individuals to individuals. ;http://www.w3.org/2002/07/owl#DatatypeProperty (s/def ::DatatypeProperty any?) diff --git a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/predicates.cljc b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/predicates.cljc new file mode 100644 index 0000000..2973182 --- /dev/null +++ b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/predicates.cljc @@ -0,0 +1,6 @@ +(ns org.domaindrivenarchitecture.activity-pub-poc.predicates + (:require [clojure.string :as str])) + +(defn uri-string? [input] + (and (string? input) + (re-matches #"\w+:(\/?\/?)[^\s]+" input))) \ No newline at end of file diff --git a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/rdf.cljc b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/rdf.cljc new file mode 100644 index 0000000..a2d6173 --- /dev/null +++ b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/rdf.cljc @@ -0,0 +1,12 @@ +(ns org.domaindrivenarchitecture.activity-pub-poc.rdf + "" "A swallow spec translation implementation of rdf. Inheritance of FunctionalProperty + is realized in deep implemented." "" + (:require [clojure.spec.alpha :as s] + [orchestra.core :refer [defn-spec]])) + +; TODO: Fill out logic +(defn-spec triple boolean? + [rdf-types any? + property any? + object any?] + ) \ No newline at end of file diff --git a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/rdfs.cljc b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/rdfs.cljc new file mode 100644 index 0000000..bebcc7d --- /dev/null +++ b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/rdfs.cljc @@ -0,0 +1,15 @@ +(ns org.domaindrivenarchitecture.activity-pub-poc.rdfs + "" "A swallow spec translation implementation of rdfs. Inheritance of FunctionalProperty + is realized in deep implemented." "" + (:require [clojure.spec.alpha :as s])) + +;https://www.w3.org/TR/rdf12-schema/#ch_range +; "P rdfs:range C" indicates that: +; 1. P is an instance of the class rdf:Property +; 2. C is an instance of the class rdfs:Class +; 3. all the resources denoted by the objects of triples whose predicate is P are instances of the class C. +; =>Bedeutet(?): Es gilt: Tupel = (Subjekt, Prädikat, Objekt): +; => Wenn (P, rdfs:range, C) & (S, P, C2) => C2 is instance of C +; +; 1. und 2. könnten wir in der spec abbilden. 3. brauchen wir vmtl nicht (und hab ich nicht 100% verstanden) +(s/def ::range any?) \ No newline at end of file diff --git a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/xsd.cljc b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/xsd.cljc new file mode 100644 index 0000000..021697f --- /dev/null +++ b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/xsd.cljc @@ -0,0 +1,8 @@ +(ns org.domaindrivenarchitecture.activity-pub-poc.xsd + "" "A swallow spec translation implementation of xsd Inheritance of FunctionalProperty + is realized in deep implemented." "" + (:require [clojure.spec.alpha :as s] + [org.domaindrivenarchitecture.activity-pub-poc.predicates :as p])) + +;https://www.w3.org/TR/xmlschema11-2/#anyURI +(s/def ::anyURI p/uri-string?) \ No newline at end of file