From 291d16e6709d88cb202acc042c9395c420fd580d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 27 Oct 2018 17:15:24 +0200 Subject: WIP: Improve validation --- lv2/core/lv2core.ttl | 31 +++++++-- lv2/options/options.ttl | 5 +- lv2/presets/presets.ttl | 2 +- lv2/units/units.ttl | 2 - schemas.lv2/xsd.ttl | 175 ++++++++++++++++++++++++++++++++++++++++++------ 5 files changed, 182 insertions(+), 33 deletions(-) diff --git a/lv2/core/lv2core.ttl b/lv2/core/lv2core.ttl index dd3e6bd..20bcacc 100644 --- a/lv2/core/lv2core.ttl +++ b/lv2/core/lv2core.ttl @@ -146,6 +146,11 @@ lv2:Plugin owl:onProperty doap:name ; owl:someValuesFrom rdf:PlainLiteral ; rdfs:comment "A plugin MUST have at least one untranslated doap:name." ; + ] , [ + a owl:Restriction ; + owl:onProperty lv2:port ; + owl:allValuesFrom lv2:Port ; + rdfs:comment "All ports on a plugin MUST be fully specified lv2:Port instances." ; ] ; lv2:documentation """

The class which represents an LV2 plugin.

@@ -162,20 +167,32 @@ e.g. Tape Delay Unit. Use doap:shortdesc or doap:description for more detailed descriptions.

""" . +lv2:PortBase + a rdfs:Class , + owl:Class ; + rdfs:label "Port Base" ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty lv2:symbol ; + owl:cardinality 1 ; + rdfs:comment "A port MUST have exactly one lv2:symbol." ; + ] ; + lv2:documentation """ +

Similar to lv2:PluginBase, an abstract port-like resource that MAY not +actually be a fully specified LV2 port . For example, this is used for preset +"ports" which do not specify an index.

+""" . + lv2:Port a rdfs:Class , owl:Class ; rdfs:label "Port" ; - rdfs:subClassOf [ + rdfs:subClassOf lv2:PortBase , + [ a owl:Restriction ; owl:onProperty lv2:index ; owl:cardinality 1 ; rdfs:comment "A port MUST have exactly one lv2:index." ; - ] , [ - a owl:Restriction ; - owl:onProperty lv2:symbol ; - owl:cardinality 1 ; - rdfs:comment "A port MUST have exactly one lv2:symbol." ; ] , [ a owl:Restriction ; owl:onProperty lv2:name ; @@ -262,7 +279,7 @@ lv2:port a rdf:Property , owl:ObjectProperty ; rdfs:domain lv2:PluginBase ; - rdfs:range lv2:Port ; + rdfs:range lv2:PortBase ; rdfs:label "port" ; rdfs:comment "A port (input or output) on this plugin." . diff --git a/lv2/options/options.ttl b/lv2/options/options.ttl index b0f752c..5c5860a 100644 --- a/lv2/options/options.ttl +++ b/lv2/options/options.ttl @@ -10,7 +10,6 @@ rdfs:seeAlso , ; lv2:documentation """ -

This extension defines a facility for options, which are dynamic properties that may be changed at run time.

@@ -79,7 +78,7 @@ be listed as a lv2:optionalFeature.

opts:requiredOption a rdf:Property , owl:ObjectProperty ; - rdfs:range opts:Option ; + rdfs:range rdf:Property ; rdfs:label "required option" ; lv2:documentation """

An option required by the instance to function at all. The host MUST pass a @@ -94,7 +93,7 @@ fall back to a reasonable default value if it is not provided.

opts:supportedOption a rdf:Property , owl:ObjectProperty ; - rdfs:range opts:Option ; + rdfs:range rdf:Property ; rdfs:label "supported option" ; lv2:documentation """

An option supported or understood by the instance. The host SHOULD diff --git a/lv2/presets/presets.ttl b/lv2/presets/presets.ttl index da7e9bb..a32347b 100644 --- a/lv2/presets/presets.ttl +++ b/lv2/presets/presets.ttl @@ -89,7 +89,7 @@ pset:bank pset:value a rdf:Property ; - rdfs:domain lv2:Port ; + rdfs:domain lv2:PortBase ; rdfs:label "value" ; rdfs:comment """Specifies the value of a Port on some Preset. This property is used in a similar way to e.g. lv2:default.""" . diff --git a/lv2/units/units.ttl b/lv2/units/units.ttl index e40bef6..aaae520 100644 --- a/lv2/units/units.ttl +++ b/lv2/units/units.ttl @@ -59,8 +59,6 @@ units:Unit units:unit a rdf:Property , owl:ObjectProperty ; - rdfs:domain lv2:Port , - lv2:Parameter ; rdfs:range units:Unit ; rdfs:label "unit" ; rdfs:comment "The unit used by the value of a port or parameter." . diff --git a/schemas.lv2/xsd.ttl b/schemas.lv2/xsd.ttl index 972a1a1..f034e6e 100644 --- a/schemas.lv2/xsd.ttl +++ b/schemas.lv2/xsd.ttl @@ -7,6 +7,9 @@ xsd: a owl:Ontology ; rdfs:comment "XML Schema Datatypes" . +xsd:anySimpleType + a rdfs:Datatype . + xsd:ENTITY a rdfs:Datatype ; owl:onDatatype xsd:NCName . @@ -33,29 +36,49 @@ xsd:Name xsd:QName a rdfs:Datatype ; - rdfs:label "XML qualified name" . + rdfs:label "XML qualified name" ; + owl:onDatatype xsd:anySimpleType ; + owl:withRestrictions ( + [ + xsd:whiteSpace "collapse" + ] + ) . xsd:anyURI a rdfs:Datatype ; - rdfs:label "URI reference" . + rdfs:label "URI reference" ; + owl:onDatatype xsd:anySimpleType ; + owl:withRestrictions ( + [ + xsd:whiteSpace "collapse" + ] + ) . xsd:base64Binary a rdfs:Datatype ; rdfs:comment "Base64-encoded arbitrary binary data." ; rdfs:label "base64 binary" ; + owl:onDatatype xsd:anySimpleType ; owl:withRestrictions ( [ xsd:pattern "(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?" ] + [ + xsd:whiteSpace "collapse" + ] ) . xsd:boolean a rdfs:Datatype ; rdfs:label "boolean" ; + owl:onDatatype xsd:anySimpleType ; owl:withRestrictions ( [ xsd:pattern "(true|false)" ] + [ + xsd:whiteSpace "collapse" + ] ) . xsd:byte @@ -64,55 +87,90 @@ xsd:byte owl:onDatatype xsd:short ; owl:withRestrictions ( [ - xsd:maxInclusive 127 + xsd:minInclusive -128 ] [ - xsd:minInclusive -128 + xsd:maxInclusive 127 ] ) . xsd:date a rdfs:Datatype ; rdfs:label "date" ; + owl:onDatatype xsd:anySimpleType ; owl:withRestrictions ( [ - xsd:pattern "-?[0-9][0-9][0-9][0-9]([0-9]*)?-(0[1-9]|1[0-2])-([0-3][0-9])([+-]([0-1][0-9]|2[0-3]):[0-5][0-9])?" + xsd:pattern "-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?" + ] + [ + xsd:whiteSpace "collapse" ] ) . xsd:dateTime a rdfs:Datatype ; - rdfs:label "date time" . + rdfs:label "date time" ; + owl:onDatatype xsd:anySimpleType ; + owl:withRestrictions ( + [ + xsd:pattern "-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?|(24:00:00(\\.0+)?))(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?" + ] + [ + xsd:whiteSpace "collapse" + ] + ) . xsd:decimal a rdfs:Datatype ; rdfs:comment "A subset of the real numbers, which can be represented by decimal numerals." ; rdfs:label "decimal" ; + owl:onDatatype xsd:anySimpleType ; owl:withRestrictions ( [ xsd:pattern "[+-]?[0-9]*\\.?[0-9]*" ] + [ + xsd:whiteSpace "collapse" + ] ) . xsd:double a rdfs:Datatype ; rdfs:comment "IEEE double-precision 64-bit floating point." ; rdfs:label "double" ; + owl:onDatatype xsd:anySimpleType ; owl:withRestrictions ( [ xsd:pattern "[+-]?[0-9]*\\.?[0-9]*([eE][-+]?[0-9]+)?" ] + [ + xsd:whiteSpace "collapse" + ] ) . xsd:duration a rdfs:Datatype ; - rdfs:label "duration" . + rdfs:label "duration" ; + owl:onDatatype xsd:anySimpleType ; + owl:withRestrictions ( + [ + xsd:whiteSpace "collapse" + ] + ) . xsd:float a rdfs:Datatype ; rdfs:comment "IEEE single-precision 32-bit floating point." ; rdfs:label "float" ; - owl:onDatatype xsd:double . + owl:onDatatype xsd:anySimpleType ; + owl:withRestrictions ( + [ + xsd:pattern "[+-]?[0-9]*\\.?[0-9]*([eE][-+]?[0-9]+)?" + ] + [ + xsd:whiteSpace "collapse" + ] + ) . xsd:fractionDigits a rdf:Property , @@ -122,28 +180,62 @@ xsd:fractionDigits rdfs:range xsd:nonNegativeInteger . xsd:gDay - a rdfs:Datatype . + a rdfs:Datatype ; + owl:onDatatype xsd:anySimpleType ; + owl:withRestrictions ( + [ + xsd:whiteSpace "collapse" + ] + ) . xsd:gMonth - a rdfs:Datatype . + a rdfs:Datatype ; + owl:onDatatype xsd:anySimpleType ; + owl:withRestrictions ( + [ + xsd:whiteSpace "collapse" + ] + ) . xsd:gMonthDay - a rdfs:Datatype . + a rdfs:Datatype ; + owl:onDatatype xsd:anySimpleType ; + owl:withRestrictions ( + [ + xsd:whiteSpace "collapse" + ] + ) . xsd:gYear - a rdfs:Datatype . + a rdfs:Datatype ; + owl:onDatatype xsd:anySimpleType ; + owl:withRestrictions ( + [ + xsd:whiteSpace "collapse" + ] + ) . xsd:gYearMonth - a rdfs:Datatype . + a rdfs:Datatype ; + owl:onDatatype xsd:anySimpleType ; + owl:withRestrictions ( + [ + xsd:whiteSpace "collapse" + ] + ) . xsd:hexBinary a rdfs:Datatype ; rdfs:comment "Hex-encoded arbitrary binary data." ; rdfs:label "hex binary" ; + owl:onDatatype xsd:anySimpleType ; owl:withRestrictions ( [ xsd:pattern "[0-9A-F]*" ] + [ + xsd:whiteSpace "collapse" + ] ) . xsd:int @@ -152,10 +244,10 @@ xsd:int owl:onDatatype xsd:long ; owl:withRestrictions ( [ - xsd:maxInclusive 2147483647 + xsd:minInclusive -2147483648 ] [ - xsd:minInclusive -2147483648 + xsd:maxInclusive 2147483647 ] ) . @@ -188,10 +280,10 @@ xsd:long owl:onDatatype xsd:integer ; owl:withRestrictions ( [ - xsd:maxInclusive 9223372036854775807 + xsd:minInclusive -9223372036854775808 ] [ - xsd:minInclusive -9223372036854775808 + xsd:maxInclusive 9223372036854775807 ] ) . @@ -259,7 +351,12 @@ xsd:normalizedString a rdfs:Datatype ; rdfs:comment "The set of strings that do not contain the carriage return (#xD), line feed (#xA) nor tab (#x9) characters." ; rdfs:label "normalized string" ; - owl:onDatatype xsd:string . + owl:onDatatype xsd:string ; + owl:withRestrictions ( + [ + xsd:whiteSpace "replace" + ] + ) . xsd:pattern a rdf:Property , @@ -267,6 +364,21 @@ xsd:pattern rdfs:comment "A regular expression that matches complete valid literals." ; rdfs:label "pattern" . +xsd:whiteSpace + a rdf:Property , + owl:DatatypeProperty ; + rdfs:comment "A string that describes whitespace normalization for a string type." ; + rdfs:label "white space" ; + rdfs:range [ + a rdfs:Datatype ; + owl:onDatatype xsd:string ; + owl:withRestrictions ( + [ + xsd:pattern "(preserve|replace|collapse)" + ] + ) + ] . + xsd:positiveInteger a rdfs:Datatype ; rdfs:label "positive integer" ; @@ -291,27 +403,50 @@ xsd:short [ xsd:minInclusive -32768 ] + ) , ( + [ + xsd:minInclusive -32768 + ] + [ + xsd:maxInclusive 32767 + ] ) . xsd:string a rdfs:Datatype ; rdfs:comment "A character string." ; - rdfs:label "string" . + rdfs:label "string" ; + owl:onDatatype xsd:anySimpleType ; + owl:withRestrictions ( + [ + xsd:whiteSpace "preserve" + ] + ) . xsd:time a rdfs:Datatype ; rdfs:label "time" ; + owl:onDatatype xsd:anySimpleType ; owl:withRestrictions ( [ xsd:pattern "[1-2][0-9]:[0-5][0-9]:[0-5][0-9].[0-9][0-9][0-9]" ] + ) , ( + [ + xsd:whiteSpace "collapse" + ] ) . xsd:token a rdfs:Datatype ; 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." ; rdfs:label "token" ; - owl:onDatatype xsd:normalizedString . + owl:onDatatype xsd:normalizedString ; + owl:withRestrictions ( + [ + xsd:whiteSpace "collapse" + ] + ) . xsd:totalDigits a rdf:Property , -- cgit v1.2.1