adiwg-mdtranslator 2.4.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +51 -1
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +33 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb +68 -35
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_codeSet.rb +66 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entity.rb +7 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityOverview.rb +10 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_enumerated.rb +38 -19
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_range.rb +68 -19
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_transferInfo.rb +3 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +4 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domain.rb +87 -79
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entity.rb +150 -115
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +184 -113
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_valueRange.rb +56 -0
- data/lib/adiwg/mdtranslator/version.rb +7 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_body.rb +3 -3
- data/lib/adiwg/mdtranslator/writers/html/sections/html_dataDictionary.rb +6 -6
- data/lib/adiwg/mdtranslator/writers/html/sections/html_domain.rb +74 -38
- data/lib/adiwg/mdtranslator/writers/html/sections/html_ellipsoidParameters.rb +68 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_entity.rb +130 -76
- data/lib/adiwg/mdtranslator/writers/html/sections/html_entityAttribute.rb +78 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_identifier.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_obliqueLinePoint.rb +37 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_projectionParameters.rb +229 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_referenceSystemParameters.rb +65 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_spatialReference.rb +19 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_verticalDatumParameters.rb +69 -0
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_address.rb +103 -103
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_citation.rb +185 -0
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_date.rb +60 -0
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_definitionReference.rb +45 -0
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_domain.rb +107 -0
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +187 -187
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_featureAttribute.rb +123 -117
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_featureType.rb +155 -141
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_gcoDateTime.rb +48 -0
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_listedValue.rb +54 -55
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_mdIdentifier.rb +56 -0
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_series.rb +63 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_attributeGroup.rb +51 -50
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_citation.rb +181 -180
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_crs.rb +96 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_ellipsoidParameters.rb +62 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_keyword.rb +54 -54
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +301 -298
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_obliqueLinePoint.rb +53 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_projectionParameters.rb +229 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceSystem.rb +49 -32
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_domain.rb +5 -2
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_entity.rb +7 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_entityAttribute.rb +18 -2
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_valueRange.rb +28 -0
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_budget.rb +33 -13
- metadata +22 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/version.rb +0 -16
@@ -2,6 +2,7 @@
|
|
2
2
|
# unpack fgdc entity range domain
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2017-10-30 added range domain
|
5
6
|
# Stan Smith 2017-09-06 original script
|
6
7
|
|
7
8
|
require 'nokogiri'
|
@@ -14,31 +15,79 @@ module ADIWG
|
|
14
15
|
|
15
16
|
module Range
|
16
17
|
|
18
|
+
def self.is_number?(str)
|
19
|
+
return true if str =~ /[-+]?[0-9]*\.?[0-9]+/
|
20
|
+
true if Float(str) rescue false
|
21
|
+
end
|
22
|
+
|
17
23
|
def self.unpack(xRange, hAttribute, hResponseObj)
|
18
24
|
|
19
|
-
#
|
20
|
-
|
21
|
-
min = xRange.xpath('./rdommin').text
|
22
|
-
unless min.empty?
|
23
|
-
hAttribute[:minValue] = min
|
24
|
-
end
|
25
|
+
# instance classes needed in script
|
26
|
+
intMetadataClass = InternalMetadata.new
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
axRanges = xRange.xpath('./rdom')
|
29
|
+
unless axRanges.empty?
|
30
|
+
axRanges.each do |xRange|
|
31
|
+
|
32
|
+
hRange = intMetadataClass.newValueRange
|
33
|
+
hAttribute[:rangeOfValues] << hRange
|
34
|
+
|
35
|
+
# entity attribute 5.1.2.4.2.1 (rdommin) - range minimum
|
36
|
+
# -> dataDictionary.entities.attributes.minValue
|
37
|
+
# -> dataDictionary.entities.attributes.rangeOfValues.minRangeValue
|
38
|
+
min = xRange.xpath('./rdommin').text
|
39
|
+
unless min.empty?
|
40
|
+
hRange[:minRangeValue] = min
|
41
|
+
a = [min]
|
42
|
+
a << hAttribute[:minValue] unless hAttribute[:minValue].nil?
|
43
|
+
b = a.sort_by do |s|
|
44
|
+
if s =~ /[-+]?[0-9]*\.?[0-9]+/
|
45
|
+
[2, $&.to_f]
|
46
|
+
else
|
47
|
+
[1, s]
|
48
|
+
end
|
49
|
+
end
|
50
|
+
hAttribute[:minValue] = b[0]
|
51
|
+
end
|
52
|
+
|
53
|
+
# entity attribute 5.1.2.4.2.2 (rdommax) - range maximum
|
54
|
+
# -> dataDictionary.entities.attributes.maxValue
|
55
|
+
# -> dataDictionary.entities.attributes.rangeOfValues.maxRangeValue
|
56
|
+
max = xRange.xpath('./rdommax').text
|
57
|
+
unless max.empty?
|
58
|
+
hRange[:maxRangeValue] = max
|
59
|
+
a = [max]
|
60
|
+
a << hAttribute[:maxValue] unless hAttribute[:maxValue].nil?
|
61
|
+
b = a.sort_by do |s|
|
62
|
+
if s =~ /[-+]?[0-9]*\.?[0-9]+/
|
63
|
+
[2, $&.to_f]
|
64
|
+
else
|
65
|
+
[1, s]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
hAttribute[:maxValue] = b[b.length-1]
|
69
|
+
end
|
70
|
+
|
71
|
+
# entity attribute 5.1.2.4.2.3 (attrunit) - units of measure
|
72
|
+
# -> dataDictionary.entities.attributes.unitOfMeasure
|
73
|
+
units = xRange.xpath('./attrunit').text
|
74
|
+
unless units.empty?
|
75
|
+
hAttribute[:unitOfMeasure] = units
|
76
|
+
end
|
77
|
+
|
78
|
+
# entity attribute 5.1.2.4.2.4 (attrmres) - measurement resolution
|
79
|
+
# -> dataDictionary.entities.attributes.measureResolution
|
80
|
+
resolution = xRange.xpath('./attrmres').text
|
81
|
+
unless resolution.empty?
|
82
|
+
if is_number?(resolution)
|
83
|
+
hAttribute[:measureResolution] = resolution.to_f
|
84
|
+
end
|
85
|
+
end
|
32
86
|
|
33
|
-
|
34
|
-
# -> dataDictionary.entities.attributes.unitOfMeasure
|
35
|
-
units = xRange.xpath('./attrunit').text
|
36
|
-
unless units.empty?
|
37
|
-
hAttribute[:unitOfMeasure] = units
|
87
|
+
end
|
38
88
|
end
|
39
89
|
|
40
|
-
|
41
|
-
# -> not mapped
|
90
|
+
return hAttribute
|
42
91
|
|
43
92
|
end
|
44
93
|
|
@@ -55,6 +55,9 @@ module ADIWG
|
|
55
55
|
hSpecification[:otherDetails] << specification
|
56
56
|
end
|
57
57
|
|
58
|
+
# distribution bio (asciistr) - ASCII file specification
|
59
|
+
# -> not mapped; cannot reliably merge with entity-attribute definition
|
60
|
+
|
58
61
|
# distribution 6.4.2.1.5 (formcont) - format information content
|
59
62
|
# -> distribution.distributor.transferOption.distributionFormat.formatSpecification.otherCitationDetails
|
60
63
|
specification = xTranInfo.xpath('./formcont').text
|
@@ -21,8 +21,8 @@
|
|
21
21
|
# Stan Smith 2013-08-09 original script
|
22
22
|
|
23
23
|
require 'json'
|
24
|
+
require 'rubygems'
|
24
25
|
require_relative 'mdJson_validator'
|
25
|
-
require_relative 'version'
|
26
26
|
require_relative 'modules/module_mdJson'
|
27
27
|
|
28
28
|
module ADIWG
|
@@ -88,7 +88,7 @@ module ADIWG
|
|
88
88
|
end
|
89
89
|
|
90
90
|
# schema - 2.0.0 =< requested version =< current version
|
91
|
-
currentVersion =
|
91
|
+
currentVersion = Gem::Specification.find_by_name('adiwg-mdjson_schemas').version.to_s
|
92
92
|
hResponseObj[:readerVersionRequested] = requestedVersion
|
93
93
|
hResponseObj[:readerVersionUsed] = currentVersion
|
94
94
|
aCurVersion = currentVersion.split('.')
|
@@ -100,7 +100,9 @@ module ADIWG
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
unless approved
|
103
|
+
approvedVersion = aCurVersion[0] + '.0.0'
|
103
104
|
hResponseObj[:readerStructureMessages] << "mdJson schema version '#{requestedVersion}' is not supported"
|
105
|
+
hResponseObj[:readerStructureMessages] << "mdJson versions '#{approvedVersion}' to '#{currentVersion}' are supported"
|
104
106
|
hResponseObj[:readerStructurePass] = false
|
105
107
|
return {}
|
106
108
|
end
|
@@ -2,94 +2,102 @@
|
|
2
2
|
# Reader - ADIwg JSON V1 to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
5
|
+
# Stan Smith 2017-11-01 added domainReference
|
6
|
+
# Stan Smith 2016-10-07 refactored for mdJson 2.0
|
7
|
+
# Stan Smith 2015-07-23 added error reporting of missing items
|
8
|
+
# Stan Smith 2015-07-14 refactored to remove global namespace constants
|
9
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
|
10
|
+
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
10
11
|
# Stan Smith 2013-12-01 original script
|
11
12
|
|
12
13
|
require_relative 'module_domainItem'
|
14
|
+
require_relative 'module_citation'
|
13
15
|
|
14
16
|
module ADIWG
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
17
|
+
module Mdtranslator
|
18
|
+
module Readers
|
19
|
+
module MdJson
|
20
|
+
|
21
|
+
module Domain
|
22
|
+
|
23
|
+
def self.unpack(hDomain, responseObj)
|
24
|
+
|
25
|
+
# return nil object if input is empty
|
26
|
+
if hDomain.empty?
|
27
|
+
responseObj[:readerExecutionMessages] << 'Domain Member object is empty'
|
28
|
+
responseObj[:readerExecutionPass] = false
|
29
|
+
return nil
|
30
|
+
end
|
31
|
+
|
32
|
+
# instance classes needed in script
|
33
|
+
intMetadataClass = InternalMetadata.new
|
34
|
+
intDomain = intMetadataClass.newDictionaryDomain
|
35
|
+
|
36
|
+
# data dictionary domain - id (required)
|
37
|
+
if hDomain.has_key?('domainId')
|
38
|
+
intDomain[:domainId] = hDomain['domainId']
|
39
|
+
end
|
40
|
+
if intDomain[:domainId].nil? || intDomain[:domainId] == ''
|
41
|
+
responseObj[:readerExecutionMessages] << 'Data Dictionary domain ID is missing'
|
42
|
+
responseObj[:readerExecutionPass] = false
|
43
|
+
return nil
|
44
|
+
end
|
45
|
+
|
46
|
+
# data dictionary domain - name
|
47
|
+
if hDomain.has_key?('commonName')
|
48
|
+
if hDomain['commonName'] != ''
|
49
|
+
intDomain[:domainName] = hDomain['commonName']
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# data dictionary domain - code (required)
|
54
|
+
if hDomain.has_key?('codeName')
|
55
|
+
intDomain[:domainCode] = hDomain['codeName']
|
56
|
+
end
|
57
|
+
if intDomain[:domainCode].nil? || intDomain[:domainCode] == ''
|
58
|
+
responseObj[:readerExecutionMessages] << 'Data Dictionary domain code name is missing'
|
59
|
+
responseObj[:readerExecutionPass] = false
|
60
|
+
return nil
|
61
|
+
end
|
62
|
+
|
63
|
+
# data dictionary domain - description (required)
|
64
|
+
if hDomain.has_key?('description')
|
65
|
+
intDomain[:domainDescription] = hDomain['description']
|
66
|
+
end
|
67
|
+
if intDomain[:domainDescription].nil? || intDomain[:domainDescription] == ''
|
68
|
+
responseObj[:readerExecutionMessages] << 'Data Dictionary domain description is missing'
|
69
|
+
responseObj[:readerExecutionPass] = false
|
70
|
+
return nil
|
71
|
+
end
|
72
|
+
|
73
|
+
# data dictionary domain - domain reference {citation}
|
74
|
+
if hDomain.has_key?('domainReference')
|
75
|
+
hCitation = hDomain['domainReference']
|
76
|
+
unless hCitation.empty?
|
77
|
+
hReturn = Citation.unpack(hCitation, responseObj)
|
78
|
+
unless hReturn.nil?
|
79
|
+
intDomain[:domainReference] = hReturn
|
37
80
|
end
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# data dictionary domain - items []
|
85
|
+
if hDomain.has_key?('domainItem')
|
86
|
+
hDomain['domainItem'].each do |item|
|
87
|
+
hDom = DomainItem.unpack(item, responseObj)
|
88
|
+
unless hDom.nil?
|
89
|
+
intDomain[:domainItems] << hDom
|
42
90
|
end
|
91
|
+
end
|
92
|
+
end
|
43
93
|
|
44
|
-
|
45
|
-
if hDomain.has_key?('commonName')
|
46
|
-
if hDomain['commonName'] != ''
|
47
|
-
intDomain[:domainName] = hDomain['commonName']
|
48
|
-
end
|
49
|
-
end
|
94
|
+
return intDomain
|
50
95
|
|
51
|
-
|
52
|
-
if hDomain.has_key?('codeName')
|
53
|
-
intDomain[:domainCode] = hDomain['codeName']
|
54
|
-
end
|
55
|
-
if intDomain[:domainCode].nil? || intDomain[:domainCode] == ''
|
56
|
-
responseObj[:readerExecutionMessages] << 'Data Dictionary domain code name is missing'
|
57
|
-
responseObj[:readerExecutionPass] = false
|
58
|
-
return nil
|
59
|
-
end
|
60
|
-
|
61
|
-
# data dictionary domain - description (required)
|
62
|
-
if hDomain.has_key?('description')
|
63
|
-
intDomain[:domainDescription] = hDomain['description']
|
64
|
-
end
|
65
|
-
if intDomain[:domainDescription].nil? || intDomain[:domainDescription] == ''
|
66
|
-
responseObj[:readerExecutionMessages] << 'Data Dictionary domain description is missing'
|
67
|
-
responseObj[:readerExecutionPass] = false
|
68
|
-
return nil
|
69
|
-
end
|
70
|
-
|
71
|
-
# data dictionary domain - items [] (required)
|
72
|
-
if hDomain.has_key?('domainItem')
|
73
|
-
hDomain['domainItem'].each do |item|
|
74
|
-
hDom = DomainItem.unpack(item, responseObj)
|
75
|
-
unless hDom.nil?
|
76
|
-
intDomain[:domainItems] << hDom
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
if intDomain[:domainItems].empty?
|
81
|
-
responseObj[:readerExecutionMessages] << 'Data Dictionary domain has no domain items'
|
82
|
-
responseObj[:readerExecutionPass] = false
|
83
|
-
return nil
|
84
|
-
end
|
85
|
-
|
86
|
-
return intDomain
|
87
|
-
|
88
|
-
end
|
89
|
-
|
90
|
-
end
|
96
|
+
end
|
91
97
|
|
92
98
|
end
|
93
|
-
|
94
|
-
|
99
|
+
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
95
103
|
end
|
@@ -2,134 +2,169 @@
|
|
2
2
|
# Reader - mdJson to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
5
|
+
# Stan Smith 2017-11-01 added entityReference, fieldSeparator, headerLines, quoteCharacter
|
6
|
+
# Stan Smith 2016-10-07 refactored for mdJson 2.0
|
7
|
+
# Stan Smith 2015-07-24 added error reporting of missing items
|
8
|
+
# Stan Smith 2015-07-14 refactored to remove global namespace constants
|
9
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
|
10
|
+
# Stan Smith 2015-02-17 add entity aliases
|
11
|
+
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
11
12
|
# Stan Smith 2013-12-01 original script
|
12
13
|
|
13
14
|
require_relative 'module_entityIndex'
|
14
15
|
require_relative 'module_entityAttribute'
|
15
16
|
require_relative 'module_entityForeignKey'
|
17
|
+
require_relative 'module_citation'
|
16
18
|
|
17
19
|
module ADIWG
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
20
|
+
module Mdtranslator
|
21
|
+
module Readers
|
22
|
+
module MdJson
|
23
|
+
|
24
|
+
module Entity
|
25
|
+
|
26
|
+
def self.unpack(hEntity, responseObj)
|
27
|
+
|
28
|
+
# return nil object if input is empty
|
29
|
+
if hEntity.empty?
|
30
|
+
responseObj[:readerExecutionMessages] << 'Entity object is empty'
|
31
|
+
responseObj[:readerExecutionPass] = false
|
32
|
+
return nil
|
33
|
+
end
|
34
|
+
|
35
|
+
# instance classes needed in script
|
36
|
+
intMetadataClass = InternalMetadata.new
|
37
|
+
intEntity = intMetadataClass.newEntity
|
38
|
+
|
39
|
+
# entity - id
|
40
|
+
if hEntity.has_key?('entityId')
|
41
|
+
s = hEntity['entityId']
|
42
|
+
unless s == ''
|
43
|
+
intEntity[:entityId] = s
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# entity - name
|
48
|
+
if hEntity.has_key?('commonName')
|
49
|
+
if hEntity['commonName'] != ''
|
50
|
+
intEntity[:entityName] = hEntity['commonName']
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# entity - code (required)
|
55
|
+
if hEntity.has_key?('codeName')
|
56
|
+
intEntity[:entityCode] = hEntity['codeName']
|
57
|
+
end
|
58
|
+
if intEntity[:entityCode].nil? || intEntity[:entityCode] == ''
|
59
|
+
responseObj[:readerExecutionMessages] << 'Data Dictionary entity code name is missing'
|
60
|
+
responseObj[:readerExecutionPass] = false
|
61
|
+
return nil
|
62
|
+
end
|
63
|
+
|
64
|
+
# entity - alias []
|
65
|
+
if hEntity.has_key?('alias')
|
66
|
+
hEntity['alias'].each do |item|
|
67
|
+
if item != ''
|
68
|
+
intEntity[:entityAlias] << item
|
43
69
|
end
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# entity - definition (required)
|
74
|
+
if hEntity.has_key?('definition')
|
75
|
+
intEntity[:entityDefinition] = hEntity['definition']
|
76
|
+
end
|
77
|
+
if intEntity[:entityDefinition].nil? || intEntity[:entityDefinition] == ''
|
78
|
+
responseObj[:readerExecutionMessages] << 'Data Dictionary entity definition is missing'
|
79
|
+
responseObj[:readerExecutionPass] = false
|
80
|
+
return nil
|
81
|
+
end
|
82
|
+
|
83
|
+
# entity - entity reference [] {citation}
|
84
|
+
if hEntity.has_key?('entityReference')
|
85
|
+
hEntity['entityReference'].each do |hCitation|
|
86
|
+
unless hCitation.empty?
|
87
|
+
hReturn = Citation.unpack(hCitation, responseObj)
|
88
|
+
unless hReturn.nil?
|
89
|
+
intEntity[:entityReferences] << hReturn
|
90
|
+
end
|
55
91
|
end
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# data entity - primary key (NOT required)
|
96
|
+
if hEntity.has_key?('primaryKeyAttributeCodeName')
|
97
|
+
hEntity['primaryKeyAttributeCodeName'].each do |item|
|
98
|
+
if item != ''
|
99
|
+
intEntity[:primaryKey] << item
|
60
100
|
end
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# entity - indexes []
|
105
|
+
if hEntity.has_key?('index')
|
106
|
+
hEntity['index'].each do |hIndex|
|
107
|
+
unless hIndex.empty?
|
108
|
+
index = EntityIndex.unpack(hIndex, responseObj)
|
109
|
+
unless index.nil?
|
110
|
+
intEntity[:indexes] << index
|
111
|
+
end
|
69
112
|
end
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
# entity - attributes []
|
117
|
+
if hEntity.has_key?('attribute')
|
118
|
+
hEntity['attribute'].each do |hAttribute|
|
119
|
+
unless hAttribute.empty?
|
120
|
+
attribute = EntityAttribute.unpack(hAttribute, responseObj)
|
121
|
+
unless attribute.nil?
|
122
|
+
intEntity[:attributes] << attribute
|
123
|
+
end
|
74
124
|
end
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
# entity - foreign keys []
|
129
|
+
if hEntity.has_key?('foreignKey')
|
130
|
+
hEntity['foreignKey'].each do |hFKey|
|
131
|
+
unless hFKey.empty?
|
132
|
+
fKey = EntityForeignKey.unpack(hFKey, responseObj)
|
133
|
+
unless fKey.nil?
|
134
|
+
intEntity[:foreignKeys] << fKey
|
135
|
+
end
|
79
136
|
end
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
unless attribute.nil?
|
108
|
-
intEntity[:attributes] << attribute
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
# entity - foreign keys []
|
115
|
-
if hEntity.has_key?('foreignKey')
|
116
|
-
hEntity['foreignKey'].each do |hFKey|
|
117
|
-
unless hFKey.empty?
|
118
|
-
fKey = EntityForeignKey.unpack(hFKey, responseObj)
|
119
|
-
unless fKey.nil?
|
120
|
-
intEntity[:foreignKeys] << fKey
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
return intEntity
|
127
|
-
|
128
|
-
end
|
129
|
-
|
130
|
-
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
# entity - field separator
|
141
|
+
if hEntity.has_key?('fieldSeparatorCharacter')
|
142
|
+
if hEntity['fieldSeparatorCharacter'] != ''
|
143
|
+
intEntity[:fieldSeparatorCharacter] = hEntity['fieldSeparatorCharacter']
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# entity - number of header lines
|
148
|
+
if hEntity.has_key?('numberOfHeaderLines')
|
149
|
+
if hEntity['numberOfHeaderLines'] != ''
|
150
|
+
intEntity[:numberOfHeaderLines] = hEntity['numberOfHeaderLines'].to_i
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
# entity - quote character
|
155
|
+
if hEntity.has_key?('quoteCharacter')
|
156
|
+
if hEntity['quoteCharacter'] != ''
|
157
|
+
intEntity[:quoteCharacter] = hEntity['quoteCharacter']
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
return intEntity
|
162
|
+
|
163
|
+
end
|
131
164
|
|
132
165
|
end
|
133
|
-
|
134
|
-
|
166
|
+
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
135
170
|
end
|