External, Non-PPA KXStudio Repository
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
4.6KB

  1. From 7485bde78f3422e4f9415ff452fcd858ee544cd0 Mon Sep 17 00:00:00 2001
  2. From: David Robillard <d@drobilla.net>
  3. Date: Thu, 11 Mar 2021 13:40:30 -0500
  4. Subject: [PATCH] Fix pattern restrictions in xsd.ttl
  5. This fixes the patterns to properly match the spec (several were too strict or
  6. otherwise impresive), and also reduces the regex syntax used to a basic and
  7. nearly universal subset (without the use of counted replication) that should be
  8. supported and handled consistently by even a very basic implementation.
  9. ---
  10. schemas.lv2/xsd.ttl | 26 ++++++++++++++------------
  11. 1 file changed, 14 insertions(+), 12 deletions(-)
  12. diff --git a/schemas.lv2/xsd.ttl b/schemas.lv2/xsd.ttl
  13. index d22687b3..01be2e4d 100644
  14. --- a/schemas.lv2/xsd.ttl
  15. +++ b/schemas.lv2/xsd.ttl
  16. @@ -61,7 +61,7 @@ xsd:base64Binary
  17. owl:onDatatype xsd:anySimpleType ;
  18. owl:withRestrictions (
  19. [
  20. - xsd:pattern "(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?"
  21. + 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] *= *=)))?"
  22. ] [
  23. xsd:whiteSpace "collapse"
  24. ]
  25. @@ -73,7 +73,7 @@ xsd:boolean
  26. owl:onDatatype xsd:anySimpleType ;
  27. owl:withRestrictions (
  28. [
  29. - xsd:pattern "(true|false)"
  30. + xsd:pattern "(true|false|0|1)"
  31. ] [
  32. xsd:whiteSpace "collapse"
  33. ]
  34. @@ -97,7 +97,7 @@ xsd:date
  35. owl:onDatatype xsd:anySimpleType ;
  36. owl:withRestrictions (
  37. [
  38. - 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))?"
  39. + 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])?"
  40. ] [
  41. xsd:whiteSpace "collapse"
  42. ]
  43. @@ -109,7 +109,7 @@ xsd:dateTime
  44. owl:onDatatype xsd:anySimpleType ;
  45. owl:withRestrictions (
  46. [
  47. - 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))?"
  48. + 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])?"
  49. ] [
  50. xsd:whiteSpace "collapse"
  51. ]
  52. @@ -122,7 +122,7 @@ xsd:decimal
  53. owl:onDatatype xsd:anySimpleType ;
  54. owl:withRestrictions (
  55. [
  56. - xsd:pattern "[+-]?[0-9]*\\.?[0-9]*"
  57. + xsd:pattern "-?INF|NaN|[+-]?(([0-9]+[.]?[0-9]*)|([0-9]*[.]?[0-9]+))([eE][-+]?[0-9]+)?"
  58. ] [
  59. xsd:whiteSpace "collapse"
  60. ]
  61. @@ -135,7 +135,7 @@ xsd:double
  62. owl:onDatatype xsd:anySimpleType ;
  63. owl:withRestrictions (
  64. [
  65. - xsd:pattern "[+-]?[0-9]*\\.?[0-9]*([eE][-+]?[0-9]+)?"
  66. + xsd:pattern "-?INF|NaN|[+-]?(([0-9]+[.]?[0-9]*)|([0-9]*[.]?[0-9]+))([eE][-+]?[0-9]+)?"
  67. ] [
  68. xsd:whiteSpace "collapse"
  69. ]
  70. @@ -147,6 +147,8 @@ xsd:duration
  71. owl:onDatatype xsd:anySimpleType ;
  72. owl:withRestrictions (
  73. [
  74. + xsd:pattern "-?P([0-9]+Y)?([0-9]+M)?([0-9]+D)?(T([0-9]+H)?([0-9]+M)?([0-9]+(\\.[0-9]+)?S)?)?"
  75. + ] [
  76. xsd:whiteSpace "collapse"
  77. ]
  78. ) .
  79. @@ -158,7 +160,7 @@ xsd:float
  80. owl:onDatatype xsd:anySimpleType ;
  81. owl:withRestrictions (
  82. [
  83. - xsd:pattern "[+-]?[0-9]*\\.?[0-9]*([eE][-+]?[0-9]+)?"
  84. + xsd:pattern "-?INF|NaN|[+-]?(([0-9]+[.]?[0-9]*)|([0-9]*[.]?[0-9]+))([eE][-+]?[0-9]+)?"
  85. ] [
  86. xsd:whiteSpace "collapse"
  87. ]
  88. @@ -223,7 +225,7 @@ xsd:hexBinary
  89. owl:onDatatype xsd:anySimpleType ;
  90. owl:withRestrictions (
  91. [
  92. - xsd:pattern "[0-9A-F]*"
  93. + xsd:pattern "([0-9A-Fa-f][0-9A-Fa-f])*"
  94. ] [
  95. xsd:whiteSpace "collapse"
  96. ]
  97. @@ -259,7 +261,7 @@ xsd:language
  98. owl:onDatatype xsd:token ;
  99. owl:withRestrictions (
  100. [
  101. - xsd:pattern "[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"
  102. + 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]?)*"
  103. ]
  104. ) .
  105. @@ -315,7 +317,7 @@ xsd:nonNegativeInteger
  106. owl:onDatatype xsd:integer ;
  107. owl:withRestrictions (
  108. [
  109. - xsd:pattern "[0-9]*"
  110. + xsd:pattern "[+]?[0-9]+"
  111. ] [
  112. xsd:minInclusive 0
  113. ]
  114. @@ -371,7 +373,7 @@ xsd:positiveInteger
  115. owl:onDatatype xsd:nonNegativeInteger ;
  116. owl:withRestrictions (
  117. [
  118. - xsd:pattern "[+]?[0-9]+"
  119. + xsd:pattern "[+]?[0-9]*[1-9]+[0-9]*"
  120. ] [
  121. xsd:minInclusive 1
  122. ]
  123. @@ -406,7 +408,7 @@ xsd:time
  124. owl:onDatatype xsd:anySimpleType ;
  125. owl:withRestrictions (
  126. [
  127. - xsd:pattern "[1-2][0-9]:[0-5][0-9]:[0-5][0-9].[0-9][0-9][0-9]"
  128. + 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])?"
  129. ] [
  130. xsd:whiteSpace "collapse"
  131. ]