adiwg-mdtranslator 0.12.1 → 1.0.0rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (191) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.gitmodules +3 -3
  4. data/Rakefile +1 -1
  5. data/adiwg-mdtranslator.gemspec +3 -3
  6. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +5 -1
  7. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_validator.rb +2 -2
  8. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_entity.rb +9 -0
  9. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_entityAttribute.rb +9 -0
  10. data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_mdJson.rb +7 -2
  11. data/lib/adiwg/mdtranslator/readers/mdJson/readme.md +2 -2
  12. data/lib/adiwg/mdtranslator/version.rb +5 -1
  13. data/lib/adiwg/mdtranslator/writers/html/html_writer.rb +43 -0
  14. data/lib/adiwg/mdtranslator/writers/html/md_html_writer.rb +25 -0
  15. data/lib/adiwg/mdtranslator/writers/html/readme.md +10 -0
  16. data/lib/adiwg/mdtranslator/writers/iso/classes/class_aggregateInformation.rb +3 -3
  17. data/lib/adiwg/mdtranslator/writers/iso/classes/class_boundingPolygon.rb +4 -4
  18. data/lib/adiwg/mdtranslator/writers/iso/classes/class_citation.rb +4 -4
  19. data/lib/adiwg/mdtranslator/writers/iso/classes/class_contact.rb +3 -3
  20. data/lib/adiwg/mdtranslator/writers/iso/classes/class_dataIdentification.rb +17 -17
  21. data/lib/adiwg/mdtranslator/writers/iso/classes/class_dataQuality.rb +2 -2
  22. data/lib/adiwg/mdtranslator/writers/iso/classes/class_date.rb +1 -1
  23. data/lib/adiwg/mdtranslator/writers/iso/classes/class_digitalTransferOptions.rb +2 -2
  24. data/lib/adiwg/mdtranslator/writers/iso/classes/class_distribution.rb +1 -1
  25. data/lib/adiwg/mdtranslator/writers/iso/classes/class_distributor.rb +4 -4
  26. data/lib/adiwg/mdtranslator/writers/iso/classes/class_extent.rb +4 -4
  27. data/lib/adiwg/mdtranslator/writers/iso/classes/class_featureAttribute.rb +3 -3
  28. data/lib/adiwg/mdtranslator/writers/iso/classes/class_featureType.rb +11 -2
  29. data/lib/adiwg/mdtranslator/writers/iso/classes/class_genericMetaData.rb +2 -2
  30. data/lib/adiwg/mdtranslator/writers/iso/classes/class_geographicDescription.rb +1 -1
  31. data/lib/adiwg/mdtranslator/writers/iso/classes/class_geographicElement.rb +2 -2
  32. data/lib/adiwg/mdtranslator/writers/iso/classes/class_identifier.rb +1 -1
  33. data/lib/adiwg/mdtranslator/writers/iso/classes/class_keyword.rb +2 -2
  34. data/lib/adiwg/mdtranslator/writers/iso/classes/class_legalConstraints.rb +1 -1
  35. data/lib/adiwg/mdtranslator/writers/iso/classes/class_lineage.rb +2 -2
  36. data/lib/adiwg/mdtranslator/writers/iso/classes/class_maintenanceInformation.rb +2 -2
  37. data/lib/adiwg/mdtranslator/writers/iso/classes/class_medium.rb +2 -2
  38. data/lib/adiwg/mdtranslator/writers/iso/classes/class_metadataExtension.rb +4 -4
  39. data/lib/adiwg/mdtranslator/writers/iso/classes/class_multiGeometry.rb +3 -3
  40. data/lib/adiwg/mdtranslator/writers/iso/classes/class_onlineResource.rb +1 -1
  41. data/lib/adiwg/mdtranslator/writers/iso/classes/class_processStep.rb +1 -1
  42. data/lib/adiwg/mdtranslator/writers/iso/classes/class_referenceSystem.rb +1 -1
  43. data/lib/adiwg/mdtranslator/writers/iso/classes/class_responsibleParty.rb +2 -2
  44. data/lib/adiwg/mdtranslator/writers/iso/classes/class_securityConstraints.rb +1 -1
  45. data/lib/adiwg/mdtranslator/writers/iso/classes/class_source.rb +2 -2
  46. data/lib/adiwg/mdtranslator/writers/iso/classes/class_taxonSystem.rb +4 -4
  47. data/lib/adiwg/mdtranslator/writers/iso/classes/class_temporalExtent.rb +2 -2
  48. data/lib/adiwg/mdtranslator/writers/iso/classes/class_usage.rb +1 -1
  49. data/lib/adiwg/mdtranslator/writers/iso/classes/class_vouchers.rb +1 -1
  50. data/lib/adiwg/mdtranslator/writers/iso19110/class_FCfeatureCatalogue.rb +159 -147
  51. data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +17 -23
  52. data/lib/adiwg/mdtranslator/writers/iso19115_2/class_MImetadata.rb +11 -10
  53. data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb +97 -103
  54. data/lib/adiwg/mdtranslator/writers/mdWriters.rb +1 -11
  55. data/test/readers/mdJson/{v0_9 → v1_0}/tc_reader_mdjson_additionalDocumentation.rb +4 -4
  56. data/test/readers/mdJson/{v0_9 → v1_0}/tc_reader_mdjson_address.rb +3 -3
  57. data/test/readers/mdJson/{v0_9 → v1_0}/tc_reader_mdjson_associatedResource.rb +4 -4
  58. data/test/readers/mdJson/{v0_9 → v1_0}/tc_reader_mdjson_browseGraphic.rb +3 -3
  59. data/test/readers/mdJson/{v0_9 → v1_0}/tc_reader_mdjson_citation.rb +4 -4
  60. data/test/readers/mdJson/{v0_9 → v1_0}/tc_reader_mdjson_contact.rb +4 -4
  61. data/test/readers/mdJson/{v0_9 → v1_0}/tc_reader_mdjson_dictionaryInfo.rb +4 -4
  62. data/test/readers/mdJson/{v0_9 → v1_0}/tc_reader_mdjson_domain.rb +4 -4
  63. data/test/readers/mdJson/{v0_9 → v1_0}/tc_reader_mdjson_onlineResource.rb +3 -3
  64. data/test/readers/mdJson/{v0_9 → v1_0}/tc_reader_mdjson_phone.rb +3 -3
  65. data/test/readers/mdJson/{v0_9 → v1_0}/tc_reader_mdjson_responsibleParty.rb +3 -3
  66. data/test/readers/mdJson/{v0_9 → v1_0}/tc_translation.rb +4 -4
  67. data/test/schemas/v1_0/.gitignore +18 -0
  68. data/test/schemas/v1_0/.travis.yml +7 -0
  69. data/test/schemas/v1_0/CREDITS +3 -0
  70. data/test/schemas/v1_0/Gemfile +4 -0
  71. data/test/schemas/v1_0/LICENSE +24 -0
  72. data/test/schemas/v1_0/README.md +36 -0
  73. data/test/schemas/v1_0/Rakefile +12 -0
  74. data/test/schemas/v1_0/adiwg-json_schemas.gemspec +25 -0
  75. data/test/schemas/v1_0/examples/additionalDocumentation.json +61 -0
  76. data/test/schemas/v1_0/examples/address.json +10 -0
  77. data/test/schemas/v1_0/examples/associatedResource.json +119 -0
  78. data/test/schemas/v1_0/examples/citation.json +128 -0
  79. data/test/schemas/v1_0/examples/contact.json +205 -0
  80. data/test/schemas/v1_0/examples/contactRef.json +12 -0
  81. data/test/schemas/v1_0/examples/dataDictionary.json +547 -0
  82. data/test/schemas/v1_0/examples/dataQuality.json +272 -0
  83. data/test/schemas/v1_0/examples/date.json +19 -0
  84. data/test/schemas/v1_0/examples/distributor.json +113 -0
  85. data/test/schemas/v1_0/examples/extent_linestring.json +288 -0
  86. data/test/schemas/v1_0/examples/extent_point.json +246 -0
  87. data/test/schemas/v1_0/examples/extent_polygon.json +353 -0
  88. data/test/schemas/v1_0/examples/format.json +14 -0
  89. data/test/schemas/v1_0/examples/full_example.json +2844 -0
  90. data/test/schemas/v1_0/examples/full_example2.json +2325 -0
  91. data/test/schemas/v1_0/examples/geojson.json +446 -0
  92. data/test/schemas/v1_0/examples/graphicOverview.json +28 -0
  93. data/test/schemas/v1_0/examples/hierarchyLevel.json +90 -0
  94. data/test/schemas/v1_0/examples/keywords.json +144 -0
  95. data/test/schemas/v1_0/examples/lcc_project_example.json +326 -0
  96. data/test/schemas/v1_0/examples/legalConstraints.json +17 -0
  97. data/test/schemas/v1_0/examples/maintInfo.json +34 -0
  98. data/test/schemas/v1_0/examples/metadataInfo.json +103 -0
  99. data/test/schemas/v1_0/examples/minimum_example.json +35 -0
  100. data/test/schemas/v1_0/examples/onlineResource.json +17 -0
  101. data/test/schemas/v1_0/examples/resolution.json +9 -0
  102. data/test/schemas/v1_0/examples/resourceInfo.json +1264 -0
  103. data/test/schemas/v1_0/examples/resourceMaintenance.json +10 -0
  104. data/test/schemas/v1_0/examples/securityConstraints.json +13 -0
  105. data/test/schemas/v1_0/examples/spatialRef.json +14 -0
  106. data/test/schemas/v1_0/examples/taxonomy.json +197 -0
  107. data/test/schemas/v1_0/examples/temporalElement.json +29 -0
  108. data/test/schemas/v1_0/examples/uri.json +16 -0
  109. data/test/schemas/v1_0/examples/usage.json +35 -0
  110. data/test/schemas/v1_0/examples/verticalExtent.json +18 -0
  111. data/test/schemas/v1_0/lib/adiwg/mdjson_schemas/utils.rb +20 -0
  112. data/test/schemas/v1_0/lib/adiwg/mdjson_schemas/validator.rb +42 -0
  113. data/test/schemas/v1_0/lib/adiwg/mdjson_schemas/version.rb +6 -0
  114. data/test/schemas/v1_0/lib/adiwg/mdjson_schemas.rb +7 -0
  115. data/test/schemas/v1_0/lib/adiwg-mdjson_schemas.rb +1 -0
  116. data/test/schemas/v1_0/schema/schema/citation.json +186 -0
  117. data/test/schemas/v1_0/schema/schema/contact.json +255 -0
  118. data/test/schemas/v1_0/schema/schema/dataDictionary.json +209 -0
  119. data/test/schemas/v1_0/schema/schema/dataQuality.json +159 -0
  120. data/test/schemas/v1_0/schema/schema/distributor.json +171 -0
  121. data/test/schemas/v1_0/schema/schema/extent.json +214 -0
  122. data/test/schemas/v1_0/schema/schema/geojson/bbox.json +14 -0
  123. data/test/schemas/v1_0/schema/schema/geojson/crs.json +99 -0
  124. data/test/schemas/v1_0/schema/schema/geojson/geojson.json +194 -0
  125. data/test/schemas/v1_0/schema/schema/geojson/geometry.json +203 -0
  126. data/test/schemas/v1_0/schema/schema/graphicOverview.json +42 -0
  127. data/test/schemas/v1_0/schema/schema/keyword.json +39 -0
  128. data/test/schemas/v1_0/schema/schema/maintInfo.json +43 -0
  129. data/test/schemas/v1_0/schema/schema/metadata.json +173 -0
  130. data/test/schemas/v1_0/schema/schema/onlineResource.json +42 -0
  131. data/test/schemas/v1_0/schema/schema/resolution.json +51 -0
  132. data/test/schemas/v1_0/schema/schema/resourceConstraint.json +108 -0
  133. data/test/schemas/v1_0/schema/schema/resourceInfo.json +305 -0
  134. data/test/schemas/v1_0/schema/schema/taxonomy.json +122 -0
  135. data/test/schemas/v1_0/schema/schema/usage.json +39 -0
  136. data/test/schemas/v1_0/schema/schema.json +64 -0
  137. data/test/schemas/v1_0/templates/mdJson_template.json +1065 -0
  138. data/test/schemas/v1_0/test/draft-04.json +189 -0
  139. data/test/schemas/v1_0/test/tc_schemas.rb +210 -0
  140. data/test/schemas/v1_0/test/tc_utils.rb +27 -0
  141. metadata +241 -90
  142. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_additionalDocumentation.rb +0 -0
  143. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_address.rb +0 -0
  144. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_associatedResource.rb +0 -0
  145. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_boundingBox.rb +0 -0
  146. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_browseGraphic.rb +0 -0
  147. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_citation.rb +0 -0
  148. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_contacts.rb +0 -0
  149. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_coordinates.rb +0 -0
  150. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_dataDictionary.rb +0 -0
  151. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_dataQuality.rb +0 -0
  152. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_dateTime.rb +0 -0
  153. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_descriptiveKeyword.rb +0 -0
  154. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_dictionaryInfo.rb +0 -0
  155. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_distributionInfo.rb +0 -0
  156. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_domain.rb +0 -0
  157. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_domainItem.rb +0 -0
  158. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_entityForeignKey.rb +0 -0
  159. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_entityIndex.rb +0 -0
  160. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_extent.rb +0 -0
  161. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_geoCoordSystem.rb +0 -0
  162. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_geoProperties.rb +0 -0
  163. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_geographicElement.rb +0 -0
  164. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_legalConstraint.rb +0 -0
  165. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_lineString.rb +0 -0
  166. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_lineage.rb +0 -0
  167. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_metadata.rb +0 -0
  168. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_metadataExtension.rb +0 -0
  169. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_metadataInfo.rb +0 -0
  170. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_onlineResource.rb +0 -0
  171. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_phone.rb +0 -0
  172. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_point.rb +0 -0
  173. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_polygon.rb +0 -0
  174. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_processStep.rb +0 -0
  175. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_resolution.rb +0 -0
  176. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_resourceFormat.rb +0 -0
  177. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_resourceIdentifier.rb +0 -0
  178. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_resourceInfo.rb +0 -0
  179. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_resourceMaintenance.rb +0 -0
  180. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_resourceSpecificUsage.rb +0 -0
  181. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_responsibleParty.rb +0 -0
  182. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_securityConstraint.rb +0 -0
  183. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_source.rb +0 -0
  184. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_spatialReference.rb +0 -0
  185. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_taxonClass.rb +0 -0
  186. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_taxonomy.rb +0 -0
  187. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_temporalElement.rb +0 -0
  188. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_timeInstant.rb +0 -0
  189. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_timePeriod.rb +0 -0
  190. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_verticalElement.rb +0 -0
  191. /data/lib/adiwg/mdtranslator/readers/mdJson/{modules_0.9 → modules_1.0}/module_voucher.rb +0 -0
@@ -0,0 +1,189 @@
1
+ {
2
+ "$schema" : "http://json-schema.org/draft-04/schema#",
3
+ "id" : "http://json-schema.org/draft-04/schema#",
4
+ "type" : "object",
5
+
6
+ "properties" : {
7
+ "type" : {
8
+ "type" : [
9
+ {
10
+ "id" : "#simple-type",
11
+ "type" : "string",
12
+ "enum" : ["object", "array", "string", "number", "boolean", "null", "any"]
13
+ },
14
+ "array"
15
+ ],
16
+ "items" : {
17
+ "type" : [
18
+ {"$ref" : "#simple-type"},
19
+ {"$ref" : "#"}
20
+ ]
21
+ },
22
+ "uniqueItems" : true,
23
+ "default" : "any"
24
+ },
25
+
26
+ "disallow" : {
27
+ "type" : ["string", "array"],
28
+ "items" : {
29
+ "type" : ["string", {"$ref" : "#"}]
30
+ },
31
+ "uniqueItems" : true
32
+ },
33
+
34
+ "extends" : {
35
+ "type" : [{"$ref" : "#"}, "array"],
36
+ "items" : {"$ref" : "#"},
37
+ "default" : {}
38
+ },
39
+
40
+ "enum" : {
41
+ "type" : "array",
42
+ "minItems" : 1,
43
+ "uniqueItems" : true
44
+ },
45
+
46
+ "minimum" : {
47
+ "type" : "number"
48
+ },
49
+
50
+ "maximum" : {
51
+ "type" : "number"
52
+ },
53
+
54
+ "exclusiveMinimum" : {
55
+ "type" : "boolean",
56
+ "default" : false
57
+ },
58
+
59
+ "exclusiveMaximum" : {
60
+ "type" : "boolean",
61
+ "default" : false
62
+ },
63
+
64
+ "divisibleBy" : {
65
+ "type" : "number",
66
+ "minimum" : 0,
67
+ "exclusiveMinimum" : true,
68
+ "default" : 1
69
+ },
70
+
71
+ "minLength" : {
72
+ "type" : "integer",
73
+ "minimum" : 0,
74
+ "default" : 0
75
+ },
76
+
77
+ "maxLength" : {
78
+ "type" : "integer"
79
+ },
80
+
81
+ "pattern" : {
82
+ "type" : "string"
83
+ },
84
+
85
+ "items" : {
86
+ "type" : [{"$ref" : "#"}, "array"],
87
+ "items" : {"$ref" : "#"},
88
+ "default" : {}
89
+ },
90
+
91
+ "additionalItems" : {
92
+ "type" : [{"$ref" : "#"}, "boolean"],
93
+ "default" : {}
94
+ },
95
+
96
+ "minItems" : {
97
+ "type" : "integer",
98
+ "minimum" : 0,
99
+ "default" : 0
100
+ },
101
+
102
+ "maxItems" : {
103
+ "type" : "integer",
104
+ "minimum" : 0
105
+ },
106
+
107
+ "uniqueItems" : {
108
+ "type" : "boolean",
109
+ "default" : false
110
+ },
111
+
112
+ "properties" : {
113
+ "type" : "object",
114
+ "additionalProperties" : {"$ref" : "#"},
115
+ "default" : {}
116
+ },
117
+
118
+ "patternProperties" : {
119
+ "type" : "object",
120
+ "additionalProperties" : {"$ref" : "#"},
121
+ "default" : {}
122
+ },
123
+
124
+ "additionalProperties" : {
125
+ "type" : [{"$ref" : "#"}, "boolean"],
126
+ "default" : {}
127
+ },
128
+
129
+ "minProperties" : {
130
+ "type" : "integer",
131
+ "minimum" : 0,
132
+ "default" : 0
133
+ },
134
+
135
+ "maxProperties" : {
136
+ "type" : "integer",
137
+ "minimum" : 0
138
+ },
139
+
140
+ "required" : {
141
+ "type" : "array",
142
+ "items" : {
143
+ "type" : "string"
144
+ }
145
+ },
146
+
147
+ "dependencies" : {
148
+ "type" : "object",
149
+ "additionalProperties" : {
150
+ "type" : ["string", "array", {"$ref" : "#"}],
151
+ "items" : {
152
+ "type" : "string"
153
+ }
154
+ },
155
+ "default" : {}
156
+ },
157
+
158
+ "id" : {
159
+ "type" : "string"
160
+ },
161
+
162
+ "$ref" : {
163
+ "type" : "string"
164
+ },
165
+
166
+ "$schema" : {
167
+ "type" : "string"
168
+ },
169
+
170
+ "title" : {
171
+ "type" : "string"
172
+ },
173
+
174
+ "description" : {
175
+ "type" : "string"
176
+ },
177
+
178
+ "default" : {
179
+ "type" : "any"
180
+ }
181
+ },
182
+
183
+ "dependencies" : {
184
+ "exclusiveMinimum" : "minimum",
185
+ "exclusiveMaximum" : "maximum"
186
+ },
187
+
188
+ "default" : {}
189
+ }
@@ -0,0 +1,210 @@
1
+ =begin
2
+ * Description: Test Validation of examples schemas and templates
3
+ * Author: Josh Bradley, Stan Smith
4
+ * Date: 2014-05-02
5
+ * License: Public Domain
6
+ =end
7
+
8
+ require 'minitest/autorun'
9
+ require 'json'
10
+ require 'json-schema'
11
+ require File.join(File.dirname(__FILE__),'..','lib', 'adiwg-mdjson_schemas.rb')
12
+
13
+ #json-schema patch
14
+ require File.join(File.dirname(__FILE__),'..','lib', 'adiwg', 'mdjson_schemas', 'validator.rb')
15
+
16
+ class TestExamples < Minitest::Test
17
+
18
+ @@dir = File.join(File.dirname(__FILE__),'..','schema/')
19
+ @@ex = File.join(File.dirname(__FILE__),'..','examples/')
20
+ @@schema = File.join(File.dirname(__FILE__),'..','schema','schema.json')
21
+
22
+ def test_schemas
23
+ #Validate the schemas themselves
24
+ #puts "\nValidating schemas, Please wait... \n"
25
+ schemas = `git ls-files #{@@dir}`.split($/)
26
+ errors = Array.new
27
+
28
+ schemas.each do |schema|
29
+ error = JSON::Validator.fully_validate(File.join(File.dirname(__FILE__), 'draft-04.json'), schema)
30
+ errors += error
31
+ end
32
+
33
+ assert(errors.empty?, errors.join("\n"))
34
+ end
35
+
36
+ def test_data_template
37
+ errors = JSON::Validator.fully_validate(@@schema, @@dir + '../templates/mdJson_template.json', :strict => false)
38
+ assert(errors.empty?, errors.join("\n"))
39
+ end
40
+
41
+ def test_full_example
42
+ errors = JSON::Validator.fully_validate(@@schema , @@ex + 'full_example.json')
43
+ assert(errors.empty?, errors.join("\n"))
44
+ end
45
+
46
+ def test_full_example2
47
+ errors = JSON::Validator.fully_validate(@@schema , @@ex + 'full_example2.json')
48
+ assert(errors.empty?, errors.join("\n"))
49
+ end
50
+
51
+ def test_minimum_example
52
+ errors = JSON::Validator.fully_validate(@@schema , @@ex + 'minimum_example.json')
53
+ assert(errors.empty?, errors.join("\n"))
54
+ end
55
+
56
+ def test_lcc_example
57
+ errors = JSON::Validator.fully_validate(@@schema , @@ex + 'lcc_project_example.json')
58
+ assert(errors.empty?, errors.join("\n"))
59
+ end
60
+
61
+ def test_contact
62
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/contact.json', @@ex + 'contact.json')
63
+ assert(errors.empty?, errors.join("\n"))
64
+ end
65
+
66
+ def test_citation
67
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/citation.json', @@ex + 'citation.json', :list => true)
68
+ assert(errors.empty?, errors.join("\n"))
69
+ end
70
+
71
+ def test_dictionary
72
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/dataDictionary.json', @@ex + 'dataDictionary.json', :list => true)
73
+ assert(errors.empty?, errors.join("\n"))
74
+ end
75
+
76
+ def test_taxonomy
77
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/taxonomy.json', @@ex + 'taxonomy.json', :list => true)
78
+ assert(errors.empty?, errors.join("\n"))
79
+ end
80
+
81
+ def test_usage
82
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/usage.json', @@ex + 'usage.json', :list => true)
83
+ assert(errors.empty?, errors.join("\n"))
84
+ end
85
+
86
+ def test_resolution
87
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/resolution.json', @@ex + 'resolution.json', :list => true)
88
+ assert(errors.empty?, errors.join("\n"))
89
+ end
90
+
91
+ def test_graphicOverview
92
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/graphicOverview.json', @@ex + 'graphicOverview.json', :list => true)
93
+ assert(errors.empty?, errors.join("\n"))
94
+ end
95
+
96
+ def test_resourceInfo
97
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/resourceInfo.json', @@ex + 'resourceInfo.json', :list => true)
98
+ assert(errors.empty?, errors.join("\n"))
99
+ end
100
+
101
+ def test_metadataInfo
102
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/metadata.json', @@ex + 'metadataInfo.json', :fragment => "#/properties/metadataInfo", :list => true)
103
+ assert(errors.empty?, errors.join("\n"))
104
+ end
105
+
106
+ def test_onlineResource
107
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/onlineResource.json', @@ex + 'onlineResource.json', :list => true)
108
+ assert(errors.empty?, errors.join("\n"))
109
+ end
110
+
111
+ def test_resourceConstraint
112
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/resourceConstraint.json', @@ex + 'legalConstraints.json', :fragment => "#/definitions/legalConstraint", :list => true)
113
+ assert(errors.empty?, errors.join("\n"))
114
+
115
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/resourceConstraint.json', @@ex + 'securityConstraints.json', :fragment => "#/definitions/securityConstraint", :list => true)
116
+ assert(errors.empty?, errors.join("\n"))
117
+
118
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/resourceConstraint.json', ["not for suitable for navigation", "draft version", "not intended for general use"], :fragment => "#/definitions/useLimitation", :list => true)
119
+ assert(errors.empty?, errors.join("\n"))
120
+ end
121
+
122
+ def test_date
123
+ errors = JSON::Validator.fully_validate(@@schema, @@ex + 'date.json', :fragment => "#/definitions/date", :list => true)
124
+ assert(errors.empty?, errors.join("\n"))
125
+ end
126
+
127
+ def test_spatialRef
128
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/resourceInfo.json', @@ex + 'spatialRef.json', :fragment => "#/properties/spatialReferenceSystem", :list => false)
129
+ assert(errors.empty?, errors.join("\n"))
130
+ end
131
+
132
+ def test_contactRef
133
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/contact.json', @@ex + 'contactRef.json', :fragment => "#/definitions/contactRef", :list => true)
134
+ assert(errors.empty?, errors.join("\n"))
135
+ end
136
+
137
+ def test_keywords
138
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/keyword.json', @@ex + 'keywords.json', :list => true)
139
+ assert(errors.empty?, errors.join("\n"))
140
+ end
141
+
142
+ def test_distributor
143
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/distributor.json', @@ex + 'distributor.json', :list => true)
144
+ assert(errors.empty?, errors.join("\n"))
145
+
146
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/distributor.json', @@ex + 'format.json', :fragment => "#/definitions/format", :list => true)
147
+ assert(errors.empty?, errors.join("\n"))
148
+ end
149
+
150
+ def test_geojson
151
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/geojson/geojson.json', @@ex + 'geojson.json', :list => true)
152
+ assert(errors.empty?, errors.join("\n"))
153
+ end
154
+
155
+ def test_extent_linestring
156
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/extent.json', @@ex + 'extent_linestring.json', :list => true)
157
+ assert(errors.empty?, errors.join("\n"))
158
+ end
159
+
160
+ def test_extent_point
161
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/extent.json', @@ex + 'extent_point.json', :list => true)
162
+ assert(errors.empty?, errors.join("\n"))
163
+ end
164
+
165
+ def test_extent_polygon
166
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/extent.json', @@ex + 'extent_polygon.json', :list => true)
167
+ assert(errors.empty?, errors.join("\n"))
168
+ end
169
+
170
+ def test_extent_temporal
171
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/extent.json', @@ex + 'temporalElement.json', :fragment => "#/definitions/temporalElement", :list => true)
172
+ assert(errors.empty?, errors.join("\n"))
173
+ end
174
+
175
+ def test_extent_vertical
176
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/extent.json', @@ex + 'verticalExtent.json', :fragment => "#/definitions/verticalExtent", :list => true)
177
+ assert(errors.empty?, errors.join("\n"))
178
+ end
179
+
180
+ def test_maintInfo
181
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/maintInfo.json', @@ex + 'maintInfo.json', :list => true)
182
+ errors = errors + JSON::Validator.fully_validate(@@dir + 'schema/maintInfo.json', @@ex + 'resourceMaintenance.json', :list => true)
183
+ assert(errors.empty?, errors.join("\n"))
184
+ end
185
+
186
+ def test_dataQuality
187
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/dataQuality.json', @@ex + 'dataQuality.json', :list => true)
188
+ assert(errors.empty?, errors.join("\n"))
189
+ end
190
+
191
+ def test_uri
192
+ errors = JSON::Validator.fully_validate(@@schema, @@ex + 'uri.json', :fragment => "#/definitions/uri", :list => true)
193
+ assert(errors.empty?, errors.join("\n"))
194
+ end
195
+
196
+ def test_additionalDocumentation
197
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/metadata.json', @@ex + 'additionalDocumentation.json', :fragment => "#/properties/additionalDocumentation", :list => false)
198
+ assert(errors.empty?, errors.join("\n"))
199
+ end
200
+
201
+ def test_associatedResource
202
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/metadata.json', @@ex + 'associatedResource.json', :fragment => "#/properties/associatedResource", :list => false)
203
+ assert(errors.empty?, errors.join("\n"))
204
+ end
205
+
206
+ def test_address
207
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/contact.json', @@ex + 'address.json', :fragment => "#/definitions/address", :list => true)
208
+ assert(errors.empty?, errors.join("\n"))
209
+ end
210
+ end
@@ -0,0 +1,27 @@
1
+ =begin
2
+ * Description: Test Utility functions
3
+ * Author: Josh Bradley
4
+ * Date: 2014-05-06
5
+ * License: Public Domain
6
+ =end
7
+
8
+ require 'minitest/autorun'
9
+ require File.join(File.dirname(__FILE__),'..','lib', 'adiwg-mdjson_schemas.rb')
10
+
11
+ class TestUtils < Minitest::Test
12
+ def test_examples_dir
13
+ puts ADIWG::MdjsonSchemas::Utils.examples_dir
14
+ errors = File.exist?(ADIWG::MdjsonSchemas::Utils.examples_dir)
15
+ assert_equal( true, errors, failure_message = 'Examples directory does not exist.')
16
+ end
17
+
18
+ def test_schema_path
19
+ errors = File.file?(ADIWG::MdjsonSchemas::Utils.schema_path)
20
+ assert_equal( true, errors, failure_message = 'File schema.json does not exist.')
21
+ end
22
+
23
+ def test_schema_dir
24
+ errors = File.exist?(ADIWG::MdjsonSchemas::Utils.schema_dir)
25
+ assert_equal( true, errors, failure_message = 'Schema directory does not exist.')
26
+ end
27
+ end