19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/module_source.rb', line 19
def self.unpack(xSource, hResponseObj)
intMetadataClass = InternalMetadata.new
hSource = intMetadataClass.newDataSource
xCitation = xSource.xpath('./srccite')
unless xCitation.empty?
hCitation = Citation.unpack(xCitation, hResponseObj)
hSource[:sourceCitation] = hCitation
end
if xCitation.empty?
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: lineage source citation is missing'
end
scale = xSource.xpath('./srcscale').text
unless scale.empty?
hResolution = intMetadataClass.newSpatialResolution
hResolution[:scaleFactor] = scale.to_i
hSource[:spatialResolution] = hResolution
end
type = xSource.xpath('./typesrc').text
unless type.empty?
hSource[:description] = type
end
if type.empty?
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: lineage source media type is missing'
end
xTimePeriod = xSource.xpath('./srctime')
unless xTimePeriod.empty?
hTimePeriod = TimePeriod.unpack(xTimePeriod, hResponseObj)
unless hTimePeriod.nil?
hScope = intMetadataClass.newScope
hExtent = intMetadataClass.newExtent
hTempExtent = intMetadataClass.newTemporalExtent
hTempExtent[:timePeriod] = hTimePeriod
hExtent[:temporalExtents] << hTempExtent
hScope[:scopeCode] = 'dataset'
hScope[:extents] << hExtent
hSource[:scope] = hScope
end
end
if xTimePeriod.empty?
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: lineage source time period is missing'
end
sourceAbb = xSource.xpath('./srccitea').text
unless sourceAbb.empty?
hSource[:sourceId] = sourceAbb
end
if sourceAbb.empty?
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: lineage source citation abbreviation is missing'
end
contribution = xSource.xpath('./srccontr').text
unless contribution.empty?
hSource[:description] = contribution
end
if contribution.empty?
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: lineage source contribution is missing'
end
return hSource
end
|