adiwg-mdtranslator 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +23 -23
- data/lib/adiwg/mdtranslator/readers/fgdc/fgdc_reader.rb +1 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb +110 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_digitalForm.rb +69 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_distribution.rb +82 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entity.rb +72 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityAttribute.rb +32 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityOverview.rb +45 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_enumerated.rb +50 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb +29 -13
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_identification.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_metadataInfo.rb +125 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_offlineOption.rb +98 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_onlineOption.rb +81 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_orderProcess.rb +79 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_pointVector.rb +102 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_range.rb +50 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_raster.rb +84 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialOrganization.rb +48 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_timePeriod.rb +20 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_transferInfo.rb +87 -0
- data/lib/adiwg/mdtranslator/version.rb +2 -1
- metadata +15 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05a5a0a4dc73f22a0ce7486fe6be73754cc93743
|
4
|
+
data.tar.gz: 7c4c4d97eb981e0d6612ce4dc439b356eb0fe0cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d224f7a98809a3738ca574b64662f466ba023f33a81fced281d72c06c2df0f3059a08daddbf7dfe9352e9ec4c56f89874644419c860a9eaa42fd4c6c6fd2f85
|
7
|
+
data.tar.gz: 533e4af92c507a80d47d89669a68d9d7a9ca829c790047b65c66bfbf968e57506889b980932975b277f813d244e3f4e2caf2f6318e8bd43331c75fbb2ae43d26
|
@@ -436,29 +436,6 @@ class InternalMetadata
|
|
436
436
|
}
|
437
437
|
end
|
438
438
|
|
439
|
-
def newSpatialReferenceSystem
|
440
|
-
{
|
441
|
-
systemType: nil,
|
442
|
-
systemIdentifier: {}
|
443
|
-
}
|
444
|
-
end
|
445
|
-
|
446
|
-
def newSpatialResolution
|
447
|
-
{
|
448
|
-
scaleFactor: nil,
|
449
|
-
measure: {},
|
450
|
-
levelOfDetail: nil
|
451
|
-
}
|
452
|
-
end
|
453
|
-
|
454
|
-
def newMeasure
|
455
|
-
{
|
456
|
-
type: nil,
|
457
|
-
value: nil,
|
458
|
-
unitOfMeasure: nil
|
459
|
-
}
|
460
|
-
end
|
461
|
-
|
462
439
|
def newExtent
|
463
440
|
{
|
464
441
|
description: nil,
|
@@ -793,6 +770,29 @@ class InternalMetadata
|
|
793
770
|
}
|
794
771
|
end
|
795
772
|
|
773
|
+
def newSpatialReferenceSystem
|
774
|
+
{
|
775
|
+
systemType: nil,
|
776
|
+
systemIdentifier: {}
|
777
|
+
}
|
778
|
+
end
|
779
|
+
|
780
|
+
def newSpatialResolution
|
781
|
+
{
|
782
|
+
scaleFactor: nil,
|
783
|
+
measure: {},
|
784
|
+
levelOfDetail: nil
|
785
|
+
}
|
786
|
+
end
|
787
|
+
|
788
|
+
def newMeasure
|
789
|
+
{
|
790
|
+
type: nil,
|
791
|
+
value: nil,
|
792
|
+
unitOfMeasure: nil
|
793
|
+
}
|
794
|
+
end
|
795
|
+
|
796
796
|
def newSpatialRepresentation
|
797
797
|
{
|
798
798
|
gridRepresentation: {},
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# Reader - fgdc to internal data structure
|
2
|
+
# unpack fgdc entity attribute
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-09-06 original script
|
6
|
+
|
7
|
+
require 'uuidtools'
|
8
|
+
require 'nokogiri'
|
9
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
10
|
+
require_relative 'module_enumerated'
|
11
|
+
require_relative 'module_range'
|
12
|
+
|
13
|
+
module ADIWG
|
14
|
+
module Mdtranslator
|
15
|
+
module Readers
|
16
|
+
module Fgdc
|
17
|
+
|
18
|
+
module Attribute
|
19
|
+
|
20
|
+
def self.unpack(xAttribute, hDictionary, hResponseObj)
|
21
|
+
|
22
|
+
# instance classes needed in script
|
23
|
+
intMetadataClass = InternalMetadata.new
|
24
|
+
hAttribute = intMetadataClass.newEntityAttribute
|
25
|
+
|
26
|
+
# entity attribute 5.1.2.1 (attrlabl) - attribute name
|
27
|
+
# -> dataDictionary.entities.attributes.attributeCode
|
28
|
+
code = xAttribute.xpath('./attrlabl').text
|
29
|
+
unless code.empty?
|
30
|
+
hAttribute[:attributeName] = code
|
31
|
+
hAttribute[:attributeCode] = code
|
32
|
+
end
|
33
|
+
|
34
|
+
# entity attribute 5.1.2.2 (attrdef) - attribute definition
|
35
|
+
# -> dataDictionary.entities.attributes.attributeDefinition
|
36
|
+
definition = xAttribute.xpath('./attrdef').text
|
37
|
+
unless definition.empty?
|
38
|
+
hAttribute[:attributeDefinition] = definition
|
39
|
+
end
|
40
|
+
|
41
|
+
# entity attribute 5.1.2.3 (attrdefs) - attribute definition source
|
42
|
+
# -> not mapped
|
43
|
+
|
44
|
+
# entity attribute 5.1.2.4 (attrdomv) - attribute domain value
|
45
|
+
axDomain = xAttribute.xpath('./attrdomv')
|
46
|
+
unless axDomain.empty?
|
47
|
+
hDomain = intMetadataClass.newDictionaryDomain
|
48
|
+
hDomain[:domainId] = UUIDTools::UUID.random_create.to_s
|
49
|
+
hDomain[:domainCode] = code
|
50
|
+
hDomain[:domainDescription] = 'FGDC enumerated domain'
|
51
|
+
|
52
|
+
axDomain.each do |xDomain|
|
53
|
+
|
54
|
+
# entity attribute 5.1.2.4.1 (edom) - enumerated domain
|
55
|
+
xEnumeration = xDomain.xpath('./edom')
|
56
|
+
unless xEnumeration.empty?
|
57
|
+
hItem = Enumerated.unpack(xEnumeration, hResponseObj)
|
58
|
+
hDomain[:domainItems] << hItem
|
59
|
+
end
|
60
|
+
|
61
|
+
# entity attribute 5.1.2.4.2 (rdom) - range domain
|
62
|
+
xRange = xDomain.xpath('./rdom')
|
63
|
+
unless xRange.empty?
|
64
|
+
Range.unpack(xRange, hAttribute, hResponseObj)
|
65
|
+
end
|
66
|
+
|
67
|
+
# entity attribute 5.1.2.4.3 (codesetd) - codeset domain
|
68
|
+
|
69
|
+
# entity attribute 5.1.2.4.3.1 (codesetn) - codeset name
|
70
|
+
# -> not mapped
|
71
|
+
|
72
|
+
# entity attribute 5.1.2.4.3.2 (codesets) - codeset source
|
73
|
+
# -> not mapped
|
74
|
+
|
75
|
+
# entity attribute 5.1.2.4.4 (udom) - unrepresentable domain
|
76
|
+
# -> not mapped
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
unless hDomain[:domainItems].empty?
|
81
|
+
hAttribute[:domainId] = hDomain[:domainId]
|
82
|
+
hDictionary[:domains] << hDomain
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
# entity attribute 5.1.2.5 (begdatea) - beginning date of attribute values
|
88
|
+
# -> not mapped
|
89
|
+
|
90
|
+
# entity attribute 5.1.2.6 (enddatea) - ending date of attribute values
|
91
|
+
# -> not mapped
|
92
|
+
|
93
|
+
# entity attribute 5.1.2.7 (attrvai) - attribute value accuracy information
|
94
|
+
|
95
|
+
# entity attribute 5.1.2.7.1 (attrva) - attribute value accuracy
|
96
|
+
# -> not mapped
|
97
|
+
|
98
|
+
# entity attribute 5.1.2.7.2 (attrvae) - attribute value accuracy explanation
|
99
|
+
# -> not mapped
|
100
|
+
|
101
|
+
hAttribute
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Reader - fgdc to internal data structure
|
2
|
+
# unpack fgdc distribution digital form
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-09-08 original script
|
6
|
+
|
7
|
+
require 'nokogiri'
|
8
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
9
|
+
require_relative 'module_date'
|
10
|
+
require_relative 'module_transferInfo'
|
11
|
+
require_relative 'module_onlineOption'
|
12
|
+
require_relative 'module_offlineOption'
|
13
|
+
|
14
|
+
module ADIWG
|
15
|
+
module Mdtranslator
|
16
|
+
module Readers
|
17
|
+
module Fgdc
|
18
|
+
|
19
|
+
module DigitalForm
|
20
|
+
|
21
|
+
def self.unpack(xDigiForm, hResponseObj)
|
22
|
+
|
23
|
+
# instance classes needed in script
|
24
|
+
intMetadataClass = InternalMetadata.new
|
25
|
+
hTransfer = intMetadataClass.newTransferOption
|
26
|
+
|
27
|
+
# distribution 6.4.2.1 (digtinfo) - digital transfer information
|
28
|
+
xTranInfo = xDigiForm.xpath('./digtinfo')
|
29
|
+
unless xTranInfo.empty?
|
30
|
+
TransferInfo.unpack(xTranInfo, hTransfer, hResponseObj)
|
31
|
+
end
|
32
|
+
|
33
|
+
# distribution 6.4.2.2 (digtopt) - digital transfer option
|
34
|
+
xDigiOption = xDigiForm.xpath('./digtopt')
|
35
|
+
unless xDigiOption.empty?
|
36
|
+
|
37
|
+
# distribution 6.4.2.2.1 (onlinopt) - online option []
|
38
|
+
axOnlines = xDigiOption.xpath('./onlinopt')
|
39
|
+
unless axOnlines.empty?
|
40
|
+
axOnlines.each do |xOnline|
|
41
|
+
aOnlines = OnlineOption.unpack(xOnline, hResponseObj)
|
42
|
+
aOnlines.each do |hOnline|
|
43
|
+
hTransfer[:onlineOptions] << hOnline
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# distribution 6.4.2.2.2 (offoptn) - offline option []
|
49
|
+
axOfflines = xDigiOption.xpath('./offoptn')
|
50
|
+
unless axOfflines.empty?
|
51
|
+
axOfflines.each do |xOffline|
|
52
|
+
aOffline = OfflineOption.unpack(xOffline, hResponseObj)
|
53
|
+
aOffline.each do |hOffline|
|
54
|
+
hTransfer[:offlineOptions] << hOffline
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
return hTransfer
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -6,6 +6,9 @@
|
|
6
6
|
|
7
7
|
require 'nokogiri'
|
8
8
|
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
9
|
+
require_relative 'module_contact'
|
10
|
+
require_relative 'module_orderProcess'
|
11
|
+
require_relative 'module_timePeriod'
|
9
12
|
|
10
13
|
module ADIWG
|
11
14
|
module Mdtranslator
|
@@ -14,9 +17,87 @@ module ADIWG
|
|
14
17
|
|
15
18
|
module Distribution
|
16
19
|
|
17
|
-
def self.unpack(xDistribution, hResponseObj)
|
20
|
+
def self.unpack(xDistribution, hResourceInfo, hResponseObj)
|
18
21
|
|
22
|
+
# instance classes needed in script
|
23
|
+
intMetadataClass = InternalMetadata.new
|
24
|
+
hDistribution = intMetadataClass.newDistribution
|
25
|
+
hDistributor = intMetadataClass.newDistributor
|
19
26
|
|
27
|
+
# distribution 6.1 (distrib) - distributor {contact}
|
28
|
+
# -> distribution.distributor.contact.responsibility(distributor)
|
29
|
+
xContact = xDistribution.xpath('./distrib')
|
30
|
+
unless xContact.empty?
|
31
|
+
hResponsibility = Contact.unpack(xContact, hResponseObj)
|
32
|
+
unless hResponsibility.nil?
|
33
|
+
hResponsibility[:roleName] = 'distributor'
|
34
|
+
hDistributor[:contact] = hResponsibility
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# distribution 6.2 (resdesc) - resource description
|
39
|
+
# -> distribution.description
|
40
|
+
description = xDistribution.xpath('./resdesc').text
|
41
|
+
unless description.empty?
|
42
|
+
hDistribution[:description] = description
|
43
|
+
end
|
44
|
+
|
45
|
+
# distribution 6.3 (distliab) - distribution liability
|
46
|
+
# -> resourceInfo.constraints.legal.otherConstraint
|
47
|
+
constraint = xDistribution.xpath('./distliab').text
|
48
|
+
unless constraint.empty?
|
49
|
+
hConstraint = intMetadataClass.newConstraint
|
50
|
+
hConstraint[:type] = 'legal'
|
51
|
+
hLegal = intMetadataClass.newLegalConstraint
|
52
|
+
hLegal[:otherCons] << constraint
|
53
|
+
hConstraint[:legalConstraint] = hLegal
|
54
|
+
hResourceInfo[:constraints] << hConstraint
|
55
|
+
end
|
56
|
+
|
57
|
+
# distribution 6.4 (stdorder) - standard order process []
|
58
|
+
axOrders = xDistribution.xpath('./stdorder')
|
59
|
+
unless axOrders.empty?
|
60
|
+
axOrders.each do |xOrder|
|
61
|
+
OrderProcess.unpack(xOrder, hDistributor, hResponseObj)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# distribution 6.5 (custom) - custom order process
|
66
|
+
# -> distribution.distributor.orderProcess.orderingInstructions
|
67
|
+
custom = xDistribution.xpath('./custom').text
|
68
|
+
unless custom.empty?
|
69
|
+
hOrder = intMetadataClass.newOrderProcess
|
70
|
+
hOrder[:orderingInstructions] = custom
|
71
|
+
hDistributor[:orderProcess] << hOrder
|
72
|
+
end
|
73
|
+
|
74
|
+
# distribution 6.6 (techpreq) - technical prerequisites
|
75
|
+
# -> distribution.description {+=}
|
76
|
+
techPre = xDistribution.xpath('./techpreq').text
|
77
|
+
unless techPre.empty?
|
78
|
+
hDistribution[:description] += '\n\n Technical Prerequisites: ' + techPre
|
79
|
+
end
|
80
|
+
|
81
|
+
# distribution 6.7 (availabl) - available time period {time period}
|
82
|
+
# -> distribution.distributor.orderProcess.plannedAvailability
|
83
|
+
xTimePeriod = xDistribution.xpath('./availabl')
|
84
|
+
unless xTimePeriod.empty?
|
85
|
+
hTimePeriod = TimePeriod.unpack(xTimePeriod, hResponseObj)
|
86
|
+
unless hTimePeriod.nil?
|
87
|
+
if hTimePeriod[:startDateTime].empty?
|
88
|
+
hDateTime = hTimePeriod[:endDateTime]
|
89
|
+
else
|
90
|
+
hDateTime = hTimePeriod[:startDateTime]
|
91
|
+
end
|
92
|
+
hDistributor[:orderProcess].each do |hOrder|
|
93
|
+
hOrder[:plannedAvailability] = hDateTime
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
hDistribution[:distributor] << hDistributor
|
99
|
+
|
100
|
+
return hDistribution
|
20
101
|
|
21
102
|
end
|
22
103
|
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# Reader - fgdc to internal data structure
|
2
|
+
# unpack fgdc entity detail
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2017-09-06 original script
|
6
|
+
|
7
|
+
require 'uuidtools'
|
8
|
+
require 'nokogiri'
|
9
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
10
|
+
require_relative 'module_attribute'
|
11
|
+
|
12
|
+
module ADIWG
|
13
|
+
module Mdtranslator
|
14
|
+
module Readers
|
15
|
+
module Fgdc
|
16
|
+
|
17
|
+
module Entity
|
18
|
+
|
19
|
+
def self.unpack(xDetail, hDictionary, hResponseObj)
|
20
|
+
|
21
|
+
# instance classes needed in script
|
22
|
+
intMetadataClass = InternalMetadata.new
|
23
|
+
|
24
|
+
# entity attribute 5.1.1 (enttype) - definition and description set
|
25
|
+
xEntity = xDetail.xpath('./enttype')
|
26
|
+
unless xEntity.empty?
|
27
|
+
|
28
|
+
hEntity = intMetadataClass.newEntity
|
29
|
+
hEntity[:entityId] = UUIDTools::UUID.random_create.to_s
|
30
|
+
|
31
|
+
# entity attribute 5.1.1.1 (enttypl) - entity name
|
32
|
+
# -> dataDictionary.entities.entityCode
|
33
|
+
code = xEntity.xpath('./enttypl').text
|
34
|
+
unless code.empty?
|
35
|
+
hEntity[:entityCode] = code
|
36
|
+
end
|
37
|
+
|
38
|
+
# entity attribute 5.1.1.2 (enttypd) - entity definition
|
39
|
+
# -> dataDictionary.entities.entityDefinition
|
40
|
+
definition = xEntity.xpath('./enttypd').text
|
41
|
+
unless definition.empty?
|
42
|
+
hEntity[:entityDefinition] = definition
|
43
|
+
end
|
44
|
+
|
45
|
+
# entity attribute 5.1.1.3 (enttypds) - entity definition source
|
46
|
+
# -> not mapped
|
47
|
+
|
48
|
+
# entity attribute 5.1.2 (attr) - characteristics of an attribute
|
49
|
+
axAttribute = xDetail.xpath('./attr')
|
50
|
+
unless axAttribute.empty?
|
51
|
+
axAttribute.each do |xAttribute|
|
52
|
+
hAttribute = Attribute.unpack(xAttribute, hDictionary, hResponseObj)
|
53
|
+
unless hAttribute.nil?
|
54
|
+
hEntity[:attributes] << hAttribute
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
return hEntity
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
return nil
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -6,6 +6,8 @@
|
|
6
6
|
|
7
7
|
require 'nokogiri'
|
8
8
|
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
9
|
+
require_relative 'module_entity'
|
10
|
+
require_relative 'module_entityOverview'
|
9
11
|
|
10
12
|
module ADIWG
|
11
13
|
module Mdtranslator
|
@@ -16,7 +18,36 @@ module ADIWG
|
|
16
18
|
|
17
19
|
def self.unpack(xEntity, hResponseObj)
|
18
20
|
|
19
|
-
|
21
|
+
# instance classes needed in script
|
22
|
+
intMetadataClass = InternalMetadata.new
|
23
|
+
hDictionary = intMetadataClass.newDataDictionary
|
24
|
+
hCitation = intMetadataClass.newCitation
|
25
|
+
hCitation[:title] = 'FGDC EntityAttribute Section 5'
|
26
|
+
hDictionary[:citation] = hCitation
|
27
|
+
|
28
|
+
# entity attribute 5.1 (detailed) - entity attribute detailed description
|
29
|
+
axDetail = xEntity.xpath('./detailed')
|
30
|
+
unless axDetail.empty?
|
31
|
+
axDetail.each do |xDetail|
|
32
|
+
hEntity = Entity.unpack(xDetail, hDictionary, hResponseObj)
|
33
|
+
unless hEntity.nil?
|
34
|
+
hDictionary[:entities] << hEntity
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# entity attribute 5.2 (overview) - entity attribute summary description
|
40
|
+
axOverview = xEntity.xpath('./overview')
|
41
|
+
unless axOverview.empty?
|
42
|
+
axOverview.each do |xOverview|
|
43
|
+
hEntity = EntityOverview.unpack(xOverview, hResponseObj)
|
44
|
+
unless hEntity.nil?
|
45
|
+
hDictionary[:entities] << hEntity
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
return hDictionary
|
20
51
|
|
21
52
|
end
|
22
53
|
|