From 4d71935fc8c767045546e0145be29224486c4403 Mon Sep 17 00:00:00 2001 From: Josh Bradley Date: Wed, 5 Sep 2018 11:19:24 -0800 Subject: [PATCH] Add schema for geologicAge. Closes #169. --- examples/geologicAge.json | 12 +++++++++ schema/geologicAge.json | 54 +++++++++++++++++++++++++++++++++++++++ test/tc_geologicAge.rb | 8 ++++++ 3 files changed, 74 insertions(+) create mode 100644 examples/geologicAge.json create mode 100644 schema/geologicAge.json create mode 100644 test/tc_geologicAge.rb diff --git a/examples/geologicAge.json b/examples/geologicAge.json new file mode 100644 index 0000000..6aeb47d --- /dev/null +++ b/examples/geologicAge.json @@ -0,0 +1,12 @@ +[{ + "ageTimeScale": "ageTimeScale", + "ageEstimate": "ageEstimate", + "ageUncertainty": "ageUncertainty", + "ageExplanation": "ageExplanation", + "ageReference": [{ + "title": "citation title" + }] +}, { + "ageTimeScale": "ageTimeScale", + "ageEstimate": "ageEstimate" +}] diff --git a/schema/geologicAge.json b/schema/geologicAge.json new file mode 100644 index 0000000..16143fb --- /dev/null +++ b/schema/geologicAge.json @@ -0,0 +1,54 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "id": "geologicAge.json#", + "type": "object", + "title": "geologicAge", + "description": "A name, code, or date describing an event or period in geologic time, expressed either as an absolute date calculated using a named dating method, or as a relative date that is drawn from stratigraphy or biostratigraphy.", + "example": "../examples/geologicAge.json", + "translation": { + "FGDC CSDGM": ["timeperd > timeinfo > sngdate > geolage"] + }, + "required": ["ageTimeScale", "ageEstimate"], + "additionalProperties": true, + "properties": { + "ageTimeScale": { + "type": "string", + "description": "Name of a recognized geologic time scale. This includes \"Absolute\" as the name of the time scale for measuring geologic dates before the present and names of geologic dating systems that are arrangements of symbols or names in order of relative geologic time", + "translation": { + "FGDC CSDGM": ["timeperd > timeinfo > sngdate > geolage > geolscal"] + } + }, + "ageEstimate": { + "type": "string", + "description": "Either an absolute geologic date or a relative geologic age name describing an event or period in geologic time based on the Geologic_Time_Scale.", + "translation": { + "FGDC CSDGM": ["timeperd > timeinfo > sngdate > geolage > geolest"] + } + }, + "ageUncertainty": { + "type": "string", + "description": "The error estimate for the geologic time. This should include the units of measure, a description of what the error estimate represents and how it was calculated.", + "translation": { + "FGDC CSDGM": ["timeperd > timeinfo > sngdate > geolage > geolun"] + } + }, + "ageExplanation": { + "type": "string", + "description": "The name and/or description of the method used to calculate the ageEstimate. Detailed information about the method may be provided through references contained in the ageReference.", + "translation": { + "FGDC CSDGM": ["timeperd > timeinfo > sngdate > geolage > geolexpl"] + } + }, + "ageReference": { + "type" : "array", + "description" : "Citation for works providing detailed information about any element of the geologicAge.", + "translation": { + "FGDC CSDGM": ["timeperd > timeinfo > sngdate > geolage > geolcit"] + }, + "items" : { + "$ref": "./citation.json#" + } + } + }, + "definitions": {} +} diff --git a/test/tc_geologicAge.rb b/test/tc_geologicAge.rb new file mode 100644 index 0000000..59f9e1b --- /dev/null +++ b/test/tc_geologicAge.rb @@ -0,0 +1,8 @@ +require 'helper.rb' + +class TestGeologicAge < TestHelper + def test_geologicAge + errors = JSON::Validator.fully_validate('geologicAge.json', @@example + 'geologicAge.json', strict: @@strict, list: true) + assert(errors.empty?, errors.join("\n")) + end +end