adiwg-mdtranslator 0.9.0 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -6
  3. data/adiwg-mdtranslator.gemspec +2 -2
  4. data/bin/mdtranslator +10 -10
  5. data/lib/adiwg/mdtranslator.rb +54 -12
  6. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +87 -7
  7. data/lib/adiwg/mdtranslator/readers/{adiwgJson/adiwgJson_reader.rb → mdJson/mdJson_reader.rb} +13 -4
  8. data/lib/adiwg/mdtranslator/readers/{adiwgJson/adiwgJson_validator.rb → mdJson/mdJson_validator.rb} +18 -10
  9. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_additionalDocumentation.rb +2 -2
  10. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_address.rb +1 -1
  11. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_associatedResource.rb +3 -3
  12. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_boundingBox.rb +1 -1
  13. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_browseGraphic.rb +1 -1
  14. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_citation.rb +5 -5
  15. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_contacts.rb +7 -7
  16. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_coordinates.rb +1 -1
  17. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_dataDictionary.rb +53 -0
  18. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_dataQuality.rb +2 -2
  19. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_dateTime.rb +1 -1
  20. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_descriptiveKeyword.rb +2 -2
  21. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_dictionaryInfo.rb +52 -0
  22. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_distributionInfo.rb +4 -4
  23. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_domain.rb +62 -0
  24. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_domainItem.rb +42 -0
  25. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entity.rb +92 -0
  26. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entityAttribute.rb +91 -0
  27. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entityForeignKey.rb +43 -0
  28. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entityIndex.rb +42 -0
  29. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_extent.rb +4 -4
  30. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_geoCoordSystem.rb +1 -1
  31. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_geoProperties.rb +4 -4
  32. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_geographicElement.rb +12 -12
  33. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_legalConstraint.rb +1 -1
  34. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_lineString.rb +2 -2
  35. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_lineage.rb +3 -3
  36. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_metadata.rb +6 -6
  37. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_metadataExtension.rb +2 -2
  38. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_metadataInfo.rb +8 -8
  39. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_onlineResource.rb +1 -1
  40. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_phone.rb +1 -1
  41. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_point.rb +2 -2
  42. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_polygon.rb +2 -2
  43. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_processStep.rb +4 -4
  44. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_resolution.rb +1 -1
  45. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_resourceFormat.rb +1 -1
  46. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_resourceIdentifier.rb +2 -2
  47. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_resourceInfo.rb +16 -16
  48. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_resourceMaintenance.rb +2 -2
  49. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_resourceSpecificUsage.rb +2 -2
  50. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_responsibleParty.rb +2 -2
  51. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_securityConstraint.rb +1 -1
  52. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_source.rb +3 -3
  53. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_spatialReference.rb +1 -1
  54. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_taxonClass.rb +1 -1
  55. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_taxonomy.rb +5 -5
  56. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_temporalElement.rb +4 -4
  57. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_timeInstant.rb +3 -3
  58. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_timePeriod.rb +4 -4
  59. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_verticalElement.rb +1 -1
  60. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_voucher.rb +2 -2
  61. data/lib/adiwg/mdtranslator/readers/mdJson/readme.md +19 -0
  62. data/lib/adiwg/mdtranslator/version.rb +5 -1
  63. data/lib/adiwg/mdtranslator/writers/iso/classes/class_FCfeatureCatalogue.rb +171 -0
  64. data/lib/adiwg/mdtranslator/writers/{iso19115_2/classes/class_metadata.rb → iso/classes/class_MImetadata.rb} +3 -3
  65. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_address.rb +0 -0
  66. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_aggregateInformation.rb +0 -0
  67. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_boundingPolygon.rb +0 -0
  68. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_browseGraphic.rb +0 -0
  69. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_citation.rb +3 -3
  70. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_contact.rb +1 -1
  71. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_dataIdentification.rb +0 -0
  72. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_dataQuality.rb +0 -0
  73. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_date.rb +0 -0
  74. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_digitalTransferOptions.rb +0 -0
  75. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_distribution.rb +0 -0
  76. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_distributor.rb +0 -0
  77. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_extent.rb +0 -0
  78. data/lib/adiwg/mdtranslator/writers/iso/classes/class_featureAttribute.rb +114 -0
  79. data/lib/adiwg/mdtranslator/writers/iso/classes/class_featureConstraint.rb +55 -0
  80. data/lib/adiwg/mdtranslator/writers/iso/classes/class_featureType.rb +120 -0
  81. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_format.rb +0 -0
  82. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_genericMetaData.rb +0 -0
  83. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_geographicBoundingBox.rb +0 -0
  84. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_geographicDescription.rb +0 -0
  85. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_geographicElement.rb +0 -0
  86. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_identifier.rb +0 -0
  87. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_keyword.rb +0 -0
  88. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_legalConstraints.rb +0 -0
  89. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_lineString.rb +1 -1
  90. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_lineage.rb +0 -0
  91. data/lib/adiwg/mdtranslator/writers/iso/classes/class_listedValue.rb +68 -0
  92. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_maintenanceInformation.rb +0 -0
  93. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_medium.rb +0 -0
  94. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_metadataExtension.rb +0 -0
  95. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_multiGeometry.rb +3 -3
  96. data/lib/adiwg/mdtranslator/writers/iso/classes/class_multiplicity.rb +44 -0
  97. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_onlineResource.rb +0 -0
  98. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_point.rb +1 -1
  99. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_polygon.rb +2 -2
  100. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_processStep.rb +1 -1
  101. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_referenceIdentifier.rb +0 -0
  102. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_referenceSystem.rb +0 -0
  103. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_resolution.rb +0 -0
  104. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_responsibleParty.rb +1 -1
  105. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_securityConstraints.rb +0 -0
  106. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_source.rb +0 -0
  107. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_standardOrderProcess.rb +0 -0
  108. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_taxonClassification.rb +0 -0
  109. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_taxonSystem.rb +0 -0
  110. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_telephone.rb +0 -0
  111. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_temporalExtent.rb +0 -0
  112. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_timeInstant.rb +1 -1
  113. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_timePeriod.rb +1 -1
  114. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_usage.rb +0 -0
  115. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_useConstraints.rb +0 -0
  116. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_verticalExtent.rb +0 -0
  117. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_vouchers.rb +0 -0
  118. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_associationType.rb +0 -0
  119. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_characterSet.rb +0 -0
  120. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_classification.rb +0 -0
  121. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_datatype.rb +0 -0
  122. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_dateType.rb +0 -0
  123. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_initiativeType.rb +0 -0
  124. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_keywordType.rb +0 -0
  125. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_maintenanceFrequency.rb +0 -0
  126. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_mediumFormat.rb +0 -0
  127. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_mediumName.rb +0 -0
  128. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_obligation.rb +0 -0
  129. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_onlineFunction.rb +0 -0
  130. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_presentationForm.rb +0 -0
  131. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_progress.rb +0 -0
  132. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_restriction.rb +0 -0
  133. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_role.rb +0 -0
  134. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_scope.rb +0 -0
  135. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_spatialRepresentationType.rb +0 -0
  136. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_topicCategory.rb +0 -0
  137. data/lib/adiwg/mdtranslator/writers/iso/units/class_baseUnit.rb +27 -0
  138. data/lib/adiwg/mdtranslator/writers/iso/units/class_conventionalUnit.rb +53 -0
  139. data/lib/adiwg/mdtranslator/writers/iso/units/class_definitionUnit.rb +24 -0
  140. data/lib/adiwg/mdtranslator/writers/iso/units/class_derivedUnit.rb +31 -0
  141. data/lib/adiwg/mdtranslator/writers/iso/units/class_unitsOfMeasure.rb +224 -0
  142. data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +28 -0
  143. data/lib/adiwg/mdtranslator/writers/iso19110/readme.md +13 -0
  144. data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb +1 -1
  145. data/lib/adiwg/mdtranslator/writers/iso19115_2/readme.md +6 -9
  146. data/test/tc_translation.rb +35 -18
  147. metadata +166 -146
  148. data/lib/adiwg/mdtranslator/readers/adiwgJson/readme.md +0 -19
  149. data/mdtranslator.rb +0 -187
@@ -42,7 +42,7 @@ class MI_Metadata
42
42
 
43
43
  def writeXML(internalObj)
44
44
 
45
- # # classes used in MD_Metadata
45
+ # classes used in MD_Metadata
46
46
  charCode = MD_CharacterSetCode.new(@xml)
47
47
  scopeCode = MD_ScopeCode.new(@xml)
48
48
  rPartyClass = CI_ResponsibleParty.new(@xml)
@@ -120,7 +120,7 @@ class MI_Metadata
120
120
  hParent = hMetaInfo[:parentMetadata]
121
121
  if !hParent.empty?
122
122
  s = hParent[:citTitle]
123
- aResIds = hParent[:citResourceIDs]
123
+ aResIds = hParent[:citResourceIds]
124
124
  if aResIds.length > 0
125
125
  s += ' ids: | '
126
126
  aResIds.each do |resource|
@@ -181,7 +181,7 @@ class MI_Metadata
181
181
  unless hDate.empty?
182
182
  mDateTime = hDate[:dateTime]
183
183
  mDateRes = hDate[:dateResolution]
184
- if mDateTime.nil?
184
+ unless mDateTime.nil?
185
185
  mDate = AdiwgDateTimeFun.stringDateFromDateTime(mDateTime, mDateRes)
186
186
  end
187
187
  end
@@ -67,7 +67,7 @@ class CI_Citation
67
67
  # citation - resource identifiers - MD_Identifier
68
68
  # do not process ISBN and ISSN as MD_identifier(s)
69
69
  # ... these are processed separately in ISO 19115-2
70
- aResIDs = hCitation[:citResourceIDs]
70
+ aResIDs = hCitation[:citResourceIds]
71
71
  if !aResIDs.empty?
72
72
  aResIDs.each do |hResID|
73
73
  if !hResID[:identifierType].nil?
@@ -108,7 +108,7 @@ class CI_Citation
108
108
 
109
109
  # citation - ISBN
110
110
  needTag = true
111
- aResIDs = hCitation[:citResourceIDs]
111
+ aResIDs = hCitation[:citResourceIds]
112
112
  if !aResIDs.empty?
113
113
  aResIDs.each do |hResID|
114
114
  if !hResID[:identifierType].nil?
@@ -130,7 +130,7 @@ class CI_Citation
130
130
 
131
131
  # citation - ISSN
132
132
  needTag = true
133
- aResIDs = hCitation[:citResourceIDs]
133
+ aResIDs = hCitation[:citResourceIds]
134
134
  if !aResIDs.empty?
135
135
  aResIDs.each do |hResID|
136
136
  if !hResID[:identifierType].nil?
@@ -73,7 +73,7 @@ class CI_Contact
73
73
 
74
74
  # find contact in contact array and return the hash
75
75
  $intContactList.each do |hContact|
76
- if hContact[:contactID] == contactID
76
+ if hContact[:contactId] == contactID
77
77
  return hContact
78
78
  end
79
79
  end
@@ -0,0 +1,114 @@
1
+ # ISO <<Class>> FC_FeatureAttribute
2
+ # writer output in XML
3
+ # create create attributes for entities
4
+
5
+ # History:
6
+ # Stan Smith 2014-12-02 original script
7
+
8
+ require 'class_multiplicity'
9
+ require 'class_listedValue'
10
+ require 'class_unitsOfMeasure'
11
+
12
+ class FC_FeatureAttribute
13
+
14
+ def initialize(xml)
15
+ @xml = xml
16
+ end
17
+
18
+ def writeXML(hAttribute)
19
+
20
+ # classes used in FC_FeatureAttribute
21
+ multiClass = Multiplicity.new(@xml)
22
+ listClass = FC_ListedValue.new(@xml)
23
+ uomClass = UnitsOfMeasure.new(@xml)
24
+
25
+ @xml.tag!('gfc:FC_FeatureAttribute') do
26
+
27
+ # feature attribute - member name - required
28
+ # used to define attribute common name
29
+ s = hAttribute[:attributeName]
30
+ if !s.nil?
31
+ @xml.tag!('gfc:memberName') do
32
+ @xml.tag!('gco:LocalName', s)
33
+ end
34
+ else
35
+ @xml.tag!('gfc:memberName', {'gco:nilReason' => 'missing'})
36
+ end
37
+
38
+ # feature attribute - definition
39
+ s = hAttribute[:attributeDefinition]
40
+ if !s.nil?
41
+ @xml.tag!('gfc:definition') do
42
+ @xml.tag!('gco:CharacterString', s)
43
+ end
44
+ elsif $showAllTags
45
+ @xml.tag!('gfc:definition')
46
+ end
47
+
48
+ # feature attribute - cardinality - required
49
+ b = hAttribute[:allowNull]
50
+ if !b.nil?
51
+ @xml.tag!('gfc:cardinality') do
52
+ multiClass.writeXML(b)
53
+ end
54
+ else
55
+ @xml.tag!('gfc:cardinality', {'gco:nilReason' => 'missing'})
56
+ end
57
+
58
+ # feature attribute - code
59
+ s = hAttribute[:attributeCode]
60
+ if !s.nil?
61
+ @xml.tag!('gfc:code') do
62
+ @xml.tag!('gco:CharacterString', s)
63
+ end
64
+ elsif $showAllTags
65
+ @xml.tag!('gfc:code')
66
+ end
67
+
68
+ # feature attribute - value measurement unit (units of measure)
69
+ s = hAttribute[:unitOfMeasure]
70
+ if !s.nil?
71
+ @xml.tag!('gfc:valueMeasurementUnit') do
72
+ uomClass.writeUnits(s)
73
+ end
74
+ end
75
+
76
+ # feature attribute - value type (datatype)
77
+ s = hAttribute[:dataType]
78
+ if !s.nil?
79
+ @xml.tag!('gfc:valueType') do
80
+ @xml.tag!('gco:TypeName') do
81
+ @xml.tag!('gco:aName') do
82
+ @xml.tag!('gco:CharacterString', s)
83
+ end
84
+ end
85
+ end
86
+ elsif $showAllTags
87
+ @xml.tag!('gfc:valueType')
88
+ end
89
+
90
+ # feature attribute - listed value (domain)
91
+ domainID = hAttribute[:domainId]
92
+ if !domainID.nil?
93
+ # find domain in domain array
94
+ hDomain = listClass.getDomain(domainID)
95
+ unless hDomain.empty?
96
+
97
+ # only the domain items are represented in iso
98
+ aItems = hDomain[:domainItems]
99
+ aItems.each do |hItem|
100
+ @xml.tag!('gfc:listedValue') do
101
+ listClass.writeXML(hItem)
102
+ end
103
+ end
104
+
105
+ end
106
+ elsif $showAllTags
107
+ @xml.tag!('gfc:listedValue')
108
+ end
109
+
110
+
111
+ end
112
+ end
113
+
114
+ end
@@ -0,0 +1,55 @@
1
+ # ISO <<Class>> FC_Constraint
2
+ # writer output in XML
3
+ # create constraints for primary keys and indexes
4
+ # ... FC_Constraint only has one attribute, description
5
+ # ... all constraints need to be expressed as character strings
6
+
7
+ # History:
8
+ # Stan Smith 2014-12-02 original script
9
+
10
+ class FC_Constraint
11
+
12
+ def initialize(xml)
13
+ @xml = xml
14
+ end
15
+
16
+ def writeXML(conType, hConstraint)
17
+
18
+ @xml.tag!('gfc:FC_Constraint') do
19
+ @xml.tag!('gfc:description') do
20
+
21
+ # find type of constraint (primary key or index)
22
+ case conType
23
+
24
+ # primary keys
25
+ when 'pk'
26
+ s = 'primary key: '
27
+ s += hConstraint.to_s
28
+
29
+ # indexes
30
+ when 'index'
31
+ if hConstraint[:duplicate]
32
+ indexType = 'duplicate'
33
+ else
34
+ indexType = 'unique'
35
+ end
36
+ s = indexType + ' index ' + hConstraint[:indexCode]
37
+ s += ' on ' + hConstraint[:attributeNames].to_s
38
+
39
+ # foreign keys
40
+ when 'fk'
41
+ s = 'foreign key '
42
+ s += hConstraint[:fkLocalAttributes].to_s
43
+ s += ' references ' + hConstraint[:fkReferencedEntity] + '.'
44
+ s += hConstraint[:fkReferencedAttributes].to_s
45
+
46
+ end
47
+
48
+ @xml.tag!('gco:CharacterString',s)
49
+
50
+ end
51
+ end
52
+
53
+ end
54
+
55
+ end
@@ -0,0 +1,120 @@
1
+ # ISO <<Class>> FC_FeatureType
2
+ # writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2014-12-02 original script
6
+
7
+ require 'class_featureConstraint'
8
+ require 'class_featureAttribute'
9
+
10
+ class FC_FeatureType
11
+
12
+ def initialize(xml)
13
+ @xml = xml
14
+ end
15
+
16
+ def writeXML(hEntity)
17
+
18
+ # classes used in FC_FeatureType
19
+ fConClass = FC_Constraint.new(@xml)
20
+ fAttClass = FC_FeatureAttribute.new(@xml)
21
+
22
+ # create and identity for the entity
23
+ $idCount = $idCount.succ
24
+ entityID = 'entity' + $idCount
25
+ @xml.tag!('gfc:FC_FeatureType', {'id' => entityID}) do
26
+
27
+ # feature type - type name - required
28
+ # use entity common name
29
+ s = hEntity[:entityName]
30
+ if !s.nil?
31
+ @xml.tag!('gfc:typeName') do
32
+ @xml.tag!('gco:LocalName', s)
33
+ end
34
+ else
35
+ @xml.tag!('gfc:typeName', {'gco:nilReason' => 'missing'})
36
+ end
37
+
38
+ # feature type - definition
39
+ s = hEntity[:entityDefinition]
40
+ if !s.nil?
41
+ @xml.tag!('gfc:definition') do
42
+ @xml.tag!('gco:CharacterString', s)
43
+ end
44
+ elsif $showAllTags
45
+ @xml.tag!('gfc:definition')
46
+ end
47
+
48
+ # feature type - code
49
+ # use entity code name
50
+ s = hEntity[:entityCode]
51
+ if !s.nil?
52
+ @xml.tag!('gfc:code') do
53
+ @xml.tag!('gco:CharacterString', s)
54
+ end
55
+ elsif $showAllTags
56
+ @xml.tag!('gfc:code')
57
+ end
58
+
59
+ # feature type - isAbstract - required
60
+ # defaulted to false, value not available in internal object
61
+ @xml.tag!('gfc:isAbstract') do
62
+ @xml.tag!('gco:Boolean','false')
63
+ end
64
+
65
+ # feature type - feature catalogue - required
66
+ # 'role that links this feature type to the feature catalogue that contains it'
67
+ # confusing, allow definition of another feature catalogue here
68
+ # just set to nilReason = 'inapplicable' (recommended by NOAA)
69
+ @xml.tag!('gfc:featureCatalogue',{'gco:nilReason' => 'inapplicable'})
70
+
71
+ # feature type - constrained by
72
+ # use to define primary key, foreign keys, and indexes
73
+ # pass primary key
74
+ aPKs = hEntity[:primaryKey]
75
+ if !aPKs.empty?
76
+ @xml.tag!('gfc:constrainedBy') do
77
+ fConClass.writeXML('pk',aPKs)
78
+ end
79
+ elsif $showAllTags
80
+ @xml.tag!('gfc:constrainedBy')
81
+ end
82
+
83
+ # pass indexes
84
+ aIndexes = hEntity[:indexes]
85
+ if !aIndexes.empty?
86
+ aIndexes.each do |hIndex|
87
+ @xml.tag!('gfc:constrainedBy') do
88
+ fConClass.writeXML('index',hIndex)
89
+ end
90
+ end
91
+ end
92
+
93
+ # pass foreign keys
94
+ aFKs = hEntity[:foreignKeys]
95
+ if !aFKs.empty?
96
+ aFKs.each do |hFK|
97
+ @xml.tag!('gfc:constrainedBy') do
98
+ fConClass.writeXML('fk',hFK)
99
+ end
100
+ end
101
+ end
102
+
103
+ # feature type - character of characteristics
104
+ # used to define entity attributes
105
+ aAttributes = hEntity[:attributes]
106
+ if !aAttributes.empty?
107
+ aAttributes.each do |hAttribute|
108
+ @xml.tag!('gfc:carrierOfCharacteristics') do
109
+ fAttClass.writeXML(hAttribute)
110
+ end
111
+ end
112
+ elsif $showAllTags
113
+ @xml.tag!('gfc:carrierOfCharacteristics')
114
+ end
115
+
116
+ end
117
+
118
+ end
119
+
120
+ end
@@ -62,7 +62,7 @@ class LineString
62
62
  # convert coordinate string from geoJSON to gml
63
63
  s = hGeoElement[:elementGeometry][:geometry]
64
64
  if !s.nil?
65
- s = Adiwg_Coordinates.unpack(s)
65
+ s = Md_Coordinates.unpack(s)
66
66
  @xml.tag!('gml:coordinates',s)
67
67
  else
68
68
  @xml.tag!('gml:coordinates')
@@ -0,0 +1,68 @@
1
+ # ISO <<Class>> FC_ListedValue
2
+ # writer output in XML
3
+ # to define the domain of an attribute
4
+
5
+ # History:
6
+ # Stan Smith 2014-12-02 original script
7
+
8
+ class FC_ListedValue
9
+
10
+ def initialize(xml)
11
+ @xml = xml
12
+ end
13
+
14
+ def writeXML(hItem)
15
+
16
+ @xml.tag!('gfc:FC_ListedValue') do
17
+
18
+ # listed value - label - required
19
+ # use domain item name
20
+ s = hItem[:itemName]
21
+ if !s.nil?
22
+ @xml.tag!('gfc:label') do
23
+ @xml.tag!('gco:CharacterString', s)
24
+ end
25
+ else
26
+ @xml.tag!('gfc:label', {'gco:nilReason' => 'missing'})
27
+ end
28
+
29
+ # listed value - code
30
+ # use domain item value
31
+ s = hItem[:itemValue]
32
+ if !s.nil?
33
+ @xml.tag!('gfc:code') do
34
+ @xml.tag!('gco:CharacterString', s)
35
+ end
36
+ elsif $showAllTags
37
+ @xml.tag!('gfc:code')
38
+ end
39
+
40
+ # listed value - code
41
+ # use domain item value
42
+ s = hItem[:itemDefinition]
43
+ if !s.nil?
44
+ @xml.tag!('gfc:definition') do
45
+ @xml.tag!('gco:CharacterString', s)
46
+ end
47
+ elsif $showAllTags
48
+ @xml.tag!('gfc:definition')
49
+ end
50
+
51
+ end
52
+
53
+ end
54
+
55
+ def getDomain(domainID)
56
+
57
+ # find domain in domain array and return the hash
58
+ $domainList.each do |hDomain|
59
+ if hDomain[:domainId] == domainID
60
+ return hDomain
61
+ end
62
+ end
63
+
64
+ return {}
65
+
66
+ end
67
+
68
+ end