Skip to content

Commit

Permalink
infer cardinality of one for owl:FunctionalProperty
Browse files Browse the repository at this point in the history
  • Loading branch information
aamedina committed Dec 19, 2023
1 parent d2b3f05 commit d4f9fc2
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 61 deletions.
44 changes: 22 additions & 22 deletions resources/net/wikipunk/ext/json-schema.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@

### https://www.w3.org/2019/wot/json-schema#const

<https://www.w3.org/2019/wot/json-schema#const> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#const> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "const" ;

Expand All @@ -125,7 +125,7 @@

### https://www.w3.org/2019/wot/json-schema#default

<https://www.w3.org/2019/wot/json-schema#default> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#default> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "default" ;

Expand All @@ -148,7 +148,7 @@

### https://www.w3.org/2019/wot/json-schema#maxItems

<https://www.w3.org/2019/wot/json-schema#maxItems> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#maxItems> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "maxItems" ;

Expand All @@ -161,7 +161,7 @@

### https://www.w3.org/2019/wot/json-schema#maximum

<https://www.w3.org/2019/wot/json-schema#maximum> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#maximum> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "maximum" ;

Expand All @@ -175,7 +175,7 @@

### https://www.w3.org/2019/wot/json-schema#exclusiveMaximum

<https://www.w3.org/2019/wot/json-schema#exclusiveMaximum> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#exclusiveMaximum> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "exclusiveMaximum" ;

Expand All @@ -189,7 +189,7 @@

### https://www.w3.org/2019/wot/json-schema#minItems

<https://www.w3.org/2019/wot/json-schema#minItems> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#minItems> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "minItems" ;

Expand All @@ -200,7 +200,7 @@

### https://www.w3.org/2019/wot/json-schema#multipleOf

<https://www.w3.org/2019/wot/json-schema#multipleOf> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#multipleOf> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "multipleOf" ;

Expand All @@ -211,7 +211,7 @@

### https://www.w3.org/2019/wot/json-schema#minimum

<https://www.w3.org/2019/wot/json-schema#minimum> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#minimum> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "minimum" ;

Expand All @@ -224,7 +224,7 @@

### https://www.w3.org/2019/wot/json-schema#exclusiveMinimum

<https://www.w3.org/2019/wot/json-schema#exclusiveMinimum> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#exclusiveMinimum> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "exclusiveMinimum" ;

Expand All @@ -237,7 +237,7 @@

### https://www.w3.org/2019/wot/json-schema#maxLength

<https://www.w3.org/2019/wot/json-schema#maxLength> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#maxLength> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "maxLength" ;

Expand All @@ -248,7 +248,7 @@

### https://www.w3.org/2019/wot/json-schema#minLength

<https://www.w3.org/2019/wot/json-schema#minLength> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#minLength> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "minLength" ;

Expand All @@ -259,14 +259,14 @@

### https://www.w3.org/2019/wot/json-schema#pattern

<https://www.w3.org/2019/wot/json-schema#pattern> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#pattern> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "pattern" ;

rdfs:comment "Provides a regular expression to express constraints of the string value. The regular expression must follow the ECMA 262 dialect."@en ;

schema:domainIncludes :StringSchema ;
rdfs:range xsd:nonNegativeInteger .
rdfs:range xsd:string .


### https://www.w3.org/2019/wot/json-schema#required
Expand All @@ -283,7 +283,7 @@

### https://www.w3.org/2019/wot/json-schema#readOnly

<https://www.w3.org/2019/wot/json-schema#readOnly> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#readOnly> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "readOnly" ;

Expand All @@ -292,7 +292,7 @@
schema:domainIncludes :DataSchema ;
rdfs:range xsd:boolean .

<https://www.w3.org/2019/wot/json-schema#format> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#format> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "format" ;

Expand All @@ -302,7 +302,7 @@
rdfs:range xsd:string .


<https://www.w3.org/2019/wot/json-schema#contentEncoding> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#contentEncoding> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "contentEncoding" ;

Expand All @@ -311,7 +311,7 @@
schema:domainIncludes :StringSchema ;
rdfs:range xsd:string .

<https://www.w3.org/2019/wot/json-schema#contentMediaType> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#contentMediaType> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "contentMediaType" ;

Expand All @@ -323,7 +323,7 @@

### https://www.w3.org/2019/wot/json-schema#writeOnly

<https://www.w3.org/2019/wot/json-schema#writeOnly> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#writeOnly> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "writeOnly" ;

Expand All @@ -335,7 +335,7 @@

### https://www.w3.org/2019/wot/json-schema#description

<https://www.w3.org/2019/wot/json-schema#propertyName> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#propertyName> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "propertyName" ;

Expand Down Expand Up @@ -429,7 +429,7 @@

### https://www.w3.org/2019/wot/json-schema#uniqueItems

<https://www.w3.org/2019/wot/json-schema#uniqueItems> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#uniqueItems> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "uniqueItems" ;

Expand All @@ -440,7 +440,7 @@

### https://www.w3.org/2019/wot/json-schema#additionalProperties

<https://www.w3.org/2019/wot/json-schema#additionalProperties> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#additionalProperties> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "additionalProperties" ;

Expand All @@ -451,7 +451,7 @@

### https://www.w3.org/2019/wot/json-schema#nullable

<https://www.w3.org/2019/wot/json-schema#nullable> rdf:type owl:DatatypeProperty ;
<https://www.w3.org/2019/wot/json-schema#nullable> rdf:type owl:DatatypeProperty, owl:FunctionalProperty ;

rdfs:label "nullable" ;

Expand Down
20 changes: 3 additions & 17 deletions src/clj/net/wikipunk/datomic/boot.clj
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@
[_]
nil)

(defmethod rdf/infer-datomic-cardinality :owl/FunctionalProperty [_] :db.cardinality/one)

(defmethod rdf/infer-datomic-type :rdfa/uri [_] :db.type/string)
(defmethod rdf/infer-datomic-cardinality :rdfa/uri [_] :db.cardinality/one)
(defmethod rdf/infer-datomic-unique :rdfa/uri [_] :db.unique/identity)
Expand All @@ -257,22 +259,6 @@
(defmethod rdf/infer-datomic-type :rdf/language [_] :db.type/string)
(defmethod rdf/infer-datomic-cardinality :rdf/language [_] :db.cardinality/one)

(defmethod rdf/infer-datomic-cardinality :jsonschema/exclusiveMinimum [_] :db.cardinality/one)
(defmethod rdf/infer-datomic-cardinality :jsonschema/exclusiveMaximum [_] :db.cardinality/one)
(defmethod rdf/infer-datomic-cardinality :jsonschema/propertyName [_] :db.cardinality/one)
(defmethod rdf/infer-datomic-cardinality :jsonschema/minimum [_] :db.cardinality/one)
(defmethod rdf/infer-datomic-cardinality :jsonschema/maximum [_] :db.cardinality/one)
(defmethod rdf/infer-datomic-cardinality :jsonschema/minItems [_] :db.cardinality/one)
(defmethod rdf/infer-datomic-cardinality :jsonschema/maxItems [_] :db.cardinality/one)
(defmethod rdf/infer-datomic-cardinality :jsonschema/minLength [_] :db.cardinality/one)
(defmethod rdf/infer-datomic-cardinality :jsonschema/maxLength [_] :db.cardinality/one)
(defmethod rdf/infer-datomic-cardinality :jsonschema/multipleOf [_] :db.cardinality/one)
(defmethod rdf/infer-datomic-cardinality :jsonschema/readOnly [_] :db.cardinality/one)
(defmethod rdf/infer-datomic-cardinality :jsonschema/uniqueItems [_] :db.cardinality/one)
(defmethod rdf/infer-datomic-cardinality :jsonschema/writeOnly [_] :db.cardinality/one)
(defmethod rdf/infer-datomic-cardinality :jsonschema/nullable [_] :db.cardinality/one)
(defmethod rdf/infer-datomic-cardinality :jsonschema/additionalProperties [_] :db.cardinality/one)

(defmethod rdf/infer-datomic-cardinality :owl/propertyChainAxiom [_] :db.cardinality/one)

(defmethod rdf/infer-datomic-type :rdf/Property
Expand Down Expand Up @@ -306,7 +292,7 @@
(when unionOf
(some rdf/infer-datomic-type unionOf))))

#_(defmethod rdf/infer-datomic-type :rdfs/Literal [_] :db.type/string)
(defmethod rdf/infer-datomic-type :rdfs/Literal [_] :db.type/string)

(prefer-method rdf/infer-datomic-type :rdfs/Literal :rdfs/Datatype)
(defmethod rdf/infer-datomic-type :rdfs/seeAlso [_] :db.type/ref)
Expand Down
Loading

0 comments on commit d4f9fc2

Please sign in to comment.