From 23e159ea5f17c4bf44a89a5165de6d2bbaea3fa3 Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Tue, 18 Jul 2023 09:18:40 +0200 Subject: [PATCH 1/5] make spec more structured --- doc/Translate_ttl_to_spec.md | 23 + .../activity_pub_poc/activitystreams2.clj | 12 +- .../activity_pub_poc/owl.cljc | 13 + src/main/resources/owl.ttl | 552 ++++++++++++++++++ 4 files changed, 598 insertions(+), 2 deletions(-) create mode 100644 doc/Translate_ttl_to_spec.md create mode 100644 src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/owl.cljc create mode 100644 src/main/resources/owl.ttl diff --git a/doc/Translate_ttl_to_spec.md b/doc/Translate_ttl_to_spec.md new file mode 100644 index 0000000..8db86b0 --- /dev/null +++ b/doc/Translate_ttl_to_spec.md @@ -0,0 +1,23 @@ +# receipts to transform ttl to spec + +## *it* **a** *something* + +*it* is **a** *something* + + +Example: +```ttl +as:id a owl:DatatypeProperty , + owl:FunctionalProperty, +``` + +Maps to +```clojure +(s/def ::DatatypeProperty any?) +(s/def ::FunctionalProperty any?) + +(s/def ::id + (s/and + ::DeprecatedProperty + ::FunctionalProperty)) +``` \ No newline at end of file diff --git a/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.clj b/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.clj index d53aa2e..e06a7b5 100644 --- a/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.clj +++ b/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.clj @@ -1,5 +1,6 @@ (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])) ; TODO: We could do these with multispec, but that is too much for a POC @@ -30,8 +31,15 @@ :uri core/uri-string? :map (s/and (s/keys :req-un [::id ::type] - :opt-un [::attributedTo ::content ::und-mehr])))) -(s/def ::id core/uri-string?) + :opt-un [::attributedTo ::und-mehr]) + (match-type "Object")))) + +;http://www.w3.org/ns/activitystreams#id +;TODO: how do we translate this? rdfs:domain [a owl:Class ; owl:unionOf (as:Link as:Object)] +(s/def ::id (s/and ::owl/FunctionalProperty + ::owl/DatatypeProperty + ::owl/DeprecatedProperty + core/uri-string?)) ; TODO: type can have multiple values!! Affects also the fct match-type and all specs that uses it! (s/def ::type #(or (core/uri-string? %) (contains? objectAndLinkTypes %))) diff --git a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/owl.cljc b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/owl.cljc new file mode 100644 index 0000000..e473146 --- /dev/null +++ b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/owl.cljc @@ -0,0 +1,13 @@ +(ns org.domaindrivenarchitecture.activity-pub-poc.owl + """A swallow spec translation implementation of owl. Inheritance of FunctionalProperty + is realized in deep implemented.""" + (:require [clojure.spec.alpha :as s])) + +;http://www.w3.org/2002/07/owl#DatatypeProperty +(s/def ::DatatypeProperty any?) + +;http://www.w3.org/2002/07/owl#FunctionalProperty +(s/def ::FunctionalProperty any?) + +;http://www.w3.org/2002/07/owl#DeprecatedProperty +(s/def ::DeprecatedProperty any?) diff --git a/src/main/resources/owl.ttl b/src/main/resources/owl.ttl new file mode 100644 index 0000000..3ecdc75 --- /dev/null +++ b/src/main/resources/owl.ttl @@ -0,0 +1,552 @@ +@prefix dc: . +@prefix grddl: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix xml: . +@prefix xsd: . + + a owl:Ontology ; + dc:title "The OWL 2 Schema vocabulary (OWL 2)" ; + rdfs:comment """ + This ontology partially describes the built-in classes and + properties that together form the basis of the RDF/XML syntax of OWL 2. + The content of this ontology is based on Tables 6.1 and 6.2 + in Section 6.4 of the OWL 2 RDF-Based Semantics specification, + available at http://www.w3.org/TR/owl2-rdf-based-semantics/. + Please note that those tables do not include the different annotations + (labels, comments and rdfs:isDefinedBy links) used in this file. + Also note that the descriptions provided in this ontology do not + provide a complete and correct formal description of either the syntax + or the semantics of the introduced terms (please see the OWL 2 + recommendations for the complete and normative specifications). + Furthermore, the information provided by this ontology may be + misleading if not used with care. This ontology SHOULD NOT be imported + into OWL ontologies. Importing this file into an OWL 2 DL ontology + will cause it to become an OWL 2 Full ontology and may have other, + unexpected, consequences. + """ ; + rdfs:isDefinedBy + , + , + ; + rdfs:seeAlso , + ; + owl:imports ; + owl:versionIRI ; + owl:versionInfo "$Date: 2009/11/15 10:54:12 $" ; + grddl:namespaceTransformation . + + +owl:AllDifferent a rdfs:Class ; + rdfs:label "AllDifferent" ; + rdfs:comment "The class of collections of pairwise different individuals." ; + rdfs:isDefinedBy ; + rdfs:subClassOf rdfs:Resource . + +owl:AllDisjointClasses a rdfs:Class ; + rdfs:label "AllDisjointClasses" ; + rdfs:comment "The class of collections of pairwise disjoint classes." ; + rdfs:isDefinedBy ; + rdfs:subClassOf rdfs:Resource . + +owl:AllDisjointProperties a rdfs:Class ; + rdfs:label "AllDisjointProperties" ; + rdfs:comment "The class of collections of pairwise disjoint properties." ; + rdfs:isDefinedBy ; + rdfs:subClassOf rdfs:Resource . + +owl:Annotation a rdfs:Class ; + rdfs:label "Annotation" ; + rdfs:comment "The class of annotated annotations for which the RDF serialization consists of an annotated subject, predicate and object." ; + rdfs:isDefinedBy ; + rdfs:subClassOf rdfs:Resource . + +owl:AnnotationProperty a rdfs:Class ; + rdfs:label "AnnotationProperty" ; + rdfs:comment "The class of annotation properties." ; + rdfs:isDefinedBy ; + rdfs:subClassOf rdf:Property . + +owl:AsymmetricProperty a rdfs:Class ; + rdfs:label "AsymmetricProperty" ; + rdfs:comment "The class of asymmetric properties." ; + rdfs:isDefinedBy ; + rdfs:subClassOf owl:ObjectProperty . + +owl:Axiom a rdfs:Class ; + rdfs:label "Axiom" ; + rdfs:comment "The class of annotated axioms for which the RDF serialization consists of an annotated subject, predicate and object." ; + rdfs:isDefinedBy ; + rdfs:subClassOf rdfs:Resource . + +owl:Class a rdfs:Class ; + rdfs:label "Class" ; + rdfs:comment "The class of OWL classes." ; + rdfs:isDefinedBy ; + rdfs:subClassOf rdfs:Class . + +owl:DataRange a rdfs:Class ; + rdfs:label "DataRange" ; + rdfs:comment "The class of OWL data ranges, which are special kinds of datatypes. Note: The use of the IRI owl:DataRange has been deprecated as of OWL 2. The IRI rdfs:Datatype SHOULD be used instead." ; + rdfs:isDefinedBy ; + rdfs:subClassOf rdfs:Datatype . + +owl:DatatypeProperty a rdfs:Class ; + rdfs:label "DatatypeProperty" ; + rdfs:comment "The class of data properties." ; + rdfs:isDefinedBy ; + rdfs:subClassOf rdf:Property . + +owl:DeprecatedClass a rdfs:Class ; + rdfs:label "DeprecatedClass" ; + rdfs:comment "The class of deprecated classes." ; + rdfs:isDefinedBy ; + rdfs:subClassOf rdfs:Class . + +owl:DeprecatedProperty a rdfs:Class ; + rdfs:label "DeprecatedProperty" ; + rdfs:comment "The class of deprecated properties." ; + rdfs:isDefinedBy ; + rdfs:subClassOf rdf:Property . + +owl:FunctionalProperty a rdfs:Class ; + rdfs:label "FunctionalProperty" ; + rdfs:comment "The class of functional properties." ; + rdfs:isDefinedBy ; + rdfs:subClassOf rdf:Property . + +owl:InverseFunctionalProperty a rdfs:Class ; + rdfs:label "InverseFunctionalProperty" ; + rdfs:comment "The class of inverse-functional properties." ; + rdfs:isDefinedBy ; + rdfs:subClassOf owl:ObjectProperty . + +owl:IrreflexiveProperty a rdfs:Class ; + rdfs:label "IrreflexiveProperty" ; + rdfs:comment "The class of irreflexive properties." ; + rdfs:isDefinedBy ; + rdfs:subClassOf owl:ObjectProperty . + +owl:NamedIndividual a rdfs:Class ; + rdfs:label "NamedIndividual" ; + rdfs:comment "The class of named individuals." ; + rdfs:isDefinedBy ; + rdfs:subClassOf owl:Thing . + +owl:NegativePropertyAssertion a rdfs:Class ; + rdfs:label "NegativePropertyAssertion" ; + rdfs:comment "The class of negative property assertions." ; + rdfs:isDefinedBy ; + rdfs:subClassOf rdfs:Resource . + +owl:Nothing a owl:Class ; + rdfs:label "Nothing" ; + rdfs:comment "This is the empty class." ; + rdfs:isDefinedBy ; + rdfs:subClassOf owl:Thing . + +owl:ObjectProperty a rdfs:Class ; + rdfs:label "ObjectProperty" ; + rdfs:comment "The class of object properties." ; + rdfs:isDefinedBy ; + rdfs:subClassOf rdf:Property . + +owl:Ontology a rdfs:Class ; + rdfs:label "Ontology" ; + rdfs:comment "The class of ontologies." ; + rdfs:isDefinedBy ; + rdfs:subClassOf rdfs:Resource . + +owl:OntologyProperty a rdfs:Class ; + rdfs:label "OntologyProperty" ; + rdfs:comment "The class of ontology properties." ; + rdfs:isDefinedBy ; + rdfs:subClassOf rdf:Property . + +owl:ReflexiveProperty a rdfs:Class ; + rdfs:label "ReflexiveProperty" ; + rdfs:comment "The class of reflexive properties." ; + rdfs:isDefinedBy ; + rdfs:subClassOf owl:ObjectProperty . + +owl:Restriction a rdfs:Class ; + rdfs:label "Restriction" ; + rdfs:comment "The class of property restrictions." ; + rdfs:isDefinedBy ; + rdfs:subClassOf owl:Class . + +owl:SymmetricProperty a rdfs:Class ; + rdfs:label "SymmetricProperty" ; + rdfs:comment "The class of symmetric properties." ; + rdfs:isDefinedBy ; + rdfs:subClassOf owl:ObjectProperty . + +owl:TransitiveProperty a rdfs:Class ; + rdfs:label "TransitiveProperty" ; + rdfs:comment "The class of transitive properties." ; + rdfs:isDefinedBy ; + rdfs:subClassOf owl:ObjectProperty . + +owl:Thing a owl:Class ; + rdfs:label "Thing" ; + rdfs:comment "The class of OWL individuals." ; + rdfs:isDefinedBy . + +owl:allValuesFrom a rdf:Property ; + rdfs:label "allValuesFrom" ; + rdfs:comment "The property that determines the class that a universal property restriction refers to." ; + rdfs:domain owl:Restriction ; + rdfs:isDefinedBy ; + rdfs:range rdfs:Class . + +owl:annotatedProperty a rdf:Property ; + rdfs:label "annotatedProperty" ; + rdfs:comment "The property that determines the predicate of an annotated axiom or annotated annotation." ; + rdfs:domain rdfs:Resource ; + rdfs:isDefinedBy ; + rdfs:range rdfs:Resource . + +owl:annotatedSource a rdf:Property ; + rdfs:label "annotatedSource" ; + rdfs:comment "The property that determines the subject of an annotated axiom or annotated annotation." ; + rdfs:domain rdfs:Resource ; + rdfs:isDefinedBy ; + rdfs:range rdfs:Resource . + +owl:annotatedTarget a rdf:Property ; + rdfs:label "annotatedTarget" ; + rdfs:comment "The property that determines the object of an annotated axiom or annotated annotation." ; + rdfs:domain rdfs:Resource ; + rdfs:isDefinedBy ; + rdfs:range rdfs:Resource . + +owl:assertionProperty a rdf:Property ; + rdfs:label "assertionProperty" ; + rdfs:comment "The property that determines the predicate of a negative property assertion." ; + rdfs:domain owl:NegativePropertyAssertion ; + rdfs:isDefinedBy ; + rdfs:range rdf:Property . + +owl:backwardCompatibleWith a owl:AnnotationProperty, owl:OntologyProperty ; + rdfs:label "backwardCompatibleWith" ; + rdfs:comment "The annotation property that indicates that a given ontology is backward compatible with another ontology." ; + rdfs:domain owl:Ontology ; + rdfs:isDefinedBy ; + rdfs:range owl:Ontology . + +owl:bottomDataProperty a owl:DatatypeProperty ; + rdfs:label "bottomDataProperty" ; + rdfs:comment "The data property that does not relate any individual to any data value." ; + rdfs:domain owl:Thing ; + rdfs:isDefinedBy ; + rdfs:range rdfs:Literal . + +owl:bottomObjectProperty a owl:ObjectProperty ; + rdfs:label "bottomObjectProperty" ; + rdfs:comment "The object property that does not relate any two individuals." ; + rdfs:domain owl:Thing ; + rdfs:isDefinedBy ; + rdfs:range owl:Thing . + +owl:cardinality a rdf:Property ; + rdfs:label "cardinality" ; + rdfs:comment "The property that determines the cardinality of an exact cardinality restriction." ; + rdfs:domain owl:Restriction ; + rdfs:isDefinedBy ; + rdfs:range xsd:nonNegativeInteger . + +owl:complementOf a rdf:Property ; + rdfs:label "complementOf" ; + rdfs:comment "The property that determines that a given class is the complement of another class." ; + rdfs:domain owl:Class ; + rdfs:isDefinedBy ; + rdfs:range owl:Class . + +owl:datatypeComplementOf a rdf:Property ; + rdfs:label "datatypeComplementOf" ; + rdfs:comment "The property that determines that a given data range is the complement of another data range with respect to the data domain." ; + rdfs:domain rdfs:Datatype ; + rdfs:isDefinedBy ; + rdfs:range rdfs:Datatype . + +owl:deprecated a owl:AnnotationProperty ; + rdfs:label "deprecated" ; + rdfs:comment "The annotation property that indicates that a given entity has been deprecated." ; + rdfs:domain rdfs:Resource ; + rdfs:isDefinedBy ; + rdfs:range rdfs:Resource . + +owl:differentFrom a rdf:Property ; + rdfs:label "differentFrom" ; + rdfs:comment "The property that determines that two given individuals are different." ; + rdfs:domain owl:Thing ; + rdfs:isDefinedBy ; + rdfs:range owl:Thing . + +owl:disjointUnionOf a rdf:Property ; + rdfs:label "disjointUnionOf" ; + rdfs:comment "The property that determines that a given class is equivalent to the disjoint union of a collection of other classes." ; + rdfs:domain owl:Class ; + rdfs:isDefinedBy ; + rdfs:range rdf:List . + +owl:disjointWith a rdf:Property ; + rdfs:label "disjointWith" ; + rdfs:comment "The property that determines that two given classes are disjoint." ; + rdfs:domain owl:Class ; + rdfs:isDefinedBy ; + rdfs:range owl:Class . + +owl:distinctMembers a rdf:Property ; + rdfs:label "distinctMembers" ; + rdfs:comment "The property that determines the collection of pairwise different individuals in a owl:AllDifferent axiom." ; + rdfs:domain owl:AllDifferent ; + rdfs:isDefinedBy ; + rdfs:range rdf:List . + +owl:equivalentClass a rdf:Property ; + rdfs:label "equivalentClass" ; + rdfs:comment "The property that determines that two given classes are equivalent, and that is used to specify datatype definitions." ; + rdfs:domain rdfs:Class ; + rdfs:isDefinedBy ; + rdfs:range rdfs:Class . + +owl:equivalentProperty a rdf:Property ; + rdfs:label "equivalentProperty" ; + rdfs:comment "The property that determines that two given properties are equivalent." ; + rdfs:domain rdf:Property ; + rdfs:isDefinedBy ; + rdfs:range rdf:Property . + +owl:hasKey a rdf:Property ; + rdfs:label "hasKey" ; + rdfs:comment "The property that determines the collection of properties that jointly build a key." ; + rdfs:domain owl:Class ; + rdfs:isDefinedBy ; + rdfs:range rdf:List . + +owl:hasSelf a rdf:Property ; + rdfs:label "hasSelf" ; + rdfs:comment "The property that determines the property that a self restriction refers to." ; + rdfs:domain owl:Restriction ; + rdfs:isDefinedBy ; + rdfs:range rdfs:Resource . + +owl:hasValue a rdf:Property ; + rdfs:label "hasValue" ; + rdfs:comment "The property that determines the individual that a has-value restriction refers to." ; + rdfs:domain owl:Restriction ; + rdfs:isDefinedBy ; + rdfs:range rdfs:Resource . + +owl:imports a owl:OntologyProperty ; + rdfs:label "imports" ; + rdfs:comment "The property that is used for importing other ontologies into a given ontology." ; + rdfs:domain owl:Ontology ; + rdfs:isDefinedBy ; + rdfs:range owl:Ontology . + +owl:incompatibleWith a owl:AnnotationProperty, owl:OntologyProperty ; + rdfs:label "incompatibleWith" ; + rdfs:comment "The annotation property that indicates that a given ontology is incompatible with another ontology." ; + rdfs:domain owl:Ontology ; + rdfs:isDefinedBy ; + rdfs:range owl:Ontology . + +owl:intersectionOf a rdf:Property ; + rdfs:label "intersectionOf" ; + rdfs:comment "The property that determines the collection of classes or data ranges that build an intersection." ; + rdfs:domain rdfs:Class ; + rdfs:isDefinedBy ; + rdfs:range rdf:List . + +owl:inverseOf a rdf:Property ; + rdfs:label "inverseOf" ; + rdfs:comment "The property that determines that two given properties are inverse." ; + rdfs:domain owl:ObjectProperty ; + rdfs:isDefinedBy ; + rdfs:range owl:ObjectProperty . + +owl:maxCardinality a rdf:Property ; + rdfs:label "maxCardinality" ; + rdfs:comment "The property that determines the cardinality of a maximum cardinality restriction." ; + rdfs:domain owl:Restriction ; + rdfs:isDefinedBy ; + rdfs:range xsd:nonNegativeInteger . + +owl:maxQualifiedCardinality a rdf:Property ; + rdfs:label "maxQualifiedCardinality" ; + rdfs:comment "The property that determines the cardinality of a maximum qualified cardinality restriction." ; + rdfs:domain owl:Restriction ; + rdfs:isDefinedBy ; + rdfs:range xsd:nonNegativeInteger . + +owl:members a rdf:Property ; + rdfs:label "members" ; + rdfs:comment "The property that determines the collection of members in either a owl:AllDifferent, owl:AllDisjointClasses or owl:AllDisjointProperties axiom." ; + rdfs:domain rdfs:Resource ; + rdfs:isDefinedBy ; + rdfs:range rdf:List . + +owl:minCardinality a rdf:Property ; + rdfs:label "minCardinality" ; + rdfs:comment "The property that determines the cardinality of a minimum cardinality restriction." ; + rdfs:domain owl:Restriction ; + rdfs:isDefinedBy ; + rdfs:range xsd:nonNegativeInteger . + +owl:minQualifiedCardinality a rdf:Property ; + rdfs:label "minQualifiedCardinality" ; + rdfs:comment "The property that determines the cardinality of a minimum qualified cardinality restriction." ; + rdfs:domain owl:Restriction ; + rdfs:isDefinedBy ; + rdfs:range xsd:nonNegativeInteger . + +owl:onClass a rdf:Property ; + rdfs:label "onClass" ; + rdfs:comment "The property that determines the class that a qualified object cardinality restriction refers to." ; + rdfs:domain owl:Restriction ; + rdfs:isDefinedBy ; + rdfs:range owl:Class . + +owl:onDataRange a rdf:Property ; + rdfs:label "onDataRange" ; + rdfs:comment "The property that determines the data range that a qualified data cardinality restriction refers to." ; + rdfs:domain owl:Restriction ; + rdfs:isDefinedBy ; + rdfs:range rdfs:Datatype . + +owl:onDatatype a rdf:Property ; + rdfs:label "onDatatype" ; + rdfs:comment "The property that determines the datatype that a datatype restriction refers to." ; + rdfs:domain rdfs:Datatype ; + rdfs:isDefinedBy ; + rdfs:range rdfs:Datatype . + +owl:oneOf a rdf:Property ; + rdfs:label "oneOf" ; + rdfs:comment "The property that determines the collection of individuals or data values that build an enumeration." ; + rdfs:domain rdfs:Class ; + rdfs:isDefinedBy ; + rdfs:range rdf:List . + +owl:onProperties a rdf:Property ; + rdfs:label "onProperties" ; + rdfs:comment "The property that determines the n-tuple of properties that a property restriction on an n-ary data range refers to." ; + rdfs:domain owl:Restriction ; + rdfs:isDefinedBy ; + rdfs:range rdf:List . + +owl:onProperty a rdf:Property ; + rdfs:label "onProperty" ; + rdfs:comment "The property that determines the property that a property restriction refers to." ; + rdfs:domain owl:Restriction ; + rdfs:isDefinedBy ; + rdfs:range rdf:Property . + +owl:priorVersion a owl:AnnotationProperty, owl:OntologyProperty ; + rdfs:label "priorVersion" ; + rdfs:comment "The annotation property that indicates the predecessor ontology of a given ontology." ; + rdfs:domain owl:Ontology ; + rdfs:isDefinedBy ; + rdfs:range owl:Ontology . + +owl:propertyChainAxiom a rdf:Property ; + rdfs:label "propertyChainAxiom" ; + rdfs:comment "The property that determines the n-tuple of properties that build a sub property chain of a given property." ; + rdfs:domain owl:ObjectProperty ; + rdfs:isDefinedBy ; + rdfs:range rdf:List . + +owl:propertyDisjointWith a rdf:Property ; + rdfs:label "propertyDisjointWith" ; + rdfs:comment "The property that determines that two given properties are disjoint." ; + rdfs:domain rdf:Property ; + rdfs:isDefinedBy ; + rdfs:range rdf:Property . + +owl:qualifiedCardinality a rdf:Property ; + rdfs:label "qualifiedCardinality" ; + rdfs:comment "The property that determines the cardinality of an exact qualified cardinality restriction." ; + rdfs:domain owl:Restriction ; + rdfs:isDefinedBy ; + rdfs:range xsd:nonNegativeInteger . + +owl:sameAs a rdf:Property ; + rdfs:label "sameAs" ; + rdfs:comment "The property that determines that two given individuals are equal." ; + rdfs:domain owl:Thing ; + rdfs:isDefinedBy ; + rdfs:range owl:Thing . + +owl:someValuesFrom a rdf:Property ; + rdfs:label "someValuesFrom" ; + rdfs:comment "The property that determines the class that an existential property restriction refers to." ; + rdfs:domain owl:Restriction ; + rdfs:isDefinedBy ; + rdfs:range rdfs:Class . + +owl:sourceIndividual a rdf:Property ; + rdfs:label "sourceIndividual" ; + rdfs:comment "The property that determines the subject of a negative property assertion." ; + rdfs:domain owl:NegativePropertyAssertion ; + rdfs:isDefinedBy ; + rdfs:range owl:Thing . + +owl:targetIndividual a rdf:Property ; + rdfs:label "targetIndividual" ; + rdfs:comment "The property that determines the object of a negative object property assertion." ; + rdfs:domain owl:NegativePropertyAssertion ; + rdfs:isDefinedBy ; + rdfs:range owl:Thing . + +owl:targetValue a rdf:Property ; + rdfs:label "targetValue" ; + rdfs:comment "The property that determines the value of a negative data property assertion." ; + rdfs:domain owl:NegativePropertyAssertion ; + rdfs:isDefinedBy ; + rdfs:range rdfs:Literal . + +owl:topDataProperty a owl:DatatypeProperty ; + rdfs:label "topDataProperty" ; + rdfs:comment "The data property that relates every individual to every data value." ; + rdfs:domain owl:Thing ; + rdfs:isDefinedBy ; + rdfs:range rdfs:Literal . + +owl:topObjectProperty a owl:ObjectProperty ; + rdfs:label "topObjectProperty" ; + rdfs:comment "The object property that relates every two individuals." ; + rdfs:domain owl:Thing ; + rdfs:isDefinedBy ; + rdfs:range owl:Thing . + +owl:unionOf a rdf:Property ; + rdfs:label "unionOf" ; + rdfs:comment "The property that determines the collection of classes or data ranges that build a union." ; + rdfs:domain rdfs:Class ; + rdfs:isDefinedBy ; + rdfs:range rdf:List . + +owl:versionInfo a owl:AnnotationProperty ; + rdfs:label "versionInfo" ; + rdfs:comment "The annotation property that provides version information for an ontology or another OWL construct." ; + rdfs:domain rdfs:Resource ; + rdfs:isDefinedBy ; + rdfs:range rdfs:Resource . + +owl:versionIRI a owl:OntologyProperty ; + rdfs:label "versionIRI" ; + rdfs:comment "The property that identifies the version IRI of an ontology." ; + rdfs:domain owl:Ontology ; + rdfs:isDefinedBy ; + rdfs:range owl:Ontology . + +owl:withRestrictions a rdf:Property ; + rdfs:label "withRestrictions" ; + rdfs:comment "The property that determines the collection of facet-value pairs that define a datatype restriction." ; + rdfs:domain rdfs:Datatype ; + rdfs:isDefinedBy ; + rdfs:range rdf:List . + \ No newline at end of file From 34922395e90a9ef26ff5546eed24439d7e516191 Mon Sep 17 00:00:00 2001 From: Clemens Date: Fri, 21 Jul 2023 12:24:11 +0200 Subject: [PATCH 2/5] Added some infos --- .../domaindrivenarchitecture/activity_pub_poc/owl.cljc | 9 +++++++++ 1 file changed, 9 insertions(+) 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 e473146..a78c43d 100644 --- a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/owl.cljc +++ b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/owl.cljc @@ -3,11 +3,20 @@ is realized in deep implemented.""" (:require [clojure.spec.alpha :as s])) +; Properties:https://www.w3.org/TR/owl-ref/#Property +; * Datatype properties link individuals to data values. +; * Object properties link individuals to data values. + ;http://www.w3.org/2002/07/owl#DatatypeProperty (s/def ::DatatypeProperty any?) +;http://www.w3.org/2002/07/owl#ObjectProperty +(s/def ::ObjectProperty any?) + ;http://www.w3.org/2002/07/owl#FunctionalProperty +;https://www.w3.org/TR/owl-ref/#FunctionalProperty-def (s/def ::FunctionalProperty any?) ;http://www.w3.org/2002/07/owl#DeprecatedProperty +;https://www.w3.org/TR/owl-ref/#Deprecation (s/def ::DeprecatedProperty any?) From d58fa20147724a7e4ba61de1d09934415795f9bf Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 21 Jul 2023 10:12:08 +0200 Subject: [PATCH 3/5] state of discussion --- .../activity_pub_poc/activitystreams2.clj | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.clj b/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.clj index e06a7b5..d0dbda5 100644 --- a/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.clj +++ b/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.clj @@ -36,11 +36,17 @@ ;http://www.w3.org/ns/activitystreams#id ;TODO: how do we translate this? rdfs:domain [a owl:Class ; owl:unionOf (as:Link as:Object)] +;TODO evtl sind ::owl/FunctionalProperty, ::owl/DatatypeProperty, ::owl/DeprecatedProperty nur meta informationen? (s/def ::id (s/and ::owl/FunctionalProperty ::owl/DatatypeProperty ::owl/DeprecatedProperty core/uri-string?)) +;TODO: we will need such a predicate ... +;(defn-spec isFunctional? bool? +; [spec keyword?] +; (search-in-meta spec)) + ; TODO: type can have multiple values!! Affects also the fct match-type and all specs that uses it! (s/def ::type #(or (core/uri-string? %) (contains? objectAndLinkTypes %))) From 7e60392a75c91cd9b4618171c922d32555ada8dd Mon Sep 17 00:00:00 2001 From: Clemens Date: Fri, 21 Jul 2023 13:41:52 +0200 Subject: [PATCH 4/5] 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 From c3cda39e414f7ccf12cd7f2c8404464ffae1158a Mon Sep 17 00:00:00 2001 From: Clemens Date: Fri, 21 Jul 2023 16:14:10 +0200 Subject: [PATCH 5/5] adjustments --- doc/Translate_ttl_to_spec.md | 23 ++++++++++++++++++- ...reams2.clj => activitystreams2_legacy.clj} | 2 +- .../activity_pub_poc/activitystreams2.cljc | 6 ++--- .../activity_pub_poc/owl.cljc | 4 ++-- .../activity_pub_poc/rdf.cljc | 12 ---------- .../activity_pub_poc/rdfs.cljc | 15 ------------ .../activity_pub_poc/xsd.cljc | 4 ++-- src/test/cljc/org/activitystreams2_test.clj | 9 ++++++++ 8 files changed, 38 insertions(+), 37 deletions(-) rename src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/{activitystreams2.clj => activitystreams2_legacy.clj} (99%) delete mode 100644 src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/rdf.cljc delete mode 100644 src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/rdfs.cljc create mode 100644 src/test/cljc/org/activitystreams2_test.clj diff --git a/doc/Translate_ttl_to_spec.md b/doc/Translate_ttl_to_spec.md index 8db86b0..0e1c86b 100644 --- a/doc/Translate_ttl_to_spec.md +++ b/doc/Translate_ttl_to_spec.md @@ -20,4 +20,25 @@ Maps to (s/and ::DeprecatedProperty ::FunctionalProperty)) -``` \ No newline at end of file +``` + +Der token `a` in einer ttl Definition entspricht dem RDF-Prädikat `rdf:type`. Siehe: +* https://www.w3.org/TR/turtle/#sec-iri +* https://www.w3.org/TR/rdf12-schema/#ch_type + +Das bedeutet für das Tripel: `(R, rdf:type, C) => C instanceof rdfs:Class & R instanceof C` + +# Further infos + +## RDF/S + +### range (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 + +### type (https://www.w3.org/TR/rdf12-schema/#ch_type) \ No newline at end of file diff --git a/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.clj b/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2_legacy.clj similarity index 99% rename from src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.clj rename to src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2_legacy.clj index d0dbda5..4c89f60 100644 --- a/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.clj +++ b/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2_legacy.clj @@ -1,4 +1,4 @@ -(ns org.domaindrivenarchitecture.activity-pub-poc.activitystreams2 +(ns org.domaindrivenarchitecture.activity-pub-poc.activitystreams2-legacy (:require [clojure.spec.alpha :as s] [org.domaindrivenarchitecture.activity-pub-poc.owl :as owl] [org.domaindrivenarchitecture.activity-pub-poc.core :as core])) 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 9114f18..71b718a 100644 --- a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.cljc +++ b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/activitystreams2.cljc @@ -1,14 +1,12 @@ (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.rdf :as rdf] [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 + core/uri-string?)) 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 cb1a30a..20cd38a 100644 --- a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/owl.cljc +++ b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/owl.cljc @@ -1,6 +1,6 @@ (ns org.domaindrivenarchitecture.activity-pub-poc.owl - """A swallow spec translation implementation of owl. Inheritance of FunctionalProperty - is realized in deep implemented.""" + "A swallow spec translation implementation of owl. Inheritance of FunctionalProperty + is realized in deep implemented." (:require [clojure.spec.alpha :as s])) ; Properties:https://www.w3.org/TR/owl-ref/#Property diff --git a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/rdf.cljc b/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/rdf.cljc deleted file mode 100644 index a2d6173..0000000 --- a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/rdf.cljc +++ /dev/null @@ -1,12 +0,0 @@ -(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 deleted file mode 100644 index bebcc7d..0000000 --- a/src/main/cljc/org/domaindrivenarchitecture/activity_pub_poc/rdfs.cljc +++ /dev/null @@ -1,15 +0,0 @@ -(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 index 021697f..2fecabf 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,6 @@ (ns org.domaindrivenarchitecture.activity-pub-poc.xsd - "" "A swallow spec translation implementation of xsd Inheritance of FunctionalProperty - is realized in deep implemented." "" + "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])) diff --git a/src/test/cljc/org/activitystreams2_test.clj b/src/test/cljc/org/activitystreams2_test.clj new file mode 100644 index 0000000..5944812 --- /dev/null +++ b/src/test/cljc/org/activitystreams2_test.clj @@ -0,0 +1,9 @@ +(ns org.domaindrivenarchitecture.activity-pub-poc.activitystreams2-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.activitystreams2 :as sut])) + +(deftest id-test + (is true)) \ No newline at end of file