diff options
author | David Robillard <d@drobilla.net> | 2012-09-09 05:34:59 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-09-09 05:34:59 +0000 |
commit | 762e323bef39d297fa19cfc3ef108f56e85a045d (patch) | |
tree | 901d6a5b40743b432dc85ed943e94c6775836cd3 | |
parent | 32d8a611c09b5a0f282e34ef89e8529e59e128e1 (diff) | |
download | lv2-762e323bef39d297fa19cfc3ef108f56e85a045d.tar.xz |
Use stricter datatype definitions conformant with the XSD and OWL specifications for better validation.
-rw-r--r-- | lv2/lv2plug.in/ns/lv2core/lv2core.ttl | 29 | ||||
-rw-r--r-- | lv2/lv2plug.in/ns/meta/meta.ttl | 2 | ||||
-rw-r--r-- | schemas/xsd.ttl | 261 |
3 files changed, 224 insertions, 68 deletions
diff --git a/lv2/lv2plug.in/ns/lv2core/lv2core.ttl b/lv2/lv2plug.in/ns/lv2core/lv2core.ttl index 2a8fc62..b923317 100644 --- a/lv2/lv2plug.in/ns/lv2core/lv2core.ttl +++ b/lv2/lv2plug.in/ns/lv2core/lv2core.ttl @@ -142,7 +142,7 @@ lv2:Plugin rdfs:subClassOf [ a owl:Restriction ; owl:onProperty doap:name ; - owl:someValuesFrom xsd:string ; + owl:someValuesFrom rdf:PlainLiteral ; rdfs:comment """ A Plugin MUST have at least one doap:name that is a string with no language tag. @@ -170,18 +170,18 @@ lv2:Port rdfs:subClassOf [ a owl:Restriction ; owl:onProperty lv2:index ; - owl:allValuesFrom xsd:nonNegativeInteger ; + owl:allValuesFrom xsd:unsignedInt ; owl:cardinality 1 ; rdfs:comment """ -A port MUST have a single lv2:index which is of type xsd:nonNegativeInteger -(e.g. a non-negative integer literal in Turtle). The actual RDF datatype -of the index MAY be xsd:integer (which is what a generic Turtle parser -will do), but the value itself MUST be non-negative. +A port MUST have a single lv2:index which is of type xsd:unsignedInt. The +explicit RDF datatype of the index MAY be something else (typically xsd:integer +for pretty Turtle numeric literals), but the value itself MUST be a valid +xsd:unsignedInt (i.e. a non-negative 32-bit integer). """ ] , [ a owl:Restriction ; owl:onProperty lv2:symbol ; - owl:allValuesFrom xsd:string ; + owl:allValuesFrom rdf:PlainLiteral ; owl:cardinality 1 ; rdfs:comment """ A port MUST have a single lv2:symbol which is of type xsd:string with no @@ -286,7 +286,8 @@ lv2:port rdfs:comment "Relates a Plugin to the Ports it contains" . lv2:project - a rdf:Property ; + a rdf:Property , + owl:ObjectProperty ; rdfs:range doap:Project ; rdfs:label "project" ; lv2:documentation """ @@ -442,14 +443,18 @@ lv2:index a rdf:Property , owl:DatatypeProperty , owl:FunctionalProperty ; - rdfs:range xsd:nonNegativeInteger ; + rdfs:range xsd:unsignedInt ; rdfs:label "index" ; - rdfs:comment "A non-negative zero-based index." . + rdfs:comment "A non-negative zero-based 32-bit index." . lv2:Symbol a rdfs:Datatype ; - rdfs:subClassOf xsd:string ; - xsd:pattern "[_a-zA-Z][_a-zA-Z0-9]*$" ; + owl:onDatatype xsd:string ; + owl:withRestrictions ( + [ + xsd:pattern "[_a-zA-Z][_a-zA-Z0-9]*" + ] + ) ; rdfs:comment """ A short restricted name used as a machine and human readable identifier. diff --git a/lv2/lv2plug.in/ns/meta/meta.ttl b/lv2/lv2plug.in/ns/meta/meta.ttl index 8fe5775..194418c 100644 --- a/lv2/lv2plug.in/ns/meta/meta.ttl +++ b/lv2/lv2plug.in/ns/meta/meta.ttl @@ -54,6 +54,8 @@ THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH R dcs:changeset [ dcs:item [ rdfs:label "Move all project metadata for extensions (e.g. change log) to separate files to spare hosts from loading them during discovery." + ] , [ + rdfs:label "Use stricter datatype definitions conformant with the XSD and OWL specifications for better validation." ] ] ] , [ diff --git a/schemas/xsd.ttl b/schemas/xsd.ttl index 27f6d4b..aa67f2b 100644 --- a/schemas/xsd.ttl +++ b/schemas/xsd.ttl @@ -1,74 +1,147 @@ -@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<> + a owl:Ontology ; + rdfs:comment "XML Schema Datatypes" . xsd:ID a rdfs:Datatype ; - rdfs:subClassOf xsd:anyURI , - xsd:Name . + owl:onDatatype xsd:NCName . xsd:IDREF a rdfs:Datatype ; - rdfs:subClassOf xsd:anyURI , - xsd:Name . + owl:onDatatype xsd:NCName . + +xsd:ENTITY + a rdfs:Datatype ; + owl:onDatatype xsd:NCName . xsd:NCName a rdfs:Datatype ; - rdfs:subClassOf xsd:anyURI , - xsd:Name . + owl:onDatatype xsd:Name . xsd:NMTOKEN a rdfs:Datatype ; - rdfs:subClassOf xsd:token . + owl:onDatatype xsd:token . xsd:Name a rdfs:Datatype ; - rdfs:subClassOf xsd:NMTOKEN . + owl:onDatatype xsd:token . + +xsd:totalDigits + a rdf:Property , + owl:DatatypeProperty ; + rdfs:range xsd:positiveInteger ; + rdfs:comment "The maximum number of decimal digits required to represent a value." . + +xsd:fractionDigits + a rdf:Property , + owl:DatatypeProperty ; + rdfs:range xsd:nonNegativeInteger ; + rdfs:comment "The total number of digits to the right of the decimal point required to represent a value." . xsd:pattern - a rdf:Property ; - rdfs:domain rdfs:Datatype ; - rdfs:range xsd:string ; - rdfs:comment "A regular expression that matches literals of this type." . + a rdf:Property , + owl:DatatypeProperty ; + rdfs:comment "A regular expression that matches complete valid literals." . + +xsd:maxInclusive + a rdf:Property , + owl:DatatypeProperty ; + rdfs:comment "The inclusive upper bound of an ordered datatype." . + +xsd:maxExclusive + a rdf:Property , + owl:DatatypeProperty ; + rdfs:comment "The exclusive upper bound of an ordered datatype." . + +xsd:minInclusive + a rdf:Property , + owl:DatatypeProperty ; + rdfs:comment "The inclusive lower bound of an ordered datatype." . + +xsd:minExclusive + a rdf:Property , + owl:DatatypeProperty ; + rdfs:comment "The exclusive lower bound of an ordered datatype." . + +xsd:QName + a rdfs:Datatype ; + rdfs:comment "XML qualified names." . xsd:anyURI a rdfs:Datatype ; - rdfs:subClassOf xsd:token . + rdfs:comment "URI reference." . xsd:base64Binary a rdfs:Datatype ; - xsd:pattern "(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" . + rdfs:comment "Base64-encoded arbitrary binary data." ; + owl:withRestrictions ( + [ + xsd:pattern "(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?" + ] + ) . xsd:boolean a rdfs:Datatype ; - xsd:pattern "(true|false)$" . + owl:withRestrictions ( + [ + xsd:pattern "(true|false)" + ] + ) . xsd:byte a rdfs:Datatype ; - rdfs:subClassOf xsd:short ; - xsd:pattern "[0-9A-F][0-9A-F]$" . + owl:onDatatype xsd:short ; + owl:withRestrictions ( + [ + xsd:pattern "[0-9A-F][0-9A-F]" + ] [ + xsd:maxInclusive 127 + ] [ + xsd:minInclusive -128 + ] + ) . xsd:date a rdfs:Datatype ; - xsd:pattern "-?[0-9][0-9][0-9][0-9]([0-9]*)?-(0[1-9]|1[0-1])-([0-3][1-9])([+-][0-1][0-9]:[0-6][0-9])?$" . + owl:withRestrictions ( + [ + xsd:pattern "-?[0-9][0-9][0-9][0-9]([0-9]*)?-(0[1-9]|1[0-1])-([0-3][1-9])([+-][0-1][0-9]:[0-6][0-9])?" + ] + ) . xsd:dateTime a rdfs:Datatype . xsd:decimal a rdfs:Datatype ; - xsd:pattern "[+-]?[0-9]*\\.?[0-9]*$" . + rdfs:comment "A subset of the real numbers, which can be represented by decimal numerals." ; + owl:withRestrictions ( + [ + xsd:pattern "[+-]?[0-9]*\\.?[0-9]*" + ] + ) . xsd:double a rdfs:Datatype ; - xsd:pattern "[+-]?[0-9]*\\.?[0-9]*([eE][-+]?[0-9]+)$" . + rdfs:comment "IEEE double-precision 64-bit floating point." ; + owl:withRestrictions ( + [ + xsd:pattern "[+-]?[0-9]*\\.?[0-9]*([eE][-+]?[0-9]+)" + ] + ) . xsd:duration a rdfs:Datatype . xsd:float a rdfs:Datatype ; - rdfs:subClassOf xsd:double . + rdfs:comment "IEEE single-precision 32-bit floating point." ; + owl:onDatatype xsd:double . xsd:gDay a rdfs:Datatype . @@ -87,86 +160,162 @@ xsd:gYearMonth xsd:hexBinary a rdfs:Datatype ; - xsd:pattern "[0-9A-F]*$" . + rdfs:comment "Hex-encoded arbitrary binary data." ; + owl:withRestrictions ( + [ + xsd:pattern "[0-9A-F]*" + ] + ) . xsd:int a rdfs:Datatype ; - rdfs:subClassOf xsd:long , - xsd:double . + owl:onDatatype xsd:long ; + owl:withRestrictions ( + [ + xsd:maxInclusive 2147483647 + ] [ + xsd:minInclusive -2147483648 + ] + ) . xsd:integer a rdfs:Datatype ; - rdfs:subClassOf xsd:decimal ; - xsd:pattern "[-+]?[0-9]+$" . + owl:onDatatype xsd:decimal ; + owl:withRestrictions ( + [ + xsd:pattern "[-+]?[0-9]+" + ] [ + xsd:fractionDigits 0 + ] + ) . xsd:language a rdfs:Datatype ; - rdfs:subClassOf xsd:NCName , - xsd:ID , - xsd:IDREF ; - xsd:pattern "[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$" . + owl:onDatatype xsd:token ; + owl:withRestrictions ( + [ + xsd:pattern "[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*" + ] + ) . xsd:long a rdfs:Datatype ; - rdfs:subClassOf xsd:integer . + owl:onDatatype xsd:integer ; + owl:withRestrictions ( + [ + xsd:maxInclusive 9223372036854775807 + ] [ + xsd:minInclusive -9223372036854775808 + ] + ) . xsd:negativeInteger a rdfs:Datatype ; - rdfs:subClassOf xsd:nonPositiveInteger . + owl:onDatatype xsd:nonPositiveInteger ; + owl:withRestrictions ( + [ + xsd:maxInclusive -1 + ] + ) . xsd:nonNegativeInteger a rdfs:Datatype ; - rdfs:subClassOf xsd:integer ; - xsd:pattern "[0-9]*$" . + owl:onDatatype xsd:integer ; + owl:withRestrictions ( + [ + xsd:pattern "[0-9]*" + ] [ + xsd:minInclusive 0 + ] + ) . xsd:nonPositiveInteger a rdfs:Datatype ; - rdfs:subClassOf xsd:integer ; - xsd:pattern "(0|-[0-9]+)$" . + owl:onDatatype xsd:integer ; + owl:withRestrictions ( + [ + xsd:pattern "(0|-[0-9]+)" + ] [ + xsd:maxInclusive 0 + ] + ) . xsd:normalizedString a rdfs:Datatype ; - rdfs:subClassOf xsd:string . + owl:onDatatype xsd:string ; + rdfs:comment "The set of strings that do not contain the carriage return (#xD), line feed (#xA) nor tab (#x9) characters." . xsd:positiveInteger a rdfs:Datatype ; - rdfs:subClassOf xsd:nonNegativeInteger ; - xsd:pattern "+?[0-9]+$" . + owl:onDatatype xsd:nonNegativeInteger ; + owl:withRestrictions ( + [ + xsd:pattern "[+]?[0-9]+" + ] [ + xsd:minInclusive 1 + ] + ) . xsd:short a rdfs:Datatype ; - rdfs:subClassOf xsd:int , - xsd:float . + owl:onDatatype xsd:int ; + owl:withRestrictions ( + [ + xsd:maxInclusive 32767 + ] [ + xsd:minInclusive -32768 + ] + ) . xsd:string - a rdfs:Datatype . + a rdfs:Datatype ; + rdfs:comment "A character string." . xsd:time a rdfs:Datatype ; - xsd:pattern "[1-2][0-9]:[0-5][0-9]:[0-5][0-9].[0-9][0-9][0-9]$" . + owl:withRestrictions ( + [ + xsd:pattern "[1-2][0-9]:[0-5][0-9]:[0-5][0-9].[0-9][0-9][0-9]" + ] + ) . xsd:token a rdfs:Datatype ; - rdfs:subClassOf xsd:normalizedString . + owl:onDatatype xsd:normalizedString ; + rdfs:comment "The set of strings that do not contain the carriage return (#xD), line feed (#xA) nor tab (#x9) characters, that have no leading or trailing spaces (#x20) and that have no internal sequences of two or more spaces." . xsd:unsignedByte a rdfs:Datatype ; - rdfs:subClassOf xsd:short , - xsd:unsignedShort ; - xsd:pattern "([0-9]|[0-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$" . + owl:onDatatype xsd:unsignedShort ; + owl:withRestrictions ( + [ + xsd:maxInclusive 255 + ] + ) . xsd:unsignedInt a rdfs:Datatype ; - rdfs:subClassOf xsd:long , - xsd:double , - xsd:unsignedLong . + owl:onDatatype xsd:unsignedLong ; + owl:withRestrictions ( + [ + xsd:maxInclusive 4294967295 + ] + ) . xsd:unsignedLong a rdfs:Datatype ; - rdfs:subClassOf xsd:nonNegativeInteger . + owl:onDatatype xsd:nonNegativeInteger ; + owl:withRestrictions ( + [ + xsd:maxInclusive 18446744073709551615 + ] + ) . xsd:unsignedShort a rdfs:Datatype ; - rdfs:subClassOf xsd:int , - xsd:float , - xsd:unsignedInt . + owl:onDatatype xsd:unsignedInt ; + owl:withRestrictions ( + [ + xsd:maxInclusive 65535 + ] + ) . |