From 7485bde78f3422e4f9415ff452fcd858ee544cd0 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 11 Mar 2021 13:40:30 -0500 Subject: Fix pattern restrictions in xsd.ttl This fixes the patterns to properly match the spec (several were too strict or otherwise impresive), and also reduces the regex syntax used to a basic and nearly universal subset (without the use of counted replication) that should be supported and handled consistently by even a very basic implementation. --- schemas.lv2/xsd.ttl | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'schemas.lv2') diff --git a/schemas.lv2/xsd.ttl b/schemas.lv2/xsd.ttl index d22687b..01be2e4 100644 --- a/schemas.lv2/xsd.ttl +++ b/schemas.lv2/xsd.ttl @@ -61,7 +61,7 @@ xsd:base64Binary owl:onDatatype xsd:anySimpleType ; owl:withRestrictions ( [ - xsd:pattern "(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?" + xsd:pattern "(([A-Za-z0-9+/] *[A-Za-z0-9+/] *[A-Za-z0-9+/] *[A-Za-z0-9+/] *)*(([A-Za-z0-9+/] *[A-Za-z0-9+/] *[A-Za-z0-9+/] *[A-Za-z0-9+/])|([A-Za-z0-9+/] *[A-Za-z0-9+/] *[AEIMQUYcgkosw048] *=)|([A-Za-z0-9+/] *[AQgw] *= *=)))?" ] [ xsd:whiteSpace "collapse" ] @@ -73,7 +73,7 @@ xsd:boolean owl:onDatatype xsd:anySimpleType ; owl:withRestrictions ( [ - xsd:pattern "(true|false)" + xsd:pattern "(true|false|0|1)" ] [ xsd:whiteSpace "collapse" ] @@ -97,7 +97,7 @@ xsd:date 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])(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?" + xsd:pattern "-?[0-9][0-9][0-9][0-9][0-9]*-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|[-+][0-2][0-9]:[0-5][0-9])?" ] [ xsd:whiteSpace "collapse" ] @@ -109,7 +109,7 @@ xsd:dateTime 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:pattern "-?[0-9][0-9][0-9][0-9][0-9]*-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([0-1][0-9])|(2[0-4])):[0-5][0-9]:[0-5][0-9](.[0-9]+)?(Z|[-+][0-2][0-9]:[0-5][0-9])?" ] [ xsd:whiteSpace "collapse" ] @@ -122,7 +122,7 @@ xsd:decimal owl:onDatatype xsd:anySimpleType ; owl:withRestrictions ( [ - xsd:pattern "[+-]?[0-9]*\\.?[0-9]*" + xsd:pattern "-?INF|NaN|[+-]?(([0-9]+[.]?[0-9]*)|([0-9]*[.]?[0-9]+))([eE][-+]?[0-9]+)?" ] [ xsd:whiteSpace "collapse" ] @@ -135,7 +135,7 @@ xsd:double owl:onDatatype xsd:anySimpleType ; owl:withRestrictions ( [ - xsd:pattern "[+-]?[0-9]*\\.?[0-9]*([eE][-+]?[0-9]+)?" + xsd:pattern "-?INF|NaN|[+-]?(([0-9]+[.]?[0-9]*)|([0-9]*[.]?[0-9]+))([eE][-+]?[0-9]+)?" ] [ xsd:whiteSpace "collapse" ] @@ -147,6 +147,8 @@ xsd:duration owl:onDatatype xsd:anySimpleType ; owl:withRestrictions ( [ + xsd:pattern "-?P([0-9]+Y)?([0-9]+M)?([0-9]+D)?(T([0-9]+H)?([0-9]+M)?([0-9]+(\\.[0-9]+)?S)?)?" + ] [ xsd:whiteSpace "collapse" ] ) . @@ -158,7 +160,7 @@ xsd:float owl:onDatatype xsd:anySimpleType ; owl:withRestrictions ( [ - xsd:pattern "[+-]?[0-9]*\\.?[0-9]*([eE][-+]?[0-9]+)?" + xsd:pattern "-?INF|NaN|[+-]?(([0-9]+[.]?[0-9]*)|([0-9]*[.]?[0-9]+))([eE][-+]?[0-9]+)?" ] [ xsd:whiteSpace "collapse" ] @@ -223,7 +225,7 @@ xsd:hexBinary owl:onDatatype xsd:anySimpleType ; owl:withRestrictions ( [ - xsd:pattern "[0-9A-F]*" + xsd:pattern "([0-9A-Fa-f][0-9A-Fa-f])*" ] [ xsd:whiteSpace "collapse" ] @@ -259,7 +261,7 @@ xsd:language owl:onDatatype xsd:token ; owl:withRestrictions ( [ - xsd:pattern "[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*" + xsd:pattern "[a-zA-Z][a-zA-Z]?[a-zA-Z]?[a-zA-Z]?[a-zA-Z]?[a-zA-Z]?[a-zA-Z]?[a-zA-Z]?(-[a-zA-Z0-9][a-zA-Z0-9]?[a-zA-Z0-9]?[a-zA-Z0-9]?[a-zA-Z0-9]?[a-zA-Z0-9]?[a-zA-Z0-9]?[a-zA-Z0-9]?)*" ] ) . @@ -315,7 +317,7 @@ xsd:nonNegativeInteger owl:onDatatype xsd:integer ; owl:withRestrictions ( [ - xsd:pattern "[0-9]*" + xsd:pattern "[+]?[0-9]+" ] [ xsd:minInclusive 0 ] @@ -371,7 +373,7 @@ xsd:positiveInteger owl:onDatatype xsd:nonNegativeInteger ; owl:withRestrictions ( [ - xsd:pattern "[+]?[0-9]+" + xsd:pattern "[+]?[0-9]*[1-9]+[0-9]*" ] [ xsd:minInclusive 1 ] @@ -406,7 +408,7 @@ xsd: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:pattern "(([0-1][0-9])|(2[0-4])):[0-5][0-9]:[0-5][0-9](.[0-9]+)?(Z|[-+][0-2][0-9]:[0-5][0-9])?" ] [ xsd:whiteSpace "collapse" ] -- cgit v1.2.1