Skip to content

Commit

Permalink
Update entity schema
Browse files Browse the repository at this point in the history
- Split entityAttribute into separate file
- Add definition for valueRange

Closes #168, Closes #165.
  • Loading branch information
jlblcc committed Dec 27, 2017
1 parent 8aaeabc commit 0aea6bf
Show file tree
Hide file tree
Showing 6 changed files with 225 additions and 83 deletions.
33 changes: 31 additions & 2 deletions examples/entityAttribute.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,37 @@
"alias1"
],
"definition": "definition",
"attributeReference": {
"title": "attributeReference"
},
"dataType": "dataType",
"allowNull": true,
"units": "units",
"unitsResolution": 9.9,
"isCaseSensitive": false,
"domainId": "domainId",
"minValue": "minValue",
"maxValue": "maxValue"
"maxValue": "maxValue",
"fieldWidth": 9,
"missingValue": "missingValue",
"valueRange": [{
"minRangeValue": "0",
"maxRangeValue": "9.9"
}],
"timePeriod": [{
"id": "id",
"description": "description",
"identifier": {
"identifier": "identifier",
"namespace": "namespace"
},
"periodName": [
"periodName0",
"periodName1"
],
"startDateTime": "2016-10-14T11:10:15.2-10:00",
"endDateTime": "2016-12-31"
}]
},
{
"commonName": "Employee ID",
Expand All @@ -24,8 +49,12 @@
"dataType": "numeric",
"allowNull": true,
"units": "meters",
"unitsResolution": 1,
"isCaseSensitive": true,
"domainId": "dom042",
"minValue": "1000000",
"maxValue": "5000000"
"maxValue": "5000000",
"fieldWidth": 7,
"missingValue": "-999"
}
]
4 changes: 4 additions & 0 deletions examples/valueRange.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[{
"minRangeValue": "0",
"maxRangeValue": "9.9"
}]
78 changes: 1 addition & 77 deletions schema/entity.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"ISO 19115-2": ["FC_FeatureCatalogue > featureType > FC_FeatureType > carrierOfCharacteristics > FC_FeatureAttribute"]
},
"items": {
"$ref": "#/definitions/attribute"
"$ref": "./entityAttribute.json#"
}
},
"foreignKey": {
Expand Down Expand Up @@ -157,82 +157,6 @@
}
}
},
"attribute": {
"type": "object",
"example": "../examples/entityAttribute.json",
"required": ["codeName", "dataType", "definition", "allowNull"],
"additionalProperties": true,
"properties": {
"commonName": {
"type": "string",
"description": "The common name used to identify this attribute",
"translation": {
"ISO 19115-2": ["FC_FeatureCatalogue > featureType > FC_FeatureType > carrierOfCharacteristics > FC_FeatureAttribute > memberName > localName"]
}
},
"codeName": {
"type": "string",
"description": "The code used to identify this attribute. Most often this will be the table or spreadsheet column name",
"translation": {
"ISO 19115-2": ["FC_FeatureCatalogue > featureType > FC_FeatureType > carrierOfCharacteristics > FC_FeatureAttribute > code > CharacterString"]
}
},
"alias": {
"type": "array",
"description": "An array of quoted strings providing alternate names by which the attribute is known",
"items": {
"type": "string"
}
},
"definition": {
"type": "string",
"description": "A succinct but comprehensive definition for the attribute",
"translation": {
"ISO 19115-2": ["FC_FeatureCatalogue > featureType > FC_FeatureType > carrierOfCharacteristics > FC_FeatureAttribute > definition > CharacterString"]
}
},
"dataType": {
"type": "string",
"description": "The datatype for the attribute. Names for datatypes vary widely by database management system. Use the datatype name associated with the database system that implemented the entity. E.g. 'integer', 'boolean', 'decimal(8,5)', 'varchar(200)'",
"translation": {
"ISO 19115-2": ["FC_FeatureCatalogue > featureType > FC_FeatureType > carrierOfCharacteristics > FC_FeatureAttribute > valueType > TypeName > aName > CharacterString"]
}
},
"allowNull": {
"type": "boolean",
"description": "Indicates whether null values are allowed for the attribute",
"translation": {
"ISO 19115-2": ["FC_FeatureCatalogue > featureType > FC_FeatureType > carrierOfCharacteristics > FC_FeatureAttribute > cardinality > Multiplicity > range > MultiplicityRange > lower > integer[0=optional | 1=required]"]
},
"default": false
},
"allowMany": {
"type": "boolean",
"description": "Indicates whether null values are allowed for the attribute",
"translation": {},
"default": false
},
"units": {
"type": "string",
"description": "A unit-of-measure for the attribute. E.g. 'meters', 'atmospheres', 'liters'",
"translation": {
"ISO 19115-2": ["FC_FeatureCatalogue > featureType > FC_FeatureType > carrierOfCharacteristics > FC_FeatureAttribute > valueMeasurementUnit > [UnitDefinition > identifier | ConversionalUnit > identifier, name, catalogSystem, conversionToPreferredUnit, formula | BaseUnit > identifier, name, catalogSymbol, unitSystem | DerivedUnit > identifier, name, remarks, catalogSymbol, derivationUnitTerm]"]
}
},
"domainId": {
"type": "string",
"description": "Provides the domain ID for the dictionary Domain containing the list of permissable values for this attribute"
},
"minValue": {
"type": "string",
"description": "The minimum range value permissible for this attribute"
},
"maxValue": {
"type": "string",
"description": "The maximum range value permissible for this attribute"
}
}
},
"foreignKey": {
"type": "object",
"example": "../examples/entityForeignKey.json",
Expand Down
177 changes: 177 additions & 0 deletions schema/entityAttribute.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "entityAttribute.json#",
"title": "attribute",
"type": "object",
"example": "../examples/entityAttribute.json",
"required": ["codeName", "dataType", "definition", "allowNull"],
"additionalProperties": true,
"properties": {
"commonName": {
"type": "string",
"description": "The common name used to identify this attribute",
"translation": {
"ISO 19115-2": ["FC_FeatureCatalogue > featureType > FC_FeatureType > carrierOfCharacteristics > FC_FeatureAttribute > memberName > localName"]
}
},
"codeName": {
"type": "string",
"description": "The code used to identify this attribute. Most often this will be the table or spreadsheet column name",
"translation": {
"ISO 19115-2": ["FC_FeatureCatalogue > featureType > FC_FeatureType > carrierOfCharacteristics > FC_FeatureAttribute > code > CharacterString"]
}
},
"alias": {
"type": "array",
"description": "An array of quoted strings providing alternate names by which the attribute is known",
"items": {
"type": "string"
}
},
"definition": {
"type": "string",
"description": "A succinct but comprehensive definition for the attribute",
"translation": {
"ISO 19115-2": ["FC_FeatureCatalogue > featureType > FC_FeatureType > carrierOfCharacteristics > FC_FeatureAttribute > definition > CharacterString"]
}
},
"attributeReference": {
"description": "Reference to a standard or external description of the entity attribute.",
"translation": {
"ISO 19115-2": ["MD_DataIdentification > citation > CI_Citation"],
"FGDC CSDGM": ["eainfo > detailed > attr > attrdef"]
},
"$ref": "./citation.json#"
},
"dataType": {
"type": "string",
"description": "The datatype for the attribute. Names for datatypes vary widely by database management system. Use the datatype name associated with the database system that implemented the entity. E.g. 'integer', 'boolean', 'decimal(8,5)', 'varchar(200)'",
"translation": {
"ISO 19115-2": ["FC_FeatureCatalogue > featureType > FC_FeatureType > carrierOfCharacteristics > FC_FeatureAttribute > valueType > TypeName > aName > CharacterString"]
}
},
"allowNull": {
"type": "boolean",
"description": "Indicates whether null values are allowed for the attribute",
"translation": {
"ISO 19115-2": ["FC_FeatureCatalogue > featureType > FC_FeatureType > carrierOfCharacteristics > FC_FeatureAttribute > cardinality > Multiplicity > range > MultiplicityRange > lower > integer[0=optional | 1=required]"]
},
"default": false
},
"allowMany": {
"type": "boolean",
"description": "Indicates whether null values are allowed for the attribute",
"translation": {},
"default": false
},
"units": {
"type": "string",
"description": "A unit-of-measure for the attribute. E.g. 'meters', 'atmospheres', 'liters'",
"translation": {
"ISO 19115-2": ["FC_FeatureCatalogue > featureType > FC_FeatureType > carrierOfCharacteristics > FC_FeatureAttribute > valueMeasurementUnit > [UnitDefinition > identifier | ConversionalUnit > identifier, name, catalogSystem, conversionToPreferredUnit, formula | BaseUnit > identifier, name, catalogSymbol, unitSystem | DerivedUnit > identifier, name, remarks, catalogSymbol, derivationUnitTerm]"]
}
},
"unitsResolution": {
"type": "number",
"description": "The smallest unit increment to which an attribute value is measured.",
"translation": {
"FGDC CSDGM": [
"eainfo > detailed > attr > attrdomv > rdom > attrunit",
"eainfo > detailed > attr > attrdomv > rdom > attrmres"
]
}
},
"isCaseSensitive": {
"type": "boolean",
"default": false,
"description": "Indicates if the content of the data set is encoded in case-sensitive ASCII.",
"translation": {
"FGDC CSDGM": ["distinfo > stdorder > digform > digtinfo > asciistr > casesens"]
}
},
"fieldWidth": {
"type": "integer",
"description": "The number of characters in the data field.",
"translation": {
"FGDC CSDGM": ["distinfo > stdorder > digform > digtinfo > asciistr > datafiel > dfwidth"]

}
},
"missingValue": {
"type": "string",
"description": "The code which represents missing data.",
"translation": {
"FGDC CSDGM": ["distinfo > stdorder > digform > digtinfo > asciistr > datafiel > missingv"]

}
},
"domainId": {
"type": "string",
"description": "Provides the domain ID for the dictionary Domain containing the list of permissable values for this attribute"
},
"minValue": {
"type": "string",
"description": "The minimum range value permissible for this attribute"
},
"maxValue": {
"type": "string",
"description": "The maximum range value permissible for this attribute"
},
"valueRange": {
"type": "array",
"description": "The minimum and maximum values that may be assigned to the attribute.",
"items": {
"$ref": "#/definitions/valueRange"
}
},
"timePeriod":{
"type" : "array",
"description" : "The earliest or only date for which the attribute values are current. In cases when a range of dates are provided, this is the earliest date for which the information is valid.",
"translation": {
"FGDC CSDGM": [
"eainfo > detailed > attr > attrdomv > begdatea",
"eainfo > detailed > attr > attrdomv > enddatea"
]
},
"items" : {
"$ref" : "./timePeriod.json#"
}
}
},
"definitions": {
"valueRange": {
"type": "object",
"description": "The minimum and maximum values of a continuum of valid values.",
"example": "../examples/valueRange.json",
"translation": {
"FGDC CSDGM": [
"eainfo > detailed > attr > attrdomv > rdom"
]
},
"required": ["minRangeValue", "maxRangeValue"],
"additionalProperties": true,
"properties": {
"minRangeValue": {
"type": "string",
"description": "The least value that the attribute can be assigned.",
"translation": {
"FGDC CSDGM": [
"eainfo > detailed > attr > attrdomv > rdom > rdommin"
]
},
"minLength": 1
},
"maxRangeValue": {
"type": "string",
"description": "The greatest value that the attribute can be assigned.",
"translation": {
"FGDC CSDGM": [
"eainfo > detailed > attr > attrdomv > rdom > rdommax"
]
},
"minLength": 1
}
}
}
}
}
4 changes: 0 additions & 4 deletions test/tc_entity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,4 @@ def test_foreignKey
errors = JSON::Validator.fully_validate('entity.json', @@example + 'entityForeignKey.json', fragment:'#/definitions/foreignKey', strict: @@strict, list: true)
assert(errors.empty?, errors.join("\n"))
end
def test_attribute
errors = JSON::Validator.fully_validate('entity.json', @@example + 'entityAttribute.json', fragment:'#/definitions/attribute', strict: @@strict, list: true)
assert(errors.empty?, errors.join("\n"))
end
end
12 changes: 12 additions & 0 deletions test/tc_entityAttribute.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'helper.rb'

class TestEntityAttribute < TestHelper
def test_attribute
errors = JSON::Validator.fully_validate('entityAttribute.json', @@example + 'entityAttribute.json', strict: @@strict, list: true)
assert(errors.empty?, errors.join("\n"))
end
def test_valueRange
errors = JSON::Validator.fully_validate('entityAttribute.json', @@example + 'valueRange.json', fragment:'#/definitions/valueRange', strict: @@strict, list: true)
assert(errors.empty?, errors.join("\n"))
end
end

0 comments on commit 0aea6bf

Please sign in to comment.