adiwg-mdjson_schemas 2.4.9 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +42 -2
  3. data/adiwg-json_schemas.gemspec +1 -0
  4. data/examples/boundingBox.json +18 -6
  5. data/examples/entityAttribute.json +1 -0
  6. data/examples/geodetic.json +20 -0
  7. data/examples/geographicExtent.json +47 -22
  8. data/examples/geologicAge.json +12 -0
  9. data/examples/mdJson.json +104 -16
  10. data/examples/obliqueLinePoint.json +9 -0
  11. data/examples/projection.json +50 -0
  12. data/examples/referenceSystemParameterSet.json +38 -0
  13. data/examples/source.json +1 -0
  14. data/examples/spatialReference.json +16 -4
  15. data/examples/spatialResolution.json +21 -0
  16. data/examples/timeInstant.json +20 -0
  17. data/examples/timePeriod.json +19 -0
  18. data/examples/verticalDatum.json +13 -0
  19. data/lib/adiwg/mdjson_schemas/version.rb +1 -1
  20. data/package.json +3 -3
  21. data/schema/entityAttribute.json +7 -0
  22. data/schema/geodetic.json +71 -0
  23. data/schema/geographicExtent.json +75 -9
  24. data/schema/geologicAge.json +54 -0
  25. data/schema/lineage.json +7 -0
  26. data/schema/projection.json +333 -0
  27. data/schema/referenceSystemParameterSet.json +73 -0
  28. data/schema/resourceInfo.json +3 -1
  29. data/schema/schema.json +1 -1
  30. data/schema/spatialReference.json +15 -0
  31. data/schema/spatialResolution.json +158 -2
  32. data/schema/timeInstant.json +16 -2
  33. data/schema/timePeriod.json +62 -26
  34. data/schema/verticalDatum.json +56 -0
  35. data/test/tc_geodetic.rb +8 -0
  36. data/test/tc_geologicAge.rb +8 -0
  37. data/test/tc_obliqueLinePoint.rb +8 -0
  38. data/test/tc_projection.rb +27 -0
  39. data/test/tc_referenceSystemParameterSet.rb +8 -0
  40. data/test/tc_verticalDatum.rb +8 -0
  41. data/test/test.js +2 -1
  42. data/yarn.lock +81 -116
  43. metadata +40 -4
  44. data/package-lock.json +0 -405
@@ -45,10 +45,166 @@
45
45
  "title": "levelOfDetail",
46
46
  "description": "A brief textual description of the spatial resolution of the resource",
47
47
  "example": "../examples/spatialResolution.json",
48
- "translation": {},
49
48
  "minLength": 1
50
49
  }
51
50
  }
51
+ },
52
+ {
53
+ "type": "object",
54
+ "title": "geographicResolution",
55
+ "required": ["geographicResolution"],
56
+ "properties": {
57
+ "geographicResolution": {
58
+ "$ref": "#/definitions/geographicResolution"
59
+ }
60
+ }
61
+ },
62
+ {
63
+ "type": "object",
64
+ "title": "bearingDistanceResolution",
65
+ "required": ["bearingDistanceResolution"],
66
+ "properties": {
67
+ "bearingDistanceResolution": {
68
+ "$ref": "#/definitions/bearingDistanceResolution"
69
+ }
70
+ }
71
+ },
72
+ {
73
+ "type": "object",
74
+ "title": "coordinateResolution",
75
+ "required": ["coordinateResolution"],
76
+ "properties": {
77
+ "coordinateResolution": {
78
+ "$ref": "#/definitions/coordinateResolution"
79
+ }
80
+ }
81
+ }
82
+ ],
83
+ "definitions": {
84
+ "geographicResolution": {
85
+ "type": "object",
86
+ "description": "The quantities of latitude and longitude which define the position of a point on the Earth's surface with respect to a reference spheroid.",
87
+ "example": "../examples/spatialResolution.json",
88
+ "translation": {
89
+ "FGDC CSDGM": ["spref > horizsys > geograph"]
90
+ },
91
+ "required": ["latitudeResolution", "longitudeResolution", "unitOfMeasure"],
92
+ "properties": {
93
+ "latitudeResolution": {
94
+ "type": "number",
95
+ "description": "The minimum difference between two adjacent latitude values expressed in Geographic Coordinate Units of measure.",
96
+ "translation": {
97
+ "FGDC CSDGM": ["spref > horizsys > geograph > latres"]
98
+ }
99
+ },
100
+ "longitudeResolution": {
101
+ "type": "number",
102
+ "description": "The minimum difference between two adjacent longitude values expressed in Geographic Coordinate Units of measure.",
103
+ "translation": {
104
+ "FGDC CSDGM": ["spref > horizsys > geograph > longres"]
105
+ }
106
+ },
107
+ "unitOfMeasure": {
108
+ "type": "string",
109
+ "description": "The unit of measure used for the latitude and longitude values.",
110
+ "translation": {
111
+ "FGDC CSDGM": ["spref > horizsys > planar > planci > plandu"]
112
+ }
113
+ }
114
+ }
115
+ },
116
+ "bearingDistanceResolution": {
117
+ "type": "object",
118
+ "description": "The method of encoding the position of a point by measuring its distance and direction (azimuth angle) from another point.",
119
+ "example": "../examples/spatialResolution.json",
120
+ "translation": {
121
+ "FGDC CSDGM": ["spref > horizsys > planar > planci > distbrep"]
122
+ },
123
+ "required": ["distanceResolution",
124
+ "distanceUnitOfMeasure",
125
+ "bearingResolution",
126
+ "bearingUnitOfMeasure",
127
+ "bearingReferenceDirection",
128
+ "bearingReferenceMeridian"
129
+ ],
130
+ "properties": {
131
+ "distanceResolution": {
132
+ "type": "number",
133
+ "description": "The minimum distance measurable between two points, expressed Planar Distance Units of measure.",
134
+ "translation": {
135
+ "FGDC CSDGM": ["spref > horizsys > planar > planci > distbrep > distres"]
136
+ }
137
+ },
138
+ "distanceUnitOfMeasure": {
139
+ "type": "string",
140
+ "description": "The units for the distance resolution.",
141
+ "translation": {
142
+ "FGDC CSDGM": ["spref > horizsys > planar > planci > plandu"]
143
+ }
144
+ },
145
+ "bearingResolution": {
146
+ "type": "number",
147
+ "description": "The minimum angle measurable between two points, expressed in Bearing Units of measure.",
148
+ "translation": {
149
+ "FGDC CSDGM": ["spref > horizsys > planar > planci > distbrep > bearres"]
150
+ }
151
+ },
152
+ "bearingUnitOfMeasure": {
153
+ "type": "string",
154
+ "description": "The units of measure used for angles.",
155
+ "translation": {
156
+ "FGDC CSDGM": ["spref > horizsys > planar > planci > distbrep > bearunit"]
157
+ }
158
+ },
159
+ "bearingReferenceDirection": {
160
+ "type": "string",
161
+ "description": "The direction from which the bearing is measured.",
162
+ "enum": ["north", "south"],
163
+ "translation": {
164
+ "FGDC CSDGM": ["spref > horizsys > planar > planci > distbrep > bearrefd"]
165
+ }
166
+ },
167
+ "bearingReferenceMeridian": {
168
+ "type": "string",
169
+ "description": "The axis from which the bearing is measured.",
170
+ "enum": ["assumed", "grid", "magnetic", "astronomic", "geodetic"],
171
+ "translation": {
172
+ "FGDC CSDGM": ["spref > horizsys > planar > planci > distbrep > bearrefm"]
173
+ }
174
+ }
175
+ }
176
+ },
177
+ "coordinateResolution": {
178
+ "type": "object",
179
+ "description": "",
180
+ "example": "../examples/spatialResolution.json",
181
+ "translation": {
182
+ "FGDC CSDGM": ["spref > horizsys > planar > planci > coordrep"]
183
+ },
184
+ "required": ["abscissaResolutionX", "ordinateResolutionY", "unitOfMeasure"],
185
+ "properties": {
186
+ "abscissaResolutionX": {
187
+ "type": "number",
188
+ "description": "The (nominal) minimum distance between the 'x' or column values of two adjacent points, expressed in Planar Distance.",
189
+ "translation": {
190
+ "FGDC CSDGM": ["spref > horizsys > planar > planci > coordrep > absres"]
191
+ }
192
+ },
193
+ "ordinateResolutionY": {
194
+ "type": "number",
195
+ "description": "The (nominal) minimum distance between the 'y' or column values of two adjacent points, expressed in Planar Distance.",
196
+ "translation": {
197
+ "FGDC CSDGM": ["spref > horizsys > planar > planci > coordrep > ordres"]
198
+ }
199
+ },
200
+ "unitOfMeasure": {
201
+ "type": "string",
202
+ "description": "The units of the ordinate and abscissa axis.",
203
+ "translation": {
204
+ "FGDC CSDGM": ["spref > horizsys > planar > planci > plandu"]
205
+ }
206
+ }
207
+ }
52
208
  }
53
- ]
209
+ }
54
210
  }
@@ -3,7 +3,6 @@
3
3
  "id": "timeInstant.json#",
4
4
  "type": "object",
5
5
  "example": "../examples/timeInstant.json",
6
- "required": ["dateTime"],
7
6
  "additionalProperties": true,
8
7
  "properties": {
9
8
  "id": {
@@ -33,12 +32,27 @@
33
32
  "type": "string"
34
33
  }
35
34
  },
35
+ "geologicAge": {
36
+ "translation": {
37
+ "FGDC CSDGM": ["timeperd > timeinfo > mdattim > sngdate > geolage"]
38
+ },
39
+ "$ref": "./geologicAge.json#"
40
+ },
36
41
  "dateTime": {
37
42
  "translation": {
38
43
  "ISO 19115-2": ["EX_TemporalExtent > extent > TimeInstant > timePosition"]
39
44
  },
40
45
  "$ref": "common.json#/definitions/date"
41
46
  }
42
- }
47
+ },
48
+ "oneOf": [{
49
+ "title": "dateTime required",
50
+ "example": "../examples/timeInstant.json#/0",
51
+ "required": ["dateTime"]
52
+ }, {
53
+ "title": "geologicAge required",
54
+ "example": "../examples/timeInstant.json#/1",
55
+ "required": ["geologicAge"]
56
+ }]
43
57
 
44
58
  }
@@ -33,36 +33,72 @@
33
33
  "items": {
34
34
  "type": "string"
35
35
  }
36
- },
37
- "startDateTime": {
38
- "description": "Starting date, or date and time.",
39
- "translation": {
40
- "ISO 19115-2": ["EX_TemporalExtent > extent > TimePeriod > beginPosition "],
41
- "FGDC CSDGM": ["idinfo > timeperd > rngdates > begdate"]
36
+ }
37
+ },
38
+ "oneOf": [{
39
+ "title": "dateTime",
40
+ "type": "object",
41
+ "description": "A timePeriod with a startDateTime and/or endDateTime.",
42
+ "example": "../examples/timePeriod.json#/0",
43
+ "properties": {
44
+ "startDateTime": {
45
+ "description": "Starting date, or date and time.",
46
+ "translation": {
47
+ "ISO 19115-2": ["EX_TemporalExtent > extent > TimePeriod > beginPosition "],
48
+ "FGDC CSDGM": ["idinfo > timeperd > rngdates > begdate"]
49
+ },
50
+ "$ref": "common.json#/definitions/date"
42
51
  },
43
- "$ref": "common.json#/definitions/date"
44
- },
45
- "endDateTime": {
46
- "description": "Ending date, or date and time.",
47
- "translation": {
48
- "ISO 19115-2": ["EX_TemporalExtent > extent > TimePeriod > endPosition"],
49
- "FGDC CSDGM": ["idinfo > timeperd > rngdates > enddate"]
52
+ "endDateTime": {
53
+ "description": "Ending date, or date and time.",
54
+ "translation": {
55
+ "ISO 19115-2": ["EX_TemporalExtent > extent > TimePeriod > endPosition"],
56
+ "FGDC CSDGM": ["idinfo > timeperd > rngdates > enddate"]
57
+ },
58
+ "$ref": "common.json#/definitions/date"
50
59
  },
51
- "$ref": "common.json#/definitions/date"
52
- },
53
- "timeInterval": {
54
- "$ref": "#/definitions/timeInterval"
60
+ "timeInterval": {
61
+ "$ref": "#/definitions/timeInterval"
62
+ },
63
+ "duration": {
64
+ "$ref": "#/definitions/duration"
65
+ }
55
66
  },
56
- "duration": {
57
- "$ref": "#/definitions/duration"
58
- }
59
- },
60
- "anyOf": [{
61
- "title": "startDateTime required",
62
- "required": ["startDateTime"]
67
+ "anyOf": [{
68
+ "title": "startDateTime required",
69
+ "required": ["startDateTime"]
70
+ }, {
71
+ "title": "endDateTime required",
72
+ "required": ["endDateTime"]
73
+ }]
63
74
  }, {
64
- "title": "endDateTime required",
65
- "required": ["endDateTime"]
75
+ "title": "geologicAge",
76
+ "type": "object",
77
+ "description": "A timePeriod with a startGeologicAge and/or endGeologicAge.",
78
+ "example": "../examples/timePeriod.json#/1",
79
+ "properties": {
80
+ "startGeologicAge": {
81
+ "$ref": "./geologicAge.json#",
82
+ "description": "A name, code, or date for the beginning of an event or period in geologic time.",
83
+ "translation": {
84
+ "FGDC CSDGM": ["timeperd > timeinfo > rngdates > beggeol"]
85
+ }
86
+ },
87
+ "endGeologicAge": {
88
+ "$ref": "./geologicAge.json#",
89
+ "description": "A name, code, or date for the end of an event or period in geologic time.",
90
+ "translation": {
91
+ "FGDC CSDGM": ["timeperd > timeinfo > rngdates > endgeol"]
92
+ }
93
+ }
94
+ },
95
+ "anyOf": [{
96
+ "title": "startGeologicAge required",
97
+ "required": ["startGeologicAge"]
98
+ }, {
99
+ "title": "endGeologicAge required",
100
+ "required": ["endGeologicAge"]
101
+ }]
66
102
  }],
67
103
  "definitions": {
68
104
  "duration": {
@@ -0,0 +1,56 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "id": "verticalDatum.json#",
4
+ "type": "object",
5
+ "title": "verticalDatum",
6
+ "description": "The reference frame or system from which vertical distances (altitudes or depths) are measured.",
7
+ "example": "../examples/verticalDatum.json",
8
+ "translation": {
9
+ "ISO 19115-2": ["referenceSystemInfo > MD_CRS > datum"],
10
+ "FGDC CSDGM": ["metadata > spref > vertdef", "metadata > spref > depthsys"]
11
+ },
12
+ "required": ["datumIdentifier"],
13
+ "additionalProperties": true,
14
+ "properties": {
15
+ "datumIdentifier": {
16
+ "description": "The identification given to the surface taken as the surface of reference from which altitudes or depths are measured.",
17
+ "translation": {
18
+ "ISO 19115-2": ["referenceSystemInfo > MD_CRS > datum > RS_Identifier > code"],
19
+ "FGDC CSDGM": ["metadata > spref > vertdef > altsys > altdatum", "metadata > spref > vertdef > depthsys > depthdn"]
20
+ },
21
+ "$ref": "./identifier.json#"
22
+ },
23
+ "encodingMethod": {
24
+ "type": "string",
25
+ "description": "The means used to encode the altitudes.",
26
+ "translation": {
27
+ "FGDC CSDGM": ["metadata > spref > vertdef > altsys > altenc", "metadata > spref > vertdef > depthsys > depthem"]
28
+ }
29
+ },
30
+ "isDepthSystem": {
31
+ "type": "boolean",
32
+ "description": "True if depth system, false if altitude system.",
33
+ "default": false
34
+ },
35
+ "verticalResolution": {
36
+ "type": "number",
37
+ "description": "The minimum distance possible between two adjacent altitude or depth values, expressed in units of measure.",
38
+ "translation": {
39
+ "FGDC CSDGM": ["metadata > spref > vertdef > altsys > altres", "metadata > spref > vertdef > depthsys > depthres"]
40
+ }
41
+ },
42
+ "unitOfMeasure": {
43
+ "type": "string",
44
+ "description": "The units of measure for altitude or depth measurements.",
45
+ "translation": {
46
+ "FGDC CSDGM": ["metadata > spref > vertdef > altsys > altunits", "metadata > spref > vertdef > depthsys > depthdu"]
47
+ }
48
+ }
49
+ },
50
+ "dependencies": {
51
+ "encodingMethod": ["isDepthSystem", "verticalResolution", "unitOfMeasure", "datumIdentifier"],
52
+ "isDepthSystem": ["encodingMethod", "verticalResolution", "unitOfMeasure", "datumIdentifier"],
53
+ "verticalResolution": ["isDepthSystem", "encodingMethod", "unitOfMeasure", "datumIdentifier"],
54
+ "unitOfMeasure": ["isDepthSystem", "verticalResolution", "encodingMethod", "datumIdentifier"]
55
+ }
56
+ }
@@ -0,0 +1,8 @@
1
+ require 'helper.rb'
2
+
3
+ class TestGeodetic < TestHelper
4
+ def test_geodetic
5
+ errors = JSON::Validator.fully_validate('geodetic.json', @@example + 'geodetic.json', strict: @@strict, list: true)
6
+ assert(errors.empty?, errors.join("\n"))
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require 'helper.rb'
2
+
3
+ class TestGeologicAge < TestHelper
4
+ def test_geologicAge
5
+ errors = JSON::Validator.fully_validate('geologicAge.json', @@example + 'geologicAge.json', strict: @@strict, list: true)
6
+ assert(errors.empty?, errors.join("\n"))
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require 'helper.rb'
2
+
3
+ class TestObliqueLinePoint < TestHelper
4
+ def test_oblique_line_point
5
+ errors = JSON::Validator.fully_validate('projection.json', @@example + 'obliqueLinePoint.json', fragment: "#/definitions/obliqueLinePoint", strict: @@strict, list: false)
6
+ assert(errors.empty?, errors.join("\n"))
7
+ end
8
+ end
@@ -0,0 +1,27 @@
1
+ require 'helper.rb'
2
+ require 'adiwg-mdcodes'
3
+
4
+ class TestProjection < TestHelper
5
+ def test_projection
6
+ errors = JSON::Validator.fully_validate('projection.json', @@example + 'projection.json', strict: @@strict, list: true)
7
+ assert(errors.empty?, errors.join("\n"))
8
+ end
9
+
10
+ def test_mapProjection
11
+ codes = ADIWG::Mdcodes::getCodelistDetail('adiwg_mapProjection')["codelist"]
12
+ data = codes.map do |c|
13
+ {:projectionIdentifier => {:identifier => c["code"], :namespace => "org.adiwg.code.mapProjection"}}
14
+ end
15
+ errors = JSON::Validator.fully_validate('projection.json', data, strict: @@strict, list: true)
16
+ assert(errors.empty?, errors.join("\n"))
17
+ end
18
+
19
+ def test_mapGridSystem
20
+ codes = ADIWG::Mdcodes::getCodelistDetail('adiwg_mapGridSystem')["codelist"]
21
+ data = codes.map do |c|
22
+ {:gridIdentifier => {:identifier => c["code"], :namespace => "org.adiwg.code.mapGridSystem"}}
23
+ end
24
+ errors = JSON::Validator.fully_validate('projection.json', data, strict: @@strict, list: true)
25
+ assert(errors.empty?, errors.join("\n"))
26
+ end
27
+ end
@@ -0,0 +1,8 @@
1
+ require 'helper.rb'
2
+
3
+ class TestReferenceSystemParameterSet < TestHelper
4
+ def test_referenceSystemParameterSet
5
+ errors = JSON::Validator.fully_validate('referenceSystemParameterSet.json', @@example + 'referenceSystemParameterSet.json', strict: @@strict, list: true)
6
+ assert(errors.empty?, errors.join("\n"))
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require 'helper.rb'
2
+
3
+ class TestVerticalDatum < TestHelper
4
+ def test_verticalDatum
5
+ errors = JSON::Validator.fully_validate('verticalDatum.json', @@example + 'verticalDatum.json', strict: @@strict, list: true)
6
+ assert(errors.empty?, errors.join("\n"))
7
+ end
8
+ end
data/test/test.js CHANGED
@@ -29,7 +29,8 @@ describe('Test schemas:', function() {
29
29
  const Ajv = require('ajv');
30
30
  const data = require('../examples/mdJson.json');
31
31
  const ajv = new Ajv({
32
- extendRefs: 'fail'
32
+ extendRefs: 'fail',
33
+ schemaId: 'id'
33
34
  });
34
35
 
35
36
  it('should load all schemas', function() {