diff --git a/doc/Translate_ttl_to_spec.md b/doc/Translate_ttl_to_spec.md index 0e1c86b..4512cd1 100644 --- a/doc/Translate_ttl_to_spec.md +++ b/doc/Translate_ttl_to_spec.md @@ -1,6 +1,18 @@ +- [receipts to transform ttl to spec](#receipts-to-transform-ttl-to-spec) + - [**a**](#a) + - [**rdfs:range**](#rdfsrange) + - [**rdfs:domain**](#rdfsdomain) + - [owner is **a** type](#owner-is-a-type) + - [owner is a **owl:unionOf** types](#owner-is-a-owlunionof-types) +- [Further infos](#further-infos) + - [RDF/S](#rdfs) + - [range (https://www.w3.org/TR/rdf12-schema/#ch\_range)](#range-httpswwww3orgtrrdf12-schemach_range) + - [type (https://www.w3.org/TR/rdf12-schema/#ch\_type)](#type-httpswwww3orgtrrdf12-schemach_type) + + # receipts to transform ttl to spec -## *it* **a** *something* +## **a** *it* is **a** *something* @@ -28,6 +40,66 @@ Der token `a` in einer ttl Definition entspricht dem RDF-Prädikat `rdf:type`. S Das bedeutet für das Tripel: `(R, rdf:type, C) => C instanceof rdfs:Class & R instanceof C` + +## **rdfs:range** + +*its* value is defined in a **rdfs:range** *the range* + +If range links to an other definition we map range same as **a**. + +Example: +```ttl +as:id rdfs:range xsd:anyURI ; +``` + +Maps to +```clojure +(s/def ::anyURI p/uri-string?) + +(s/def ::id + (s/and + ... + ::anyURI)) +``` + +## **rdfs:domain** + +*it* belong to a **rdfs:domain** *owner* + +### owner is **a** type + +It is added to the owner. That's the way to model properties. If the owner is membe of an other namespace, we create a subclass with same name in the namespce in scope and enhance the subclass. + +Example in namespace activitypub2 +```ttl +as:id rdfs:domain [a owl:Class;] +``` + +Maps to +```clojure +(s/def + ::Class + (s/merge ::owl/Class + (s/keys :opt-un [::id]))) +``` + +### owner is a **owl:unionOf** types + +It is added to the owner. That's the way to model properties. If the owner is membe of an other namespace, we create a subclass with same name in the namespce in scope and enhance the subclass. + +Example in namespace activitypub2 +```ttl +as:id rdfs:domain [owl:unionOf (as:Link as:Object)] +``` + +Maps to +```clojure +(s/def ::Object (s/keys :opt-un [::id ...])) + + +(s/def ::Link (s/keys :opt-un [::id])) +``` + # Further infos ## RDF/S diff --git a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.cljc b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.cljc index a4bffa9..3540fc0 100644 --- a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.cljc +++ b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.cljc @@ -18,25 +18,43 @@ ::xsd/anyURI)) ;http://www.w3.org/ns/activitystreams#attachment -;TODO: definition in progress (s/def ::attachment - (s/and ::owl/ObjectProperty)) + (s/and + ::Class + ::Link + ::Object + ::owl/ObjectProperty)) ;http://www.w3.org/ns/activitystreams#result ;TODO: definition in progress +;How should we translate this? +;rdfs:range [ +; a owl:Class ; +; owl:unionOf ( as:Object as:Link ) +; ] (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) +;http://www.w3.org/ns/activitystreams#Object +;TODO: definition in progress +(s/def ::Object (s/keys :opt-un [::id ::attachment])) + +;http://www.w3.org/ns/activitystreams#Link +;TODO: definition in progress +(s/def ::Link (s/keys :opt-un [::id])) + +(s/def + ::Class + (s/merge ::owl/Class + (s/keys :opt-un [::id]))) + + +;http://www.w3.org/ns/activitystreams#Like +(s/def ::Like ::Activity) \ 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 7afe811..7e0ccf6 100644 --- a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/owl.cljc +++ b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/owl.cljc @@ -9,6 +9,10 @@ ; * Datatype properties link individuals to data values. ; * Object properties link individuals to individuals. +;http://www.w3.org/2002/07/owl#Class +;https://www.w3.org/TR/owl-ref/#Class-def +(s/def ::Class any?) + ;http://www.w3.org/2002/07/owl#DatatypeProperty (s/def ::DatatypeProperty any?) diff --git a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/xsd.cljc b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/xsd.cljc index 2fecabf..578afab 100644 --- a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/xsd.cljc +++ b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/xsd.cljc @@ -1,6 +1,5 @@ (ns org.domaindrivenarchitecture.activity-pub-poc.xsd - "A swallow spec translation implementation of xsd Inheritance of FunctionalProperty - is realized in deep implemented." + "A spec translation implementation of xsd. Predicates are implemented fully functional." (:require [clojure.spec.alpha :as s] [org.domaindrivenarchitecture.activity-pub-poc.predicates :as p]))