From 894515eb3d6472e06b84d2ec9d75119649bd1110 Mon Sep 17 00:00:00 2001 From: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com> Date: Thu, 1 Feb 2024 14:20:53 -0700 Subject: [PATCH 01/64] change divs to headers (#337) * change divs to headers * fix key within qualityMeasure. change to header tags --- .../html/sections/html_dataQualityReport.rb | 4 +-- .../sections/html_additionalDocumentation.rb | 2 +- .../simple_html/sections/html_algorithm.rb | 2 +- .../simple_html/sections/html_allocation.rb | 2 +- .../sections/html_associatedResource.rb | 4 +-- .../simple_html/sections/html_attribute.rb | 4 +-- .../sections/html_attributeGroup.rb | 2 +- .../simple_html/sections/html_citation.rb | 10 +++--- .../simple_html/sections/html_classedData.rb | 2 +- .../simple_html/sections/html_constraint.rb | 10 +++--- .../simple_html/sections/html_contact.rb | 12 +++---- .../simple_html/sections/html_coverageInfo.rb | 6 ++-- .../sections/html_dataDictionary.rb | 10 +++--- .../simple_html/sections/html_dataQuality.rb | 10 +++--- .../sections/html_dataQualityReport.rb | 34 +++++++++---------- .../simple_html/sections/html_distribution.rb | 2 +- .../simple_html/sections/html_distributor.rb | 6 ++-- .../simple_html/sections/html_domain.rb | 6 ++-- .../simple_html/sections/html_domainItem.rb | 2 +- .../simple_html/sections/html_entity.rb | 10 +++--- .../sections/html_entityAttribute.rb | 6 ++-- .../simple_html/sections/html_extent.rb | 6 ++-- .../simple_html/sections/html_feature.rb | 10 +++--- .../sections/html_featureCollection.rb | 8 ++--- .../sections/html_featureProperties.rb | 2 +- .../simple_html/sections/html_format.rb | 2 +- .../simple_html/sections/html_funding.rb | 2 +- .../sections/html_geodeticParameters.rb | 4 +-- .../sections/html_geographicElement.rb | 8 ++--- .../sections/html_geographicExtent.rb | 10 +++--- .../simple_html/sections/html_geologicAge.rb | 2 +- .../sections/html_geometryCollection.rb | 8 ++--- .../sections/html_geometryObject.rb | 4 +-- .../html_georectifiedRepresentation.rb | 4 +-- .../html_georeferenceableRepresentation.rb | 6 ++-- .../simple_html/sections/html_graphic.rb | 4 +-- .../sections/html_gridRepresentation.rb | 4 +-- .../simple_html/sections/html_identifier.rb | 2 +- .../simple_html/sections/html_imageInfo.rb | 2 +- .../simple_html/sections/html_keyword.rb | 4 +-- .../simple_html/sections/html_metadataInfo.rb | 18 +++++----- .../sections/html_metadataRepository.rb | 2 +- .../simple_html/sections/html_processStep.rb | 2 +- .../simple_html/sections/html_processing.rb | 6 ++-- .../simple_html/sections/html_resourceInfo.rb | 34 +++++++++---------- .../sections/html_responsibility.rb | 2 +- .../simple_html/sections/html_scope.rb | 4 +-- .../simple_html/sections/html_source.rb | 4 +-- .../simple_html/sections/html_taxonomy.rb | 2 +- 49 files changed, 156 insertions(+), 156 deletions(-) diff --git a/lib/adiwg/mdtranslator/writers/html/sections/html_dataQualityReport.rb b/lib/adiwg/mdtranslator/writers/html/sections/html_dataQualityReport.rb index 7f651ca59..33087d830 100644 --- a/lib/adiwg/mdtranslator/writers/html/sections/html_dataQualityReport.rb +++ b/lib/adiwg/mdtranslator/writers/html/sections/html_dataQualityReport.rb @@ -61,9 +61,9 @@ def writeQualityMeasure(qualityMeasure) end # Names - unless qualityMeasure[:name].empty? + unless qualityMeasure[:nameOfMeasure].empty? @html.em('Names: ') - @html.text!(qualityMeasure[:name].join('; ')) + @html.text!(qualityMeasure[:nameOfMeasure].join('; ')) @html.br end end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_additionalDocumentation.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_additionalDocumentation.rb index eb86a2586..d7a9505bc 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_additionalDocumentation.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_additionalDocumentation.rb @@ -33,7 +33,7 @@ def writeHtml(hAddDoc) # additional documentation - citation [] {citation} hAddDoc[:citation].each do |hCitation| @html.div do - @html.div(hCitation[:title], {'class' => 'h5'}) + @html.h5(hCitation[:title], {'class' => 'h5'}) @html.div(:class => 'block') do citationClass.writeHtml(hCitation) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_algorithm.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_algorithm.rb index b2782f562..aa68d4965 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_algorithm.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_algorithm.rb @@ -32,7 +32,7 @@ def writeHtml(hAlgorithm) # algorithm - citation {citation} unless hAlgorithm[:citation].empty? @html.div do - @html.div('Algorithm citation', {'class' => 'h5'}) + @html.h5('Algorithm citation', {'class' => 'h5'}) @html.div(:class => 'block') do citationClass.writeHtml(hAlgorithm[:citation]) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_allocation.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_allocation.rb index 296503c8b..f9bfd31e9 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_allocation.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_allocation.rb @@ -80,7 +80,7 @@ def writeHtml(hAllocation) # allocation - responsible parties [] {responsibleParty} hAllocation[:responsibleParties].each do |hResponsibility| @html.div do - @html.div(hResponsibility[:roleName], 'class' => 'h5') + @html.h5(hResponsibility[:roleName], 'class' => 'h5') @html.div(:class => 'block') do responsibilityClass.writeHtml(hResponsibility) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_associatedResource.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_associatedResource.rb index 83af5e693..353b8f2fb 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_associatedResource.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_associatedResource.rb @@ -47,7 +47,7 @@ def writeHtml(hResource) # associated resource - resource citation {citation} unless hResource[:resourceCitation].empty? @html.div do - @html.div('Resource citation', {'class' => 'h5'}) + @html.h5('Resource citation', {'class' => 'h5'}) @html.div(:class => 'block') do citationClass.writeHtml(hResource[:resourceCitation]) end @@ -57,7 +57,7 @@ def writeHtml(hResource) # associated resource - metadata citation unless hResource[:metadataCitation].empty? @html.div do - @html.div('Metadata citation', {'class' => 'h5'}) + @html.h5('Metadata citation', {'class' => 'h5'}) @html.div(:class => 'block') do citationClass.writeHtml(hResource[:metadataCitation]) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_attribute.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_attribute.rb index adf123c00..071f39100 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_attribute.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_attribute.rb @@ -48,7 +48,7 @@ def writeHtml(hAttribute) # attribute - attribute identifiers [] {identifier} hAttribute[:attributeIdentifiers].each do |hIdentifier| @html.div do - @html.div('Identifier', 'class' => 'h5') + @html.h5('Identifier', 'class' => 'h5') @html.div(:class => 'block') do identifierClass.writeHtml(hIdentifier) end @@ -121,7 +121,7 @@ def writeHtml(hAttribute) # attribute - range element description hAttribute[:rangeElementDescription].each do |red| @html.div do - @html.div('Range Element Description', 'class' => 'h5') + @html.h5('Range Element Description', 'class' => 'h5') @html.div(:class => 'block') do rangeElementDescriptionClass.writeHtml(red) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_attributeGroup.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_attributeGroup.rb index 5b29e305f..bd8aeae16 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_attributeGroup.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_attributeGroup.rb @@ -35,7 +35,7 @@ def writeHtml(hGroup) hGroup[:attributes].each do |hAttribute| @html.div do counter += 1 - @html.div('Attribute '+counter.to_s, {'class' => 'h5'}) + @html.h5('Attribute '+counter.to_s, {'class' => 'h5'}) @html.div(:class => 'block') do attributeClass.writeHtml(hAttribute) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_citation.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_citation.rb index 746fab2d0..d7d45336c 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_citation.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_citation.rb @@ -68,7 +68,7 @@ def writeHtml(hCitation) # citation - responsibilities [] {responsibility} hCitation[:responsibleParties].each do |hResponsibility| @html.div do - @html.div(hResponsibility[:roleName], 'class' => 'h5') + @html.h5(hResponsibility[:roleName], 'class' => 'h5') @html.div(:class => 'block') do responsibilityClass.writeHtml(hResponsibility) end @@ -78,7 +78,7 @@ def writeHtml(hCitation) # citation - identifier [] hCitation[:identifiers].each do |hIdentifier| @html.div do - @html.div('Identifier', 'class' => 'h5') + @html.h5('Identifier', 'class' => 'h5') @html.div(:class => 'block') do identifierClass.writeHtml(hIdentifier) end @@ -88,7 +88,7 @@ def writeHtml(hCitation) # citation - series unless hCitation[:series].empty? @html.div do - @html.div('Publication Series', {'class' => 'h5'}) + @html.h5('Publication Series', {'class' => 'h5'}) @html.div(:class => 'block') do hSeries = hCitation[:series] @@ -121,7 +121,7 @@ def writeHtml(hCitation) # citation - online resource [] hCitation[:onlineResources].each do |hOnline| @html.div do - @html.div('Online Resource', {'class' => 'h5'}) + @html.h5('Online Resource', {'class' => 'h5'}) @html.div(:class => 'block') do onlineClass.writeHtml(hOnline) end @@ -131,7 +131,7 @@ def writeHtml(hCitation) # citation - browse graphic [] hCitation[:browseGraphics].each do |hGraphic| @html.div do - @html.div('Graphic Overview', {'class' => 'h5'}) + @html.h5('Graphic Overview', {'class' => 'h5'}) @html.div(:class => 'block') do graphicClass.writeHtml(hGraphic) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_classedData.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_classedData.rb index 600939422..fef5e299f 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_classedData.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_classedData.rb @@ -33,7 +33,7 @@ def writeHtml(hClassD) aClassItems = hClassD[:classedDataItems] aClassItems.each do |hClassItem| @html.div do - @html.div(hClassItem[:className], {'class'=>'h5'}) + @html.h5(hClassItem[:className], {'class'=>'h5'}) @html.div(:class=>'block') do htmlClassItem.writeHtml(hClassItem) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_constraint.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_constraint.rb index 6759566dd..5a19637b7 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_constraint.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_constraint.rb @@ -52,7 +52,7 @@ def writeHtml(hConstraint) # constraint - scope {scope} unless hConstraint[:scope].empty? @html.div do - @html.div('Scope', {'class' => 'h5'}) + @html.h5('Scope', {'class' => 'h5'}) @html.div(:class => 'block') do scopeClass.writeHtml(hConstraint[:scope]) end @@ -62,7 +62,7 @@ def writeHtml(hConstraint) # constraint - graphic [] {graphic} hConstraint[:graphic].each do |hGraphic| @html.div do - @html.div('Graphic', {'class' => 'h5'}) + @html.h5('Graphic', {'class' => 'h5'}) @html.div(:class => 'block') do graphicClass.writeHtml(hGraphic) end @@ -72,7 +72,7 @@ def writeHtml(hConstraint) # constraint - reference [] {citation} hConstraint[:reference].each do |hReference| @html.div do - @html.div('Reference', {'class' => 'h5'}) + @html.h5('Reference', {'class' => 'h5'}) @html.div(:class => 'block') do citationClass.writeHtml(hReference) end @@ -82,7 +82,7 @@ def writeHtml(hConstraint) # constraint - releasability {releasability} unless hConstraint[:releasability].empty? @html.div do - @html.div('Releasability', {'class' => 'h5'}) + @html.h5('Releasability', {'class' => 'h5'}) @html.div(:class => 'block') do releasabilityClass.writeHtml(hConstraint[:releasability]) end @@ -92,7 +92,7 @@ def writeHtml(hConstraint) # constraint - responsibility [] {responsibility} hConstraint[:responsibleParty].each do |hResponsibility| @html.div do - @html.div(hResponsibility[:roleName], {'class' => 'h5'}) + @html.h5(hResponsibility[:roleName], {'class' => 'h5'}) @html.div(:class => 'block') do responsibilityClass.writeHtml(hResponsibility) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_contact.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_contact.rb index ab55f54aa..1bd127ef8 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_contact.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_contact.rb @@ -28,7 +28,7 @@ def writeHtml(hContact) graphicClass = Html_Graphic.new(@html) @html.div do - @html.div(hContact[:name], {'id' => 'CID_' + hContact[:contactId], 'class' => 'h3'}) + @html.h3(hContact[:name], {'id' => 'CID_' + hContact[:contactId], 'class' => 'h3'}) @html.div(:class => 'block') do # contact - contact ID @@ -70,7 +70,7 @@ def writeHtml(hContact) # contact - address hContact[:addresses].each do |hAddress| @html.div do - @html.div('Address', {'class' => 'h5'}) + @html.h5('Address', {'class' => 'h5'}) @html.div(:class => 'block') do # address - delivery points @@ -119,7 +119,7 @@ def writeHtml(hContact) # contact - phones hContact[:phones].each do |hPhone| @html.div do - @html.div('Phone', {'class' => 'h5'}) + @html.h5('Phone', {'class' => 'h5'}) @html.div(:class => 'block') do # phone - name @@ -159,7 +159,7 @@ def writeHtml(hContact) # contact - online resource [] hContact[:onlineResources].each do |hOnline| @html.div do - @html.div('Online Resource', {'class' => 'h5'}) + @html.h5('Online Resource', {'class' => 'h5'}) @html.div(:class => 'block') do onlineClass.writeHtml(hOnline) end @@ -169,7 +169,7 @@ def writeHtml(hContact) # contact - logos [] hContact[:logos].each do |hLogo| @html.div do - @html.div('Logo Graphic', {'class' => 'h5'}) + @html.h5('Logo Graphic', {'class' => 'h5'}) @html.div(:class => 'block') do graphicClass.writeHtml(hLogo) end @@ -194,7 +194,7 @@ def writeHtml(hContact) if hContact.key?(:externalIdentifier) && !hContact[:externalIdentifier].empty? hContact[:externalIdentifier].each do |identifier| @html.div do - @html.div("External Identifier", {'class' => 'h5'}) + @html.h5("External Identifier", {'class' => 'h5'}) @html.div(:class => 'block') do @html.em('Identifier: ') @html.text!(identifier[:identifier]) diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_coverageInfo.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_coverageInfo.rb index a5b2d4244..b124a24b4 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_coverageInfo.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_coverageInfo.rb @@ -45,7 +45,7 @@ def writeHtml(hCoverage) # coverage - process level code unless hCoverage[:processingLevelCode].empty? @html.div do - @html.div('Processing Level Code', {'class' => 'h5'}) + @html.h5('Processing Level Code', {'class' => 'h5'}) @html.div(:class => 'block') do identifierClass.writeHtml(hCoverage[:processingLevelCode]) end @@ -55,7 +55,7 @@ def writeHtml(hCoverage) # coverage - attribute group [] {attributeGroup} hCoverage[:attributeGroups].each do |hAttGroup| @html.div do - @html.div('Attribute Group', {'class' => 'h5'}) + @html.h5('Attribute Group', {'class' => 'h5'}) @html.div(:class => 'block') do attGroupClass.writeHtml(hAttGroup) end @@ -65,7 +65,7 @@ def writeHtml(hCoverage) # coverage - image description {imageInfo} unless hCoverage[:imageDescription].empty? @html.div do - @html.div('Image Description', {'class' => 'h5'}) + @html.h5('Image Description', {'class' => 'h5'}) @html.div(:class => 'block') do imageClass.writeHtml(hCoverage[:imageDescription]) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataDictionary.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataDictionary.rb index 22c34e2d5..bb4098377 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataDictionary.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataDictionary.rb @@ -51,7 +51,7 @@ def writeHtml(hDictionary) # dictionary - domains [] {domain} unless hDictionary[:domains].empty? @html.div do - @html.div('Domains', {'class' => 'h5'}) + @html.h5('Domains', {'class' => 'h5'}) @html.div(:class => 'block') do domainClass.writeHtml(hDictionary[:domains]) end @@ -61,7 +61,7 @@ def writeHtml(hDictionary) # dictionary - entities [] {entity} unless hDictionary[:entities].empty? @html.div do - @html.div('Entities', {'class' => 'h5'}) + @html.h5('Entities', {'class' => 'h5'}) @html.div(:class => 'block') do entityClass.writeHtml(hDictionary[:entities]) end @@ -71,7 +71,7 @@ def writeHtml(hDictionary) # dictionary - citation {citation} unless hDictionary[:citation].empty? @html.div do - @html.div('Citation', {'class' => 'h5'}) + @html.h5('Citation', {'class' => 'h5'}) @html.div(:class => 'block') do citationClass.writeHtml(hDictionary[:citation]) end @@ -81,7 +81,7 @@ def writeHtml(hDictionary) # dictionary - locales {locale} hDictionary[:locales].each do |hLocale| @html.div do - @html.div('Locale', {'class' => 'h5'}) + @html.h5('Locale', {'class' => 'h5'}) @html.div(:class => 'block') do localeClass.writeHtml(hLocale) end @@ -91,7 +91,7 @@ def writeHtml(hDictionary) # dictionary - responsible party {responsibility} unless hDictionary[:responsibleParty].empty? @html.div do - @html.div(hDictionary[:responsibleParty][:roleName], {'class' => 'h5'}) + @html.h5(hDictionary[:responsibleParty][:roleName], {'class' => 'h5'}) @html.div(:class => 'block') do responsibilityClass.writeHtml(hDictionary[:responsibleParty]) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQuality.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQuality.rb index a9dd2b184..af6c37518 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQuality.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQuality.rb @@ -19,7 +19,7 @@ def writeHtml(hDataQuality) unless hDataQuality[:scope].empty? @html.div(class: 'block') do @html.div do - @html.div('Scope', {'class' => 'h5'}) + @html.h5('Scope', {'class' => 'h5'}) @html.div(class: 'block') do scopeClass.writeHtml(hDataQuality[:scope]) end @@ -35,7 +35,7 @@ def writeHtml(hDataQuality) @html.div(class: 'block') do @html.div do - @html.div('Standalone Quality Report', {'class' => 'h5'}) + @html.h5('Standalone Quality Report', {'class' => 'h5'}) unless report[:abstract].nil? @html.div(class: 'block') do @html.em('Abstract:') @@ -45,7 +45,7 @@ def writeHtml(hDataQuality) unless report[:reportReference].nil? @html.div do - @html.div('Report Reference', {'class' => 'h5'}) + @html.h5('Report Reference', {'class' => 'h5'}) @html.div(class: 'block') do citationClass.writeHtml(report[:reportReference]) end @@ -60,11 +60,11 @@ def writeHtml(hDataQuality) unless hDataQuality[:report].empty? @html.div(class: 'block') do @html.div do - @html.div('Reports', {'class' => 'h4'}) + @html.h4('Reports', {'class' => 'h4'}) hDataQuality[:report].each do |report| @html.div(class: 'block') do @html.div do - @html.div('Report', {'class' => 'h5'}) + @html.h5('Report', {'class' => 'h5'}) dataQualityReportClass.writeHtml(report) end end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQualityReport.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQualityReport.rb index de798f46f..8dd8ce00c 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQualityReport.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQualityReport.rb @@ -41,12 +41,12 @@ def writeQualityMeasure(qualityMeasure) identifierClass = Html_Identifier.new(@html) @html.div do - @html.div('Quality Measure', {'class' => 'h5'}) + @html.h5('Quality Measure', {'class' => 'h5'}) @html.div(class: 'block') do # Identifier unless qualityMeasure[:identifier].empty? @html.div do - @html.div('Identifier', {'class' => 'h5'}) + @html.h5('Identifier', {'class' => 'h5'}) @html.div(class: 'block') do identifierClass.writeHtml(qualityMeasure[:identifier]) end @@ -61,9 +61,9 @@ def writeQualityMeasure(qualityMeasure) end # Names - unless qualityMeasure[:name].empty? + unless qualityMeasure[:nameOfMeasure].empty? @html.em('Names: ') - @html.text!(qualityMeasure[:name].join('; ')) + @html.text!(qualityMeasure[:nameOfMeasure].join('; ')) @html.br end end @@ -74,7 +74,7 @@ def writeEvaluationMethod(evaluationMethod) citationClass = Html_Citation.new(@html) @html.div do - @html.div('Evaluation Method', {'class' => 'h5'}) + @html.h5('Evaluation Method', {'class' => 'h5'}) @html.div(class: 'block') do # Type unless evaluationMethod[:type].nil? @@ -137,7 +137,7 @@ def writeEvaluationMethod(evaluationMethod) # EvaluationProcedure unless evaluationMethod[:evaluationProcedure].nil? || evaluationMethod[:evaluationProcedure].empty? @html.div do - @html.div('Evaluation Procedure', {'class' => 'h5'}) + @html.h5('Evaluation Procedure', {'class' => 'h5'}) @html.div(class: 'block') do citationClass.writeHtml(evaluationMethod[:evaluationProcedure]) end @@ -147,7 +147,7 @@ def writeEvaluationMethod(evaluationMethod) # ReferenceDocument unless evaluationMethod[:referenceDocument].nil? || evaluationMethod[:referenceDocument].empty? @html.div do - @html.div('Reference Document', {'class' => 'h5'}) + @html.h5('Reference Document', {'class' => 'h5'}) evaluationMethod[:referenceDocument].each do |doc| @html.div(class: 'block') do citationClass.writeHtml(doc) @@ -164,7 +164,7 @@ def writeConformanceResult(conformanceResult) scopeClass = Html_Scope.new(@html) # Assuming there's a class to handle scope objects @html.div do - @html.div('Conformance Result', {'class' => 'h5'}) + @html.h5('Conformance Result', {'class' => 'h5'}) conformanceResult.each do |result| @html.div(class: 'block') do # DateTime @@ -177,7 +177,7 @@ def writeConformanceResult(conformanceResult) # Scope unless result[:scope].nil? || result[:scope].empty? @html.div do - @html.div('Scope', {'class' => 'h5'}) + @html.h5('Scope', {'class' => 'h5'}) @html.div(class: 'block') do scopeClass.writeHtml(result[:scope]) end @@ -187,7 +187,7 @@ def writeConformanceResult(conformanceResult) # Specification (citation) unless result[:specification].nil? @html.div do - @html.div('Specification', {'class' => 'h5'}) + @html.h5('Specification', {'class' => 'h5'}) @html.div(class: 'block') do citationClass.writeHtml(result[:specification]) end @@ -219,7 +219,7 @@ def writeCoverageResult(coverageResult) formatClass = Html_Format.new(@html) # Assuming a class to handle format objects @html.div do - @html.div('Coverage Result', {'class' => 'h5'}) + @html.h5('Coverage Result', {'class' => 'h5'}) coverageResult.each do |result| @html.div(class: 'block') do # DateTime @@ -232,7 +232,7 @@ def writeCoverageResult(coverageResult) # Scope unless result[:scope].nil? || result[:scope].empty? @html.div do - @html.div('Scope', {'class' => 'h5'}) + @html.h5('Scope', {'class' => 'h5'}) @html.div(class: 'block') do scopeClass.writeHtml(result[:scope]) end @@ -249,7 +249,7 @@ def writeCoverageResult(coverageResult) # SpatialRepresentation unless result[:spatialRepresentation].nil? || result[:spatialRepresentation].empty? @html.div do - @html.div('Spatial Representation', {'class' => 'h5'}) + @html.h5('Spatial Representation', {'class' => 'h5'}) @html.div(class: 'block') do spatialRepresentationClass.writeHtml(result[:spatialRepresentation]) end @@ -289,7 +289,7 @@ def writeDescriptiveResult(descriptiveResult) scopeClass = Html_Scope.new(@html) # Assuming a class to handle scope objects @html.div do - @html.div('Descriptive Result', {'class' => 'h5'}) + @html.h5('Descriptive Result', {'class' => 'h5'}) descriptiveResult.each do |result| @html.div(class: 'block') do # DateTime @@ -302,7 +302,7 @@ def writeDescriptiveResult(descriptiveResult) # Scope unless result[:scope].nil? @html.div do - @html.div('Scope', {'class' => 'h5'}) + @html.h5('Scope', {'class' => 'h5'}) @html.div(class: 'block') do scopeClass.writeHtml(result[:scope]) end @@ -324,7 +324,7 @@ def writeQuantitativeResult(quantitativeResult) scopeClass = Html_Scope.new(@html) # Assuming a class to handle scope objects @html.div do - @html.div('Quantitative Result', {'class' => 'h5'}) + @html.h5('Quantitative Result', {'class' => 'h5'}) quantitativeResult.each do |result| @html.div(class: 'block') do # DateTime @@ -337,7 +337,7 @@ def writeQuantitativeResult(quantitativeResult) # Scope unless result[:scope].nil? @html.div do - @html.div('Scope', {'class' => 'h5'}) + @html.h5('Scope', {'class' => 'h5'}) @html.div(class: 'block') do scopeClass.writeHtml(result[:scope]) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_distribution.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_distribution.rb index 6ea61e1c2..6819afc2b 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_distribution.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_distribution.rb @@ -42,7 +42,7 @@ def writeHtml(hDistribution) # distribution - distributor [] {distributor} hDistribution[:distributor].each do |hDistributor| @html.div do - @html.div('Distributor', {'class' => 'h5'}) + @html.h5('Distributor', {'class' => 'h5'}) @html.div(:class => 'block') do distributorClass.writeHtml(hDistributor) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_distributor.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_distributor.rb index c31e0b275..5e08759ec 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_distributor.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_distributor.rb @@ -30,7 +30,7 @@ def writeHtml(hDistributor) # distributor - contact {responsibility} unless hDistributor[:contact].empty? @html.div do - @html.div('Contact', {'class' => 'h5'}) + @html.h5('Contact', {'class' => 'h5'}) @html.div(:class => 'block') do responsibilityClass.writeHtml(hDistributor[:contact]) end @@ -40,7 +40,7 @@ def writeHtml(hDistributor) # distributor - order process [] {orderProcess} hDistributor[:orderProcess].each do |hOrder| @html.div do - @html.div('Order Process', {'class' => 'h5'}) + @html.h5('Order Process', {'class' => 'h5'}) @html.div(:class => 'block') do orderClass.writeHtml(hOrder) end @@ -50,7 +50,7 @@ def writeHtml(hDistributor) # distributor - transfer options [] {transferOption} hDistributor[:transferOptions].each do |hTransfer| @html.div do - @html.div('Transfer Option', {'class' => 'h5'}) + @html.h5('Transfer Option', {'class' => 'h5'}) @html.div(:class => 'block') do transferClass.writeHtml(hTransfer) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_domain.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_domain.rb index 2c7a551bb..762dd4cf9 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_domain.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_domain.rb @@ -38,7 +38,7 @@ def writeHtml(aDomains) type = 'ENUMERATED' unless hDomain[:domainItems].empty? @html.div do - @html.div(dName, {'class' => 'h5'}) + @html.h5(dName, {'class' => 'h5'}) @html.div(:class => 'block') do # domain - type @@ -78,7 +78,7 @@ def writeHtml(aDomains) # domain - domain reference {citation} unless hDomain[:domainReference].empty? @html.div do - @html.div('Reference', {'class' => 'h5'}) + @html.h5('Reference', {'class' => 'h5'}) @html.div(:class => 'block') do citationClass.writeHtml(hDomain[:domainReference]) end @@ -88,7 +88,7 @@ def writeHtml(aDomains) # domain - domain items [] {domainItem} hDomain[:domainItems].each do |hItem| @html.div do - @html.div(hItem[:itemValue], {'class' => 'h5'}) + @html.h5(hItem[:itemValue], {'class' => 'h5'}) @html.div(:class => 'block') do itemClass.writeHtml(hItem) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_domainItem.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_domainItem.rb index 59a3627a9..a8300e144 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_domainItem.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_domainItem.rb @@ -48,7 +48,7 @@ def writeHtml(hItem) # domain item - reference {citation} unless hItem[:itemReference].empty? @html.div do - @html.div('Reference', {'class' => 'h5'}) + @html.h5('Reference', {'class' => 'h5'}) @html.div(:class => 'block') do citationClass.writeHtml(hItem[:itemReference]) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_entity.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_entity.rb index f5f690075..09bff685a 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_entity.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_entity.rb @@ -38,7 +38,7 @@ def writeHtml(aEntities) eName = hEntity[:entityName] unless hEntity[:entityName].nil? @html.div do - @html.div(eName, {'class' => 'h5'}) + @html.h5(eName, {'class' => 'h5'}) @html.div(:class => 'block') do # entity - entity id @@ -116,7 +116,7 @@ def writeHtml(aEntities) iName = hIndex[:indexCode] unless hIndex[:indexCode].nil? iName = hIndex[:indexName] unless hIndex[:indexName].nil? @html.div do - @html.div('Index: '+iName, {'class' => 'h5'}) + @html.h5('Index: '+iName, {'class' => 'h5'}) @html.div(:class => 'block') do indexClass.writeHtml(hIndex) end @@ -126,7 +126,7 @@ def writeHtml(aEntities) # entity - foreign keys [] {entityForeignKey} hEntity[:foreignKeys].each do |hForeign| @html.div do - @html.div('ForeignKey', {'class' => 'h5'}) + @html.h5('ForeignKey', {'class' => 'h5'}) @html.div(:class => 'block') do foreignClass.writeHtml(hForeign) end @@ -136,7 +136,7 @@ def writeHtml(aEntities) # entity - entity reference [] {citation} hEntity[:entityReferences].each do |hReference| @html.div do - @html.div('Reference', {'class' => 'h5'}) + @html.h5('Reference', {'class' => 'h5'}) @html.div(:class => 'block') do citationClass.writeHtml(hReference) end @@ -149,7 +149,7 @@ def writeHtml(aEntities) aName = hAttribute[:attributeCode] unless hAttribute[:attributeCode].nil? aName = hAttribute[:attributeName] unless hAttribute[:attributeName].nil? @html.div do - @html.div('Attribute: '+aName, {'class' => 'h5'}) + @html.h5('Attribute: '+aName, {'class' => 'h5'}) @html.div(:class => 'block') do attributeClass.writeHtml(hAttribute) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_entityAttribute.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_entityAttribute.rb index a55a28d66..3f92acd7c 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_entityAttribute.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_entityAttribute.rb @@ -129,7 +129,7 @@ def writeHtml(hAttribute) # entity attribute - range of values [] {citation} hAttribute[:valueRange].each do |hRange| @html.div do - @html.div('Range of Values', {'class' => 'h5'}) + @html.h5('Range of Values', {'class' => 'h5'}) @html.div(:class => 'block') do # range of values - minimum value @@ -153,7 +153,7 @@ def writeHtml(hAttribute) # entity attribute - time period of values {timePeriod} hAttribute[:timePeriod].each do |hPeriod| @html.div do - @html.div('Time Period of Values', {'class' => 'h5'}) + @html.h5('Time Period of Values', {'class' => 'h5'}) @html.div(:class => 'block') do periodClass.writeHtml(hPeriod) end @@ -163,7 +163,7 @@ def writeHtml(hAttribute) # entity attribute - attribute reference {citation} unless hAttribute[:attributeReference].empty? @html.div do - @html.div('Reference', {'class' => 'h5'}) + @html.h5('Reference', {'class' => 'h5'}) @html.div(:class => 'block') do citationClass.writeHtml(hAttribute[:attributeReference]) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_extent.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_extent.rb index 63fda0d3a..a4ef5d8f8 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_extent.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_extent.rb @@ -39,7 +39,7 @@ def writeHtml(hExtent) # extent - geographic extents hExtent[:geographicExtents].each do |hGeographic| @html.div do - @html.div('Geographic Extent', {'class' => 'h5'}) + @html.h5('Geographic Extent', {'class' => 'h5'}) @html.div(:class => 'block extent-geographic') do geographicClass.writeHtml(hGeographic) end @@ -49,7 +49,7 @@ def writeHtml(hExtent) # extent - temporal extents hExtent[:temporalExtents].each do |hTemporal| @html.div do - @html.div('Temporal Extent', {'class' => 'h5'}) + @html.h5('Temporal Extent', {'class' => 'h5'}) @html.div(:class => 'block') do temporalClass.writeHtml(hTemporal) end @@ -59,7 +59,7 @@ def writeHtml(hExtent) # extent - vertical extents hExtent[:verticalExtents].each do |hVertical| @html.div do - @html.div('Vertical Extent', {'class' => 'h5'}) + @html.h5('Vertical Extent', {'class' => 'h5'}) @html.div(:class => 'block') do verticalClass.writeHtml(hVertical) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_feature.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_feature.rb index a828898f1..05e81c9d4 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_feature.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_feature.rb @@ -36,7 +36,7 @@ def writeHtml(hFeature) # feature - geometry object unless hFeature[:geometryObject].empty? @html.div do - @html.div(hFeature[:geometryObject][:type], 'class' => 'h5') + @html.h5(hFeature[:geometryObject][:type], 'class' => 'h5') @html.div(:class => 'block') do geometryClass.writeHtml(hFeature[:geometryObject]) end @@ -46,7 +46,7 @@ def writeHtml(hFeature) # feature - user bounding box unless hFeature[:bbox].empty? @html.div do - @html.div('User Provided Bounding Box', 'class' => 'h5') + @html.h5('User Provided Bounding Box', 'class' => 'h5') @html.div(:class => 'block') do bbox = {} bbox[:westLongitude] = hFeature[:bbox][0] @@ -61,7 +61,7 @@ def writeHtml(hFeature) # feature - computed bounding box unless hFeature[:computedBbox].empty? @html.div do - @html.div('Computed Bounding Box', 'class' => 'h5') + @html.h5('Computed Bounding Box', 'class' => 'h5') @html.div(:class => 'block') do boxClass.writeHtml(hFeature[:computedBbox]) end @@ -71,7 +71,7 @@ def writeHtml(hFeature) # feature - properties unless hFeature[:properties].empty? @html.div do - @html.div('Properties', 'class' => 'h5') + @html.h5('Properties', 'class' => 'h5') @html.div(:class => 'block') do propertyClass.writeHtml(hFeature[:properties]) end @@ -81,7 +81,7 @@ def writeHtml(hFeature) # feature - native GeoJson unless hFeature[:nativeGeoJson].empty? @html.div do - @html.div('GeoJson', 'class' => 'h5') + @html.h5('GeoJson', 'class' => 'h5') @html.div(:class => 'block') do @html.text!(hFeature[:nativeGeoJson].to_json) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_featureCollection.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_featureCollection.rb index 3757b44db..0fd0ef793 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_featureCollection.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_featureCollection.rb @@ -31,7 +31,7 @@ def writeHtml(hCollection) unless feature[:id].nil? title += ': '+feature[:id].to_s end - @html.div(title, 'class' => 'h5') + @html.h5(title, 'class' => 'h5') @html.div(:class => 'block') do featureClass.writeHtml(feature) end @@ -41,7 +41,7 @@ def writeHtml(hCollection) # feature collection - user bounding box unless hCollection[:bbox].empty? @html.div do - @html.div('User Provided Bounding Box', 'class' => 'h5') + @html.h5('User Provided Bounding Box', 'class' => 'h5') @html.div(:class => 'block') do bbox = {} bbox[:westLongitude] = hCollection[:bbox][0] @@ -56,7 +56,7 @@ def writeHtml(hCollection) # feature collection - computed bounding box unless hCollection[:computedBbox].empty? @html.div do - @html.div('Computed Bounding Box', 'class' => 'h5') + @html.h5('Computed Bounding Box', 'class' => 'h5') @html.div(:class => 'block') do boxClass.writeHtml(hCollection[:computedBbox]) end @@ -66,7 +66,7 @@ def writeHtml(hCollection) # feature collection - native GeoJson unless hCollection[:nativeGeoJson].empty? @html.div do - @html.div('GeoJson', 'class' => 'h5') + @html.h5('GeoJson', 'class' => 'h5') @html.div(:class => 'block') do @html.text!(hCollection[:nativeGeoJson].to_json) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_featureProperties.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_featureProperties.rb index 19231ff7a..d4959c2ea 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_featureProperties.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_featureProperties.rb @@ -40,7 +40,7 @@ def writeHtml(hProperty) # feature properties - identifier [] {identifier} hProperty[:identifiers].each do |hIdentifier| @html.div do - @html.div('Identifier', 'class' => 'h5') + @html.h5('Identifier', 'class' => 'h5') @html.div(:class => 'block') do identifierClass.writeHtml(hIdentifier) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_format.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_format.rb index 08edad8f5..09b5063fc 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_format.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_format.rb @@ -28,7 +28,7 @@ def writeHtml(hFormat) # resource format - format specification {citation} unless hFormat[:formatSpecification].empty? @html.div do - @html.div(hFormat[:formatSpecification][:title], {'class' => 'h5'}) + @html.h5(hFormat[:formatSpecification][:title], {'class' => 'h5'}) @html.div(:class => 'block') do citationClass.writeHtml(hFormat[:formatSpecification]) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_funding.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_funding.rb index 718bda512..58c9f78bd 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_funding.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_funding.rb @@ -44,7 +44,7 @@ def writeHtml(hFunding) # funding - allocations [] {allocation} hFunding[:allocations].each do |hAllocation| @html.div do - @html.div('Allocation', {'class' => 'h5'}) + @html.h5('Allocation', {'class' => 'h5'}) @html.div(:class => 'block') do allocationClass.writeHtml(hAllocation) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geodeticParameters.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geodeticParameters.rb index 608c62e10..565b4e13c 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geodeticParameters.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geodeticParameters.rb @@ -25,7 +25,7 @@ def writeHtml(hGeodetic) # geodetic parameters - datum identifier unless hGeodetic[:datumIdentifier].empty? @html.div do - @html.div('Datum Identifier', {'id' => 'datum-identifier', 'class' => 'h5'}) + @html.h5('Datum Identifier', {'id' => 'datum-identifier', 'class' => 'h5'}) @html.div(:class => 'block') do identifierClass.writeHtml(hGeodetic[:datumIdentifier]) end @@ -35,7 +35,7 @@ def writeHtml(hGeodetic) # geodetic parameters - ellipsoid identifier unless hGeodetic[:ellipsoidIdentifier].empty? @html.div do - @html.div('Ellipsoid Identifier', {'id' => 'ellipsoid-identifier', 'class' => 'h5'}) + @html.h5('Ellipsoid Identifier', {'id' => 'ellipsoid-identifier', 'class' => 'h5'}) @html.div(:class => 'block') do identifierClass.writeHtml(hGeodetic[:ellipsoidIdentifier]) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geographicElement.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geographicElement.rb index 34922cb23..7ca4260a6 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geographicElement.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geographicElement.rb @@ -32,7 +32,7 @@ def writeHtml(hElement) case hElement[:type] when 'Point', 'LineString', 'Polygon', 'MultiPoint', 'MultiLineString', 'MultiPolygon' @html.div do - @html.div(hElement[:type], 'class' => 'h5') + @html.h5(hElement[:type], 'class' => 'h5') @html.div(:class => 'block') do geometryClass.writeHtml(hElement) end @@ -40,7 +40,7 @@ def writeHtml(hElement) when 'GeometryCollection' @html.div do - @html.div('Geometry Collection', 'class' => 'h5') + @html.h5('Geometry Collection', 'class' => 'h5') @html.div(:class => 'block') do geoCollectionClass.writeHtml(hElement) end @@ -52,7 +52,7 @@ def writeHtml(hElement) unless hElement[:id].nil? title += ': '+hElement[:id].to_s end - @html.div(title, 'class' => 'h5') + @html.h5(title, 'class' => 'h5') @html.div(:class => 'block') do featureClass.writeHtml(hElement) end @@ -60,7 +60,7 @@ def writeHtml(hElement) when 'FeatureCollection' @html.div do - @html.div(hElement[:type], 'class' => 'h5') + @html.h5(hElement[:type], 'class' => 'h5') @html.div(:class => 'block') do featCollectionClass.writeHtml(hElement) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geographicExtent.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geographicExtent.rb index 3431f536f..0dc413c50 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geographicExtent.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geographicExtent.rb @@ -43,7 +43,7 @@ def writeHtml(hExtent) # geographic extent - map {div} @html.div do - @html.div('Map', 'class' => 'h5 map-summary') + @html.h5('Map', 'class' => 'h5 map-summary') @html.div(:class => 'block') do @html.div('class' => 'map', 'id' => 'map') do # map drawn by html_bodyScript.js @@ -54,7 +54,7 @@ def writeHtml(hExtent) # geographic extent - geographic element [] {geographicElement} unless hExtent[:geographicElements].empty? @html.div do - @html.div('Elements', 'class' => 'h5') + @html.h5('Elements', 'class' => 'h5') @html.div(:class => 'block') do hExtent[:geographicElements].each do |hElement| geographicClass.writeHtml(hElement) @@ -66,7 +66,7 @@ def writeHtml(hExtent) # geographic extent - user bounding box unless hExtent[:boundingBox].empty? @html.div do - @html.div('User Provided Bounding Box', 'class' => 'h5') + @html.h5('User Provided Bounding Box', 'class' => 'h5') @html.div(:class => 'block') do boundingClass.writeHtml(hExtent[:boundingBox]) @html.div(:class =>'userBBox hidden') do @@ -79,7 +79,7 @@ def writeHtml(hExtent) # computed bounding box - {boundingBox} unless hExtent[:computedBbox].empty? @html.div do - @html.div('Computed Bounding Box', 'class' => 'h5') + @html.h5('Computed Bounding Box', 'class' => 'h5') @html.div(:class => 'block') do boundingClass.writeHtml(hExtent[:computedBbox]) @html.div(:class =>'computedBBox hidden') do @@ -102,7 +102,7 @@ def writeHtml(hExtent) # geographic extent - native GeoJson unless hExtent[:nativeGeoJson].empty? @html.div do - @html.div('GeoJson', 'class' => 'h5') + @html.h5('GeoJson', 'class' => 'h5') @html.div(:class => 'block') do @html.div(:class =>'geojson', :dataPopup => 'fill in popData') do @html.text!(hExtent[:nativeGeoJson].to_json) diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geologicAge.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geologicAge.rb index 1ff953e7a..bb212b501 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geologicAge.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geologicAge.rb @@ -55,7 +55,7 @@ def writeHtml(hGeoAge) # geologic age - age references [] {citation} hGeoAge[:ageReferences].each do |hCitation| @html.div do - @html.div('Age Reference', {'class' => 'h5'}) + @html.h5('Age Reference', {'class' => 'h5'}) @html.div(:class => 'block') do citationClass.writeHtml(hCitation) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geometryCollection.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geometryCollection.rb index 760302b97..9cde44020 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geometryCollection.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geometryCollection.rb @@ -27,7 +27,7 @@ def writeHtml(hCollection) # geometry collection - objects hCollection[:geometryObjects].each do |hObject| @html.div do - @html.div(hObject[:type], 'class' => 'h5') + @html.h5(hObject[:type], 'class' => 'h5') @html.div(:class => 'block') do geometryClass.writeHtml(hObject) end @@ -37,7 +37,7 @@ def writeHtml(hCollection) # geometry collection - user bounding box unless hCollection[:bbox].empty? @html.div do - @html.div('User Provided Bounding Box', 'class' => 'h5') + @html.h5('User Provided Bounding Box', 'class' => 'h5') @html.div(:class => 'block') do bbox = {} bbox[:westLongitude] = hCollection[:bbox][0] @@ -52,7 +52,7 @@ def writeHtml(hCollection) # geometry collection - computed bounding box unless hCollection[:computedBbox].empty? @html.div do - @html.div('Computed Bounding Box', 'class' => 'h5') + @html.h5('Computed Bounding Box', 'class' => 'h5') @html.div(:class => 'block') do boxClass.writeHtml(hCollection[:computedBbox]) end @@ -62,7 +62,7 @@ def writeHtml(hCollection) # geographic element - native GeoJson unless hCollection[:nativeGeoJson].empty? @html.div do - @html.div('GeoJson', 'class' => 'h5') + @html.h5('GeoJson', 'class' => 'h5') @html.div(:class => 'block') do @html.text!(hCollection[:nativeGeoJson].to_json) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geometryObject.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geometryObject.rb index 6ccfd5b63..88971847c 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geometryObject.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geometryObject.rb @@ -20,7 +20,7 @@ def writeHtml(hObject) # geometry object - coordinates unless hObject[:coordinates].nil? @html.div do - @html.div('Coordinates', 'class' => 'h5') + @html.h5('Coordinates', 'class' => 'h5') @html.div(:class => 'block') do @html.text!(hObject[:coordinates].to_s) end @@ -30,7 +30,7 @@ def writeHtml(hObject) # geographic element - native GeoJson unless hObject[:nativeGeoJson].empty? @html.div do - @html.div('GeoJson', 'class' => 'h5') + @html.h5('GeoJson', 'class' => 'h5') @html.div(:class => 'block') do @html.text!(hObject[:nativeGeoJson].to_json) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_georectifiedRepresentation.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_georectifiedRepresentation.rb index cf340b2c6..81a48eb9b 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_georectifiedRepresentation.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_georectifiedRepresentation.rb @@ -27,7 +27,7 @@ def writeHtml(hGeorectified) # georectified representation - scope hGeorectified[:scope].each do |scope| @html.div do - @html.div('Scope ', 'class' => 'h5') + @html.h5('Scope ', 'class' => 'h5') @html.div(:class => 'block') do scopeClass.writeHtml(hGeorectified[:scope]) end @@ -37,7 +37,7 @@ def writeHtml(hGeorectified) # georectified representation - grid {gridRepresentation} unless hGeorectified[:gridRepresentation].empty? @html.div do - @html.div('Grid Information ', 'class' => 'h5') + @html.h5('Grid Information ', 'class' => 'h5') @html.div(:class => 'block') do gridClass.writeHtml(hGeorectified[:gridRepresentation]) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_georeferenceableRepresentation.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_georeferenceableRepresentation.rb index f65966232..4402fc2cc 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_georeferenceableRepresentation.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_georeferenceableRepresentation.rb @@ -29,7 +29,7 @@ def writeHtml(hGeoreferenceable) # georeferenceable representation - scope hGeoreferenceable[:scope].each do |scope| @html.div do - @html.div('Scope ', 'class' => 'h5') + @html.h5('Scope ', 'class' => 'h5') @html.div(:class => 'block') do scopeClass.writeHtml(hGeoreferenceable[:scope]) end @@ -40,7 +40,7 @@ def writeHtml(hGeoreferenceable) # georeferenceable representation - grid {gridRepresentation} unless hGeoreferenceable[:gridRepresentation].empty? @html.div do - @html.div('Grid Information ', 'class' => 'h5') + @html.h5('Grid Information ', 'class' => 'h5') @html.div(:class => 'block') do gridClass.writeHtml(hGeoreferenceable[:gridRepresentation]) end @@ -75,7 +75,7 @@ def writeHtml(hGeoreferenceable) # georeferenceable representation - parameter citation {citation} hGeoreferenceable[:parameterCitation].each do |hCitation| @html.div do - @html.div('Parameter Citation ', 'class' => 'h5') + @html.h5('Parameter Citation ', 'class' => 'h5') @html.div(:class => 'block') do citationClass.writeHtml(hCitation) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_graphic.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_graphic.rb index c587f3519..d06944c9e 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_graphic.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_graphic.rb @@ -49,7 +49,7 @@ def writeHtml(hGraphic) # graphic - uri [] {onlineResource} hGraphic[:graphicURI].each do |hOnline| @html.div do - @html.div('Online Link ', {'class' => 'h5'}) + @html.h5('Online Link ', {'class' => 'h5'}) @html.div(:class => 'block') do onlineClass.writeHtml(hOnline) end @@ -59,7 +59,7 @@ def writeHtml(hGraphic) # graphic - constraint [] {constraint} hGraphic[:graphicConstraints].each do |hConstraint| @html.div do - @html.div('Constraint', {'class' => 'h5'}) + @html.h5('Constraint', {'class' => 'h5'}) @html.div(:class => 'block') do constraintClass.writeHtml(hConstraint) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_gridRepresentation.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_gridRepresentation.rb index 1b217df66..c2b647034 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_gridRepresentation.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_gridRepresentation.rb @@ -28,7 +28,7 @@ def writeHtml(hGrid) # grid representation - scope hGrid[:scope].each do |scope| @html.div do - @html.div('Scope ', 'class' => 'h5') + @html.h5('Scope ', 'class' => 'h5') @html.div(:class => 'block') do scopeClass.writeHtml(hGrid[:scope]) end @@ -48,7 +48,7 @@ def writeHtml(hGrid) hGrid[:dimension].each do |hDimension| dimensionCount += 1 @html.div do - @html.div('Dimension '+dimensionCount.to_s, 'class' => 'h5') + @html.h5('Dimension '+dimensionCount.to_s, 'class' => 'h5') @html.div(:class => 'block') do dimensionClass.writeHtml(hDimension) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_identifier.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_identifier.rb index a8bcf6cd8..ae97dcdf6 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_identifier.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_identifier.rb @@ -65,7 +65,7 @@ def writeHtml(hIdentifier) # identifier - authority {citation} unless hIdentifier[:citation].empty? @html.div do - @html.div('Authority', {'id' => 'metadata-identifier', 'class' => 'h5'}) + @html.h5('Authority', {'id' => 'metadata-identifier', 'class' => 'h5'}) @html.div(:class => 'block') do citationClass.writeHtml(hIdentifier[:citation]) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_imageInfo.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_imageInfo.rb index 494bc6d01..18633439d 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_imageInfo.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_imageInfo.rb @@ -61,7 +61,7 @@ def writeHtml(hImage) # image information - image quality code {identifier} unless hImage[:imageQualityCode].empty? @html.div do - @html.div('Image Quality Code', {'class' => 'h5'}) + @html.h5('Image Quality Code', {'class' => 'h5'}) @html.div(:class => 'block') do identifierClass.writeHtml(hImage[:imageQualityCode]) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb index e2b0a2e6c..a15a6c916 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb @@ -30,7 +30,7 @@ def writeHtml(hKeyword) if type.nil? type = 'Unclassified' end - @html.div(type, {'class' => 'h5'}) + @html.h5(type, {'class' => 'h5'}) @html.div(:class => 'block') do # keywords @@ -49,7 +49,7 @@ def writeHtml(hKeyword) # thesaurus unless hKeyword[:thesaurus].empty? @html.div do - @html.div('Thesaurus', {'class' => 'h5'}) + @html.h5('Thesaurus', {'class' => 'h5'}) @html.div(:class => 'block') do citationClass.writeHtml(hKeyword[:thesaurus]) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataInfo.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataInfo.rb index 0f70128df..513914817 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataInfo.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataInfo.rb @@ -50,7 +50,7 @@ def writeHtml(hMetaInfo) # metadataInfo - metadata identifier {identifier} unless hMetaInfo[:metadataIdentifier].empty? @html.div do - @html.div('Metadata Identifier', {'id' => 'metadataInfo-identifier', 'class' => 'h3'}) + @html.h3('Metadata Identifier', {'id' => 'metadataInfo-identifier', 'class' => 'h3'}) @html.div(:class => 'block') do identifierClass.writeHtml(hMetaInfo[:metadataIdentifier]) end @@ -60,7 +60,7 @@ def writeHtml(hMetaInfo) # metadataInfo - parent metadata {citation} unless hMetaInfo[:parentMetadata].empty? @html.div do - @html.div('Parent Metadata', {'id' => 'metadataInfo-parent', 'class' => 'h3'}) + @html.h3('Parent Metadata', {'id' => 'metadataInfo-parent', 'class' => 'h3'}) @html.div(:class => 'block') do citationClass.writeHtml(hMetaInfo[:parentMetadata]) end @@ -70,7 +70,7 @@ def writeHtml(hMetaInfo) # metadataInfo - metadata locales unless hMetaInfo[:defaultMetadataLocale].empty? && hMetaInfo[:otherMetadataLocales].empty? @html.div do - @html.div('Metadata Locales', {'id' => 'metadataInfo-locale', 'class' => 'h3'}) + @html.h3('Metadata Locales', {'id' => 'metadataInfo-locale', 'class' => 'h3'}) @html.div(:class => 'block') do # default metadata locales {locale} @@ -100,7 +100,7 @@ def writeHtml(hMetaInfo) # metadataInfo - contacts [] {responsibility} unless hMetaInfo[:metadataContacts].empty? @html.div do - @html.div('Metadata Contacts', {'id' => 'metadataInfo-contacts', 'class' => 'h3'}) + @html.h3('Metadata Contacts', {'id' => 'metadataInfo-contacts', 'class' => 'h3'}) @html.div(:class => 'block') do hMetaInfo[:metadataContacts].each do |hResponsibility| @html.div do @@ -117,7 +117,7 @@ def writeHtml(hMetaInfo) # metadataInfo - dates [] {date} unless hMetaInfo[:metadataDates].empty? @html.div do - @html.div('Metadata Dates', {'id' => 'metadataInfo-dates', 'class' => 'h3'}) + @html.h3('Metadata Dates', {'id' => 'metadataInfo-dates', 'class' => 'h3'}) @html.div(:class => 'block') do hMetaInfo[:metadataDates].each do |hDate| @html.em('Date: ') @@ -131,7 +131,7 @@ def writeHtml(hMetaInfo) # metadataInfo - linkages [] {onlineResource} unless hMetaInfo[:metadataLinkages].empty? @html.div do - @html.div('Metadata Online Resource', {'id' => 'metadataInfo-links', 'class' => 'h3'}) + @html.h3('Metadata Online Resource', {'id' => 'metadataInfo-links', 'class' => 'h3'}) @html.div(:class => 'block') do hMetaInfo[:metadataLinkages].each do |hOnline| @html.div do @@ -148,7 +148,7 @@ def writeHtml(hMetaInfo) # metadataInfo - constraints [] {constraint} unless hMetaInfo[:metadataConstraints].empty? @html.div do - @html.div('Metadata Constraints', {'id' => 'metadataInfo-constraint', 'class' => 'h3'}) + @html.h3('Metadata Constraints', {'id' => 'metadataInfo-constraint', 'class' => 'h3'}) @html.div(:class => 'block') do hMetaInfo[:metadataConstraints].each do |hConstraint| @html.div do @@ -165,7 +165,7 @@ def writeHtml(hMetaInfo) # metadataInfo - maintenance {maintenance} unless hMetaInfo[:metadataMaintenance].empty? @html.div do - @html.div('Metadata Maintenance', {'id' => 'metadataInfo-maintenance', 'class' => 'h3'}) + @html.h3('Metadata Maintenance', {'id' => 'metadataInfo-maintenance', 'class' => 'h3'}) @html.div(:class => 'block') do maintClass.writeHtml(hMetaInfo[:metadataMaintenance]) end @@ -175,7 +175,7 @@ def writeHtml(hMetaInfo) # metadataInfo - alternate metadata references [] {citation} unless hMetaInfo[:alternateMetadataReferences].empty? @html.div do - @html.div('Alternate Metadata Citations', {'id' => 'metadataInfo-alternate', 'class' => 'h3'}) + @html.h3('Alternate Metadata Citations', {'id' => 'metadataInfo-alternate', 'class' => 'h3'}) @html.div(:class => 'block') do hMetaInfo[:alternateMetadataReferences].each do |hCitation| @html.div do diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataRepository.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataRepository.rb index 5e3a9d42b..50a0b2619 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataRepository.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataRepository.rb @@ -40,7 +40,7 @@ def writeHtml(hRepository) # metadata repository - citation unless hRepository[:citation].empty? @html.div do - @html.div('Citation', {'class' => 'h5'}) + @html.h5('Citation', {'class' => 'h5'}) @html.div(:class => 'block') do citationClass.writeHtml(hRepository[:citation]) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_processStep.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_processStep.rb index 7573b7950..d4a414b20 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_processStep.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_processStep.rb @@ -135,7 +135,7 @@ def writeHtml(hStep) # process step - scope {scope} unless hStep[:scope].empty? @html.div do - @html.div('Scope', {'class' => 'h5'}) + @html.h5('Scope', {'class' => 'h5'}) @html.div(:class => 'block') do scopeClass.writeHtml(hStep[:scope]) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_processing.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_processing.rb index 5b8f54d77..7c9e4f334 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_processing.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_processing.rb @@ -36,7 +36,7 @@ def writeHtml(hProcessing) # processing - identifier {identifier} unless hProcessing[:identifier].empty? @html.div do - @html.div('Identifier', {'class' => 'h5'}) + @html.h5('Identifier', {'class' => 'h5'}) @html.div(:class => 'block') do identifierClass.writeHtml(hProcessing[:identifier]) end @@ -63,7 +63,7 @@ def writeHtml(hProcessing) # processing - documentation [] {citation} hProcessing[:documentation].each do |hCitation| @html.div do - @html.div('Documentation', {'class' => 'h5'}) + @html.h5('Documentation', {'class' => 'h5'}) @html.div(:class => 'block') do citationClass.writeHtml(hCitation) end @@ -73,7 +73,7 @@ def writeHtml(hProcessing) # processing - algorithm [] {algorithm} hProcessing[:algorithms].each do |hAlgorithm| @html.div do - @html.div('Algorithm', {'class' => 'h5'}) + @html.h5('Algorithm', {'class' => 'h5'}) @html.div(:class => 'block') do algorithmClass.writeHtml(hAlgorithm) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_resourceInfo.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_resourceInfo.rb index b137dbc13..bdd995bc9 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_resourceInfo.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_resourceInfo.rb @@ -76,7 +76,7 @@ def writeHtml(hResource) # resource - citation {citation} unless hResource[:citation].empty? @html.div do - @html.div('Citation', {'id' => 'resourceInfo-citation', 'class' => 'h3'}) + @html.h3('Citation', {'id' => 'resourceInfo-citation', 'class' => 'h3'}) @html.div(:class => 'block') do citationClass.writeHtml(hResource[:citation]) end @@ -86,7 +86,7 @@ def writeHtml(hResource) # resource - abstract unless hResource[:abstract].nil? && hResource[:shortAbstract].nil? @html.div do - @html.div('Abstract', {'id' => 'resourceInfo-abstract', 'class' => 'h3'}) + @html.h3('Abstract', {'id' => 'resourceInfo-abstract', 'class' => 'h3'}) @html.div(:class => 'block') do # short abstract @@ -115,7 +115,7 @@ def writeHtml(hResource) # resource - purpose unless hResource[:purpose].nil? && hResource[:resourceUsages].empty? @html.div do - @html.div('Purpose, Usage, and Limitations', {'id' => 'resourceInfo-purpose', 'class' => 'h3'}) + @html.h3('Purpose, Usage, and Limitations', {'id' => 'resourceInfo-purpose', 'class' => 'h3'}) @html.div(:class => 'block') do # purpose @@ -148,7 +148,7 @@ def writeHtml(hResource) # resource - graphic overview [] {graphicOverview} unless hResource[:graphicOverviews].empty? @html.div do - @html.div('Graphic Overviews', {'id' => 'resourceInfo-overview', 'class' => 'h3'}) + @html.h3('Graphic Overviews', {'id' => 'resourceInfo-overview', 'class' => 'h3'}) @html.div(:class => 'block') do counter = 0 hResource[:graphicOverviews].each do |hGraphic| @@ -167,7 +167,7 @@ def writeHtml(hResource) # resource - point of contact [] {responsibility} unless hResource[:pointOfContacts].empty? && hResource[:credits].empty? @html.div do - @html.div('Resource Contacts', {'id' => 'resourceInfo-contacts', 'class' => 'h3'}) + @html.h3('Resource Contacts', {'id' => 'resourceInfo-contacts', 'class' => 'h3'}) @html.div(:class => 'block') do # contacts - responsibility @@ -201,7 +201,7 @@ def writeHtml(hResource) # resource - temporal information unless hResource[:timePeriod].empty? && hResource[:temporalResolutions].empty? @html.div do - @html.div('Temporal Information', {'id' => 'resourceInfo-temporal', 'class' => 'h3'}) + @html.h3('Temporal Information', {'id' => 'resourceInfo-temporal', 'class' => 'h3'}) @html.div(:class => 'block') do # time period {timePeriod} @@ -234,7 +234,7 @@ def writeHtml(hResource) hResource[:spatialRepresentations].empty? hResource[:spatialResolutions].empty? @html.div do - @html.div('Spatial Information', {'id' => 'resourceInfo-spatial', 'class' => 'h3'}) + @html.h3('Spatial Information', {'id' => 'resourceInfo-spatial', 'class' => 'h3'}) @html.div(:class => 'block') do # representation type [] {spatialRepresentation} @@ -312,11 +312,11 @@ def writeHtml(hResource) # # resource - extent [] {extent} # unless hResource[:extents].empty? # @html.div do - # @html.div('Spatial, Temporal, and Vertical Extents', {'id' => 'resourceInfo-extent', 'class' => 'h3'}) + # @html.h3('Spatial, Temporal, and Vertical Extents', {'id' => 'resourceInfo-extent', 'class' => 'h3'}) # @html.div(:class => 'block') do # hResource[:extents].each do |hExtent| # @html.div do - # @html.div('Extent', {'class' => 'h5'}) + # @html.h5('Extent', {'class' => 'h5'}) # @html.div(:class => 'block') do # extentClass.writeHtml(hExtent) # end @@ -329,7 +329,7 @@ def writeHtml(hResource) # resource - keywords [] {keyword} unless hResource[:keywords].empty? @html.div do - @html.div('Keywords', {'id' => 'resourceInfo-keyword', 'class' => 'h3'}) + @html.h3('Keywords', {'id' => 'resourceInfo-keyword', 'class' => 'h3'}) @html.div(:class => 'block') do hResource[:keywords].each do |hKeyword| keywordClass.writeHtml(hKeyword) @@ -341,7 +341,7 @@ def writeHtml(hResource) # resource - taxonomy {taxonomy} unless hResource[:taxonomy].empty? @html.div do - @html.div('Taxonomy', {'id' => 'resourceInfo-taxonomy', 'class' => 'h3'}) + @html.h3('Taxonomy', {'id' => 'resourceInfo-taxonomy', 'class' => 'h3'}) @html.div(:class => 'block') do counter = 0 hResource[:taxonomy].each do |hTaxonomy| @@ -360,7 +360,7 @@ def writeHtml(hResource) # resource - constraints [] {constraint} unless hResource[:constraints].empty? @html.div do - @html.div('Constraints', {'id' => 'resourceInfo-constraint', 'class' => 'h3'}) + @html.h3('Constraints', {'id' => 'resourceInfo-constraint', 'class' => 'h3'}) @html.div(:class => 'block') do hResource[:constraints].each do |hConstraint| @html.div do @@ -377,7 +377,7 @@ def writeHtml(hResource) # resource - coverage description [] {coverageInfo} unless hResource[:coverageDescriptions].empty? @html.div do - @html.div('Coverage Description', {'id' => 'resourceInfo-Coverage', 'class' => 'h3'}) + @html.h3('Coverage Description', {'id' => 'resourceInfo-Coverage', 'class' => 'h3'}) @html.div(:class => 'block') do hResource[:coverageDescriptions].each do |hCoverage| @html.div do @@ -394,7 +394,7 @@ def writeHtml(hResource) # resource - locale unless hResource[:defaultResourceLocale].empty? && hResource[:otherResourceLocales].empty? @html.div do - @html.div('Resource Locales', {'id' => 'resourceInfo-locale', 'class' => 'h3'}) + @html.h3('Resource Locales', {'id' => 'resourceInfo-locale', 'class' => 'h3'}) @html.div(:class => 'block') do # default resource locales {locale} @@ -424,11 +424,11 @@ def writeHtml(hResource) # resource - formats [] {format} unless hResource[:resourceFormats].empty? @html.div do - @html.div('Resource Formats', {'id' => 'resourceInfo-format', 'class' => 'h3'}) + @html.h3('Resource Formats', {'id' => 'resourceInfo-format', 'class' => 'h3'}) @html.div(:class => 'block') do hResource[:resourceFormats].each do |hFormat| @html.div do - @html.div('Format', {'class' => 'h5'}) + @html.h5('Format', {'class' => 'h5'}) @html.div(:class => 'block') do formatClass.writeHtml(hFormat) end @@ -443,7 +443,7 @@ def writeHtml(hResource) hResource[:environmentDescription].nil? && hResource[:supplementalInfo].nil? @html.div do - @html.div('Supplemental Information', {'id' => 'resourceInfo-supplemental', 'class' => 'h3'}) + @html.h3('Supplemental Information', {'id' => 'resourceInfo-supplemental', 'class' => 'h3'}) @html.div(:class => 'block') do # supplemental - maintenance [] {maintenance} diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_responsibility.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_responsibility.rb index ef6ff1ec3..e4d40466a 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_responsibility.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_responsibility.rb @@ -65,7 +65,7 @@ def writeHtml(hResponsibility) # # responsibility - role extent [] {extent} # hResponsibility[:roleExtents].each do |hExtent| # @html.div do - # @html.div('Extent', {'class' => 'h5'}) + # @html.h5('Extent', {'class' => 'h5'}) # @html.div(:class => 'block') do # extentClass.writeHtml(hExtent) # end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_scope.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_scope.rb index f548bfc75..7b7e1ff65 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_scope.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_scope.rb @@ -34,7 +34,7 @@ def writeHtml(hScope) # scope - description [] {scopeDescription} hScope[:scopeDescriptions].each do |hDescription| @html.div do - @html.div('Description', {'class' => 'h5'}) + @html.h5('Description', {'class' => 'h5'}) @html.div(:class => 'block') do descriptionClass.writeHtml(hDescription) end @@ -44,7 +44,7 @@ def writeHtml(hScope) # # scope - extent [] {extent} # hScope[:extents].each do |hExtent| # @html.div do - # @html.div('Extent', {'class' => 'h5'}) + # @html.h5('Extent', {'class' => 'h5'}) # @html.div(:class => 'block') do # extentClass.writeHtml(hExtent) # end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_source.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_source.rb index f7b728128..573e66f8b 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_source.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_source.rb @@ -82,7 +82,7 @@ def writeHtml(hSource) # source - spatial resolution {resolution} unless hSource[:spatialResolution].empty? @html.div do - @html.div('Resolution', {'class' => 'h5'}) + @html.h5('Resolution', {'class' => 'h5'}) @html.div(:class => 'block') do resolutionClass.writeHtml(hSource[:spatialResolution]) end @@ -119,7 +119,7 @@ def writeHtml(hSource) # source - scope {scope} unless hSource[:scope].empty? @html.div do - @html.div('Scope', {'class' => 'h5'}) + @html.h5('Scope', {'class' => 'h5'}) @html.div(:class => 'block') do scopeClass.writeHtml(hSource[:scope]) end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_taxonomy.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_taxonomy.rb index 2da661fe5..44546640a 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_taxonomy.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_taxonomy.rb @@ -102,7 +102,7 @@ def writeHtml(hTaxonomy) # taxonomy - observers {responsibility} unless hTaxonomy[:observers].empty? @html.div do - @html.div('Observers', {'class' => 'h5'}) + @html.h5('Observers', {'class' => 'h5'}) @html.div(:class => 'block') do hTaxonomy[:observers].each do |hObserver| @html.div do From 15fbd11e8fb626909b738f756fbd12357a794cb9 Mon Sep 17 00:00:00 2001 From: Johnathan Date: Thu, 8 Feb 2024 16:12:05 -0700 Subject: [PATCH 02/64] Simple HTML Enhancements (#339) * add geographicExtent to simple_html writer (#338) * add geographicExtent to simple_html writer * Fix Data Quality Fixed checks for nil and empty. Fixed tags. Fixed structures. * Fix Data Quality * Remove bodyScript and other js * Fix Typo referenceDocument -> referenceDocuments --------- Co-authored-by: Johnathan Aspinwall * add bookmark span tags to headers (#340) Co-authored-by: Johnathan Aspinwall * Increment Patch Version * Increment Minor Version --------- Co-authored-by: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com> --- Gemfile.lock | 2 +- lib/adiwg/mdtranslator/version.rb | 2 +- .../writers/html/sections/html_dataQuality.rb | 18 +- .../html/sections/html_dataQualityReport.rb | 115 ++++--- .../writers/simple_html/sections/html_body.rb | 29 +- .../simple_html/sections/html_bodyScript.js | 317 ------------------ .../simple_html/sections/html_dataQuality.rb | 20 +- .../sections/html_dataQualityReport.rb | 125 +++---- .../sections/html_geographicExtent.rb | 10 - .../simple_html/sections/html_scope.rb | 22 +- 10 files changed, 172 insertions(+), 488 deletions(-) delete mode 100644 lib/adiwg/mdtranslator/writers/simple_html/sections/html_bodyScript.js diff --git a/Gemfile.lock b/Gemfile.lock index c8c4d3171..f2110490e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - adiwg-mdtranslator (2.19.1) + adiwg-mdtranslator (2.20.0) adiwg-mdcodes (= 2.9.0) adiwg-mdjson_schemas (= 2.8.2) builder (~> 3.2) diff --git a/lib/adiwg/mdtranslator/version.rb b/lib/adiwg/mdtranslator/version.rb index d748c435c..2544673ee 100644 --- a/lib/adiwg/mdtranslator/version.rb +++ b/lib/adiwg/mdtranslator/version.rb @@ -109,7 +109,7 @@ module ADIWG module Mdtranslator # current mdtranslator version - VERSION = "2.19.1" + VERSION = "2.20.0" end end diff --git a/lib/adiwg/mdtranslator/writers/html/sections/html_dataQuality.rb b/lib/adiwg/mdtranslator/writers/html/sections/html_dataQuality.rb index e9ec1001e..9bc748d16 100644 --- a/lib/adiwg/mdtranslator/writers/html/sections/html_dataQuality.rb +++ b/lib/adiwg/mdtranslator/writers/html/sections/html_dataQuality.rb @@ -17,11 +17,11 @@ def writeHtml(hDataQuality) dataQualityReportClass = Html_DataQualityReport.new(@html) # scope - unless hDataQuality[:scope].nil? || hDataQuality[:scope].empty? - @html.section(class: 'block') do + unless hDataQuality[:scope].empty? + @html.section(:class => 'block') do @html.details do @html.summary('Scope', {'class' => 'h4'}) - @html.section(class: 'block') do + @html.section(:class => 'block') do scopeClass.writeHtml(hDataQuality[:scope]) end end @@ -33,20 +33,20 @@ def writeHtml(hDataQuality) ( hDataQuality[:standaloneReport][:abstract].nil? && hDataQuality[:standaloneReport][:reportReference].nil? ) report = hDataQuality[:standaloneReport] - @html.section(class: 'block') do + @html.section(:class => 'block') do @html.details do @html.summary('Standalone Quality Report', {'class' => 'h4'}) unless report[:abstract].nil? - @html.section(class: 'block') do + @html.section(:class => 'block') do @html.em('Abstract:') @html.text!(report[:abstract]) end end unless report[:reportReference].nil? - @html.section(class: 'block') do + @html.section(:class => 'block') do @html.details do @html.summary('Report Reference', {'class' => 'h5'}) - @html.section(class: 'block') do + @html.section(:class => 'block') do citationClass.writeHtml(report[:reportReference]) end end @@ -58,11 +58,11 @@ def writeHtml(hDataQuality) # reports unless hDataQuality[:report].nil? || hDataQuality[:report].empty? - @html.section(class: 'block') do + @html.section(:class => 'block') do @html.details do @html.summary('Reports', {'class' => 'h4'}) hDataQuality[:report].each do |report| - @html.section(class: 'block') do + @html.section(:class => 'block') do @html.details do @html.summary('Report', {'class' => 'h5'}) dataQualityReportClass.writeHtml(report) diff --git a/lib/adiwg/mdtranslator/writers/html/sections/html_dataQualityReport.rb b/lib/adiwg/mdtranslator/writers/html/sections/html_dataQualityReport.rb index b462d6dd8..b5d47ab9c 100644 --- a/lib/adiwg/mdtranslator/writers/html/sections/html_dataQualityReport.rb +++ b/lib/adiwg/mdtranslator/writers/html/sections/html_dataQualityReport.rb @@ -4,6 +4,7 @@ require_relative 'html_spatialRepresentation' require_relative 'html_format' require_relative 'html_resultFile' +require_relative 'html_coverageInfo' module ADIWG module Mdtranslator @@ -15,22 +16,22 @@ def initialize(html) end def writeHtml(hDataQualityReport) - @html.section(class: 'block') do + @html.section(:class => 'block') do writeQualityMeasure(hDataQualityReport[:qualityMeasure]) unless hDataQualityReport[:qualityMeasure].empty? end - @html.section(class: 'block') do + @html.section(:class => 'block') do writeEvaluationMethod(hDataQualityReport[:evaluationMethod]) unless hDataQualityReport[:evaluationMethod].empty? end - @html.section(class: 'block') do + @html.section(:class => 'block') do writeConformanceResult(hDataQualityReport[:conformanceResult]) unless hDataQualityReport[:conformanceResult].empty? end - @html.section(class: 'block') do + @html.section(:class => 'block') do writeCoverageResult(hDataQualityReport[:coverageResult]) unless hDataQualityReport[:coverageResult].empty? end - @html.section(class: 'block') do + @html.section(:class => 'block') do writeDescriptiveResult(hDataQualityReport[:descriptiveResult]) unless hDataQualityReport[:descriptiveResult].empty? end - @html.section(class: 'block') do + @html.section(:class => 'block') do writeQuantitativeResult(hDataQualityReport[:quantitativeResult]) unless hDataQualityReport[:quantitativeResult].empty? end end @@ -42,12 +43,12 @@ def writeQualityMeasure(qualityMeasure) @html.details do @html.summary('Quality Measure', {'class' => 'h5'}) - @html.section(class: 'block') do + @html.section(:class => 'block') do # Identifier unless qualityMeasure[:identifier].empty? @html.details do @html.summary('Identifier', {'class' => 'h5'}) - @html.section(class: 'block') do + @html.section(:class => 'block') do identifierClass.writeHtml(qualityMeasure[:identifier]) end end @@ -75,7 +76,7 @@ def writeEvaluationMethod(evaluationMethod) @html.details do @html.summary('Evaluation Method', {'class' => 'h5'}) - @html.section(class: 'block') do + @html.section(:class => 'block') do # Type unless evaluationMethod[:type].nil? @html.em('Type: ') @@ -90,18 +91,19 @@ def writeEvaluationMethod(evaluationMethod) @html.text!(datetime) @html.br end + @html.br end # MethodDescription unless evaluationMethod[:methodDescription].nil? - @html.em('evaluationMethod Description: ') + @html.em('Evaluation Method Description: ') @html.text!(evaluationMethod[:methodDescription]) @html.br end # EvaluationMethodType unless evaluationMethod[:evaluationMethodType].nil? - @html.em('Evaluation evaluationMethod Type: ') + @html.em('Evaluation Method Type: ') @html.text!(evaluationMethod[:evaluationMethodType]) @html.br end @@ -135,21 +137,21 @@ def writeEvaluationMethod(evaluationMethod) end # EvaluationProcedure - unless evaluationMethod[:evaluationProcedure].nil? || evaluationMethod[:evaluationProcedure].empty? + unless evaluationMethod[:evaluationProcedure].empty? @html.details do @html.summary('Evaluation Procedure', {'class' => 'h5'}) - @html.section(class: 'block') do + @html.section(:class => 'block') do citationClass.writeHtml(evaluationMethod[:evaluationProcedure]) end end end # ReferenceDocument - unless evaluationMethod[:referenceDocument].nil? || evaluationMethod[:referenceDocument].empty? + unless evaluationMethod[:referenceDocuments].empty? @html.details do @html.summary('Reference Document', {'class' => 'h5'}) - evaluationMethod[:referenceDocument].each do |doc| - @html.section(class: 'block') do + evaluationMethod[:referenceDocuments].each do |doc| + @html.section(:class => 'block') do citationClass.writeHtml(doc) end end @@ -161,12 +163,12 @@ def writeEvaluationMethod(evaluationMethod) def writeConformanceResult(conformanceResult) citationClass = Html_Citation.new(@html) - scopeClass = Html_Scope.new(@html) # Assuming there's a class to handle scope objects + scopeClass = Html_Scope.new(@html) @html.details do @html.summary('Conformance Result', {'class' => 'h5'}) conformanceResult.each do |result| - @html.section(class: 'block') do + @html.section(:class => 'block') do # DateTime unless result[:dateTime].nil? @html.em('Date Time: ') @@ -175,20 +177,20 @@ def writeConformanceResult(conformanceResult) end # Scope - unless result[:scope].nil? || result[:scope].empty? + unless result[:scope].empty? @html.details do @html.summary('Scope', {'class' => 'h5'}) - @html.section(class: 'block') do + @html.section(:class => 'block') do scopeClass.writeHtml(result[:scope]) end end end # Specification (citation) - unless result[:specification].nil? + unless result[:specification].empty? @html.details do @html.summary('Specification', {'class' => 'h5'}) - @html.section(class: 'block') do + @html.section(:class => 'block') do citationClass.writeHtml(result[:specification]) end end @@ -213,15 +215,16 @@ def writeConformanceResult(conformanceResult) end def writeCoverageResult(coverageResult) - scopeClass = Html_Scope.new(@html) # Assuming a class to handle scope objects - spatialRepresentationClass = Html_SpatialRepresentation.new(@html) # Assuming a class to handle spatialRepresentation objects + scopeClass = Html_Scope.new(@html) + spatialRepresentationClass = Html_SpatialRepresentation.new(@html) formatClass = Html_Format.new(@html) resultFileClass = Html_ResultFile.new(@html) + coverageInfoClass = Html_CoverageInfo.new(@html) @html.details do @html.summary('Coverage Result', {'class' => 'h5'}) coverageResult.each do |result| - @html.section(class: 'block') do + @html.section(:class => 'block') do # DateTime unless result[:dateTime].nil? @html.em('Date Time: ') @@ -230,56 +233,62 @@ def writeCoverageResult(coverageResult) end # Scope - unless result[:scope].nil? || result[:scope].empty? + unless result[:scope].empty? @html.details do @html.summary('Scope', {'class' => 'h5'}) - @html.section(class: 'block') do + @html.section(:class => 'block') do scopeClass.writeHtml(result[:scope]) end end end # SpatialRepresentationType - unless result[:spatialRepresentationType].nil? || result[:spatialRepresentationType].empty? + unless result[:spatialRepresentationType].nil? @html.em('Spatial Representation Type: ') @html.text!(result[:spatialRepresentationType]) @html.br end # SpatialRepresentation - unless result[:spatialRepresentation].nil? || result[:spatialRepresentation].empty? + unless result[:spatialRepresentation].empty? @html.details do @html.summary('Spatial Representation', {'class' => 'h5'}) - @html.section(class: 'block') do + @html.section(:class => 'block') do spatialRepresentationClass.writeHtml(result[:spatialRepresentation]) end end end - # ResultContent - unless result[:resultContent].nil? || result[:resultContent].empty? - @html.em('Result Content: ') - result[:resultContent].each do |content| - @html.text!(content) - @html.br + # ResultContentDescription + unless result[:resultContentDescription].empty? + @html.details do + @html.summary('Result Content Description', {'class' => 'h5'}) + @html.section(:class => 'block') do + coverageInfoClass.writeHtml(result[:resultContentDescription]) + end end end # ResourceFormat - unless result[:resourceFormat].nil? - @html.em('Resource Format: ') - @html.section(class: 'block') do - formatClass.writeHtml(result[:resourceFormat]) + unless result[:resourceFormat].empty? + @html.details do + @html.summary('Resource Format', {'class' => 'h5'}) + @html.section(:class => 'block') do + formatClass.writeHtml(result[:resourceFormat]) + end end end # ResultFile - unless result[:resultFile].nil? - @html.em('Result File: ') - @html.section(class: 'block') do - resultFileClass.writeHtml(result[:resultFile]) + unless result[:resultFile].empty? + @html.details do + @html.summary('Result File', {'class' => 'h5'}) + @html.section(:class => 'block') do + resultFileClass.writeHtml(result[:resultFile]) + end end end + end end end @@ -291,7 +300,7 @@ def writeDescriptiveResult(descriptiveResult) @html.details do @html.summary('Descriptive Result', {'class' => 'h5'}) descriptiveResult.each do |result| - @html.section(class: 'block') do + @html.section(:class => 'block') do # DateTime unless result[:dateTime].nil? @html.em('Date Time: ') @@ -300,10 +309,10 @@ def writeDescriptiveResult(descriptiveResult) end # Scope - unless result[:scope].nil? + unless result[:scope].empty? @html.details do @html.summary('Scope', {'class' => 'h5'}) - @html.section(class: 'block') do + @html.section(:class => 'block') do scopeClass.writeHtml(result[:scope]) end end @@ -321,12 +330,12 @@ def writeDescriptiveResult(descriptiveResult) end def writeQuantitativeResult(quantitativeResult) - scopeClass = Html_Scope.new(@html) # Assuming a class to handle scope objects + scopeClass = Html_Scope.new(@html) @html.details do @html.summary('Quantitative Result', {'class' => 'h5'}) quantitativeResult.each do |result| - @html.section(class: 'block') do + @html.section(:class => 'block') do # DateTime unless result[:dateTime].nil? @html.em('Date Time: ') @@ -335,19 +344,19 @@ def writeQuantitativeResult(quantitativeResult) end # Scope - unless result[:scope].nil? + unless result[:scope].empty? @html.details do @html.summary('Scope', {'class' => 'h5'}) - @html.section(class: 'block') do + @html.section(:class => 'block') do scopeClass.writeHtml(result[:scope]) end end end # Value - unless result[:value].nil? || result[:value].empty? + unless result[:values].empty? @html.em('Value: ') - @html.text!(result[:value].join(', ')) + @html.text!(result[:values].join(', ')) @html.br end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_body.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_body.rb index 429ff6fbb..2b66667dc 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_body.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_body.rb @@ -129,6 +129,7 @@ def writeHtml(version, intObj) unless aContacts.empty? @html.div do @html.h2('Contacts', {'id' => 'body-contacts', 'class' => 'h2'}) + @html.span('', {'style' => 'mso-bookmark:body-contacts'}) @html.div(:class => 'block') do aContacts.each do |hContact| @html.div(:class => 'block') do @@ -144,6 +145,7 @@ def writeHtml(version, intObj) unless hMetaInfo.empty? @html.div do @html.h2('Metadata Information', {'id' => 'body-metadataInfo', 'class' => 'h2'}) + @html.span('', {'style' => 'mso-bookmark:body-metadataInfo'}) @html.div(:class => 'block') do @html.div(:class => 'block') do metaInfoClass.writeHtml(hMetaInfo) @@ -157,7 +159,8 @@ def writeHtml(version, intObj) unless hResourceInfo.empty? @html.div do @html.h2('Resource Information', {'id' => 'body-resourceInfo', 'class' => 'h2'}) - @html.div(:class => 'block') do + @html.span('', {'style' => 'mso-bookmark:body-resourceInfo'}) + @html.div(:class => 'block') do resourceClass.writeHtml(hResourceInfo) end @html.hr @@ -167,6 +170,7 @@ def writeHtml(version, intObj) unless aDataQuality.nil? || aDataQuality.empty? @html.div do @html.h2('Data Quality', {'id' => 'body-dataQuality', 'class' => 'h2'}) + @html.span('', {'style' => 'mso-bookmark:body-dataQuality'}) aDataQuality.each do |hDataQuality| @html.div(:class => 'block') do dataQualityClass.writeHtml(hDataQuality) @@ -179,6 +183,7 @@ def writeHtml(version, intObj) unless aLineage.empty? @html.div do @html.h2('Resource Lineage', {'id' => 'body-lineage', 'class' => 'h2'}) + @html.span('', {'style' => 'mso-bookmark:body-lineage'}) @html.div(:class => 'block') do aLineage.each do |hLineage| @html.div do @@ -197,6 +202,7 @@ def writeHtml(version, intObj) unless aDistribution.empty? @html.div do @html.h2('Resource Distribution', {'id' => 'body-distribution', 'class' => 'h2'}) + @html.span('', {'style' => 'mso-bookmark:body-distribution'}) @html.div(:class => 'block') do aDistribution.each do |hDistribution| @html.div do @@ -215,6 +221,7 @@ def writeHtml(version, intObj) unless aAssociated.empty? @html.div do @html.h2('Associated Resources', {'id' => 'body-associatedResource', 'class' => 'h2'}) + @html.span('', {'style' => 'mso-bookmark:body-associatedResource'}) @html.div(:class => 'block') do aAssociated.each do |hAssociated| @html.div do @@ -233,6 +240,7 @@ def writeHtml(version, intObj) unless aAdditional.empty? @html.div do @html.h2('Additional Documentation', {'id' => 'body-additionalDocument', 'class' => 'h2'}) + @html.span('', {'style' => 'mso-bookmark:body-additionalDocument'}) @html.div(:class => 'block') do aAdditional.each do |hAdditional| @html.div do @@ -251,6 +259,7 @@ def writeHtml(version, intObj) unless aDictionaries.empty? @html.div do @html.h2('Data Dictionaries', {'id' => 'body-dataDictionary', 'class' => 'h2'}) + @html.span('', {'style' => 'mso-bookmark:body-dataDictionary'}) @html.div(:class => 'block') do aDictionaries.each do |hDictionary| @html.div do @@ -268,6 +277,7 @@ def writeHtml(version, intObj) unless aFunding.empty? @html.div do @html.h2('Funding', {'id' => 'body-funding', 'class' => 'h2'}) + @html.span('', {'style' => 'mso-bookmark:body-funding'}) @html.div(:class => 'block') do aFunding.each do |hFunding| @html.div do @@ -285,6 +295,7 @@ def writeHtml(version, intObj) unless aRepositories.empty? @html.div do @html.h2('Metadata Repositories', {'id' => 'body-repository', 'class' => 'h2'}) + @html.span('', {'style' => 'mso-bookmark:body-repository'}) @html.div(:class => 'block') do aRepositories.each do |hRepository| @html.div do @@ -298,22 +309,6 @@ def writeHtml(version, intObj) end end - # load leaflet - @html.link( :rel => 'stylesheet', :href => 'https://unpkg.com/leaflet@1.0.3/dist/leaflet.css') - @html.script('', :src => 'https://unpkg.com/leaflet@1.0.3/dist/leaflet.js') - @html.script('', :src => 'https://stamen-maps.a.ssl.fastly.net/js/tile.stamen.js') - - # add inline javascript - # read javascript from file - path = File.join(File.dirname(__FILE__), 'html_bodyScript.js') - file = File.open(path, 'r') - bodyJS = file.read - file.close - - @html.script('type'=>'text/javascript') do - @html << bodyJS - end - end # body end # writeHtml end # Html_Body diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_bodyScript.js b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_bodyScript.js deleted file mode 100644 index a88cde78e..000000000 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_bodyScript.js +++ /dev/null @@ -1,317 +0,0 @@ - -//forEach Polyfill, Reference: https://goo.gl/hFIfSd -if (!Array.prototype.forEach) { - Array.prototype.forEach = function(callback, thisArg) { - var T, k; - if (this === null || this === undefined) { - throw new TypeError(' this is null or not defined'); - } - var O = Object(this); - var len = O.length >>> 0; - if ( typeof callback !== "function") { - throw new TypeError(callback + ' is not a function'); - } - if (arguments.length > 1) { - T = thisArg; - } - k = 0; - while (k < len) { - var kValue; - if ( k in O) { - kValue = O[k]; - callback.call(T, kValue, k, O); - } - k++; - } - }; -} - -// open detail panel in the document -function openDetail(evt) { - var href = evt.target.getAttribute("href"); - href = href.slice(1); - - if(window.location !== window.parent.location){ - evt.preventDefault(); - var el = document.getElementById(href); - window.scrollTo(0, el.offsetTop); - } - var parentNode = document.getElementById(href).parentNode; - parentNode.open = true; -} - -// open all detail panels in the document -function openAllDetails(evt) { - if(window.location !== window.parent.location){ - evt.preventDefault(); - } - var arr = document.getElementsByTagName("details"); - var len = arr.length; - - for (var i = 0; i < len; i++) { - arr[i].open = true; - } -} - -// close all detail panels in the document -function closeAllDetails(evt) { - if(window.location !== window.parent.location){ - evt.preventDefault(); - } - var arr = document.getElementsByTagName("details"); - var len = arr.length; - - for (var i = 0; i < len; i++) { - arr[i].open = false; - } -} - -// add event listeners to all anchor buttons in the sideNav -var navBtnList = document.querySelectorAll('a.navBtn'); -var navBtnArray = Array.prototype.slice.call(navBtnList); -navBtnArray.forEach(function(btn, btnIdx, btnArr) { - var href = btn.getAttribute("href").slice(1); - var target = document.getElementById(href); - //hide button if target is not present - if(target) { - btn.addEventListener("click", openDetail, false); - } else { - btn.style.display = 'none'; - } -}); - -// add event listener to openAllButton -var elOpen = document.getElementById("openAllButton"); -elOpen.addEventListener("click", openAllDetails, false); - -// add event listener to closeAllButton -var elClose = document.getElementById("closeAllButton"); -elClose.addEventListener("click", closeAllDetails, false); - -//replace top links in inframes -if(window.location !== window.parent.location){ - // add event listeners to all "top" links - var topList = document.querySelectorAll("a[href='#']"); - var topArray = Array.prototype.slice.call(topList); - topArray.forEach(function(a) { - a.addEventListener("click", function(evt) { - evt.preventDefault(); - window.scrollTo(0,0); - }, false); - }); -} - -if ( typeof L === "object") { - (function() { - - var westBound; - var eastBound; - - var coordsToLatLng = function(coords) { - // if computed bounding box spans the antimeridian - // add 360 to negative longitudes - var longitude = coords[0]; - if (westBound >= 0 && eastBound < 0) { - if (longitude < 0) { - longitude += 360; - } - } - var latitude = coords[1]; - return L.latLng(latitude, longitude); - }; - - var bbox2Poly = function(bbox) { - var bboxJson = JSON.parse(bbox.textContent || bbox.innerText); - var sw = [ bboxJson.westLongitude, bboxJson.southLatitude ]; - var nw = [ bboxJson.westLongitude, bboxJson.northLatitude ]; - var ne = [ bboxJson.eastLongitude, bboxJson.northLatitude ]; - var se = [ bboxJson.eastLongitude, bboxJson.southLatitude ]; - var coords = []; - coords.push(sw); - coords.push(nw); - coords.push(ne); - coords.push(se); - var bboxCoods = []; - bboxCoods.push(coords); - return bboxCoods; - }; - - // collect all geographicExtents sections in document - var geoExtentNodeList = document.querySelectorAll('section.extent-geographic'); - var geoExtents = Array.prototype.slice.call(geoExtentNodeList); - - var check = function(i, me, bnds) { - if (i < 3) { - var resize = me.getSize().x === 0 && me.getContainer().offsetWidth > 0; - - me.invalidateSize(); - if (resize) { - me.fitBounds(bnds); - } else { - i++; - setTimeout(function() { - check(i, me, bnds); - }, 100); - } - } - }; - - geoExtents.forEach(function(geoExtent, idx, arr) { - // instantiate a leaflet map in the map div - var map = L.map(geoExtent.querySelector('div.map'), {noWrap: true}); - // get a pointer to the map header switch - var header = geoExtent.querySelector('summary.map-summary'); - // get the GeoJSON from the geojson div - var geoJsonDiv = geoExtent.querySelector('div.geojson'); - if (geoJsonDiv) { - var geojson = JSON.parse(geoJsonDiv.textContent || geoJsonDiv.innerText); - } - else { - var geojson = []; - } - // get the user provided bounding box for the extent - if any - var userBBox = geoExtent.querySelector('div.userBBox'); - if (userBBox) { - var userCoords = bbox2Poly(userBBox); - var newUserBBox = { - "type": "Feature", - "geometry": { - "type": "Polygon", - "coordinates": userCoords - }, - "properties": { - "style": { - "color": '#f00', - "fill": false - }, - "featureName": [ - "User BBOX" - ] - } - }; - geojson.push(newUserBBox); - } - - // get the computed bounding box for the extent - always one - var computedBBox = geoExtent.querySelector('div.computedBBox'); - if (computedBBox) { - var compCoords = bbox2Poly(computedBBox); - var newCompBBox = { - "type": "Feature", - "geometry": { - "type": "Polygon", - "coordinates": compCoords - }, - "properties": { - "style": { - "color": '#0f0', - "fill": false - }, - "featureName": [ - "Computed BBOX" - ] - } - }; - geojson.push(newCompBBox); - westBound = compCoords[0][0][0]; - eastBound = compCoords[0][2][0]; - } - - var pointCnt = 0; - var lineStringCnt = 0; - var polygonCnt = 0; - var geoCollectCnt = 0; - var featureCnt = 0; - - geojson.forEach(function(geo, geoIdx, geoArr) { - - // make sure each geo has a properties object - if (!geo.properties) { - geo.properties = {}; - } - - // add popup information - if (geo.type === "Point") { - pointCnt += 1; - geo.properties.popup = "Point " + pointCnt; - } - if (geo.type === 'LineString') { - lineStringCnt += 1; - geo.properties.popup = "LineString " + lineStringCnt; - } - if (geo.type === 'Polygon') { - polygonCnt += 1; - geo.properties.popup = "Polygon " + polygonCnt; - } - if (geo.type === 'GeometryCollection') { - geoCollectCnt += 1; - geo.properties.popup = "Geometry Collection " + geoCollectCnt; - // popup can't find properties on collection objects - // placed popup on geometry collection instead - // geo.geometries.forEach(function (geoG, geoGIdx, geoGArr) { - // geoG.properties = {}; - // geoG.properties.popup = "Geometry Collection " + geoCollectCnt + " " + geoG.type; - // }); - } - if (geo.type === 'Feature') { - featureCnt += 1; - var featureName; - if (geo.properties.featureName !== undefined) { - featureName = geo.properties.featureName[0] || geo.id || geo.geometry.type; - } else featureName = geo.id || "Feature " + featureCnt + " " + geo.geometry.type; - geo.properties.popup = featureName; - } - if (geo.type === 'FeatureCollection') { - geo.features.forEach(function (geoF, geoFIdx, geoFArr) { - featureCnt += 1; - var featureName; - if (geoF.properties.featureName !== undefined) { - featureName = geoF.properties.featureName[0] || geoF.id || geoF.geometry.type; - } else featureName = geoF.id || "Feature " + featureCnt + " " + geoF.geometry.type; - geoF.properties.popup = featureName; - }); - } - - }); - - var geoLayer = L.geoJSON(geojson, { - style: function(feature) { - return feature.properties.style || {}; - }, - coordsToLatLng: coordsToLatLng, - onEachFeature: function (feature, layer) { - layer.bindPopup(feature.properties.popup,{ - closeButton: true - }); - } - }).addTo(map); - - var bnds = geoLayer.getBounds(); - map.fitBounds(bnds); - - L.DomEvent.addListener(header, 'click', function() { - var me = this; - var i = 0; - - setTimeout(function() { - check(i, me, bnds); - }, 100); - - }, map); - - L.DomEvent.addListener(L.DomUtil.get('openAllButton'), 'click', function() { - var me = this; - var i = 0; - - setTimeout(function() { - check(i, me, bnds); - }, 100); - - }, map); - - // map.addLayer(new L.TileLayer.OSM()); - var stamen = new L.StamenTileLayer("terrain"); - map.addLayer(stamen); - }); - })(); -} diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQuality.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQuality.rb index af6c37518..9c4664926 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQuality.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQuality.rb @@ -17,12 +17,10 @@ def writeHtml(hDataQuality) dataQualityReportClass = Html_DataQualityReport.new(@html) unless hDataQuality[:scope].empty? - @html.div(class: 'block') do - @html.div do - @html.h5('Scope', {'class' => 'h5'}) - @html.div(class: 'block') do - scopeClass.writeHtml(hDataQuality[:scope]) - end + @html.div do + @html.h5('Scope', {'class' => 'h5'}) + @html.div(:class => 'block') do + scopeClass.writeHtml(hDataQuality[:scope]) end end end @@ -33,11 +31,11 @@ def writeHtml(hDataQuality) hDataQuality[:standaloneQualityReport][:reportReference].nil? ) report = hDataQuality[:standaloneQualityReport] - @html.div(class: 'block') do + @html.div(:class => 'block') do @html.div do @html.h5('Standalone Quality Report', {'class' => 'h5'}) unless report[:abstract].nil? - @html.div(class: 'block') do + @html.div(:class =>'block') do @html.em('Abstract:') @html.text!(report[:abstract]) end @@ -46,7 +44,7 @@ def writeHtml(hDataQuality) unless report[:reportReference].nil? @html.div do @html.h5('Report Reference', {'class' => 'h5'}) - @html.div(class: 'block') do + @html.div(:class =>'block') do citationClass.writeHtml(report[:reportReference]) end end @@ -58,11 +56,11 @@ def writeHtml(hDataQuality) # reports unless hDataQuality[:report].empty? - @html.div(class: 'block') do + @html.div(:class =>'block') do @html.div do @html.h4('Reports', {'class' => 'h4'}) hDataQuality[:report].each do |report| - @html.div(class: 'block') do + @html.div(:class =>'block') do @html.div do @html.h5('Report', {'class' => 'h5'}) dataQualityReportClass.writeHtml(report) diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQualityReport.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQualityReport.rb index 8dd8ce00c..2049d61af 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQualityReport.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQualityReport.rb @@ -2,8 +2,9 @@ require_relative 'html_identifier' require_relative 'html_scope' require_relative 'html_spatialRepresentation' -require_relative 'html_resultFile' require_relative 'html_format' +require_relative 'html_resultFile' +require_relative 'html_coverageInfo' module ADIWG module Mdtranslator @@ -15,22 +16,22 @@ def initialize(html) end def writeHtml(hDataQualityReport) - @html.div(class: 'block') do - writeQualityMeasure(hDataQualityReport[:qualityMeasure]) unless hDataQualityReport[:qualityMeasure].nil? + @html.div(:class => 'block') do + writeQualityMeasure(hDataQualityReport[:qualityMeasure]) unless hDataQualityReport[:qualityMeasure].empty? end - @html.div(class: 'block') do + @html.div(:class => 'block') do writeEvaluationMethod(hDataQualityReport[:evaluationMethod]) unless hDataQualityReport[:evaluationMethod].empty? end - @html.div(class: 'block') do + @html.div(:class => 'block') do writeConformanceResult(hDataQualityReport[:conformanceResult]) unless hDataQualityReport[:conformanceResult].empty? end - @html.div(class: 'block') do + @html.div(:class => 'block') do writeCoverageResult(hDataQualityReport[:coverageResult]) unless hDataQualityReport[:coverageResult].empty? end - @html.div(class: 'block') do + @html.div(:class => 'block') do writeDescriptiveResult(hDataQualityReport[:descriptiveResult]) unless hDataQualityReport[:descriptiveResult].empty? end - @html.div(class: 'block') do + @html.div(:class => 'block') do writeQuantitativeResult(hDataQualityReport[:quantitativeResult]) unless hDataQualityReport[:quantitativeResult].empty? end end @@ -42,12 +43,12 @@ def writeQualityMeasure(qualityMeasure) @html.div do @html.h5('Quality Measure', {'class' => 'h5'}) - @html.div(class: 'block') do + @html.div(:class => 'block') do # Identifier unless qualityMeasure[:identifier].empty? @html.div do @html.h5('Identifier', {'class' => 'h5'}) - @html.div(class: 'block') do + @html.div(:class => 'block') do identifierClass.writeHtml(qualityMeasure[:identifier]) end end @@ -75,7 +76,7 @@ def writeEvaluationMethod(evaluationMethod) @html.div do @html.h5('Evaluation Method', {'class' => 'h5'}) - @html.div(class: 'block') do + @html.div(:class => 'block') do # Type unless evaluationMethod[:type].nil? @html.em('Type: ') @@ -86,10 +87,11 @@ def writeEvaluationMethod(evaluationMethod) # DateTime unless evaluationMethod[:dateTime].nil? @html.em('Date Time: ') - evaluationMethod[:dateTime].each do |dt| - @html.text!(dt) + evaluationMethod[:dateTime].each do |datetime| + @html.text!(datetime) @html.br end + @html.br end # MethodDescription @@ -135,21 +137,21 @@ def writeEvaluationMethod(evaluationMethod) end # EvaluationProcedure - unless evaluationMethod[:evaluationProcedure].nil? || evaluationMethod[:evaluationProcedure].empty? + unless evaluationMethod[:evaluationProcedure].empty? @html.div do @html.h5('Evaluation Procedure', {'class' => 'h5'}) - @html.div(class: 'block') do + @html.div(:class => 'block') do citationClass.writeHtml(evaluationMethod[:evaluationProcedure]) end end end # ReferenceDocument - unless evaluationMethod[:referenceDocument].nil? || evaluationMethod[:referenceDocument].empty? + unless evaluationMethod[:referenceDocuments].empty? @html.div do @html.h5('Reference Document', {'class' => 'h5'}) - evaluationMethod[:referenceDocument].each do |doc| - @html.div(class: 'block') do + evaluationMethod[:referenceDocuments].each do |doc| + @html.div(:class => 'block') do citationClass.writeHtml(doc) end end @@ -161,12 +163,12 @@ def writeEvaluationMethod(evaluationMethod) def writeConformanceResult(conformanceResult) citationClass = Html_Citation.new(@html) - scopeClass = Html_Scope.new(@html) # Assuming there's a class to handle scope objects + scopeClass = Html_Scope.new(@html) @html.div do @html.h5('Conformance Result', {'class' => 'h5'}) conformanceResult.each do |result| - @html.div(class: 'block') do + @html.div(:class => 'block') do # DateTime unless result[:dateTime].nil? @html.em('Date Time: ') @@ -175,20 +177,20 @@ def writeConformanceResult(conformanceResult) end # Scope - unless result[:scope].nil? || result[:scope].empty? + unless result[:scope].empty? @html.div do @html.h5('Scope', {'class' => 'h5'}) - @html.div(class: 'block') do + @html.div(:class => 'block') do scopeClass.writeHtml(result[:scope]) end end end # Specification (citation) - unless result[:specification].nil? + unless result[:specification].empty? @html.div do @html.h5('Specification', {'class' => 'h5'}) - @html.div(class: 'block') do + @html.div(:class => 'block') do citationClass.writeHtml(result[:specification]) end end @@ -213,15 +215,16 @@ def writeConformanceResult(conformanceResult) end def writeCoverageResult(coverageResult) - scopeClass = Html_Scope.new(@html) # Assuming a class to handle scope objects - spatialRepresentationClass = Html_SpatialRepresentation.new(@html) # Assuming a class to handle spatialRepresentation objects - resultFileClass = Html_ResultFile.new(@html) # Assuming a class to handle resultFile objects - formatClass = Html_Format.new(@html) # Assuming a class to handle format objects + scopeClass = Html_Scope.new(@html) + spatialRepresentationClass = Html_SpatialRepresentation.new(@html) + formatClass = Html_Format.new(@html) + resultFileClass = Html_ResultFile.new(@html) + coverageInfoClass = Html_CoverageInfo.new(@html) @html.div do @html.h5('Coverage Result', {'class' => 'h5'}) coverageResult.each do |result| - @html.div(class: 'block') do + @html.div(:class => 'block') do # DateTime unless result[:dateTime].nil? @html.em('Date Time: ') @@ -230,68 +233,74 @@ def writeCoverageResult(coverageResult) end # Scope - unless result[:scope].nil? || result[:scope].empty? + unless result[:scope].empty? @html.div do @html.h5('Scope', {'class' => 'h5'}) - @html.div(class: 'block') do + @html.div(:class => 'block') do scopeClass.writeHtml(result[:scope]) end end end # SpatialRepresentationType - unless result[:spatialRepresentationType].nil? || result[:spatialRepresentationType].empty? + unless result[:spatialRepresentationType].nil? @html.em('Spatial Representation Type: ') @html.text!(result[:spatialRepresentationType]) @html.br end # SpatialRepresentation - unless result[:spatialRepresentation].nil? || result[:spatialRepresentation].empty? + unless result[:spatialRepresentation].empty? @html.div do @html.h5('Spatial Representation', {'class' => 'h5'}) - @html.div(class: 'block') do + @html.div(:class => 'block') do spatialRepresentationClass.writeHtml(result[:spatialRepresentation]) end end end - # ResultContent - unless result[:resultContent].nil? || result[:resultContent].empty? - @html.em('Result Content: ') - result[:resultContent].each do |content| - @html.text!(content) - @html.br + # ResultContentDescription + unless result[:resultContentDescription].empty? + @html.div do + @html.div('Result Content Description', {'class' => 'h5'}) + @html.div(:class => 'block') do + coverageInfoClass.writeHtml(result[:resultContentDescription]) + end end end # ResourceFormat - unless result[:resourceFormat].nil? - @html.em('Resource Format: ') - @html.div(class: 'block') do - formatClass.writeHtml(result[:resourceFormat]) + unless result[:resourceFormat].empty? + @html.div do + @html.div('Resource Format', {'class' => 'h5'}) + @html.div(:class => 'block') do + formatClass.writeHtml(result[:resourceFormat]) + end end end # ResultFile - unless result[:resultFile].nil? - @html.em('Result File: ') - @html.div(class: 'block') do - resultFileClass.writeHtml(result[:resultFile]) + unless result[:resultFile].empty? + @html.div do + @html.div('Result File', {'class' => 'h5'}) + @html.div(:class => 'block') do + resultFileClass.writeHtml(result[:resultFile]) + end end end + end end end end def writeDescriptiveResult(descriptiveResult) - scopeClass = Html_Scope.new(@html) # Assuming a class to handle scope objects + scopeClass = Html_Scope.new(@html) @html.div do @html.h5('Descriptive Result', {'class' => 'h5'}) descriptiveResult.each do |result| - @html.div(class: 'block') do + @html.div(:class => 'block') do # DateTime unless result[:dateTime].nil? @html.em('Date Time: ') @@ -300,10 +309,10 @@ def writeDescriptiveResult(descriptiveResult) end # Scope - unless result[:scope].nil? + unless result[:scope].empty? @html.div do @html.h5('Scope', {'class' => 'h5'}) - @html.div(class: 'block') do + @html.div(:class => 'block') do scopeClass.writeHtml(result[:scope]) end end @@ -321,12 +330,12 @@ def writeDescriptiveResult(descriptiveResult) end def writeQuantitativeResult(quantitativeResult) - scopeClass = Html_Scope.new(@html) # Assuming a class to handle scope objects + scopeClass = Html_Scope.new(@html) @html.div do @html.h5('Quantitative Result', {'class' => 'h5'}) quantitativeResult.each do |result| - @html.div(class: 'block') do + @html.div(:class => 'block') do # DateTime unless result[:dateTime].nil? @html.em('Date Time: ') @@ -335,19 +344,19 @@ def writeQuantitativeResult(quantitativeResult) end # Scope - unless result[:scope].nil? + unless result[:scope].empty? @html.div do @html.h5('Scope', {'class' => 'h5'}) - @html.div(class: 'block') do + @html.div(:class => 'block') do scopeClass.writeHtml(result[:scope]) end end end # Value - unless result[:value].nil? || result[:value].empty? + unless result[:values].empty? @html.em('Value: ') - @html.text!(result[:value].join(', ')) + @html.text!(result[:values].join(', ')) @html.br end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geographicExtent.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geographicExtent.rb index 0dc413c50..9974ba218 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geographicExtent.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geographicExtent.rb @@ -41,16 +41,6 @@ def writeHtml(hExtent) end end - # geographic extent - map {div} - @html.div do - @html.h5('Map', 'class' => 'h5 map-summary') - @html.div(:class => 'block') do - @html.div('class' => 'map', 'id' => 'map') do - # map drawn by html_bodyScript.js - end - end - end - # geographic extent - geographic element [] {geographicElement} unless hExtent[:geographicElements].empty? @html.div do diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_scope.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_scope.rb index 7b7e1ff65..2d8c0b35d 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_scope.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_scope.rb @@ -5,7 +5,7 @@ # Stan Smith 2017-03-25 original script require_relative 'html_scopeDescription' -# require_relative 'html_extent' +require_relative 'html_extent' module ADIWG module Mdtranslator @@ -22,7 +22,7 @@ def writeHtml(hScope) # classes used descriptionClass = Html_ScopeDescription.new(@html) - # extentClass = Html_Extent.new(@html) + extentClass = Html_Extent.new(@html) # scope - code unless hScope[:scopeCode].nil? @@ -41,15 +41,15 @@ def writeHtml(hScope) end end - # # scope - extent [] {extent} - # hScope[:extents].each do |hExtent| - # @html.div do - # @html.h5('Extent', {'class' => 'h5'}) - # @html.div(:class => 'block') do - # extentClass.writeHtml(hExtent) - # end - # end - # end + # scope - extent [] {extent} + hScope[:extents].each do |hExtent| + @html.div do + @html.h5('Extent', {'class' => 'h5'}) + @html.div(:class => 'block') do + extentClass.writeHtml(hExtent) + end + end + end end # writeHtml end # Html_Scope From e9965a050429e7fdb47e74e20b52517c733e06dd Mon Sep 17 00:00:00 2001 From: Johnathan Date: Mon, 12 Feb 2024 10:25:00 -0700 Subject: [PATCH 03/64] Feature/simple html (#345) * add geographicExtent to simple_html writer (#338) * add geographicExtent to simple_html writer * Fix Data Quality Fixed checks for nil and empty. Fixed tags. Fixed structures. * Fix Data Quality * Remove bodyScript and other js * Fix Typo referenceDocument -> referenceDocuments --------- Co-authored-by: Johnathan Aspinwall * add bookmark span tags to headers (#340) Co-authored-by: Johnathan Aspinwall * Increment Patch Version * Increment Minor Version * Bugfixes for Simple HTML (#343) * change divs to headers (#337) * change divs to headers * fix key within qualityMeasure. change to header tags * Simple HTML Enhancements (#339) * add geographicExtent to simple_html writer (#338) * add geographicExtent to simple_html writer * Fix Data Quality Fixed checks for nil and empty. Fixed tags. Fixed structures. * Fix Data Quality * Remove bodyScript and other js * Fix Typo referenceDocument -> referenceDocuments --------- Co-authored-by: Johnathan Aspinwall * add bookmark span tags to headers (#340) Co-authored-by: Johnathan Aspinwall * Increment Patch Version * Increment Minor Version --------- Co-authored-by: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com> --------- Co-authored-by: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com> * Increment Patch Version * Fix Data Quality * Increment Patch Version * simple_html output formatting (#344) --------- Co-authored-by: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com> --- Gemfile.lock | 2 +- lib/adiwg/mdtranslator/version.rb | 2 +- ...{class_quality.rb => class_dataQuality.rb} | 6 ++--- .../writers/fgdc/classes/class_fgdc.rb | 6 ++--- .../writers/simple_html/sections/html_body.rb | 17 +++--------- .../simple_html/sections/html_contact.rb | 10 +++---- .../simple_html/sections/html_keyword.rb | 26 +++++++++---------- .../simple_html/sections/html_metadataInfo.rb | 19 +++++++------- .../simple_html/sections/html_timePeriod.rb | 4 +-- test/readers/fgdc/tc_fgdc_quality.rb | 2 +- 10 files changed, 40 insertions(+), 54 deletions(-) rename lib/adiwg/mdtranslator/writers/fgdc/classes/{class_quality.rb => class_dataQuality.rb} (96%) diff --git a/Gemfile.lock b/Gemfile.lock index 071d441ee..f2110490e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - adiwg-mdtranslator (2.19.2) + adiwg-mdtranslator (2.20.0) adiwg-mdcodes (= 2.9.0) adiwg-mdjson_schemas (= 2.8.2) builder (~> 3.2) diff --git a/lib/adiwg/mdtranslator/version.rb b/lib/adiwg/mdtranslator/version.rb index 5a4cab3c0..2544673ee 100644 --- a/lib/adiwg/mdtranslator/version.rb +++ b/lib/adiwg/mdtranslator/version.rb @@ -109,7 +109,7 @@ module ADIWG module Mdtranslator # current mdtranslator version - VERSION = "2.19.2" + VERSION = "2.20.0" end end diff --git a/lib/adiwg/mdtranslator/writers/fgdc/classes/class_quality.rb b/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dataQuality.rb similarity index 96% rename from lib/adiwg/mdtranslator/writers/fgdc/classes/class_quality.rb rename to lib/adiwg/mdtranslator/writers/fgdc/classes/class_dataQuality.rb index 0e9f498af..8bd081912 100644 --- a/lib/adiwg/mdtranslator/writers/fgdc/classes/class_quality.rb +++ b/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dataQuality.rb @@ -12,7 +12,7 @@ module Mdtranslator module Writers module Fgdc - class Quality + class DataQuality def initialize(xml, hResponseObj) @xml = xml @@ -71,7 +71,7 @@ def writeXML(intObj) horizontal_positional_accuracy_report = hDataQuality[:report].find do |report| report[:type] == 'DQ_AbsoluteExternalPositionalAccuracy' && - report.dig(:qualityMeasure, :name).any? { |name| + report.dig(:qualityMeasure, :nameOfMeasure)&.any? { |name| name == 'Horizontal Positional Accuracy Report' } end @@ -81,7 +81,7 @@ def writeXML(intObj) vertical_positional_accuracy_report = hDataQuality[:report].find do |report| report[:type] == 'DQ_AbsoluteExternalPositionalAccuracy' && - report.dig(:qualityMeasure, :name).any? { |name| + report.dig(:qualityMeasure, :nameOfMeasure)&.any? { |name| name == 'Vertical Positional Accuracy Report' } end diff --git a/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb b/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb index 6713251d6..a8c3d9748 100644 --- a/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb +++ b/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb @@ -5,7 +5,7 @@ # Stan Smith 2017-11-16 original script require_relative 'class_identification' -require_relative 'class_quality' +require_relative 'class_dataQuality' require_relative 'class_spatialOrganization' require_relative 'class_spatialReference' require_relative 'class_dictionary' @@ -33,7 +33,7 @@ def writeXML(intObj) # classes used idClass = Identification.new(@xml, @hResponseObj) - qualityClass = Quality.new(@xml, @hResponseObj) + dataQualityClass = DataQuality.new(@xml, @hResponseObj) spaceOrgClass = SpatialOrganization.new(@xml, @hResponseObj) spaceRefClass = SpatialReference.new(@xml, @hResponseObj) dictionaryClass = DataDictionary.new(@xml, @hResponseObj) @@ -62,7 +62,7 @@ def writeXML(intObj) # currently only lineage is implemented unless intObj[:metadata][:lineageInfo].empty? @xml.tag!('dataqual') do - qualityClass.writeXML(intObj) + dataQualityClass.writeXML(intObj) end end if intObj[:metadata][:lineageInfo].empty? && @hResponseObj[:writerShowTags] diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_body.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_body.rb index 2b66667dc..3b2d14747 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_body.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_body.rb @@ -67,37 +67,25 @@ def writeHtml(version, intObj) @html.div('id' => 'sideNav') do # add section buttons - @html.a(' Top', {'href' => '#', 'class' => 'btn'}) @html.a(' Contacts', {'href' => '#body-contacts', 'class' => 'btn navBtn', 'id' => 'contactButton'}) @html.a(' Metadata', {'href' => '#body-metadataInfo', 'class' => 'btn navBtn', 'id' => 'metadataButton'}) @html.a(' Resource', {'href' => '#body-resourceInfo', 'class' => 'btn navBtn', 'id' => 'resourceButton'}) @html.a(' Lineage', {'href' => '#body-lineage', 'class' => 'btn navBtn', 'id' => 'lineageButton'}) @html.a(' Distribution', {'href' => '#body-distribution', 'class' => 'btn navBtn', 'id' => 'distributionButton'}) + @html.br @html.a(' Associated', {'href' => '#body-associatedResource', 'class' => 'btn navBtn', 'id' => 'associatedButton'}) @html.a(' Additional', {'href' => '#body-additionalDocument', 'class' => 'btn navBtn', 'id' => 'additionalButton'}) @html.a(' Dictionary', {'href' => '#body-dataDictionary', 'class' => 'btn navBtn', 'id' => 'dictionaryButton'}) @html.a(' Funding', {'href' => '#body-funding', 'class' => 'btn navBtn', 'id' => 'fundingButton'}) @html.a(' Repository', {'href' => '#body-repository', 'class' => 'btn navBtn', 'id' => 'repositoryButton'}) - # add open and close buttons - @html.span(' Open', {'class' => 'btn icon-caret-down', 'id' => 'openAllButton'}) - @html.span(' Close', {'class' => 'btn icon-caret-right', 'id' => 'closeAllButton'}) - end # main header @html.h2('id' => 'mainHeader') do # added blank to span tag to force builder to create closing tag - @html.span('', 'id' => 'logo') - @html.span('Metadata Record') - @html.span('HTML5', 'class' => 'version') end - # report title - # aShortVersion = version.split('.') - # shortVersion = aShortVersion[0].to_s + '.' + aShortVersion[1].to_s - @html.h1('mdTranslator ' + version + ' HTML Metadata Record', 'id' => 'mdtranslator-metadata-report') - # resource citation title unless hResourceInfo.empty? unless hResourceInfo[:citation].empty? @@ -110,7 +98,7 @@ def writeHtml(version, intObj) # report date @html.div(:class => 'block') do @html.em('Report Generated:') - @html.text!(Time.new.inspect) + @html.text!(Time.new.strftime('%Y-%m-%d %H:%M:%S')) end # metadata source @@ -137,6 +125,7 @@ def writeHtml(version, intObj) end end @html.hr + @html.br end end end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_contact.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_contact.rb index 1bd127ef8..c1483e1d2 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_contact.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_contact.rb @@ -70,7 +70,7 @@ def writeHtml(hContact) # contact - address hContact[:addresses].each do |hAddress| @html.div do - @html.h5('Address', {'class' => 'h5'}) + @html.h5('Address', {'class' => 'h5', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do # address - delivery points @@ -119,7 +119,7 @@ def writeHtml(hContact) # contact - phones hContact[:phones].each do |hPhone| @html.div do - @html.h5('Phone', {'class' => 'h5'}) + @html.h5('Phone', {'class' => 'h5', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do # phone - name @@ -159,7 +159,7 @@ def writeHtml(hContact) # contact - online resource [] hContact[:onlineResources].each do |hOnline| @html.div do - @html.h5('Online Resource', {'class' => 'h5'}) + @html.h5('Online Resource', {'class' => 'h5', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do onlineClass.writeHtml(hOnline) end @@ -169,7 +169,7 @@ def writeHtml(hContact) # contact - logos [] hContact[:logos].each do |hLogo| @html.div do - @html.h5('Logo Graphic', {'class' => 'h5'}) + @html.h5('Logo Graphic', {'class' => 'h5', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do graphicClass.writeHtml(hLogo) end @@ -194,7 +194,7 @@ def writeHtml(hContact) if hContact.key?(:externalIdentifier) && !hContact[:externalIdentifier].empty? hContact[:externalIdentifier].each do |identifier| @html.div do - @html.h5("External Identifier", {'class' => 'h5'}) + @html.h5("External Identifier", {'class' => 'h5', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do @html.em('Identifier: ') @html.text!(identifier[:identifier]) diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb index a15a6c916..61cd4844d 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb @@ -32,20 +32,7 @@ def writeHtml(hKeyword) end @html.h5(type, {'class' => 'h5'}) @html.div(:class => 'block') do - - # keywords - @html.ul do - hKeyword[:keywords].each do |hKeyword| - unless hKeyword[:keyword].nil? - keyword = hKeyword[:keyword] - unless hKeyword[:keywordId].nil? - keyword += ' (ID: ' + hKeyword[:keywordId].to_s + ')' - end - @html.li(keyword) - end - end - end - + # thesaurus unless hKeyword[:thesaurus].empty? @html.div do @@ -56,6 +43,17 @@ def writeHtml(hKeyword) end end + # keywords + hKeyword[:keywords].each do |hKeyword| + unless hKeyword[:keyword].nil? + keyword = hKeyword[:keyword] + unless hKeyword[:keywordId].nil? + keyword += ' (ID: ' + hKeyword[:keywordId].to_s + ')' + end + @html.div('Keyword:' + keyword) + end + end + end end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataInfo.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataInfo.rb index 513914817..307867338 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataInfo.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataInfo.rb @@ -50,7 +50,7 @@ def writeHtml(hMetaInfo) # metadataInfo - metadata identifier {identifier} unless hMetaInfo[:metadataIdentifier].empty? @html.div do - @html.h3('Metadata Identifier', {'id' => 'metadataInfo-identifier', 'class' => 'h3'}) + @html.h3('Metadata Identifier', {'id' => 'metadataInfo-identifier', 'class' => 'h3', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do identifierClass.writeHtml(hMetaInfo[:metadataIdentifier]) end @@ -60,7 +60,7 @@ def writeHtml(hMetaInfo) # metadataInfo - parent metadata {citation} unless hMetaInfo[:parentMetadata].empty? @html.div do - @html.h3('Parent Metadata', {'id' => 'metadataInfo-parent', 'class' => 'h3'}) + @html.h3('Parent Metadata', {'id' => 'metadataInfo-parent', 'class' => 'h3', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do citationClass.writeHtml(hMetaInfo[:parentMetadata]) end @@ -70,7 +70,7 @@ def writeHtml(hMetaInfo) # metadataInfo - metadata locales unless hMetaInfo[:defaultMetadataLocale].empty? && hMetaInfo[:otherMetadataLocales].empty? @html.div do - @html.h3('Metadata Locales', {'id' => 'metadataInfo-locale', 'class' => 'h3'}) + @html.h3('Metadata Locales', {'id' => 'metadataInfo-locale', 'class' => 'h3', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do # default metadata locales {locale} @@ -100,7 +100,7 @@ def writeHtml(hMetaInfo) # metadataInfo - contacts [] {responsibility} unless hMetaInfo[:metadataContacts].empty? @html.div do - @html.h3('Metadata Contacts', {'id' => 'metadataInfo-contacts', 'class' => 'h3'}) + @html.h3('Metadata Contacts', {'id' => 'metadataInfo-contacts', 'class' => 'h3', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do hMetaInfo[:metadataContacts].each do |hResponsibility| @html.div do @@ -117,7 +117,7 @@ def writeHtml(hMetaInfo) # metadataInfo - dates [] {date} unless hMetaInfo[:metadataDates].empty? @html.div do - @html.h3('Metadata Dates', {'id' => 'metadataInfo-dates', 'class' => 'h3'}) + @html.h3('Metadata Dates', {'id' => 'metadataInfo-dates', 'class' => 'h3', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do hMetaInfo[:metadataDates].each do |hDate| @html.em('Date: ') @@ -131,7 +131,7 @@ def writeHtml(hMetaInfo) # metadataInfo - linkages [] {onlineResource} unless hMetaInfo[:metadataLinkages].empty? @html.div do - @html.h3('Metadata Online Resource', {'id' => 'metadataInfo-links', 'class' => 'h3'}) + @html.h3('Metadata Online Resource', {'id' => 'metadataInfo-links', 'class' => 'h3', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do hMetaInfo[:metadataLinkages].each do |hOnline| @html.div do @@ -148,7 +148,7 @@ def writeHtml(hMetaInfo) # metadataInfo - constraints [] {constraint} unless hMetaInfo[:metadataConstraints].empty? @html.div do - @html.h3('Metadata Constraints', {'id' => 'metadataInfo-constraint', 'class' => 'h3'}) + @html.h3('Metadata Constraints', {'id' => 'metadataInfo-constraint', 'class' => 'h3', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do hMetaInfo[:metadataConstraints].each do |hConstraint| @html.div do @@ -165,7 +165,7 @@ def writeHtml(hMetaInfo) # metadataInfo - maintenance {maintenance} unless hMetaInfo[:metadataMaintenance].empty? @html.div do - @html.h3('Metadata Maintenance', {'id' => 'metadataInfo-maintenance', 'class' => 'h3'}) + @html.h3('Metadata Maintenance', {'id' => 'metadataInfo-maintenance', 'class' => 'h3', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do maintClass.writeHtml(hMetaInfo[:metadataMaintenance]) end @@ -175,13 +175,14 @@ def writeHtml(hMetaInfo) # metadataInfo - alternate metadata references [] {citation} unless hMetaInfo[:alternateMetadataReferences].empty? @html.div do - @html.h3('Alternate Metadata Citations', {'id' => 'metadataInfo-alternate', 'class' => 'h3'}) + @html.h3('Alternate Metadata Citations', {'id' => 'metadataInfo-alternate', 'class' => 'h3', 'style' => 'font-style: italic'}) @html.div(:class => 'block') do hMetaInfo[:alternateMetadataReferences].each do |hCitation| @html.div do @html.div(hCitation[:title], 'class' => 'h5') @html.div(:class => 'block') do citationClass.writeHtml(hCitation) + @html.br end end end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_timePeriod.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_timePeriod.rb index 566d6fbbd..94804a12f 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_timePeriod.rb +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_timePeriod.rb @@ -64,9 +64,7 @@ def writeHtml(hPeriod) # time period - description unless hPeriod[:description].nil? @html.em('Description: ') - @html.div(:class => 'block') do - @html.text!(hPeriod[:description]) - end + @html.text!(hPeriod[:description]) end # time period - start geologic age {geologic age} diff --git a/test/readers/fgdc/tc_fgdc_quality.rb b/test/readers/fgdc/tc_fgdc_quality.rb index d2c16aa2d..8430079f4 100644 --- a/test/readers/fgdc/tc_fgdc_quality.rb +++ b/test/readers/fgdc/tc_fgdc_quality.rb @@ -1,5 +1,5 @@ # MdTranslator - minitest of -# readers / fgdc / module_quality +# readers / fgdc / module_dataQuality # History: # Stan Smith 2017-08-31 original script From c769d1c157bc6ea3445aa123e7610f92beb9f2d3 Mon Sep 17 00:00:00 2001 From: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com> Date: Tue, 20 Feb 2024 10:48:48 -0700 Subject: [PATCH 04/64] Feature/fgdc reader lineage process (#347) * add references to process * redirect citation to processSteps * revert to lineageCitation * Fix newLineage Order dataSources after processSteps * Moving Methodology to Process Steps * Restore hResourceInfo Variable * Commented Keyword - Method Required Warning * Upgrade adiwg-mdjson_schemas adiwg-mdjson_schemas -> 2.9.0 * Update Gemfile.lock * commented out mdJson reader minor version test * Refactor lineage module and process module. Updated tests. * Add comment about test being disabled. * Add comment to explain why code is disabled --------- Co-authored-by: Johnathan Aspinwall --- Gemfile.lock | 4 +- adiwg-mdtranslator.gemspec | 2 +- .../internal/internal_metadata_obj.rb | 4 +- .../readers/fgdc/modules/module_keyword.rb | 16 +++-- .../readers/fgdc/modules/module_lineage.rb | 25 ++++---- .../fgdc/modules/module_methodology.rb | 60 ++++++++----------- .../readers/fgdc/modules/module_process.rb | 14 ++++- test/readers/fgdc/tc_fgdc_lineage.rb | 49 ++++++++++++--- test/readers/fgdc/tc_fgdc_process.rb | 15 ++--- test/translator/tc_mdJson_reader.rb | 56 ++++++++--------- 10 files changed, 142 insertions(+), 103 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index f2110490e..ea63e2ecc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ PATH specs: adiwg-mdtranslator (2.20.0) adiwg-mdcodes (= 2.9.0) - adiwg-mdjson_schemas (= 2.8.2) + adiwg-mdjson_schemas (= 2.9.0) builder (~> 3.2) coderay (~> 1.1) jbuilder (~> 2.5) @@ -32,7 +32,7 @@ GEM public_suffix (>= 2.0.2, < 6.0) adiwg-mdcodes (2.9.0) json (~> 2.0) - adiwg-mdjson_schemas (2.8.2) + adiwg-mdjson_schemas (2.9.0) builder (3.2.4) coderay (1.1.3) concurrent-ruby (1.2.2) diff --git a/adiwg-mdtranslator.gemspec b/adiwg-mdtranslator.gemspec index 8b67fbcc7..7fa6dfade 100644 --- a/adiwg-mdtranslator.gemspec +++ b/adiwg-mdtranslator.gemspec @@ -34,7 +34,7 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency "thor", "~> 0.19" spec.add_runtime_dependency "uuidtools", "~> 2.1" spec.add_runtime_dependency "json-schema", "~> 2.7" - spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.8.2" + spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.9.0" spec.add_runtime_dependency "adiwg-mdcodes", "2.9.0" spec.add_runtime_dependency "jbuilder", "~> 2.5" spec.add_runtime_dependency "kramdown", ">= 1.13", "< 3.0" diff --git a/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb b/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb index 0e837ad44..a16cb4499 100644 --- a/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +++ b/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb @@ -951,8 +951,8 @@ def newLineage statement: nil, resourceScope: {}, lineageCitation: [], - dataSources: [], - processSteps: [] + processSteps: [], + dataSources: [] } end diff --git a/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb b/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb index e0d7761b1..a96c5f8e1 100644 --- a/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +++ b/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb @@ -231,9 +231,11 @@ def self.unpack(xKeywords, hResourceInfo, hResponseObj) hCitation[:title] = thesaurus hKeyword[:thesaurus] = hCitation end - if thesaurus.empty? - hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: BIO method keyword thesaurus is missing' - end + # This code is being disabled intentionally. While the standard does indicate this is required, in practice it is not always present. + # Instead of requiring keywords, we will allow them to be optional for bio lineage. + # if thesaurus.empty? + # hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: BIO method keyword thesaurus is missing' + # end # theme keyword bio.1.2 (methkey) - lineage method keywords {keywordObject} axKeywords = xKeywords.xpath('./methkey') @@ -247,9 +249,11 @@ def self.unpack(xKeywords, hResourceInfo, hResponseObj) end end end - if axKeywords.empty? - hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: BIO method keyword is missing' - end + # This code is being disabled intentionally. While the standard does indicate this is required, in practice it is not always present. + # Instead of requiring keywords, we will allow them to be optional for bio lineage. + # if axKeywords.empty? + # hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: BIO method keyword is missing' + # end aKeywords << hKeyword diff --git a/lib/adiwg/mdtranslator/readers/fgdc/modules/module_lineage.rb b/lib/adiwg/mdtranslator/readers/fgdc/modules/module_lineage.rb index 3e591f191..bd211e760 100644 --- a/lib/adiwg/mdtranslator/readers/fgdc/modules/module_lineage.rb +++ b/lib/adiwg/mdtranslator/readers/fgdc/modules/module_lineage.rb @@ -30,21 +30,15 @@ def self.unpack(xLineage, hResponseObj) # lineage bio (method) - methodology [] (required) axMethods = xLineage.xpath('./method') unless axMethods.empty? - Method.unpack(hLineage, axMethods, hResponseObj) + axMethods.each do |xMethod| + hProcess = Method.unpack(hLineage, xMethod, hResponseObj) + hLineage[:processSteps] << hProcess + end end if axMethods.empty? hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: BIO lineage methodology section is missing' end - - # lineage 2.5.1 (srcinfo) - source information [] - axSource = xLineage.xpath('./srcinfo') - unless axSource.empty? - axSource.each do |xSource| - hSource = Source.unpack(xSource, hResponseObj) - hLineage[:dataSources] << hSource - end - end - + # lineage 2.5.2 (procstep) - process step [] (required) axProcess = xLineage.xpath('./procstep') unless axProcess.empty? @@ -57,6 +51,15 @@ def self.unpack(xLineage, hResponseObj) hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: lineage process step section is missing' end + # lineage 2.5.1 (srcinfo) - source information [] + axSource = xLineage.xpath('./srcinfo') + unless axSource.empty? + axSource.each do |xSource| + hSource = Source.unpack(xSource, hResponseObj) + hLineage[:dataSources] << hSource + end + end + return hLineage end diff --git a/lib/adiwg/mdtranslator/readers/fgdc/modules/module_methodology.rb b/lib/adiwg/mdtranslator/readers/fgdc/modules/module_methodology.rb index 83ff9ba20..2b83dcd52 100644 --- a/lib/adiwg/mdtranslator/readers/fgdc/modules/module_methodology.rb +++ b/lib/adiwg/mdtranslator/readers/fgdc/modules/module_methodology.rb @@ -16,53 +16,45 @@ module Fgdc module Method - def self.unpack(hLineage, axMethods, hResponseObj) + def self.unpack(hLineage, xMethod, hResponseObj) - statement = '' intObj = Fgdc.get_intObj hResourceInfo = intObj[:metadata][:resourceInfo] - axMethods.each do |xMethod| + intMetadataClass = InternalMetadata.new + hProcessStep = intMetadataClass.newProcessStep - # methodology bio (methtype) - method type (not supported) + # methodology bio (methtype) - method type (not supported) - # methodology bio (methodid) - method identifier [] {keyword} - axKeywords = xMethod.xpath('./methodid') - unless axKeywords.empty? - axKeywords.each do |xKeyword| - Keyword.unpack(xKeyword, hResourceInfo, hResponseObj) - end + # methodology bio (methodid) - method identifier [] {keyword} + axKeywords = xMethod.xpath('./methodid') + unless axKeywords.empty? + axKeywords.each do |xKeyword| + Keyword.unpack(xKeyword, hResourceInfo, hResponseObj) end + end - # methodology bio (methdesc) - method description (required) - description = xMethod.xpath('./methdesc').text - unless description.empty? - statement += description + '; ' - end - if description.empty? - hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: BIO lineage methodology description is missing' - end + # methodology bio (methdesc) - method description (required) + description = xMethod.xpath('./methdesc').text + unless description.empty? + hProcessStep[:description] = description + end + if description.empty? + hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: BIO lineage methodology description is missing' + end - # methodology bio (methcite) - method citation [] {citation} - axCitations = xMethod.xpath('./methcite') - unless axCitations.empty? - axCitations.each do |xCitation| - hReturn = Citation.unpack(xCitation, hResponseObj) - unless hReturn.nil? - hLineage[:lineageCitation] << hReturn - end + # methodology bio (methcite) - method citation [] {citation} + axCitations = xMethod.xpath('./methcite') + unless axCitations.empty? + axCitations.each do |xCitation| + hReturn = Citation.unpack(xCitation, hResponseObj) + unless hReturn.nil? + hProcessStep[:references] << hReturn end end - end - unless statement.empty? - statement.chomp!('; ') - hLineage[:statement] = statement - end - - return hLineage - + return hProcessStep end end diff --git a/lib/adiwg/mdtranslator/readers/fgdc/modules/module_process.rb b/lib/adiwg/mdtranslator/readers/fgdc/modules/module_process.rb index b7cae30ab..c8fddbdfc 100644 --- a/lib/adiwg/mdtranslator/readers/fgdc/modules/module_process.rb +++ b/lib/adiwg/mdtranslator/readers/fgdc/modules/module_process.rb @@ -8,6 +8,7 @@ require 'adiwg/mdtranslator/internal/internal_metadata_obj' require_relative 'module_dateTime' require_relative 'module_contact' +require_relative 'module_citation' module ADIWG module Mdtranslator @@ -37,7 +38,7 @@ def self.unpack(xProcess, hLineage, hResponseObj) axUsed.each do |xUsed| usedSrc = xUsed.text unless usedSrc.empty? - hLineage[:dataSources].each do |hSource| + hProcess[:stepSources].each do |hSource| unless hSource[:sourceId].nil? if usedSrc == hSource[:sourceId] hProcess[:stepSources] << hSource @@ -92,6 +93,17 @@ def self.unpack(xProcess, hLineage, hResponseObj) end end + # process (references) - references [] + axReferences = xProcess.xpath('./reference') + unless axReferences.empty? + axReferences.each do |xReference| + hCitation = Citation.unpack(xReference, hResponseObj) + unless hCitation.nil? + hProcess[:references] << hCitation + end + end + end + return hProcess end diff --git a/test/readers/fgdc/tc_fgdc_lineage.rb b/test/readers/fgdc/tc_fgdc_lineage.rb index d8f0ac02c..eb3b8b656 100644 --- a/test/readers/fgdc/tc_fgdc_lineage.rb +++ b/test/readers/fgdc/tc_fgdc_lineage.rb @@ -35,16 +35,47 @@ def test_lineage_complete # lineage refute_nil hLineage - assert_equal 'method description one; method description two', hLineage[:statement] - assert_equal 3, hLineage[:lineageCitation].length - assert_equal 2, hLineage[:dataSources].length - assert_equal 2, hLineage[:processSteps].length - - # citation - hCitation = hLineage[:lineageCitation][0] - assert_equal 'method citation one', hCitation[:title] - + # statement to processStep description, change + assert_nil hLineage[:statement] + refute_empty hLineage[:processSteps] + + # 4 total, 2 from methodology and 2 from process step + assert_equal 4, hLineage[:processSteps].length + + # 2 tests for descriptions in methods + assert_equal 'method description one', hLineage[:processSteps][0][:description] + assert_equal 'method description two', hLineage[:processSteps][1][:description] + + # expected 2 citations in the first process step + assert_equal 2, hLineage[:processSteps][0][:references].length + + # expected 1 citation in the second process step + assert_equal 1, hLineage[:processSteps][1][:references].length + + + # process step descriptions + assert_equal 'my proc step 1 description', hLineage[:processSteps][2][:description] + assert_equal 'my proc step 2 description', hLineage[:processSteps][3][:description] + + # citations within the methodologies + hCitation1 = hLineage[:processSteps][0][:references][0] + refute_nil hCitation1 + assert_equal 'method citation one', hCitation1[:title] + + hCitation2 = hLineage[:processSteps][0][:references][1] + refute_nil hCitation2 + assert_equal 'method citation two', hCitation2[:title] + + hCitation3 = hLineage[:processSteps][1][:references][0] + refute_nil hCitation3 + assert_equal 1, hLineage[:processSteps][1][:references].length + assert_equal 'method citation three', hCitation3[:title] + + # lineageCitation + assert_equal 0, hLineage[:lineageCitation].length + # dataSource + assert_equal 2, hLineage[:dataSources].length hSource = hLineage[:dataSources][0] assert_equal 'source id', hSource[:sourceId] assert_equal 'my source 1 contribution', hSource[:description] diff --git a/test/readers/fgdc/tc_fgdc_process.rb b/test/readers/fgdc/tc_fgdc_process.rb index eedbe3500..075740184 100644 --- a/test/readers/fgdc/tc_fgdc_process.rb +++ b/test/readers/fgdc/tc_fgdc_process.rb @@ -24,17 +24,18 @@ def test_process_complete refute_nil hLineage aSteps = hLineage[:processSteps] - assert_equal 2, aSteps.length + assert_equal 4, aSteps.length - hProcess = aSteps[0] + # first process step that is not a methodology + hProcess = aSteps[2] refute_empty hProcess assert_nil hProcess[:stepId] assert_equal 'my proc step 1 description', hProcess[:description] assert_nil hProcess[:rationale] refute_empty hProcess[:timePeriod] assert_equal 1, hProcess[:processors].length - assert_equal 2, hProcess[:stepSources].length - assert_equal 1, hProcess[:stepProducts].length + assert_empty hProcess[:stepSources] + assert_empty hProcess[:stepProducts] assert_empty hProcess[:scope] hTimePeriod = hProcess[:timePeriod] @@ -47,12 +48,6 @@ def test_process_complete assert_empty hProcessor[:roleExtents] assert_equal 1, hProcessor[:parties].length - hSource = hProcess[:stepSources][0] - assert_equal 'my source 1 contribution', hSource[:description] - - hProduct = hProcess[:stepProducts][0] - assert_equal 'my source 2 contribution', hProduct[:description] - assert hResponse[:readerExecutionPass] assert_includes hResponse[:readerExecutionMessages], 'WARNING: FGDC reader: contact address is missing' assert_includes hResponse[:readerExecutionMessages], 'WARNING: FGDC reader: contact voice phone is missing' diff --git a/test/translator/tc_mdJson_reader.rb b/test/translator/tc_mdJson_reader.rb index dad462975..0aeaac014 100755 --- a/test/translator/tc_mdJson_reader.rb +++ b/test/translator/tc_mdJson_reader.rb @@ -157,33 +157,35 @@ def test_mdJson_reader_schema_missing_version end - def test_mdJson_reader_schema_version_future_minor - - # read in an mdJson 2.x test file with schema object - file = File.join(File.dirname(__FILE__), 'testData', 'mdJson_minimal.json') - file = File.open(file, 'r') - jsonMinimal = file.read - file.close - - # bump minor version - version = Gem::Specification.find_by_name('adiwg-mdjson_schemas').version.to_s - aVersion = version.split('.') - newMinor = aVersion[1].to_i + 1 - testVersion = aVersion[0] + '.' + newMinor.to_s + '.' + aVersion[2] - - hJson = JSON.parse(jsonMinimal) - hSchema = hJson['schema'] - hSchema['version'] = testVersion - jsonIn = hJson.to_json - - metadata = ADIWG::Mdtranslator.translate(file: jsonIn) - - refute_empty metadata - assert_equal 'mdJson', metadata[:readerRequested] - refute metadata[:readerStructurePass] - refute_empty metadata[:readerStructureMessages] - - end +# This test needs to be verified that it's still valid and useful. +# Leave this test disabled until issue #348 is resolved. +# def test_mdJson_reader_schema_version_future_minor + +# # read in an mdJson 2.x test file with schema object +# file = File.join(File.dirname(__FILE__), 'testData', 'mdJson_minimal.json') +# file = File.open(file, 'r') +# jsonMinimal = file.read +# file.close + +# # bump minor version +# version = Gem::Specification.find_by_name('adiwg-mdjson_schemas').version.to_s +# aVersion = version.split('.') +# newMinor = aVersion[1].to_i + 1 +# testVersion = aVersion[0] + '.' + newMinor.to_s + '.' + aVersion[2] + +# hJson = JSON.parse(jsonMinimal) +# hSchema = hJson['schema'] +# hSchema['version'] = testVersion +# jsonIn = hJson.to_json + +# metadata = ADIWG::Mdtranslator.translate(file: jsonIn) + +# refute_empty metadata +# assert_equal 'mdJson', metadata[:readerRequested] +# refute metadata[:readerStructurePass] +# refute_empty metadata[:readerStructureMessages] + +# end def test_mdJson_reader_schema_version_future_major From 0d1307a47091564e1801864a0fed37ab85cbea71 Mon Sep 17 00:00:00 2001 From: Chris MacDermaid <64213093+chris-macdermaid@users.noreply.github.com> Date: Fri, 29 Mar 2024 14:46:36 -0600 Subject: [PATCH 05/64] Update 19115-3 test data (#334) * Update 19115-3 test data * Update 19115-3 test data * Update 19115-3 test data * Update 19115-3 test data * Update 19115-3 test data * Update 19115-3 test data * Update 19115-3 test data * upate attributeGroup * update 19115_3_citation.xml * update 19115_3_constraintCommon.xml * update 19115_3_constraintCommon.xml and 19115_3_citation.xml * update 19115_3_dataIdentification.xml * update 19115_3_leProcessStep.xml * update 19115_3_maintenance.xml * update 19115_3_mdBand.xml * Update 19115-3 test data * Update 19115-3 test data * Update 19115-3 test data * Update 19115-3 test data * Update 19115-3 test data * Update 19115-3 test data * Update 19115-3 test data * Update 19115-3 test data * Update remoteSchema URL in class_mdMetadata.rb * Add fix for 19115-3 writer in class_rangeElementDescription and class_sampleDimension * fix unit definition identifiers in test cases * fix attributeGroup test data * Refactor algorithm element to LE_Processing in 19115_3_leProcessStep.xml and 19115_3_processing.xml * Refactor algorithm element to LE_Processing in 19115_3_processing.xml * Remove underscore from id's in iso19115-3 writer tests * Update organization external identifier namespace from ORCID to ROR Remove duplicate external contact identifier in iso19115-3 writer * Update to ROR on feature xml and proper capitalization of multiPoint * Removed partyIdentifier duplicate in expected organization output * Remove duplicate partyIdentifier in expected constraintCommon xml * Fix Spacing * Fix spacing and remove duplicate partyIdentifier in expected constraintCommon xml --------- Co-authored-by: Johnathan Aspinwall Co-authored-by: Jonathan Oliveros --- .../iso19115_3/classes/class_mdMetadata.rb | 2 +- .../iso19115_3/classes/class_organization.rb | 20 +--- .../classes/class_rangeElementDescription.rb | 27 +++--- .../classes/class_sampleDimension.rb | 12 +-- .../writers/iso19115_3/iso19115_3_writer.rb | 2 + test/helpers/mdJson_hash_objects.rb | 2 +- .../iso19115-3/tc_19115_3_mdMetadata.rb | 2 +- .../iso19115-3/testData/19115_3_attribute.xml | 96 ++++++++++--------- .../testData/19115_3_attributeGroup.xml | 32 ++++--- .../iso19115-3/testData/19115_3_citation.xml | 91 +++--------------- .../testData/19115_3_constraintCommon.xml | 22 ----- .../iso19115-3/testData/19115_3_contact.xml | 11 --- .../testData/19115_3_dataIdentification.xml | 41 +------- .../iso19115-3/testData/19115_3_feature.xml | 30 +++--- .../testData/19115_3_geographicElement.xml | 32 +++---- .../testData/19115_3_geographicExtent.xml | 4 +- .../testData/19115_3_geometryCollection.xml | 8 +- .../testData/19115_3_georectified.xml | 24 ++--- .../testData/19115_3_maintenance.xml | 11 --- .../iso19115-3/testData/19115_3_mdBand.xml | 92 +++++++++--------- .../testData/19115_3_mdMetadata.xml | 4 +- .../iso19115-3/testData/19115_3_miBand.xml | 64 +++++++------ .../testData/19115_3_organization.xml | 33 ------- .../testData/19115_3_releasability.xml | 22 ----- .../testData/19115_3_responsibility.xml | 15 +-- .../testData/19115_3_sampleDimension.xml | 58 +++++------ .../19115_3_spatialRepresentation.xml | 6 +- .../19115_3_spatialRepresentation_scope.xml | 6 +- .../testData/19115_3_timeInstant.xml | 2 +- .../testData/19115_3_timePeriod.xml | 4 +- .../iso19115-3/testData/19115_3_usage.xml | 13 +-- 31 files changed, 288 insertions(+), 500 deletions(-) diff --git a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_mdMetadata.rb b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_mdMetadata.rb index 60ac34d75..c6657190e 100644 --- a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_mdMetadata.rb +++ b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_mdMetadata.rb @@ -85,7 +85,7 @@ def writeXML(intObj) # schema locations # set to 'remoteSchema' before publishing localSchema = 'C:\Users\StanSmith\Projects\ISO\19115\-3\mdt\1.0\mdt.xsd' - remoteSchema = 'http://standards.iso.org/iso/19115/-3/mdt/2.0/mdt.xsd' + remoteSchema = 'https://schemas.isotc211.org/19115/-3/mdt/2.0/mdt.xsd' # MD_Metadata @xml.tag!('mdb:MD_Metadata', diff --git a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_organization.rb b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_organization.rb index 4cef88081..8f577041b 100644 --- a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_organization.rb +++ b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_organization.rb @@ -113,25 +113,7 @@ def writeXML(hParty, hContact, inContext = nil) @xml.tag!('cit:individual') end - # organization - party identifier - if hContact[:externalIdentifier] && hContact[:externalIdentifier].length > 0 - hContact[:externalIdentifier].each do |identifier| - @xml.tag!('cit:partyIdentifier') do - identifierClass.writeXML(identifier); - end - end - else - if hContact[:contactId] && - hContact[:contactId].is_a?(Hash) - @xml.tag!('cit:partyIdentifier') do - identifierClass.writeXML(hContact[:contactId]); - end - elsif hContact[:contactId].is_a?(String) - @xml.tag!('cit:partyIdentifier') do - identifierClass.writeXML({ identifier: hContact[:contactId] }) - end - end - end + end if hContact.empty? diff --git a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_rangeElementDescription.rb b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_rangeElementDescription.rb index 2c1facde6..7a8e49fd0 100644 --- a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_rangeElementDescription.rb +++ b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_rangeElementDescription.rb @@ -17,23 +17,24 @@ def initialize(xml, hResponseObj) end def writeXML(hAttribute, inContext = nil) - - unless hAttribute[:name].nil? - @xml.tag!('mrc:name') do - @xml.tag!('gco:CharacterString', hAttribute[:name]) + @xml.tag!('mrc:MI_RangeElementDescription') do + unless hAttribute[:name].nil? + @xml.tag!('mrc:name') do + @xml.tag!('gco:CharacterString', hAttribute[:name]) + end end - end - unless hAttribute[:definition].nil? - @xml.tag!('mrc:definition') do - @xml.tag!('gco:CharacterString', hAttribute[:definition]) + unless hAttribute[:definition].nil? + @xml.tag!('mrc:definition') do + @xml.tag!('gco:CharacterString', hAttribute[:definition]) + end end - end - hAttribute[:rangeElement].each do |hRangeElement| - @xml.tag!('mrc:rangeElement') do - @xml.tag!('gco:Record') do - @xml.tag!('gco:CharacterString', hRangeElement) + hAttribute[:rangeElement].each do |hRangeElement| + @xml.tag!('mrc:rangeElement') do + @xml.tag!('gco:Record') do + @xml.tag!('gco:CharacterString', hRangeElement) + end end end end diff --git a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_sampleDimension.rb b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_sampleDimension.rb index 3e2ae4814..20056e431 100644 --- a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_sampleDimension.rb +++ b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_sampleDimension.rb @@ -67,12 +67,6 @@ def writeXML(hAttribute, inContext = nil) @xml.tag!('mrc:scaleFactor') end - hAttribute[:rangeElementDescription].each do |red| - @xml.tag!('mrc:rangeElementDescription') do - rangeElementDescription.writeXML(red, inContext) - end - end - # sample dimension - offset {real} unless hAttribute[:offset].nil? @xml.tag!('mrc:offset') do @@ -126,6 +120,12 @@ def writeXML(hAttribute, inContext = nil) @xml.tag!('mrc:bitsPerValue') end + hAttribute[:rangeElementDescription].each do |red| + @xml.tag!('mrc:rangeElementDescription') do + rangeElementDescription.writeXML(red, inContext) + end + end + end # writeXML end # MD_SampleDescription diff --git a/lib/adiwg/mdtranslator/writers/iso19115_3/iso19115_3_writer.rb b/lib/adiwg/mdtranslator/writers/iso19115_3/iso19115_3_writer.rb index 912156880..19ccac687 100644 --- a/lib/adiwg/mdtranslator/writers/iso19115_3/iso19115_3_writer.rb +++ b/lib/adiwg/mdtranslator/writers/iso19115_3/iso19115_3_writer.rb @@ -20,6 +20,8 @@ module Iso19115_3 def self.startWriter(intObj, hResponseObj) + hResponseObj[:writerMissingIdCount] = '000' + # make contact available to the instance @contacts = intObj[:contacts] @hResponseObj = hResponseObj diff --git a/test/helpers/mdJson_hash_objects.rb b/test/helpers/mdJson_hash_objects.rb index e088d4eb7..773c8d518 100644 --- a/test/helpers/mdJson_hash_objects.rb +++ b/test/helpers/mdJson_hash_objects.rb @@ -57,7 +57,7 @@ def base isOrganization: true, name: 'organization name', externalIdentifier: [ - { identifier: '0000-00002', namespace: 'ORCID' } + { identifier: '0000-00002', namespace: 'ROR' } ], phone: [ { diff --git a/test/writers/iso19115-3/tc_19115_3_mdMetadata.rb b/test/writers/iso19115-3/tc_19115_3_mdMetadata.rb index 35eddfe0c..509dbd1aa 100755 --- a/test/writers/iso19115-3/tc_19115_3_mdMetadata.rb +++ b/test/writers/iso19115-3/tc_19115_3_mdMetadata.rb @@ -50,7 +50,7 @@ def test_mdMetadata_complete assert_equal 'xml', hResponseObj[:writerOutputFormat] assert hResponseObj[:writerShowTags] assert_nil hResponseObj[:writerCSSlink] - assert_equal '_001', hResponseObj[:writerMissingIdCount] + assert_equal '001', hResponseObj[:writerMissingIdCount] assert_equal translatorVersion, hResponseObj[:translatorVersion] xMetadata = Nokogiri::XML(hResponseObj[:writerOutput]) diff --git a/test/writers/iso19115-3/testData/19115_3_attribute.xml b/test/writers/iso19115-3/testData/19115_3_attribute.xml index 36edf72f9..4a0e04792 100644 --- a/test/writers/iso19115-3/testData/19115_3_attribute.xml +++ b/test/writers/iso19115-3/testData/19115_3_attribute.xml @@ -125,26 +125,13 @@ 0 - + min/max units 99.9 - - - range element name 1 - - - range element definition - - - - range element record 1 - - - 1.0 @@ -160,6 +147,21 @@ 9 + + + + range element name 1 + + + range element definition + + + + range element record 1 + + + + @@ -211,26 +213,13 @@ 0 - + min/max units 99.9 - - - range element name 1 - - - range element definition - - - - range element record 1 - - - 1.0 @@ -246,6 +235,21 @@ 9 + + + + range element name 1 + + + range element definition + + + + range element record 1 + + + + 999 @@ -253,7 +257,7 @@ 100 - + bound min/max units @@ -314,26 +318,13 @@ 0 - + min/max units 99.9 - - - range element name 1 - - - range element definition - - - - range element record 1 - - - 1.0 @@ -349,6 +340,21 @@ 9 + + + + range element name 1 + + + range element definition + + + + range element record 1 + + + + 999 @@ -356,7 +362,7 @@ 100 - + bound min/max units @@ -384,4 +390,4 @@ - + \ No newline at end of file diff --git a/test/writers/iso19115-3/testData/19115_3_attributeGroup.xml b/test/writers/iso19115-3/testData/19115_3_attributeGroup.xml index ce70ed324..4eba99b16 100644 --- a/test/writers/iso19115-3/testData/19115_3_attributeGroup.xml +++ b/test/writers/iso19115-3/testData/19115_3_attributeGroup.xml @@ -183,26 +183,13 @@ 0 - + min/max units 99.9 - - - range element name 1 - - - range element definition - - - - range element record 1 - - - 1.0 @@ -218,6 +205,21 @@ 9 + + + + range element name 1 + + + range element definition + + + + range element record 1 + + + + @@ -235,4 +237,4 @@ - + \ No newline at end of file diff --git a/test/writers/iso19115-3/testData/19115_3_citation.xml b/test/writers/iso19115-3/testData/19115_3_citation.xml index 632ab8050..db49e0b92 100644 --- a/test/writers/iso19115-3/testData/19115_3_citation.xml +++ b/test/writers/iso19115-3/testData/19115_3_citation.xml @@ -137,33 +137,20 @@ - - - - 0000-00002 - - - ORCID - - - - + + + + 0000-00002 + + + ROR + + + + - - - - - 0000-00002 - - - ORCID - - - - - @@ -365,7 +352,7 @@ 0000-00002 - ORCID + ROR @@ -373,19 +360,6 @@ - - - - - 0000-00002 - - - ORCID - - - - - @@ -511,7 +485,7 @@ 0000-00002 - ORCID + ROR @@ -519,19 +493,6 @@ - - - - - 0000-00002 - - - ORCID - - - - - @@ -561,17 +522,6 @@ - - - - - CID004 - - - - - - @@ -626,7 +576,7 @@ 0000-00002 - ORCID + ROR @@ -634,19 +584,6 @@ - - - - - 0000-00002 - - - ORCID - - - - - diff --git a/test/writers/iso19115-3/testData/19115_3_constraintCommon.xml b/test/writers/iso19115-3/testData/19115_3_constraintCommon.xml index 7f80b6f8f..6a5ac0169 100644 --- a/test/writers/iso19115-3/testData/19115_3_constraintCommon.xml +++ b/test/writers/iso19115-3/testData/19115_3_constraintCommon.xml @@ -145,17 +145,6 @@ - - - - - CID004 - - - - - - @@ -196,17 +185,6 @@ - - - - - CID004 - - - - - - diff --git a/test/writers/iso19115-3/testData/19115_3_contact.xml b/test/writers/iso19115-3/testData/19115_3_contact.xml index 167a01e26..60d4699de 100644 --- a/test/writers/iso19115-3/testData/19115_3_contact.xml +++ b/test/writers/iso19115-3/testData/19115_3_contact.xml @@ -73,17 +73,6 @@ - - - - - CID004 - - - - - - diff --git a/test/writers/iso19115-3/testData/19115_3_dataIdentification.xml b/test/writers/iso19115-3/testData/19115_3_dataIdentification.xml index ebc811308..9f9791250 100644 --- a/test/writers/iso19115-3/testData/19115_3_dataIdentification.xml +++ b/test/writers/iso19115-3/testData/19115_3_dataIdentification.xml @@ -256,7 +256,7 @@ - + resource time period @@ -603,7 +603,7 @@ - + resource time period @@ -798,17 +798,6 @@ - - - - - CID004 - - - - - - @@ -1280,7 +1269,7 @@ - + resource time period @@ -1659,17 +1648,6 @@ - - - - - CID004 - - - - - - @@ -1764,17 +1742,6 @@ - - - - - CID004 - - - - - - @@ -2303,7 +2270,7 @@ - + resource time period diff --git a/test/writers/iso19115-3/testData/19115_3_feature.xml b/test/writers/iso19115-3/testData/19115_3_feature.xml index 8cb0e9eb1..b7a97a4c8 100644 --- a/test/writers/iso19115-3/testData/19115_3_feature.xml +++ b/test/writers/iso19115-3/testData/19115_3_feature.xml @@ -62,7 +62,7 @@ true - + @@ -104,7 +104,7 @@ true - + @@ -147,7 +147,7 @@ true - + @@ -215,18 +215,18 @@ true - + - + 100.0 10.0 - + @@ -270,19 +270,19 @@ true - + - + 100.0 10.0 101.0 11.0 - + @@ -327,12 +327,12 @@ true - + - + @@ -346,7 +346,7 @@ - + @@ -407,15 +407,15 @@ true - + - + 100.0 10.0 - + diff --git a/test/writers/iso19115-3/testData/19115_3_geographicElement.xml b/test/writers/iso19115-3/testData/19115_3_geographicElement.xml index dbcd7b73f..c855c6cae 100644 --- a/test/writers/iso19115-3/testData/19115_3_geographicElement.xml +++ b/test/writers/iso19115-3/testData/19115_3_geographicElement.xml @@ -39,7 +39,7 @@ true - + @@ -55,7 +55,7 @@ true - + @@ -72,7 +72,7 @@ true - + @@ -114,18 +114,18 @@ true - + - + 100.0 10.0 - + @@ -143,19 +143,19 @@ true - + - + 100.0 10.0 101.0 11.0 - + @@ -174,12 +174,12 @@ true - + - + @@ -193,7 +193,7 @@ - + @@ -228,15 +228,15 @@ true - + - + 100.0 10.0 - + @@ -271,7 +271,7 @@ true - + diff --git a/test/writers/iso19115-3/testData/19115_3_geographicExtent.xml b/test/writers/iso19115-3/testData/19115_3_geographicExtent.xml index cd44cc487..d51965b77 100644 --- a/test/writers/iso19115-3/testData/19115_3_geographicExtent.xml +++ b/test/writers/iso19115-3/testData/19115_3_geographicExtent.xml @@ -78,7 +78,7 @@ true - + @@ -167,7 +167,7 @@ false - + diff --git a/test/writers/iso19115-3/testData/19115_3_geometryCollection.xml b/test/writers/iso19115-3/testData/19115_3_geometryCollection.xml index c4b8f39de..8e1fa482a 100644 --- a/test/writers/iso19115-3/testData/19115_3_geometryCollection.xml +++ b/test/writers/iso19115-3/testData/19115_3_geometryCollection.xml @@ -62,15 +62,15 @@ true - + - + 100.0 10.0 - + @@ -96,7 +96,7 @@ true - + diff --git a/test/writers/iso19115-3/testData/19115_3_georectified.xml b/test/writers/iso19115-3/testData/19115_3_georectified.xml index 8489ad6c0..e3e160d1d 100644 --- a/test/writers/iso19115-3/testData/19115_3_georectified.xml +++ b/test/writers/iso19115-3/testData/19115_3_georectified.xml @@ -77,7 +77,7 @@ check point description - + @@ -85,7 +85,7 @@ - + @@ -93,7 +93,7 @@ - + @@ -154,7 +154,7 @@ - + @@ -162,7 +162,7 @@ - + @@ -170,7 +170,7 @@ - + @@ -227,7 +227,7 @@ - + @@ -235,7 +235,7 @@ - + @@ -293,7 +293,7 @@ - + @@ -301,7 +301,7 @@ - + @@ -309,7 +309,7 @@ - + @@ -317,7 +317,7 @@ - + diff --git a/test/writers/iso19115-3/testData/19115_3_maintenance.xml b/test/writers/iso19115-3/testData/19115_3_maintenance.xml index 2a331cf77..1a96e8ede 100644 --- a/test/writers/iso19115-3/testData/19115_3_maintenance.xml +++ b/test/writers/iso19115-3/testData/19115_3_maintenance.xml @@ -193,17 +193,6 @@ - - - - - CID004 - - - - - - diff --git a/test/writers/iso19115-3/testData/19115_3_mdBand.xml b/test/writers/iso19115-3/testData/19115_3_mdBand.xml index 4288d4afd..25c03b71e 100644 --- a/test/writers/iso19115-3/testData/19115_3_mdBand.xml +++ b/test/writers/iso19115-3/testData/19115_3_mdBand.xml @@ -81,26 +81,13 @@ 0 - + min/max units 99.9 - - - range element name 1 - - - range element definition - - - - range element record 1 - - - 1.0 @@ -116,6 +103,21 @@ 9 + + + + range element name 1 + + + range element definition + + + + range element record 1 + + + + 999 @@ -123,7 +125,7 @@ 100 - + bound min/max units @@ -184,26 +186,13 @@ 0 - + min/max units 99.9 - - - range element name 1 - - - range element definition - - - - range element record 1 - - - 1.0 @@ -219,6 +208,21 @@ 9 + + + + range element name 1 + + + range element definition + + + + range element record 1 + + + + @@ -277,26 +281,13 @@ 0 - + min/max units 99.9 - - - range element name 1 - - - range element definition - - - - range element record 1 - - - 1.0 @@ -312,6 +303,21 @@ 9 + + + + range element name 1 + + + range element definition + + + + range element record 1 + + + + diff --git a/test/writers/iso19115-3/testData/19115_3_mdMetadata.xml b/test/writers/iso19115-3/testData/19115_3_mdMetadata.xml index 8ec039a28..34da63772 100644 --- a/test/writers/iso19115-3/testData/19115_3_mdMetadata.xml +++ b/test/writers/iso19115-3/testData/19115_3_mdMetadata.xml @@ -1,4 +1,4 @@ - + @@ -378,7 +378,7 @@ - + resource time period diff --git a/test/writers/iso19115-3/testData/19115_3_miBand.xml b/test/writers/iso19115-3/testData/19115_3_miBand.xml index 5584cf052..db4a419f7 100644 --- a/test/writers/iso19115-3/testData/19115_3_miBand.xml +++ b/test/writers/iso19115-3/testData/19115_3_miBand.xml @@ -81,26 +81,13 @@ 0 - + min/max units 99.9 - - - range element name 1 - - - range element definition - - - - range element record 1 - - - 1.0 @@ -116,6 +103,21 @@ 9 + + + + range element name 1 + + + range element definition + + + + range element record 1 + + + + 999 @@ -123,7 +125,7 @@ 100 - + bound min/max units @@ -199,26 +201,13 @@ 0 - + min/max units 99.9 - - - range element name 1 - - - range element definition - - - - range element record 1 - - - 1.0 @@ -234,6 +223,21 @@ 9 + + + + range element name 1 + + + range element definition + + + + range element record 1 + + + + 999 @@ -241,7 +245,7 @@ 100 - + bound min/max units diff --git a/test/writers/iso19115-3/testData/19115_3_organization.xml b/test/writers/iso19115-3/testData/19115_3_organization.xml index 2f1a3baaa..632ac6135 100644 --- a/test/writers/iso19115-3/testData/19115_3_organization.xml +++ b/test/writers/iso19115-3/testData/19115_3_organization.xml @@ -196,17 +196,6 @@ - - - - - CID006 - - - - - - @@ -447,17 +436,6 @@ - - - - - CID006 - - - - - - @@ -480,17 +458,6 @@ - - - - - CID004 - - - - - - diff --git a/test/writers/iso19115-3/testData/19115_3_releasability.xml b/test/writers/iso19115-3/testData/19115_3_releasability.xml index 5709be500..ccc44a8ff 100644 --- a/test/writers/iso19115-3/testData/19115_3_releasability.xml +++ b/test/writers/iso19115-3/testData/19115_3_releasability.xml @@ -60,17 +60,6 @@ - - - - - CID004 - - - - - - @@ -114,17 +103,6 @@ - - - - - CID004 - - - - - - diff --git a/test/writers/iso19115-3/testData/19115_3_responsibility.xml b/test/writers/iso19115-3/testData/19115_3_responsibility.xml index e7056a2e2..e204abe0e 100644 --- a/test/writers/iso19115-3/testData/19115_3_responsibility.xml +++ b/test/writers/iso19115-3/testData/19115_3_responsibility.xml @@ -326,7 +326,7 @@ 0000-00002 - ORCID + ROR @@ -334,19 +334,6 @@ - - - - - 0000-00002 - - - ORCID - - - - - diff --git a/test/writers/iso19115-3/testData/19115_3_sampleDimension.xml b/test/writers/iso19115-3/testData/19115_3_sampleDimension.xml index 8f8a9d64f..b4ebda043 100644 --- a/test/writers/iso19115-3/testData/19115_3_sampleDimension.xml +++ b/test/writers/iso19115-3/testData/19115_3_sampleDimension.xml @@ -81,26 +81,13 @@ 0 - + min/max units 99.9 - - - range element name 1 - - - range element definition - - - - range element record 1 - - - 1.0 @@ -116,6 +103,21 @@ 9 + + + + range element name 1 + + + range element definition + + + + range element record 1 + + + + @@ -164,19 +166,6 @@ - - - range element name 1 - - - range element definition - - - - range element record 1 - - - @@ -184,6 +173,21 @@ 9 + + + + range element name 1 + + + range element definition + + + + range element record 1 + + + + diff --git a/test/writers/iso19115-3/testData/19115_3_spatialRepresentation.xml b/test/writers/iso19115-3/testData/19115_3_spatialRepresentation.xml index 6830cf9e3..eb66a1af2 100644 --- a/test/writers/iso19115-3/testData/19115_3_spatialRepresentation.xml +++ b/test/writers/iso19115-3/testData/19115_3_spatialRepresentation.xml @@ -145,7 +145,7 @@ check point description - + @@ -153,7 +153,7 @@ - + @@ -161,7 +161,7 @@ - + diff --git a/test/writers/iso19115-3/testData/19115_3_spatialRepresentation_scope.xml b/test/writers/iso19115-3/testData/19115_3_spatialRepresentation_scope.xml index e0e9c1067..f73294d03 100644 --- a/test/writers/iso19115-3/testData/19115_3_spatialRepresentation_scope.xml +++ b/test/writers/iso19115-3/testData/19115_3_spatialRepresentation_scope.xml @@ -190,7 +190,7 @@ check point description - + @@ -198,7 +198,7 @@ - + @@ -206,7 +206,7 @@ - + diff --git a/test/writers/iso19115-3/testData/19115_3_timeInstant.xml b/test/writers/iso19115-3/testData/19115_3_timeInstant.xml index ce1cb6a54..315736a48 100644 --- a/test/writers/iso19115-3/testData/19115_3_timeInstant.xml +++ b/test/writers/iso19115-3/testData/19115_3_timeInstant.xml @@ -50,7 +50,7 @@ - + diff --git a/test/writers/iso19115-3/testData/19115_3_timePeriod.xml b/test/writers/iso19115-3/testData/19115_3_timePeriod.xml index 615b3c645..9da4a1f9e 100644 --- a/test/writers/iso19115-3/testData/19115_3_timePeriod.xml +++ b/test/writers/iso19115-3/testData/19115_3_timePeriod.xml @@ -52,7 +52,7 @@ - + @@ -67,7 +67,7 @@ - + diff --git a/test/writers/iso19115-3/testData/19115_3_usage.xml b/test/writers/iso19115-3/testData/19115_3_usage.xml index fb7150b71..302e96c38 100644 --- a/test/writers/iso19115-3/testData/19115_3_usage.xml +++ b/test/writers/iso19115-3/testData/19115_3_usage.xml @@ -33,7 +33,7 @@ xsi:schemaLocation="http://standards.iso.org/iso/19115/-3/mdt/2.0 http://standards.iso.org/iso/19115/-3/mdt/2.0/mdt.xsd"> - + usage one @@ -77,17 +77,6 @@ - - - - - CID004 - - - - - - From 0ac8429280d2c62bf7084ab5cba54a403fd9da28 Mon Sep 17 00:00:00 2001 From: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com> Date: Mon, 8 Apr 2024 12:51:33 -0600 Subject: [PATCH 06/64] Fix version comparison bug in mdJson_reader.rb (#356) * Fix version comparison bug in mdJson_reader.rb * Fix version comparison logic --- .../readers/mdJson/mdJson_reader.rb | 4 +- test/translator/tc_mdJson_reader.rb | 56 +++++++++---------- 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb b/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb index fb7dd4c8c..d4920b891 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb @@ -95,8 +95,8 @@ def self.readFile(file, hResponseObj) aCurVersion = currentVersion.split('.') aReqVersion = requestedVersion.split('.') approved = false - if aReqVersion[0] == aCurVersion[0] - if aReqVersion[1] <= aCurVersion[1] + if aReqVersion[0].to_i == aCurVersion[0].to_i + if aReqVersion[1].to_i <= aCurVersion[1].to_i approved = true end end diff --git a/test/translator/tc_mdJson_reader.rb b/test/translator/tc_mdJson_reader.rb index 0aeaac014..dad462975 100755 --- a/test/translator/tc_mdJson_reader.rb +++ b/test/translator/tc_mdJson_reader.rb @@ -157,35 +157,33 @@ def test_mdJson_reader_schema_missing_version end -# This test needs to be verified that it's still valid and useful. -# Leave this test disabled until issue #348 is resolved. -# def test_mdJson_reader_schema_version_future_minor - -# # read in an mdJson 2.x test file with schema object -# file = File.join(File.dirname(__FILE__), 'testData', 'mdJson_minimal.json') -# file = File.open(file, 'r') -# jsonMinimal = file.read -# file.close - -# # bump minor version -# version = Gem::Specification.find_by_name('adiwg-mdjson_schemas').version.to_s -# aVersion = version.split('.') -# newMinor = aVersion[1].to_i + 1 -# testVersion = aVersion[0] + '.' + newMinor.to_s + '.' + aVersion[2] - -# hJson = JSON.parse(jsonMinimal) -# hSchema = hJson['schema'] -# hSchema['version'] = testVersion -# jsonIn = hJson.to_json - -# metadata = ADIWG::Mdtranslator.translate(file: jsonIn) - -# refute_empty metadata -# assert_equal 'mdJson', metadata[:readerRequested] -# refute metadata[:readerStructurePass] -# refute_empty metadata[:readerStructureMessages] - -# end + def test_mdJson_reader_schema_version_future_minor + + # read in an mdJson 2.x test file with schema object + file = File.join(File.dirname(__FILE__), 'testData', 'mdJson_minimal.json') + file = File.open(file, 'r') + jsonMinimal = file.read + file.close + + # bump minor version + version = Gem::Specification.find_by_name('adiwg-mdjson_schemas').version.to_s + aVersion = version.split('.') + newMinor = aVersion[1].to_i + 1 + testVersion = aVersion[0] + '.' + newMinor.to_s + '.' + aVersion[2] + + hJson = JSON.parse(jsonMinimal) + hSchema = hJson['schema'] + hSchema['version'] = testVersion + jsonIn = hJson.to_json + + metadata = ADIWG::Mdtranslator.translate(file: jsonIn) + + refute_empty metadata + assert_equal 'mdJson', metadata[:readerRequested] + refute metadata[:readerStructurePass] + refute_empty metadata[:readerStructureMessages] + + end def test_mdJson_reader_schema_version_future_major From 1202405ad55d16e70a7aab8437fe4bd6aa4bd001 Mon Sep 17 00:00:00 2001 From: Johnathan Aspinwall Date: Tue, 9 Apr 2024 11:50:48 -0600 Subject: [PATCH 07/64] Update adiwg-mdtranslator version to 2.20.0-beta.0 --- Gemfile.lock | 2 +- lib/adiwg/mdtranslator/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0617cace2..b28cb70a0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - adiwg-mdtranslator (2.20.0) + adiwg-mdtranslator (2.20.0.pre.beta.0) adiwg-mdcodes (= 2.9.2) adiwg-mdjson_schemas (= 2.9.1) builder (~> 3.2) diff --git a/lib/adiwg/mdtranslator/version.rb b/lib/adiwg/mdtranslator/version.rb index 2544673ee..beb2e7b80 100644 --- a/lib/adiwg/mdtranslator/version.rb +++ b/lib/adiwg/mdtranslator/version.rb @@ -109,7 +109,7 @@ module ADIWG module Mdtranslator # current mdtranslator version - VERSION = "2.20.0" + VERSION = "2.20.0-beta.0" end end From e5f845dda6992624a9169a65c3080da2475da139 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Mon, 15 Apr 2024 11:03:23 -0600 Subject: [PATCH 08/64] add Acquisition class. Fix internal obj --- .../internal/internal_metadata_obj.rb | 1 + .../mdJson/modules/module_acquisition.rb | 135 ++++++++++++++++++ .../readers/mdJson/modules/module_metadata.rb | 11 ++ 3 files changed, 147 insertions(+) create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb diff --git a/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb b/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb index a16cb4499..66b1ab780 100644 --- a/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +++ b/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb @@ -158,6 +158,7 @@ def newSchema # acquisition ---------------------------- def newAcquisition { + scope: {}, plans: [], requirements: [], objectives: [], diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb new file mode 100644 index 000000000..cb6584813 --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb @@ -0,0 +1,135 @@ +require_relative 'module_scope' +require_relative 'module_acq-requirement' +require_relative 'module_acq-objective' +require_relative 'module_acq-platform' +require_relative 'module_acq-instrument' +require_relative 'module_acq-operation' +require_relative 'module_acq-event' +require_relative 'module_acq-pass' +require_relative 'module_acq-environment' + +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module Acquisition + + def self.unpack(hAcquisition, responseObj, inContext = nil) + + @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson + + + # instance classes needed in script + intMetadataClass = InternalMetadata.new + intAcquisition = intMetadataClass.newAcquisition + + if hAcquisition.has_key?('scope') + unless hAcquisition['scope'].empty? + hReturn = Scope.unpack(hAcquisition['scope'], responseObj, outContext) + unless hReturn.nil? + intAlgorithm[:scope] = hReturn + end + end + end + + if hAcquisition.has_key?('plan') + aItems = hAcquisition['plan'] + aItems.each do |item| + hReturn = AcqPlan.unpack(item, responseObj, outContext) + unless hReturn.nil? + intAttGroup[:plans] << hReturn + end + end + end + + if hAcquisition.has_key?('requirement') + aItems = hAcquisition['requirement'] + aItems.each do |item| + hReturn = AcqRequirement.unpack(item, responseObj, outContext) + unless hReturn.nil? + intAttGroup[:requirements] << hReturn + end + end + end + + if hAcquisition.has_key?('objective') + aItems = hAcquisition['objective'] + aItems.each do |item| + hReturn = AcqObjective.unpack(item, responseObj, outContext) + unless hReturn.nil? + intAttGroup[:objectives] << hReturn + end + end + end + + if hAcquisition.has_key?('platform') + aItems = hAcquisition['platform'] + aItems.each do |item| + hReturn = AcqPlatform.unpack(item, responseObj, outContext) + unless hReturn.nil? + intAttGroup[:platforms] << hReturn + end + end + end + + if hAcquisition.has_key?('instrument') + aItems = hAcquisition['instrument'] + aItems.each do |item| + hReturn = AcqInstrument.unpack(item, responseObj, outContext) + unless hReturn.nil? + intAttGroup[:instruments] << hReturn + end + end + end + + if hAcquisition.has_key?('operation') + aItems = hAcquisition['operation'] + aItems.each do |item| + hReturn = AcqOperation.unpack(item, responseObj, outContext) + unless hReturn.nil? + intAttGroup[:operations] << hReturn + end + end + end + + if hAcquisition.has_key?('event') + aItems = hAcquisition['event'] + aItems.each do |item| + hReturn = AcqEvent.unpack(item, responseObj, outContext) + unless hReturn.nil? + intAttGroup[:events] << hReturn + end + end + end + + if hAcquisition.has_key?('environment') + aItems = hAcquisition['environment'] + aItems.each do |item| + hReturn = AcqEnvironment.unpack(item, responseObj, outContext) + unless hReturn.nil? + intAttGroup[:environments] << hReturn + end + end + end + + if hAcquisition.has_key?('scope') + unless hAcquisition['scope'].empty? + hReturn = Scope.unpack(hAcquisition['scope'], responseObj, outContext) + unless hReturn.nil? + intAlgorithm[:scope] = hReturn + end + end + end + + return intAcquisition + + end + + end + + end + end + end +end + \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb index c4d312298..219604c07 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb @@ -13,6 +13,7 @@ require_relative 'module_additionalDocumentation' require_relative 'module_funding' require_relative 'module_dataQuality' +require_relative 'module_acquisition' module ADIWG module Mdtranslator @@ -128,6 +129,16 @@ def self.unpack(hMetadata, responseObj) end end + if hMetadata.has_key?('acquisition') + aItems = hMetadata['acquisition'] + aItems.each do |item| + hReturn = Acquisition.unpack(item, responseObj) + unless hReturn.nil? + intMetadata[:acquisition] << hReturn + end + end + end + return intMetadata end From 0b1eab59fab33a9b37e924404de36baf9e59faa3 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Mon, 15 Apr 2024 11:23:59 -0600 Subject: [PATCH 09/64] Boilerplate for acq classes. Add logic to handle acq-pass --- .../mdJson/modules/module_acq-environment.rb | 15 +++++++++++ .../mdJson/modules/module_acq-instrument.rb | 15 +++++++++++ .../mdJson/modules/module_acq-objective.rb | 15 +++++++++++ .../mdJson/modules/module_acq-operation.rb | 15 +++++++++++ .../readers/mdJson/modules/module_acq-pass.rb | 15 +++++++++++ .../readers/mdJson/modules/module_acq-plan.rb | 15 +++++++++++ .../mdJson/modules/module_acq-platform.rb | 15 +++++++++++ .../mdJson/modules/module_acq-requirement.rb | 15 +++++++++++ .../mdJson/modules/module_acquisition.rb | 27 ++++++++++--------- .../readers/mdJson/modules/module_event.rb | 15 +++++++++++ 10 files changed, 149 insertions(+), 13 deletions(-) create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-environment.rb create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-instrument.rb create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-objective.rb create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-operation.rb create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-pass.rb create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-plan.rb create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-platform.rb create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-requirement.rb create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_event.rb diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-environment.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-environment.rb new file mode 100644 index 000000000..453b9979d --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-environment.rb @@ -0,0 +1,15 @@ +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module AcqEnvironment + def self.unpack(hAcqEnvironment, responseObj, inContext = nil) + + end + end + + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-instrument.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-instrument.rb new file mode 100644 index 000000000..ff378d1e9 --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-instrument.rb @@ -0,0 +1,15 @@ +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module AcqInstrument + def self.unpack(hAcqInstrument, responseObj, inContext = nil) + + end + end + + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-objective.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-objective.rb new file mode 100644 index 000000000..f930b41e6 --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-objective.rb @@ -0,0 +1,15 @@ +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module AcqObjective + def self.unpack(hAcqObjective, responseObj, inContext = nil) + + end + end + + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-operation.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-operation.rb new file mode 100644 index 000000000..503677fe7 --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-operation.rb @@ -0,0 +1,15 @@ +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module AcqOperation + def self.unpack(hAcqOperation, responseObj, inContext = nil) + + end + end + + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-pass.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-pass.rb new file mode 100644 index 000000000..0772c255b --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-pass.rb @@ -0,0 +1,15 @@ +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module AcqPass + def self.unpack(hAcqPass, responseObj, inContext = nil) + + end + end + + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-plan.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-plan.rb new file mode 100644 index 000000000..2096fcb37 --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-plan.rb @@ -0,0 +1,15 @@ +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module AcqPlan + def self.unpack(hAcqPlan, responseObj, inContext = nil) + + end + end + + end + end + end +end diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-platform.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-platform.rb new file mode 100644 index 000000000..35db28c41 --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-platform.rb @@ -0,0 +1,15 @@ +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module AcqPlatform + def self.unpack(hAcqPlatform, responseObj, inContext = nil) + + end + end + + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-requirement.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-requirement.rb new file mode 100644 index 000000000..074a3577a --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-requirement.rb @@ -0,0 +1,15 @@ +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module AcqRequirement + def self.unpack(hAcqRequirement, responseObj, inContext = nil) + + end + end + + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb index cb6584813..ce61fca14 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb @@ -103,21 +103,12 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) end end - if hAcquisition.has_key?('environment') - aItems = hAcquisition['environment'] + if hAcquisition.has_key?('pass') + aItems = hAcquisition['pass'] aItems.each do |item| - hReturn = AcqEnvironment.unpack(item, responseObj, outContext) + hReturn = AcqPass.unpack(item, responseObj, outContext) unless hReturn.nil? - intAttGroup[:environments] << hReturn - end - end - end - - if hAcquisition.has_key?('scope') - unless hAcquisition['scope'].empty? - hReturn = Scope.unpack(hAcquisition['scope'], responseObj, outContext) - unless hReturn.nil? - intAlgorithm[:scope] = hReturn + intAttGroup[:passs] << hReturn end end end @@ -126,6 +117,16 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) end + if hAcquisition.has_key?('environment') + aItems = hAcquisition['environment'] + aItems.each do |item| + hReturn = AcqEnvironment.unpack(item, responseObj, outContext) + unless hReturn.nil? + intAttGroup[:environments] << hReturn + end + end + end + end end diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_event.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_event.rb new file mode 100644 index 000000000..3146f771d --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_event.rb @@ -0,0 +1,15 @@ +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module AcqEvent + def self.unpack(hAcqEvent, responseObj, inContext = nil) + + end + end + + end + end + end +end \ No newline at end of file From f53540f622b6ad278c3cd3e49276994274f75a08 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Mon, 15 Apr 2024 11:27:07 -0600 Subject: [PATCH 10/64] add acq-event class --- .../readers/mdJson/modules/module_acq-event.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-event.rb diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-event.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-event.rb new file mode 100644 index 000000000..3146f771d --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-event.rb @@ -0,0 +1,15 @@ +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module AcqEvent + def self.unpack(hAcqEvent, responseObj, inContext = nil) + + end + end + + end + end + end +end \ No newline at end of file From aabf4f81642e434a89461ddf6d388be3f7052f66 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Mon, 15 Apr 2024 14:52:08 -0600 Subject: [PATCH 11/64] fix internal object variable reference --- .../mdJson/modules/module_acquisition.rb | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb index ce61fca14..b80a61721 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb @@ -28,7 +28,7 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) unless hAcquisition['scope'].empty? hReturn = Scope.unpack(hAcquisition['scope'], responseObj, outContext) unless hReturn.nil? - intAlgorithm[:scope] = hReturn + intAcquisition[:scope] = hReturn end end end @@ -38,7 +38,7 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) aItems.each do |item| hReturn = AcqPlan.unpack(item, responseObj, outContext) unless hReturn.nil? - intAttGroup[:plans] << hReturn + intAcquisition[:plans] << hReturn end end end @@ -48,7 +48,7 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) aItems.each do |item| hReturn = AcqRequirement.unpack(item, responseObj, outContext) unless hReturn.nil? - intAttGroup[:requirements] << hReturn + intAcquisition[:requirements] << hReturn end end end @@ -58,7 +58,7 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) aItems.each do |item| hReturn = AcqObjective.unpack(item, responseObj, outContext) unless hReturn.nil? - intAttGroup[:objectives] << hReturn + intAcquisition[:objectives] << hReturn end end end @@ -68,7 +68,7 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) aItems.each do |item| hReturn = AcqPlatform.unpack(item, responseObj, outContext) unless hReturn.nil? - intAttGroup[:platforms] << hReturn + intAcquisition[:platforms] << hReturn end end end @@ -78,7 +78,7 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) aItems.each do |item| hReturn = AcqInstrument.unpack(item, responseObj, outContext) unless hReturn.nil? - intAttGroup[:instruments] << hReturn + intAcquisition[:instruments] << hReturn end end end @@ -88,7 +88,7 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) aItems.each do |item| hReturn = AcqOperation.unpack(item, responseObj, outContext) unless hReturn.nil? - intAttGroup[:operations] << hReturn + intAcquisition[:operations] << hReturn end end end @@ -98,7 +98,7 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) aItems.each do |item| hReturn = AcqEvent.unpack(item, responseObj, outContext) unless hReturn.nil? - intAttGroup[:events] << hReturn + intAcquisition[:events] << hReturn end end end @@ -108,23 +108,22 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) aItems.each do |item| hReturn = AcqPass.unpack(item, responseObj, outContext) unless hReturn.nil? - intAttGroup[:passs] << hReturn + intAcquisition[:passs] << hReturn end end end - return intAcquisition + if hAcquisition.has_key?('environment') + aItems = hAcquisition['environment'] + aItems.each do |item| + hReturn = AcqEnvironment.unpack(item, responseObj, outContext) + unless hReturn.nil? + intAcquisition[:environments] << hReturn + end + end - end + return intAcquisition - if hAcquisition.has_key?('environment') - aItems = hAcquisition['environment'] - aItems.each do |item| - hReturn = AcqEnvironment.unpack(item, responseObj, outContext) - unless hReturn.nil? - intAttGroup[:environments] << hReturn - end - end end end From 05aee35d06d551e49a5d0f1e3a3e73ea7b8b9be5 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Mon, 15 Apr 2024 14:56:27 -0600 Subject: [PATCH 12/64] Fix closing out conditional --- .../mdtranslator/readers/mdJson/modules/module_acquisition.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb index b80a61721..234e92d7a 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb @@ -122,7 +122,9 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) end end - return intAcquisition + end + + return intAcquisition end From 1fe82d4c3d4f054f3b146655b598c4846b92f076 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Mon, 29 Apr 2024 12:01:29 -0600 Subject: [PATCH 13/64] add acquisition key to metadata internal object --- lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb | 3 ++- .../mdtranslator/readers/mdJson/modules/module_metadata.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb b/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb index 66b1ab780..2dace8d88 100644 --- a/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +++ b/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb @@ -143,7 +143,8 @@ def newMetadata associatedResources: [], additionalDocuments: [], funding: [], - dataQuality: [] + dataQuality: [], + acquisitions: [] } end diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb index 219604c07..5cb16aa1f 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb @@ -134,7 +134,7 @@ def self.unpack(hMetadata, responseObj) aItems.each do |item| hReturn = Acquisition.unpack(item, responseObj) unless hReturn.nil? - intMetadata[:acquisition] << hReturn + intMetadata[:acquisitions] << hReturn end end end From 0bb9da9b49c0237a4149b60ac9a5e71c4df1ea18 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Mon, 29 Apr 2024 12:11:14 -0600 Subject: [PATCH 14/64] Add outContext --- .../mdtranslator/readers/mdJson/modules/module_acquisition.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb index 234e92d7a..dea7c11d7 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb @@ -19,6 +19,8 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson + outContext = 'acquisition' + outContext = inContext + ' > ' + outContext unless inContext.nil? # instance classes needed in script intMetadataClass = InternalMetadata.new From 4472aeee58c02f7129b8d1909166cb5acca2b50a Mon Sep 17 00:00:00 2001 From: Johnathan Aspinwall Date: Tue, 30 Apr 2024 10:11:06 -0600 Subject: [PATCH 15/64] chore: Update adiwg-mdjson_schemas and adiwg-mdcodes gem dependencies to latest pre-beta versions --- Gemfile.lock | 8 ++++---- adiwg-mdtranslator.gemspec | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4a7a6fcc0..7717b0ac4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,8 +2,8 @@ PATH remote: . specs: adiwg-mdtranslator (2.20.0.pre.beta.2) - adiwg-mdcodes (= 2.9.2) - adiwg-mdjson_schemas (= 2.9.1) + adiwg-mdcodes (= 2.9.3.pre.beta.3) + adiwg-mdjson_schemas (= 2.9.2.pre.beta.5) builder (~> 3.2) coderay (~> 1.1) jbuilder (~> 2.5) @@ -30,9 +30,9 @@ GEM tzinfo (~> 1.1) addressable (2.8.5) public_suffix (>= 2.0.2, < 6.0) - adiwg-mdcodes (2.9.2) + adiwg-mdcodes (2.9.3.pre.beta.3) json (~> 2.0) - adiwg-mdjson_schemas (2.9.1) + adiwg-mdjson_schemas (2.9.2.pre.beta.5) builder (3.2.4) coderay (1.1.3) concurrent-ruby (1.2.2) diff --git a/adiwg-mdtranslator.gemspec b/adiwg-mdtranslator.gemspec index 46ef5ad51..101d4f475 100644 --- a/adiwg-mdtranslator.gemspec +++ b/adiwg-mdtranslator.gemspec @@ -34,8 +34,8 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency "thor", "~> 0.19" spec.add_runtime_dependency "uuidtools", "~> 2.1" spec.add_runtime_dependency "json-schema", "~> 2.7" - spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.9.1" - spec.add_runtime_dependency "adiwg-mdcodes", "2.9.2" + spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.9.2.pre.beta.5" + spec.add_runtime_dependency "adiwg-mdcodes", "2.9.3.pre.beta.3" spec.add_runtime_dependency "jbuilder", "~> 2.5" spec.add_runtime_dependency "kramdown", ">= 1.13", "< 3.0" spec.add_runtime_dependency "coderay", "~> 1.1" From 1b6869a9efd65e0e11ee8c5727edfe159f7d302f Mon Sep 17 00:00:00 2001 From: Johnathan Aspinwall Date: Tue, 30 Apr 2024 10:31:09 -0600 Subject: [PATCH 16/64] chore: Update adiwg-mdjson_schemas and adiwg-mdcodes gem dependencies to latest pre-beta versions --- Gemfile.lock | 4 ++-- adiwg-mdtranslator.gemspec | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7717b0ac4..3c5a2246d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ PATH specs: adiwg-mdtranslator (2.20.0.pre.beta.2) adiwg-mdcodes (= 2.9.3.pre.beta.3) - adiwg-mdjson_schemas (= 2.9.2.pre.beta.5) + adiwg-mdjson_schemas (= 2.9.2.pre.beta.6) builder (~> 3.2) coderay (~> 1.1) jbuilder (~> 2.5) @@ -32,7 +32,7 @@ GEM public_suffix (>= 2.0.2, < 6.0) adiwg-mdcodes (2.9.3.pre.beta.3) json (~> 2.0) - adiwg-mdjson_schemas (2.9.2.pre.beta.5) + adiwg-mdjson_schemas (2.9.2.pre.beta.6) builder (3.2.4) coderay (1.1.3) concurrent-ruby (1.2.2) diff --git a/adiwg-mdtranslator.gemspec b/adiwg-mdtranslator.gemspec index 101d4f475..5734ee107 100644 --- a/adiwg-mdtranslator.gemspec +++ b/adiwg-mdtranslator.gemspec @@ -34,7 +34,7 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency "thor", "~> 0.19" spec.add_runtime_dependency "uuidtools", "~> 2.1" spec.add_runtime_dependency "json-schema", "~> 2.7" - spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.9.2.pre.beta.5" + spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.9.2.pre.beta.6" spec.add_runtime_dependency "adiwg-mdcodes", "2.9.3.pre.beta.3" spec.add_runtime_dependency "jbuilder", "~> 2.5" spec.add_runtime_dependency "kramdown", ">= 1.13", "< 3.0" From ec270f2b66815518d79404009fcabf5c5b36bc1e Mon Sep 17 00:00:00 2001 From: Johnathan Aspinwall Date: Tue, 30 Apr 2024 10:56:33 -0600 Subject: [PATCH 17/64] Refactor dataQuality report structure --- test/helpers/mdJson_hash_functions.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/helpers/mdJson_hash_functions.rb b/test/helpers/mdJson_hash_functions.rb index 4d47a2311..5ca63c183 100644 --- a/test/helpers/mdJson_hash_functions.rb +++ b/test/helpers/mdJson_hash_functions.rb @@ -72,7 +72,7 @@ def build_dataQuality hDataQuality[:report] = [ { - type: 'AbsoluteExternalPositionalAccuracy', + type: 'AbsolutePositionalAccuracy', standaloneQualityReportDetails: "standalone quality report details 1", qualityMeasure: { identifier: { From cf39d3377b803024fde2b246a92ea6106a79e147 Mon Sep 17 00:00:00 2001 From: Johnathan Aspinwall Date: Tue, 30 Apr 2024 11:23:24 -0600 Subject: [PATCH 18/64] chore: Update adiwg-mdjson_schemas and adiwg-mdcodes gem dependencies to latest pre-beta versions --- Gemfile.lock | 4 ++-- adiwg-mdtranslator.gemspec | 2 +- test/helpers/mdJson_hash_functions.rb | 2 +- test/writers/simple_html/testData/metadataGeo.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3c5a2246d..d3aeb4a03 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ PATH specs: adiwg-mdtranslator (2.20.0.pre.beta.2) adiwg-mdcodes (= 2.9.3.pre.beta.3) - adiwg-mdjson_schemas (= 2.9.2.pre.beta.6) + adiwg-mdjson_schemas (= 2.9.2.pre.beta.7) builder (~> 3.2) coderay (~> 1.1) jbuilder (~> 2.5) @@ -32,7 +32,7 @@ GEM public_suffix (>= 2.0.2, < 6.0) adiwg-mdcodes (2.9.3.pre.beta.3) json (~> 2.0) - adiwg-mdjson_schemas (2.9.2.pre.beta.6) + adiwg-mdjson_schemas (2.9.2.pre.beta.7) builder (3.2.4) coderay (1.1.3) concurrent-ruby (1.2.2) diff --git a/adiwg-mdtranslator.gemspec b/adiwg-mdtranslator.gemspec index 5734ee107..4854e13ff 100644 --- a/adiwg-mdtranslator.gemspec +++ b/adiwg-mdtranslator.gemspec @@ -34,7 +34,7 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency "thor", "~> 0.19" spec.add_runtime_dependency "uuidtools", "~> 2.1" spec.add_runtime_dependency "json-schema", "~> 2.7" - spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.9.2.pre.beta.6" + spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.9.2.pre.beta.7" spec.add_runtime_dependency "adiwg-mdcodes", "2.9.3.pre.beta.3" spec.add_runtime_dependency "jbuilder", "~> 2.5" spec.add_runtime_dependency "kramdown", ">= 1.13", "< 3.0" diff --git a/test/helpers/mdJson_hash_functions.rb b/test/helpers/mdJson_hash_functions.rb index 5ca63c183..0efdf3fd3 100644 --- a/test/helpers/mdJson_hash_functions.rb +++ b/test/helpers/mdJson_hash_functions.rb @@ -85,7 +85,7 @@ def build_dataQuality description: 'description' }, evaluationMethod: { - type: 'DQ_EvaluationMethod', + type: 'evaluationMethod', dateTime: ['2019-06-11T08:35:00', '2019-06-11T09:00:00'], methodDescription: 'evaluation method description', evaluationProcedure: { title: 'EP Title' }, diff --git a/test/writers/simple_html/testData/metadataGeo.json b/test/writers/simple_html/testData/metadataGeo.json index fcc82b7d4..7d94ceb90 100644 --- a/test/writers/simple_html/testData/metadataGeo.json +++ b/test/writers/simple_html/testData/metadataGeo.json @@ -2957,7 +2957,7 @@ } ], "evaluationMethod": { - "type": "DQ_EvaluationMethod", + "type": "evaluationMethod", "dateTime": ["2019-06-11T08:35:00"], "methodDescription": "evaluation method description", "evaluationProcedure": { From 9ef5dab812404a764844cfd2a821a25d31b5f924 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Tue, 30 Apr 2024 12:13:50 -0600 Subject: [PATCH 19/64] add acquisition to metadata hash objects --- test/helpers/mdJson_hash_objects.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/helpers/mdJson_hash_objects.rb b/test/helpers/mdJson_hash_objects.rb index 773c8d518..e872a5bc0 100644 --- a/test/helpers/mdJson_hash_objects.rb +++ b/test/helpers/mdJson_hash_objects.rb @@ -216,7 +216,8 @@ def base } ] }, - dataQuality: [] + dataQuality: [], + acquisition: [] }, metadataRepository: [], dataDictionary: [] @@ -1379,7 +1380,8 @@ def metadata associatedResource: [], additionalDocumentation: [], funding: [], - dataQuality: [] + dataQuality: [], + acquisition: [] } end From 5a3f58470ae80c9f8d401919ed1f196126a1ae0c Mon Sep 17 00:00:00 2001 From: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com> Date: Wed, 1 May 2024 11:20:54 -0600 Subject: [PATCH 20/64] fix/mdJson-reader-requirement (#359) * Update AcqRequirement class to handle acq-requirement * fix reference to hAcqRequirement * Rename to reference the Requirement class. add handlers to Requirement and RequestedDate --- .../mdJson/modules/module_acq-requirement.rb | 15 --- .../mdJson/modules/module_acquisition.rb | 4 +- .../mdJson/modules/module_requestedDate.rb | 51 +++++++++++ .../mdJson/modules/module_requirement.rb | 91 +++++++++++++++++++ 4 files changed, 144 insertions(+), 17 deletions(-) delete mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-requirement.rb create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_requestedDate.rb create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-requirement.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-requirement.rb deleted file mode 100644 index 074a3577a..000000000 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-requirement.rb +++ /dev/null @@ -1,15 +0,0 @@ -module ADIWG - module Mdtranslator - module Readers - module MdJson - - module AcqRequirement - def self.unpack(hAcqRequirement, responseObj, inContext = nil) - - end - end - - end - end - end -end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb index dea7c11d7..ec018674b 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb @@ -1,5 +1,5 @@ require_relative 'module_scope' -require_relative 'module_acq-requirement' +require_relative 'module_requirement' require_relative 'module_acq-objective' require_relative 'module_acq-platform' require_relative 'module_acq-instrument' @@ -48,7 +48,7 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) if hAcquisition.has_key?('requirement') aItems = hAcquisition['requirement'] aItems.each do |item| - hReturn = AcqRequirement.unpack(item, responseObj, outContext) + hReturn = Requirement.unpack(item, responseObj, outContext) unless hReturn.nil? intAcquisition[:requirements] << hReturn end diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requestedDate.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requestedDate.rb new file mode 100644 index 000000000..070fc4146 --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requestedDate.rb @@ -0,0 +1,51 @@ +require_relative 'module_dateTime' + +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module RequestedDate + def self.unpack(hRequestedDate, responseObj, inContext = nil) + + @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson + + outContext = 'RequestedDate' + outContext = inContext + ' > ' + outContext unless inContext.nil? + + # return nil object if input is empty + if hRequestedDate.empty? + @MessagePath.issueWarning(41, responseObj, outContext) + return nil + end + + intMetadataClass = InternalMetadata.new + intRequestedDate = intMetadataClass.newRequestedDate + + if hRequestedDate.has_key?('requestedDateOfCollection') + hReturn = DateTime.unpack(hRequestedDate['requestedDateOfCollection'], responseObj, outContext) + unless hReturn.nil? + intRequestedDate[:requestedDateOfCollection] = hReturn + else + @MessagePath.issueError(161, responseObj, inContext) + end + end + + if hRequestedDate.has_key?('latestAcceptableDate') + hReturn = DateTime.unpack(hRequestedDate['latestAcceptableDate'], responseObj, outContext) + unless hReturn.nil? + intRequestedDate[:latestAcceptableDate] = hReturn + else + @MessagePath.issueError(161, responseObj, inContext) + end + end + + intRequestedDate + + end + end + + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb new file mode 100644 index 000000000..c55d4c613 --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb @@ -0,0 +1,91 @@ +require_relative 'module_citation' +require_relative 'module_identifier' +require_relative 'module_requestedDate' +require_relative 'module_plan' + +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module Requirement + def self.unpack(hRequirement, responseObj, inContext = nil) + + @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson + + outContext = 'requirement' + outContext = inContext + ' > ' + outContext unless inContext.nil? + + # return nil object if input is empty + if hRequirement.empty? + @MessagePath.issueWarning(41, responseObj, outContext) + return nil + end + + intMetadataClass = InternalMetadata.new + intRequirement = intMetadataClass.newRequirement + + if hRequirement.has_key?('requirementId') + intRequirement[:requirementId] = hRequirement['requirementId'] + end + + if hRequirement.has_key?('citation') + hReturn = Citation.unpack(hRequirement['citation'], responseObj, outContext) + unless hReturn.nil? + intRequirement[:citation] = hReturn + end + end + + if hRequirement.has_key?('identifier') + hReturn = Identifier.unpack(hRequirement['identifier'], responseObj, outContext) + unless hReturn.nil? + intRequirement[:identifiers] = hReturn + end + end + + if hRequirement.has_key?('requestors') + hRequirement['requestors'].each do |requestor| + intRequirement[:requestors] << requestor + end + end + + if hRequirement.has_key?('recipients') + hRequirement['recipients'].each do |recipient| + intRequirement[:recipients] << recipient + end + end + + if hRequirement.has_key?('priority') + intRequirement[:priority] = hRequirement['priority'] + end + + if hRequirement.has_key?('requestedDate') + hReturn = RequestedDate.unpack(hRequirement['requestedDate'], responseObj, outContext) + unless hReturn.nil? + intRequirement[:requestedDate] = hReturn + end + end + + if hRequirement.has_key?('expiryDate') + intRequirement[:expiryDate] = hRequirement['expiryDate'] + end + + if hRequirement.has_key?('satisfiedPlans') + aItems = hRequirement['satisfiedPlans'] + aItems.each do |item| + hReturn = Plan.unpack(item, responseObj, outContext) + unless hReturn.nil? + intRequirement[:satisfiedPlans] << hReturn + end + end + end + puts intRequirement + intRequirement + + end + end + + end + end + end +end \ No newline at end of file From 498193fd7918041e02521f60e9071bde3d7c9987 Mon Sep 17 00:00:00 2001 From: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com> Date: Wed, 1 May 2024 11:23:00 -0600 Subject: [PATCH 21/64] Fix/md json reader event (#362) * update internal object. Add handler for event * Rename and reference Event class. Rename file. --- .../internal/internal_metadata_obj.rb | 3 +- .../mdJson/modules/module_acq-event.rb | 15 ---- .../mdJson/modules/module_acquisition.rb | 22 +++--- .../readers/mdJson/modules/module_event.rb | 79 ++++++++++++++++++- 4 files changed, 89 insertions(+), 30 deletions(-) delete mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-event.rb diff --git a/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb b/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb index 2dace8d88..aba27e91a 100644 --- a/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +++ b/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb @@ -184,12 +184,13 @@ def newEnvironment def newEvent { eventId: nil, + identifier: {}, trigger: nil, context: nil, sequence: nil, dateTime: nil, expectedObjectives: [], - relatedPass: nil, + relatedPass: {}, relatedSensors: [] } end diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-event.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-event.rb deleted file mode 100644 index 3146f771d..000000000 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-event.rb +++ /dev/null @@ -1,15 +0,0 @@ -module ADIWG - module Mdtranslator - module Readers - module MdJson - - module AcqEvent - def self.unpack(hAcqEvent, responseObj, inContext = nil) - - end - end - - end - end - end -end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb index ec018674b..a8f9218ce 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb @@ -4,7 +4,7 @@ require_relative 'module_acq-platform' require_relative 'module_acq-instrument' require_relative 'module_acq-operation' -require_relative 'module_acq-event' +require_relative 'module_event' require_relative 'module_acq-pass' require_relative 'module_acq-environment' @@ -35,15 +35,15 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) end end - if hAcquisition.has_key?('plan') - aItems = hAcquisition['plan'] - aItems.each do |item| - hReturn = AcqPlan.unpack(item, responseObj, outContext) - unless hReturn.nil? - intAcquisition[:plans] << hReturn - end - end - end + # if hAcquisition.has_key?('plan') + # aItems = hAcquisition['plan'] + # aItems.each do |item| + # hReturn = AcqPlan.unpack(item, responseObj, outContext) + # unless hReturn.nil? + # intAcquisition[:plans] << hReturn + # end + # end + # end if hAcquisition.has_key?('requirement') aItems = hAcquisition['requirement'] @@ -98,7 +98,7 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) if hAcquisition.has_key?('event') aItems = hAcquisition['event'] aItems.each do |item| - hReturn = AcqEvent.unpack(item, responseObj, outContext) + hReturn = Event.unpack(item, responseObj, outContext) unless hReturn.nil? intAcquisition[:events] << hReturn end diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_event.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_event.rb index 3146f771d..3689a7dec 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_event.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_event.rb @@ -1,11 +1,84 @@ +require_relative 'module_identifier' +require_relative 'module_dateTime' +# require_relative 'module_objective' +# require_relative 'module_pass' +# require_relative 'module_instrument' + module ADIWG module Mdtranslator module Readers module MdJson - module AcqEvent - def self.unpack(hAcqEvent, responseObj, inContext = nil) - + module Event + def self.unpack(hEvent, responseObj, inContext = nil) + @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson + + intMetadataClass = InternalMetadata.new + intEvent = intMetadataClass.newEvent + + outContext = 'Event' + outContext = inContext + ' > ' + outContext unless inContext.nil? + + if hEvent.has_key?('eventId') + intEvent[:eventId] = hEvent['eventId'] + else + @MessagePath.issueWarning(40, responseObj, outContext) + end + + if hEvent.has_key?('identifier') + intEvent[:identifier] = Identifier.unpack(hEvent['identifier'], responseObj, outContext) + else + @MessagePath.issueWarning(40, responseObj, outContext) + end + + if hEvent.has_key?('trigger') + intEvent[:trigger] = hEvent['trigger'] + else + @MessagePath.issueWarning(40, responseObj, outContext) + end + + if hEvent.has_key?('context') + intEvent[:context] = hEvent['context'] + else + @MessagePath.issueWarning(40, responseObj, outContext) + end + + if hEvent.has_key?('sequence') + intEvent[:sequence] = hEvent['sequence'] + else + @MessagePath.issueWarning(40, responseObj, outContext,) + end + + if hEvent.has_key?('time') + intEvent[:time] = DateTime.unpack(hEvent['time'], responseObj, outContext) + else + @MessagePath.issueWarning(40, responseObj, outContext) + end + + if hEvent.has_key?('expectedObjective') + intEvent['expectedObjective'].each do |item| + hReturn = Objective.unpack(item, responseObj, outContext) + unless hReturn.nil? + intEvent[:expectedObjectives] << hReturn + end + end + end + + if hEvent.has_key?('relatedPass') + intEvent[:relatedPass] = Pass.unpack(hEvent['relatedPass'], response) + end + + if hEvent.has_key?('relatedSensor') + hEvent['relatedSensor'].each do |item| + hReturn = Instrument.unpack(item, responseObj, outContext) + unless hReturn.nil? + intEvent[:relatedSensors] << hReturn + end + end + end + + intEvent + end end From 3a514e7f9e4410d95c7867417455625d1c883e16 Mon Sep 17 00:00:00 2001 From: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com> Date: Wed, 1 May 2024 11:23:54 -0600 Subject: [PATCH 22/64] Fix/md json reader instrument (#363) * Add internal object. Handle instrumentationEventList. * Add internal object. handle instrumentationEvent * Add internal object. Add handler to for revision. * update internal object. Add handler to instrument * Add handlers for instrument, instrumentationEvent, instrumentationEventList, Revision. Rename module_instrument file. Update internal objects to fix typos --- .../internal/internal_metadata_obj.rb | 32 +++++++- .../mdJson/modules/module_acq-instrument.rb | 15 ---- .../mdJson/modules/module_acquisition.rb | 4 +- .../mdJson/modules/module_instrument.rb | 73 +++++++++++++++++++ .../modules/module_instrumentationEvent.rb | 72 ++++++++++++++++++ .../module_instrumentationEventList.rb | 65 +++++++++++++++++ .../readers/mdJson/modules/module_revision.rb | 50 +++++++++++++ 7 files changed, 293 insertions(+), 18 deletions(-) delete mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-instrument.rb create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrument.rb create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrumentationEvent.rb create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrumentationEventList.rb create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_revision.rb diff --git a/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb b/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb index aba27e91a..5117c5b20 100644 --- a/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +++ b/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb @@ -202,7 +202,29 @@ def newInstrument identifier: {}, instrumentType: nil, description: nil, - mountedOn: nil + mountedOn: nil, + histories: [], + hostId: {} + } + end + + def newInstrumentationEvent + { + citation: {}, + description: nil, + extent: {}, + eventType: nil, + revisionHistories: [], + } + end + + def newInstrumentationEventList + { + citations: [], + description: nil, + locale: {}, + constraints: [], + instrumentationEvents: [] } end @@ -270,6 +292,14 @@ def newRequirement } end + def newRevision + { + description: nil, + responsibleParty: {}, + dateInfo: [] + } + end + def newPlatform { platformId: nil, diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-instrument.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-instrument.rb deleted file mode 100644 index ff378d1e9..000000000 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-instrument.rb +++ /dev/null @@ -1,15 +0,0 @@ -module ADIWG - module Mdtranslator - module Readers - module MdJson - - module AcqInstrument - def self.unpack(hAcqInstrument, responseObj, inContext = nil) - - end - end - - end - end - end -end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb index a8f9218ce..a7c3e78fb 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb @@ -2,7 +2,7 @@ require_relative 'module_requirement' require_relative 'module_acq-objective' require_relative 'module_acq-platform' -require_relative 'module_acq-instrument' +require_relative 'module_instrument' require_relative 'module_acq-operation' require_relative 'module_event' require_relative 'module_acq-pass' @@ -78,7 +78,7 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) if hAcquisition.has_key?('instrument') aItems = hAcquisition['instrument'] aItems.each do |item| - hReturn = AcqInstrument.unpack(item, responseObj, outContext) + hReturn = Instrument.unpack(item, responseObj, outContext) unless hReturn.nil? intAcquisition[:instruments] << hReturn end diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrument.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrument.rb new file mode 100644 index 000000000..29436d045 --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrument.rb @@ -0,0 +1,73 @@ +require_relative 'module_citation' +require_relative 'module_platform' +require_relative 'module_instrumentationEventList' +require_relative 'module_identifier' + +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module Instrument + def self.unpack(hInstrument, responseObj, inContext = nil) + + @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson + + intMetadataClass = InternalMetadata.new + intInstrument = intMetadataClass.newInstrument + + outContext = 'instrument' + outContext = inContext + ' > ' + outContext unless inContext.nil? + + if hInstrument.has_key?('instrumentId') + intInstrument[:instrumentId] = hInstrument['instrumentId'] + else + @MessagePath.issueWarning(40, responseObj, outContext) + end + + if hInstrument.has_key?('citation') + intInstrument[:citation] = Citation.unpack(hInstrument['citation'], responseObj, outContext) + end + + if hInstrument.has_key?('identifier') + intInstrument[:identifier] = hInstrument['identifier'] + else + @MessagePath.issueWarning(40, responseObj, outContext) + end + + if hInstrument.has_key?('instrumentType') + intInstrument[:instrumentType] = hInstrument['instrumentType'] + else + @MessagePath.issueWarning(40, responseObj, outContext) + end + + if hInstrument.has_key?('description') + intInstrument[:description] = hInstrument['description'] + end + + if hInstrument.has_key?('mountedOn') + intInstrument[:mountedOn] = Platform.unpack(hInstrument['mountedOn'], responseObj, outContext) + end + + if hInstrument.has_key?('history') + hInstrument['history'].each do |item| + hReturn = InstrumentationEventList.unpack(item, responseObj, outContext) + unless hReturn.nil? + intInstrument[:histories] << hReturn + end + end + end + + if hInstrument.has_key?('hostId') + intInstrument[:hostId] = Identifier.unpack(hInstrument['hostId'], responseObj, outContext) + end + + intInstrument + + end + end + + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrumentationEvent.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrumentationEvent.rb new file mode 100644 index 000000000..360852a18 --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrumentationEvent.rb @@ -0,0 +1,72 @@ +require_relative 'module_citation' +require_relative 'module_extent' +require_relative 'module_revision' + +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module InstrumentationEvent + def self.unpack(hInstrumentationEvent, responseObj, inContext = nil) + @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson + + intMetadataClass = InternalMetadata.new + intInstrumentationEvent = intMetadataClass.newInstrumentationEvent + + outContext = 'instrumentation event' + outContext = inContext + ' > ' + outContext unless inContext.nil? + + eventTypeArray = [ + "announcement", + "calibration", + "calibrationCoefficientUpdate", + "dataLoss", + "fatal", + "manoeuvre", + "missingData", + "notice", + "prelaunch", + "severe", + "switchOff", + "switchOn", + "clean" + ] + + if hInstrumentationEvent.has_key?('citation') + intInstrumentationEvent[:citation] = Citation.unpack(hInstrumentationEvent['citation'], responseObj, outContext) + end + + if hInstrumentationEvent.has_key?('description') + intInstrumentationEvent[:description] = hInstrumentationEvent['description'] + else + @MessagePath.issueWarning(40, responseObj, outContext) + end + + if hInstrumentationEvent.has_key?('extent') + intInstrumentationEvent[:extent] = Extent.unpack(hInstrumentationEvent['extent'], responseObj, outContext) + end + + if hInstrumentationEvent.has_key?('eventType') && eventTypeArray.include?(hInstrumentationEvent['eventType']) + intInstrumentationEvent[:eventType] = hInstrumentationEvent['eventType'] + else + @MessagePath.issueWarning(41, responseObj, outContext) + end + + if hInstrumentationEvent.has_key?('revisionHistory') + hInstrumentationEvent['revisionHistory'].each do |item| + hReturn = Revision.unpack(item, responseObj, outContext) + unless hReturn.nil? + intInstrumentationEvent[:revisionHistories] << hReturn + end + end + end + + intInstrumentationEvent + end + end + + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrumentationEventList.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrumentationEventList.rb new file mode 100644 index 000000000..510ba7c5c --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrumentationEventList.rb @@ -0,0 +1,65 @@ +require_relative 'module_citation' +require_relative 'module_locale' +require_relative 'module_constraint' +require_relative 'module_instrumentationEvent' + +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module InstrumentationEventList + def self.unpack(hInstrumentationEventList, responseObj, inContext = nil) + @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson + + intMetadataClass = InternalMetadata.new + intInstrumentationEventList = intMetadataClass.newInstrumentationEventList + + if hInstrumentationEventList.has_key?('citation') + citations = hInstrumentationEventList['citation'] + citations.each do |citation| + hReturn = Citation.unpack(hInstrumentationEventList['citation'], responseObj, inContext) + unless hReturn.nil? + intInstrumentationEventList[:citations] << hReturn + end + end + end + + if hInstrumentationEventList.has_key?('description') + intInstrumentationEventList[:description] = hInstrumentationEventList['description'] + else + @MessagePath.issueWarning(40, responseObj, inContext, 'instrumentation event description') + end + + if hInstrumentationEventList.has_key?('locale') + hReturn = Locale.unpack(hInstrumentationEventList['locale'], responseObj, inContext) + + end + + if hInstrumentationEventList.has_key?('constraint') + constraints = hInstrumentationEventList['constraint'] + constraints.each do |constraint| + hReturn = Constraint.unpack(hInstrumentationEventList['constraint'], responseObj, inContext) + unless hReturn.nil? + intInstrumentationEventList[:constraints] << hReturn + end + end + end + + if hInstrumentationEventList.has_key?('instrumentationEvent') + hInstrumentationEventList['instrumentationEvent'].each do |item| + hReturn = InstrumentationEvent.unpack(item, responseObj, inContext) + unless hReturn.nil? + intInstrumentationEventList[:instrumentationEvents] << hReturn + end + end + end + + intInstrumentationEventList + end + end + + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_revision.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_revision.rb new file mode 100644 index 000000000..8d3338f8a --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_revision.rb @@ -0,0 +1,50 @@ +require_relative 'module_responsibleParty' +require_relative 'module_dateTime' + +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module Revision + def self.unpack(hRevision, responseObj, inContext = nil) + @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson + + intMetadataClass = InternalMetadata.new + intRevision = intMetadataClass.newRevision + + outContext = 'revision' + outContext = inContext + ' > ' + outContext unless inContext.nil? + + if hRevision.has_key?('description') + intRevision[:description] = hRevision['description'] + else + @MessagePath.issueWarning(40, responseObj, outContext) + end + + if hRevision.has_key?('responsibleParty') + intRevision[:responsibleParty] = ResponsibleParty.unpack(hRevision['responsibleParty'], responseObj, outContext) + else + @MessagePath.issueWarning(41, responseObj, outContext) + end + + if hRevision.has_key?('dateInfo') + intRevision[:dateInfo].each do |item| + hReturn = DateTime.unpack(item, responseObj, outContex) + unless hReturn.nil? + intRevision[:dateInfo] << hReturn + end + end + else + @MessagePath.issueWarning(41, responseObj, outContext) + end + + intRevision + + end + end + + end + end + end +end \ No newline at end of file From 174f3d8e2e8aea704ce2d39f5d03ae3a94e4d740 Mon Sep 17 00:00:00 2001 From: Johnathan Aspinwall Date: Wed, 1 May 2024 11:36:39 -0600 Subject: [PATCH 23/64] Update adiwg-mdtranslator version to 2.20.0-beta.1 --- Gemfile.lock | 2 +- lib/adiwg/mdtranslator/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a9d154596..ff22fde13 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - adiwg-mdtranslator (2.20.0.pre.beta.4) + adiwg-mdtranslator (2.20.0.pre.beta.1) adiwg-mdcodes (= 2.9.3.pre.beta.3) adiwg-mdjson_schemas (= 2.9.2.pre.beta.7) builder (~> 3.2) diff --git a/lib/adiwg/mdtranslator/version.rb b/lib/adiwg/mdtranslator/version.rb index 120184454..a8cd5aa04 100644 --- a/lib/adiwg/mdtranslator/version.rb +++ b/lib/adiwg/mdtranslator/version.rb @@ -109,7 +109,7 @@ module ADIWG module Mdtranslator # current mdtranslator version - VERSION = "2.20.0-beta.4" + VERSION = "2.20.0-beta.1" end end From 3cd7445e293698d16eb2f4c35fd35e51bbdc21fa Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Thu, 2 May 2024 16:01:44 -0600 Subject: [PATCH 24/64] Add acquisition class to writer. Add reference to class in metadata. --- .../mdJson/sections/mdJson_acquisition.rb | 42 +++++++++++++++++++ .../mdJson/sections/mdJson_metadata.rb | 2 + 2 files changed, 44 insertions(+) create mode 100644 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb new file mode 100644 index 000000000..9787e38d9 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb @@ -0,0 +1,42 @@ +require 'jbuilder' +require_relative 'mdJson_scope' +# require_relative 'mdJson_plan' +# require_relative 'mdJson_requirement' +# require_relative 'mdJson_objective' +# require_relative 'mdJson_platform' +# require_relative 'mdJson_instrument' +# require_relative 'mdJson_operation' +require_relative 'mdJson_event' +# require_relative 'mdJson_pass' +# require_relative 'mdJson_environment' + +module ADIWG + module Mdtranslator + module Writers + module MdJson + + module Acquisition + + @Namespace = ADIWG::Mdtranslator::Writers::MdJson + + def self.build(hAcquisition) + + Jbuilder.new do |json| + # json.scope Scope.build(hAcquisition[:scope]) + # json.plan @Namespace.json_map(hAcquisition[:plans], Plan) + # json.requirement @Namespace.json_map(hAcquisition[:requirements], Requirement) + # json.objective @Namespace.json_map(hAcquisition[:objectives], Objective) + # json.platform @Namespace.json_map(hAcquisition[:platforms], Platform) + # json.instrument @Namespace.json_map(hAcquisition[:instruments], Instrument) + # json.operation @Namespace.json_map(hAcquisition[:operations], Operation) + json.event @Namespace.json_map(hAcquisition[:events], Event) + # json.pass @Namespace.json_map(hAcquisition[:passes], Pass) + # json.environment Environment.build(hAcquisition[:environment]) + end + + end + end # Acquisition + end # Event + end + end +end diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_metadata.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_metadata.rb index 5a6469553..834de0f4c 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_metadata.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_metadata.rb @@ -13,6 +13,7 @@ require_relative 'mdJson_additionalDocumentation' require_relative 'mdJson_funding' require_relative 'mdJson_dataQuality' +require_relative 'mdJson_acquisition' module ADIWG module Mdtranslator @@ -34,6 +35,7 @@ def self.build(hMetadata) json.associatedResource @Namespace.json_map(hMetadata[:associatedResources], AssociatedResource) json.additionalDocumentation @Namespace.json_map(hMetadata[:additionalDocuments], AdditionalDocument) json.funding @Namespace.json_map(hMetadata[:funding], Funding) + json.acquisition @Namespace.json_map(hMetadata[:acquisitions], Acquisition) end end # build From 5dc829a4a14f2c4e77a5a5b58b8af71922ebefa9 Mon Sep 17 00:00:00 2001 From: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com> Date: Thu, 2 May 2024 16:14:53 -0600 Subject: [PATCH 25/64] Fix/md json reader pass (#364) * Add handler to Pass * Rename Pass file. Update references to Pass class. Add handler for Pass. * uncomment necessary code --- .../readers/mdJson/modules/module_acq-pass.rb | 15 ------ .../mdJson/modules/module_acquisition.rb | 6 +-- .../readers/mdJson/modules/module_pass.rb | 53 +++++++++++++++++++ 3 files changed, 56 insertions(+), 18 deletions(-) delete mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-pass.rb create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_pass.rb diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-pass.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-pass.rb deleted file mode 100644 index 0772c255b..000000000 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-pass.rb +++ /dev/null @@ -1,15 +0,0 @@ -module ADIWG - module Mdtranslator - module Readers - module MdJson - - module AcqPass - def self.unpack(hAcqPass, responseObj, inContext = nil) - - end - end - - end - end - end -end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb index a7c3e78fb..2e23e153a 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb @@ -4,8 +4,8 @@ require_relative 'module_acq-platform' require_relative 'module_instrument' require_relative 'module_acq-operation' +require_relative 'module_pass' require_relative 'module_event' -require_relative 'module_acq-pass' require_relative 'module_acq-environment' module ADIWG @@ -108,9 +108,9 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) if hAcquisition.has_key?('pass') aItems = hAcquisition['pass'] aItems.each do |item| - hReturn = AcqPass.unpack(item, responseObj, outContext) + hReturn = Pass.unpack(item, responseObj, outContext) unless hReturn.nil? - intAcquisition[:passs] << hReturn + intAcquisition[:passes] << hReturn end end end diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_pass.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_pass.rb new file mode 100644 index 000000000..ca8d70f64 --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_pass.rb @@ -0,0 +1,53 @@ +require_relative 'module_identifier' +require_relative 'module_extent' +require_relative 'module_event' + +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module Pass + def self.unpack(hPass, responseObj, inContext = nil) + @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson + + intMetadataClass = InternalMetadata.new + intPass = intMetadataClass.newPass + + outContext = 'pass' + outContext = inContext + ' > ' + outContext unless inContext.nil? + + if hPass.has_key?('passId') + intPass[:passId] = hPass['passId'] + else + @MessagePath.issueWarning(40, responseObj, outContext) + end + + if hPass.has_key?('identifier') + intPass[:identifier] = Identifier.unpack(hPass['identifier'], responseObj, outContext) + else + @MessagePath.issueWarning(40, responseObj, outContext) + end + + if hPass.has_key?('extent') + intPass[:extent] = Extent.unpack(hPass['extent'], responseObj, outContext) + end + + if hPass.has_key?('relatedEvent') + hPass['relatedEvent'].each do |item| + hReturn = Event.unpack(item, responseObj, outContext) + unless hReturn.nil? + intPass[:relatedEvents] << hReturn + end + end + end + + intPass + + end + end + + end + end + end +end \ No newline at end of file From 0e5f2557f0d86a68f9d6dd66f92247045bbaf6a8 Mon Sep 17 00:00:00 2001 From: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com> Date: Thu, 2 May 2024 16:16:08 -0600 Subject: [PATCH 26/64] fix/mdJson-reader-platform (#361) * Update interal object. Add logic to handle platform class * fix key name * Rename Platform class and file. Updated references to class. --- .../internal/internal_metadata_obj.rb | 3 +- .../mdJson/modules/module_acq-platform.rb | 15 ---- .../mdJson/modules/module_acquisition.rb | 4 +- .../readers/mdJson/modules/module_platform.rb | 76 +++++++++++++++++++ 4 files changed, 80 insertions(+), 18 deletions(-) delete mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-platform.rb create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb diff --git a/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb b/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb index 5117c5b20..e2d5cd1e2 100644 --- a/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +++ b/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb @@ -307,7 +307,8 @@ def newPlatform identifier: {}, description: nil, sponsors: [], - instruments: [] + instruments: [], + history: [] } end diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-platform.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-platform.rb deleted file mode 100644 index 35db28c41..000000000 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-platform.rb +++ /dev/null @@ -1,15 +0,0 @@ -module ADIWG - module Mdtranslator - module Readers - module MdJson - - module AcqPlatform - def self.unpack(hAcqPlatform, responseObj, inContext = nil) - - end - end - - end - end - end -end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb index 2e23e153a..ea3f12c42 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb @@ -1,7 +1,7 @@ require_relative 'module_scope' require_relative 'module_requirement' require_relative 'module_acq-objective' -require_relative 'module_acq-platform' +require_relative 'module_platform' require_relative 'module_instrument' require_relative 'module_acq-operation' require_relative 'module_pass' @@ -68,7 +68,7 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) if hAcquisition.has_key?('platform') aItems = hAcquisition['platform'] aItems.each do |item| - hReturn = AcqPlatform.unpack(item, responseObj, outContext) + hReturn = Platform.unpack(item, responseObj, outContext) unless hReturn.nil? intAcquisition[:platforms] << hReturn end diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb new file mode 100644 index 000000000..27477ab46 --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb @@ -0,0 +1,76 @@ +require_relative 'module_citation' +require_relative 'module_identifier' +require_relative 'module_responsibileParty' +require_relative 'module_acq-instrument' +require_relative 'module_acq-instrumentationEventList' + +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module Platform + def self.unpack(hAcqPlatform, responseObj, inContext = nil) + @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson + + intAcqPlatform = intMetadataClass.newPlatform + + if hAcqPlatform.has_key('platformId') + intAcqPlatform[:platformId] = hAcqPlatform['platformId'] + else + @MessagePath.issueError(460, responseObj, inContext) + end + + if hAcqPlatform.has_key?('citation') + hReturn = Citation.unpack(hAcqPlatform['citation'], responseObj, inContext) + unless hReturn.nil? + intAcqPlatform[:citation] = hReturn + end + end + + if hAcqPlatform.has_key?('identifier') + hReturn = Identifier.unpack(hAcqPlatform['identifier'], responseObj, inContext) + unless hReturn.nil? + intAcqPlatform[:identifier] = hReturn + else + @MessagePath.issueError(461, responseObj, inContext) + end + end + + if hAcqPlatform.has_key('description') + intAcqPlatform[:description] = hAcqPlatform['description'] + else + @MessagePath.issueError(460, responseObj, inContext) + end + + if hAcqPlatform.has_key?('sponsor') + hReturn = ResponsibileParty.unpack(hAcqPlatform['sponsor'], responseObj, inContext) + unless hReturn.nil? + intAcqPlatform[:sponsors] = hReturn + end + end + + if hAcqPlatform.has_key('instrument') + hReturn = AcqInstrument.unpack(hAcqPlatform['instrument'], responseObj, inContext) + unless hReturn.nil? + intAcqPlatform[:instruments] = hReturn + else + @MessagePath.issueError(461, responseObj, inContext) + end + end + + if hAcqPlatform.has_key('history') + hReturn = AcqInstrumentationEventList.unpack(hAcqPlatform['history'], responseObj, inContext) + unless hReturn.nil? + intAcqPlatform[:history] = hReturn + end + + intAcqPlatform + + end + end + + end + end + end +end \ No newline at end of file From 43bec4c3951b71bbcbc6ab2ffec08ffd959063d1 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Fri, 3 May 2024 11:24:09 -0600 Subject: [PATCH 27/64] Add Requirement and RequestedDate classes to mdJson writer. --- .../mdJson/sections/mdJson_requestedDate.rb | 26 ++++++++++++++ .../mdJson/sections/mdJson_requirement.rb | 34 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_requestedDate.rb create mode 100644 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_requirement.rb diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_requestedDate.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_requestedDate.rb new file mode 100644 index 000000000..085e7c891 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_requestedDate.rb @@ -0,0 +1,26 @@ +require 'jbuilder' +require_relative 'mdJson_dateTime' + +module ADIWG + module Mdtranslator + module Writers + module MdJson + + module Requirement + + @Namespace = ADIWG::Mdtranslator::Writers::MdJson + + def self.build(hRequestedDate) + + Jbuilder.new do |json| + json.requestedDateOfCollection DateTime.build(hRequestedDate[:requestedDateOfCollection]) + json.latestAcceptableDate DateTime.build(hRequestedDate[:latestAcceptableDate]) + end + + end + end # Requested Date + + end + end + end +end diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_requirement.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_requirement.rb new file mode 100644 index 000000000..2b5e0a683 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_requirement.rb @@ -0,0 +1,34 @@ +require 'jbuilder' +require_relative 'mdJson_citation' +require_relative 'mdJson_identifier' +require_relative 'mdJson_requestedDate' + +module ADIWG + module Mdtranslator + module Writers + module MdJson + + module Requirement + + @Namespace = ADIWG::Mdtranslator::Writers::MdJson + + def self.build(hRequirement) + + Jbuilder.new do |json| + json.requirementId hRequirement[:requirementId] + json.citation Citation.build(hRequirement[:citation]) + json.identifier Identifier.build(hRequirement[:identifier]) + json.requestor @Namespace.json_map(hRequirement[:requestors], Requestor) + json.recipient @Namespace.json_map(hRequirement[:recipients], Recipient) + json.priority hRequirement[:priority] + json.requestedDate RequestedDate.build(hRequirement[:requestedDate]) + json.expiryDate hRequirement[:expiryDate] + json.satisfiedPlan @Namespace.json_map(hRequirement[:satisfiedPlans], Plan) + end + + end + end # Requirement + end + end + end +end From 46602fbfe52719ef6ffd56b7b09491ccb7f4f181 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Fri, 3 May 2024 13:11:46 -0600 Subject: [PATCH 28/64] fix class name for requestedDate --- .../writers/mdJson/sections/mdJson_requestedDate.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_requestedDate.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_requestedDate.rb index 085e7c891..634574675 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_requestedDate.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_requestedDate.rb @@ -6,7 +6,7 @@ module Mdtranslator module Writers module MdJson - module Requirement + module RequestedDate @Namespace = ADIWG::Mdtranslator::Writers::MdJson From a2cec2e73060e02d2d7c20e908711456749255ea Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Fri, 3 May 2024 13:30:18 -0600 Subject: [PATCH 29/64] Add Objective class to writer --- .../mdJson/sections/mdJson_objective.rb | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_objective.rb diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_objective.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_objective.rb new file mode 100644 index 000000000..b1cdc2ab7 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_objective.rb @@ -0,0 +1,38 @@ +require 'jbuilder' +require_relative 'mdJson_identifier' +require_relative 'mdJson_objectiveType' +require_relative 'mdJson_extent' +require_relative 'mdJson_event' +require_relative 'mdJson_pass' +require_relative 'mdJson_instrument' + +module ADIWG + module Mdtranslator + module Writers + module MdJson + + module Objective + + @Namespace = ADIWG::Mdtranslator::Writers::MdJson + + def self.build(hObjective) + + Jbuilder.new do |json| + json.objectiveId hObjective[:objectiveId] + json.identifier @Namespace.json_map(hObjective[:identifiers], Identifier) + json.priority hObjective[:priority] unless hObjective[:priority].nil? + json.objectiveType hObjective[:objectiveTypes] unless hObjective[:types].empty? + json.function hObjective[:functions] unless hObjective[:functions].empty? + json.extent @Namespace.json_map(hObjective[:extents], Extent) unless hObjective[:extents].empty? + json.objectiveOccurence @Namespace.json_map(hObjective[:occurrences], Event) unless hObjective[:occurrences].empty? + json.pass @Namespace.json_map(hObjective[:passes], Pass) unless hObjective[:passes].empty? + json.sensingInstrument @Namespace.json_map(hObjective[:instruments], Instrument) unless hObjective[:instruments].empty? + end + + end + end # Objective + + end + end + end +end From 8746b4172d57498aeafc3453e1ab0804d924b8fd Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Fri, 3 May 2024 15:02:38 -0600 Subject: [PATCH 30/64] Add Platform class to mdJson writer --- .../mdJson/sections/mdJson_platform.rb | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_platform.rb diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_platform.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_platform.rb new file mode 100644 index 000000000..2c5ed83cc --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_platform.rb @@ -0,0 +1,35 @@ +require 'jbuilder' +require_relative 'mdJson_citation' +require_relative 'mdJson_identifier' +require_relative 'mdJson_responsibleParty' +require_relative 'mdJson_instrument' +require_relative 'mdJson_instrumentationEventList' + +module ADIWG + module Mdtranslator + module Writers + module MdJson + + module Platform + + @Namespace = ADIWG::Mdtranslator::Writers::MdJson + + def self.build(hPlatform) + + Jbuilder.new do |json| + json.platformId hPlatform[:platformId] + json.citation Citation.build(hPlatform[:citation]) unless hPlatform[:citation].empty? + json.identifier Identifier.build(hPlatform[:identifier]) + json.description hPlatform[:description] + json.sponsor @Namespace.json_map(hPlatform[:sponsors], ResponsibleParty) unless hPlatform[:sponsors].empty? + json.instrument @Namespace.json_map(hPlatform[:instruments], Instrument) + json.history @Namespace.json_map(hPlatform[:history], InstrumentationEventList) unless hPlatform[:history].empty? + end + + end + end # Platform + + end + end + end +end From 2037a2a8fb9a4d1b0a6a28b8d6d1bc851a1e5bbc Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Fri, 3 May 2024 15:29:22 -0600 Subject: [PATCH 31/64] Add instrument class to writer. --- .../mdJson/sections/mdJson_instrument.rb | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrument.rb diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrument.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrument.rb new file mode 100644 index 000000000..e349a8baa --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrument.rb @@ -0,0 +1,35 @@ +require 'jbuilder' +require_relative 'mdJson_citation' +require_relative 'mdJson_identifier' +require_relative 'mdJson_platform' +require_relative 'mdJson_instrumentationEventList' + +module ADIWG + module Mdtranslator + module Writers + module MdJson + + module Instrument + + @Namespace = ADIWG::Mdtranslator::Writers::MdJson + + def self.build(hInstrument) + + Jbuilder.new do |json| + json.instrumentId hInstrument[:instrumentId] + json.citation Citation.build(hInstrument[:citation]) unless hInstrument[:citation].empty? + json.identifier Identifier.build(hInstrument[:identifier]) + json.instrumentType hInstrument[:instrumentType] + json.description hInstrument[:description] unless hInstrument[:description].nil? + json.mountedOn Platform.build(hInstrument[:mountedOn]) unless hInstrument[:mountedOn].empty? + json.history @Namespace.json_map(hInstrument[:history], InstrumentationEventList) unless hInstrument[:history].empty? + json.hostId Identifier.build(hInstrument[:hostId]) unless hInstrument[:hostId].empty? + end + + end + end # Instrument + + end + end + end +end From 7eb9883218b095ffcaa057e4998144cd1bba2049 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Fri, 3 May 2024 22:22:08 -0600 Subject: [PATCH 32/64] Add instrumentationEventList, instrumentationEvent, Revision classes to mdJson writer --- .../sections/mdJson_instrumentationEvent.rb | 30 +++++++++++++++++ .../mdJson_instrumentationEventList.rb | 32 +++++++++++++++++++ .../mdJson/sections/mdJson_revision.rb | 28 ++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEvent.rb create mode 100644 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEventList.rb create mode 100644 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_revision.rb diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEvent.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEvent.rb new file mode 100644 index 000000000..78967bdbf --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEvent.rb @@ -0,0 +1,30 @@ +require 'jbuilder' +require_relative 'mdJson_citation' +require_relative 'mdJson_revision' + +module ADIWG + module Mdtranslator + module Writers + module MdJson + + module InstrumentationEvent + + @Namespace = ADIWG::Mdtranslator::Writers::MdJson + + def self.build(hInstrumentationEvent) + # "required": ["description","eventType"], + Jbuilder.new do |json| + json.citation Citation.build(hInstrumentationEvent[:citation]) unless hInstrumentationEvent[:citation].empty? + json.description hInstrumentationEvent[:description] + json.extent hInstrumentationEvent[:extent] unless hInstrumentationEvent[:extent].empty? + json.eventType hInstrumentationEvent[:eventType] + json.revisionHistory @Namespace.json_map(hInstrumentationEvent[:revisionHistories], Revision) unless hInstrumentationEvent[:revisionHistories].empty? + end + + end + end # InstrumentationEvent + + end + end + end +end diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEventList.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEventList.rb new file mode 100644 index 000000000..c7adb30ae --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEventList.rb @@ -0,0 +1,32 @@ +require 'jbuilder' +require_relative 'mdJson_citation' +require_relative 'mdJson_locale' +require_relative 'mdJson_constraint' +require_relative 'mdJson_instrumentationEvent' + +module ADIWG + module Mdtranslator + module Writers + module MdJson + + module InstrumentationEventList + + @Namespace = ADIWG::Mdtranslator::Writers::MdJson + + def self.build(hInstrumentationEventList) + + Jbuilder.new do |json| + json.citation Citation.build(hInstrumentationEventList[:citation]) unless hInstrumentationEventList[:citation].empty? + json.description hInstrumentationEventList[:description] + json.locale Locale.build(hInstrumentationEventList[:locale]) unless hInstrumentationEventList[:locale].empty? + json.constraints @Namespace.json_map(hInstrumentationEventList[:constraints], Constraint) unless hInstrumentationEventList[:constraints].empty? + json.instrumentationEvent @Namespace.json_map(hInstrumentationEventList[:instrumentationEvents], InstrumentationEvent) unless hInstrumentationEventList[:instrumentationEvents].empty? + end + + end + end # InstrumentationEventList + + end + end + end +end diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_revision.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_revision.rb new file mode 100644 index 000000000..4b7a302fd --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_revision.rb @@ -0,0 +1,28 @@ +require 'jbuilder' +require_relative 'mdJson_responsibleParty' +require_relative 'mdJson_dateTime' + +module ADIWG + module Mdtranslator + module Writers + module MdJson + + module Revision + + @Namespace = ADIWG::Mdtranslator::Writers::MdJson + + def self.build(hRevision) + # "required": ["description", "responsibleParty", "dateInfo"] + Jbuilder.new do |json| + json.description hRevision[:description] + json.responsibleParty @Namespace.json_map(hRevision[:responsibleParties], ResponsibileParty) + json.dateInfo @Namespace.json_map(hRevision[:dateInfo], DateTime) + end + + end + end # Revision + + end + end + end +end From 4fa43cd89ff6ffde87549ff207b2cf2f09a09fef Mon Sep 17 00:00:00 2001 From: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com> Date: Mon, 6 May 2024 08:52:33 -0600 Subject: [PATCH 33/64] Fix/mdjson-reader-platform (#371) * Update interal object. Add logic to handle platform class * fix key name * Rename Platform class and file. Updated references to class. * Update to handle platform without errors. * Fix iteration of array of responsible parties. * fix iteration of arrays for instrument and instrumentationEventList --- .../readers/mdJson/modules/module_platform.rb | 64 +++++++++++-------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb index 27477ab46..9a6d7c52f 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb @@ -1,6 +1,6 @@ require_relative 'module_citation' require_relative 'module_identifier' -require_relative 'module_responsibileParty' +require_relative 'module_responsibleParty' require_relative 'module_acq-instrument' require_relative 'module_acq-instrumentationEventList' @@ -10,62 +10,70 @@ module Readers module MdJson module Platform - def self.unpack(hAcqPlatform, responseObj, inContext = nil) + def self.unpack(hPlatform, responseObj, inContext = nil) @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson - intAcqPlatform = intMetadataClass.newPlatform + intMetadataClass = InternalMetadata.new + intPlatform = intMetadataClass.newPlatform - if hAcqPlatform.has_key('platformId') - intAcqPlatform[:platformId] = hAcqPlatform['platformId'] + if hPlatform.has_key?('platformId') + intPlatform[:platformId] = hPlatform['platformId'] else @MessagePath.issueError(460, responseObj, inContext) end - if hAcqPlatform.has_key?('citation') - hReturn = Citation.unpack(hAcqPlatform['citation'], responseObj, inContext) + if hPlatform.has_key?('citation') + hReturn = Citation.unpack(hPlatform['citation'], responseObj, inContext) unless hReturn.nil? - intAcqPlatform[:citation] = hReturn + intPlatform[:citation] = hReturn end end - if hAcqPlatform.has_key?('identifier') - hReturn = Identifier.unpack(hAcqPlatform['identifier'], responseObj, inContext) + if hPlatform.has_key?('identifier') + hReturn = Identifier.unpack(hPlatform['identifier'], responseObj, inContext) unless hReturn.nil? - intAcqPlatform[:identifier] = hReturn + intPlatform[:identifier] = hReturn else @MessagePath.issueError(461, responseObj, inContext) end end - if hAcqPlatform.has_key('description') - intAcqPlatform[:description] = hAcqPlatform['description'] + if hPlatform.has_key?('description') + intPlatform[:description] = hPlatform['description'] else @MessagePath.issueError(460, responseObj, inContext) end - if hAcqPlatform.has_key?('sponsor') - hReturn = ResponsibileParty.unpack(hAcqPlatform['sponsor'], responseObj, inContext) - unless hReturn.nil? - intAcqPlatform[:sponsors] = hReturn + if hPlatform.has_key?('sponsor') + hPlatform['sponsor'].each do |sponsor| + hReturn = ResponsibleParty.unpack(sponsor, responseObj, inContext) + unless hReturn.nil? + intPlatform[:sponsors] = hReturn + end end end - if hAcqPlatform.has_key('instrument') - hReturn = AcqInstrument.unpack(hAcqPlatform['instrument'], responseObj, inContext) - unless hReturn.nil? - intAcqPlatform[:instruments] = hReturn - else - @MessagePath.issueError(461, responseObj, inContext) + if hPlatform.has_key?('instrument') + hPlatform['instrument'].each do |instrument| + hReturn = AcqInstrument.unpack(instrument, responseObj, inContext) + unless hReturn.nil? + intPlatform[:instruments] = hReturn + else + @MessagePath.issueError(461, responseObj, inContext) + end end end - if hAcqPlatform.has_key('history') - hReturn = AcqInstrumentationEventList.unpack(hAcqPlatform['history'], responseObj, inContext) - unless hReturn.nil? - intAcqPlatform[:history] = hReturn + if hPlatform.has_key?('history') + hPlatform['history'].each do |history| + hReturn = AcqInstrumentationEventList.unpack(history, responseObj, inContext) + unless hReturn.nil? + intPlatform[:history] = hReturn + end + end end - intAcqPlatform + intPlatform end end From 2c5f3c869e1d862f5c86bb237b9ef03f4d18a072 Mon Sep 17 00:00:00 2001 From: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com> Date: Mon, 6 May 2024 08:57:00 -0600 Subject: [PATCH 34/64] Update AcqPlan class to handle acq-plan (#358) * Update AcqPlan class to handle acq-plan * Rename class * add reference to Plan class and reference correct class name * Change to validate status and planType using mdCodes. fix array iteration for planOperations and satisfiedRequirements. * remove puts --------- Co-authored-by: Johnathan Aspinwall --- .../readers/mdJson/modules/module_acq-plan.rb | 15 ---- .../mdJson/modules/module_acquisition.rb | 19 ++--- .../readers/mdJson/modules/module_plan.rb | 80 +++++++++++++++++++ 3 files changed, 90 insertions(+), 24 deletions(-) delete mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-plan.rb create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_plan.rb diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-plan.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-plan.rb deleted file mode 100644 index 2096fcb37..000000000 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-plan.rb +++ /dev/null @@ -1,15 +0,0 @@ -module ADIWG - module Mdtranslator - module Readers - module MdJson - - module AcqPlan - def self.unpack(hAcqPlan, responseObj, inContext = nil) - - end - end - - end - end - end -end diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb index ea3f12c42..419b59c4b 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb @@ -6,6 +6,7 @@ require_relative 'module_acq-operation' require_relative 'module_pass' require_relative 'module_event' +require_relative 'module_plan' require_relative 'module_acq-environment' module ADIWG @@ -35,15 +36,15 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) end end - # if hAcquisition.has_key?('plan') - # aItems = hAcquisition['plan'] - # aItems.each do |item| - # hReturn = AcqPlan.unpack(item, responseObj, outContext) - # unless hReturn.nil? - # intAcquisition[:plans] << hReturn - # end - # end - # end + if hAcquisition.has_key?('plan') + aItems = hAcquisition['plan'] + aItems.each do |item| + hReturn = Plan.unpack(item, responseObj, outContext) + unless hReturn.nil? + intAcquisition[:plans] << hReturn + end + end + end if hAcquisition.has_key?('requirement') aItems = hAcquisition['requirement'] diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_plan.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_plan.rb new file mode 100644 index 000000000..fa5f3e25d --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_plan.rb @@ -0,0 +1,80 @@ +require 'adiwg/mdtranslator/internal/module_codelistFun' +require_relative 'module_citation' +require_relative 'module_operation' +require_relative 'module_requirement' + +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module Plan + def self.unpack(hPlan, responseObj, inContext = nil) + + @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson + + # return nil object if input is empty + if hPlan.empty? + @MessagePath.issueWarning(40, responseObj, inContext) + return nil + end + + intMetadataClass = InternalMetadata.new + intPlan = intMetadataClass.newPlan + + outContext = 'plan' + outContext = inContext + ' > ' + outContext unless inContext.nil? + + if hPlan.has_key?('planId') + intPlan[:planId] = hPlan['planId'] + + else + @MessagePath.issueError(42, responseObj, outContext) + end + + if hPlan.has_key?('planType') && CodelistFun.validateItem('iso_geometryTypeCode', hPlan['planType']) + intPlan[:planType] = hPlan['planType'] + end + + if hPlan.has_key?('status') && CodelistFun.validateItem('iso_progress', hPlan['status']) + intPlan[:status] = hPlan['status'] + else + @MessagePath.issueError(43, responseObj, outContext) + end + + if hPlan.has_key?('citation') + hReturn = Citation.unpack(hPlan['citation'], responseObj, outContext) + unless hReturn.nil? + intPlan[:citation] = hReturn + end + else + @MessagePath.issueError(44, responseObj, outContext) + end + + if hPlan.has_key?('planOperations') + hPlan['planOperations'].each do |item| + hReturn = Operation.unpack(item, responseObj, outContext) + unless hReturn.nil? + intPlan[:planOperations] << hReturn + end + end + end + + if hPlan.has_key?('satisfiedRequirements') + hPlan['satisfiedRequirements'].each do |item| + hReturn = Requirement.unpack(item, responseObj, outContext) + unless hReturn.nil? + intPlan[:satisfiedRequirements] << hReturn + end + end + end + + intPlan + + end + end + + end + end + end +end From 8f1e241d68838f70d003af54d54d4c3c3f628e7c Mon Sep 17 00:00:00 2001 From: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com> Date: Mon, 6 May 2024 08:57:56 -0600 Subject: [PATCH 35/64] Add acquisition class to writer. Add reference to class in metadata. (#368) Co-authored-by: Johnathan Aspinwall --- .../mdJson/sections/mdJson_acquisition.rb | 42 +++++++++++++++++++ .../mdJson/sections/mdJson_metadata.rb | 2 + 2 files changed, 44 insertions(+) create mode 100644 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb new file mode 100644 index 000000000..9787e38d9 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb @@ -0,0 +1,42 @@ +require 'jbuilder' +require_relative 'mdJson_scope' +# require_relative 'mdJson_plan' +# require_relative 'mdJson_requirement' +# require_relative 'mdJson_objective' +# require_relative 'mdJson_platform' +# require_relative 'mdJson_instrument' +# require_relative 'mdJson_operation' +require_relative 'mdJson_event' +# require_relative 'mdJson_pass' +# require_relative 'mdJson_environment' + +module ADIWG + module Mdtranslator + module Writers + module MdJson + + module Acquisition + + @Namespace = ADIWG::Mdtranslator::Writers::MdJson + + def self.build(hAcquisition) + + Jbuilder.new do |json| + # json.scope Scope.build(hAcquisition[:scope]) + # json.plan @Namespace.json_map(hAcquisition[:plans], Plan) + # json.requirement @Namespace.json_map(hAcquisition[:requirements], Requirement) + # json.objective @Namespace.json_map(hAcquisition[:objectives], Objective) + # json.platform @Namespace.json_map(hAcquisition[:platforms], Platform) + # json.instrument @Namespace.json_map(hAcquisition[:instruments], Instrument) + # json.operation @Namespace.json_map(hAcquisition[:operations], Operation) + json.event @Namespace.json_map(hAcquisition[:events], Event) + # json.pass @Namespace.json_map(hAcquisition[:passes], Pass) + # json.environment Environment.build(hAcquisition[:environment]) + end + + end + end # Acquisition + end # Event + end + end +end diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_metadata.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_metadata.rb index 5a6469553..834de0f4c 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_metadata.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_metadata.rb @@ -13,6 +13,7 @@ require_relative 'mdJson_additionalDocumentation' require_relative 'mdJson_funding' require_relative 'mdJson_dataQuality' +require_relative 'mdJson_acquisition' module ADIWG module Mdtranslator @@ -34,6 +35,7 @@ def self.build(hMetadata) json.associatedResource @Namespace.json_map(hMetadata[:associatedResources], AssociatedResource) json.additionalDocumentation @Namespace.json_map(hMetadata[:additionalDocuments], AdditionalDocument) json.funding @Namespace.json_map(hMetadata[:funding], Funding) + json.acquisition @Namespace.json_map(hMetadata[:acquisitions], Acquisition) end end # build From 575b8c32c04efc7ff9a381edd4cac6680672fbd7 Mon Sep 17 00:00:00 2001 From: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com> Date: Mon, 6 May 2024 08:59:39 -0600 Subject: [PATCH 36/64] Add Event class to writer. (#369) * Add acquisition class to writer. Add reference to class in metadata. * Add Event class to writer. * fix key for relatedSensor for access to internal object. --------- Co-authored-by: Johnathan Aspinwall --- .../writers/mdJson/sections/mdJson_event.rb | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_event.rb diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_event.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_event.rb new file mode 100644 index 000000000..9d0e64cdb --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_event.rb @@ -0,0 +1,38 @@ +require 'jbuilder' +require_relative 'mdJson_identifier' +require_relative 'mdJson_dateTime' +# require_relative 'mdJson_objective' +# require_relative 'mdJson_pass' +# require_relative 'mdJson_instrument' + + +module ADIWG + module Mdtranslator + module Writers + module MdJson + + module Event + + @Namespace = ADIWG::Mdtranslator::Writers::MdJson + + def self.build(hEvent) + puts hEvent + + Jbuilder.new do |json| + json.eventId hEvent[:eventId] + json.identifiers Identifier.build(hEvent[:identifier]) + json.trigger hEvent[:eventTrigger] + json.context hEvent[:eventContext] + json.sequence hEvent[:sequence] + json.time DateTime.build(hEvent[:time]) + # json.expectedObjective @Namespace.json_map(hEvent[:expectedObjectives], Objective) + # json.relatedPass Pass.build(hEvent[:relatedPass]) + # json.relatedSensor @Namespace.json_map(hEvent[:relatedSensors], Instrument) + end + + end + end # Event + end + end + end +end From 24a951efa13527e3edd5c9534a1a136a0fb51d1d Mon Sep 17 00:00:00 2001 From: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com> Date: Tue, 7 May 2024 09:54:55 -0600 Subject: [PATCH 37/64] fix/mdJson-reader-environment (#366) * Update AcqEnvironment class to handle acq-environment. Update internal object to contain all fields * Rename file and reference to environment class --- .../internal/internal_metadata_obj.rb | 5 ++- .../mdJson/modules/module_acq-environment.rb | 15 ------- .../mdJson/modules/module_acquisition.rb | 13 ++---- .../mdJson/modules/module_environment.rb | 45 +++++++++++++++++++ 4 files changed, 52 insertions(+), 26 deletions(-) delete mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-environment.rb create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_environment.rb diff --git a/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb b/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb index e2d5cd1e2..9fbf702b5 100644 --- a/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +++ b/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb @@ -177,7 +177,10 @@ def newEnvironment averageAirTemperature: nil, maxRelativeHumidity: nil, maxAltitude: nil, - meteorologicalConditions: nil + meteorologicalConditions: nil, + solarAzimuth: nil, + solarElevation: nil + } end diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-environment.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-environment.rb deleted file mode 100644 index 453b9979d..000000000 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-environment.rb +++ /dev/null @@ -1,15 +0,0 @@ -module ADIWG - module Mdtranslator - module Readers - module MdJson - - module AcqEnvironment - def self.unpack(hAcqEnvironment, responseObj, inContext = nil) - - end - end - - end - end - end -end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb index 419b59c4b..b2e7df1ff 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb @@ -6,8 +6,8 @@ require_relative 'module_acq-operation' require_relative 'module_pass' require_relative 'module_event' +require_relative 'module_environment' require_relative 'module_plan' -require_relative 'module_acq-environment' module ADIWG module Mdtranslator @@ -117,16 +117,9 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) end if hAcquisition.has_key?('environment') - aItems = hAcquisition['environment'] - aItems.each do |item| - hReturn = AcqEnvironment.unpack(item, responseObj, outContext) - unless hReturn.nil? - intAcquisition[:environments] << hReturn - end - end - + intAcquisition[:environments] = hAcquisition['environment'] end - + puts intAcquisition return intAcquisition end diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_environment.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_environment.rb new file mode 100644 index 000000000..f2fc08002 --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_environment.rb @@ -0,0 +1,45 @@ +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module Environment + def self.unpack(hEnvironment, responseObj, inContext = nil) + intEnvironment = intMetadataClass.newEnvironment + + outContext = 'environment' + outContext = inContext + ' > ' + outContext unless inContext.nil? + + if hEnvironment.has_key('averageAirTemperature') + intEnvironment[:averageAirTemperature] = hEnvironment['averageAirTemperature'] + end + + if hEnvironment.has_key('maxRelativeHumidity') + intEnvironment[:maxRelativeHumidity] = hEnvironment['maxRelativeHumidity'] + end + + if hEnvironment.has_key('maxAltitude') + intEnvironment[:maxAltitude] = hEnvironment['maxAltitude'] + end + + if hEnvironment.has_key('meteorologicalConditions') + intEnvironment[:meteorologicalConditions] = hEnvironment['meteorologicalConditions'] + end + + if hEnvironment.has_key('solarAzimuth') + intEnvironment[:solarAzimuth] = hEnvironment['solarAzimuth'] + end + + if hEnvironment.has_key('solarElevation') + intEnvironment[:solarElevation] = hEnvironment['solarElevation'] + end + + intEnvironment + + end + end + + end + end + end +end \ No newline at end of file From 2e558ef753cd6906e2f8ba1b0640dc7a1f709ee6 Mon Sep 17 00:00:00 2001 From: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com> Date: Tue, 7 May 2024 09:55:22 -0600 Subject: [PATCH 38/64] Add operation class. remove acq- prefix to relative require and class in acquisition (#376) --- .../mdJson/modules/module_acquisition.rb | 4 +- .../mdJson/modules/module_operation.rb | 119 ++++++++++++++++++ 2 files changed, 121 insertions(+), 2 deletions(-) create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_operation.rb diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb index b2e7df1ff..df3633186 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb @@ -3,7 +3,7 @@ require_relative 'module_acq-objective' require_relative 'module_platform' require_relative 'module_instrument' -require_relative 'module_acq-operation' +require_relative 'module_operation' require_relative 'module_pass' require_relative 'module_event' require_relative 'module_environment' @@ -89,7 +89,7 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) if hAcquisition.has_key?('operation') aItems = hAcquisition['operation'] aItems.each do |item| - hReturn = AcqOperation.unpack(item, responseObj, outContext) + hReturn = Operation.unpack(item, responseObj, outContext) unless hReturn.nil? intAcquisition[:operations] << hReturn end diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_operation.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_operation.rb new file mode 100644 index 000000000..33adfaa97 --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_operation.rb @@ -0,0 +1,119 @@ +require 'adiwg/mdtranslator/internal/module_codelistFun' +require_relative 'module_citation' +require_relative 'module_identifier' +require_relative 'module_objective' +require_relative 'module_platform' +require_relative 'module_event' + +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module Operation + def self.unpack(hOperation, responseObj, inContext = nil) + + @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson + + intMetadataClass = InternalMetadata.new + intOperation = intMetadataClass.newOperation + + outContext = 'operation' + outContext = inContext + ' > ' + outContext unless inContext.nil? + + if hOperation.has_key?('operationId') + intOperation[:operationId] = hOperation['operationId'] + + else + @MessagePath.issueError(42, responseObj, outContext) + end + + if hOperation.has_key?('description') + intOperation[:description] = hOperation['description'] + end + + if hOperation.has_key?('citation') + hReturn = Citation.unpack(hOperation['citation'], responseObj, outContext) + unless hReturn.nil? + intOperation[:citation] = hReturn + end + end + + if hOperation.has_key?('identifier') + hReturn = Identifier.unpack(hOperation['identifier'], responseObj, outContext) + unless hReturn.nil? + intOperation[:identifier] = hReturn + end + else + @MessagePath.issueError(44, responseObj, outContext) + end + + if hOperation.has_key?('status') && CodelistFun.validateItem('iso_progress', hOperation['status']) + intOperation[:status] = hOperation['status'] + end + + if hOperation.has_key?('operationType') && CodelistFun.validateItem('iso_operationTypeCode', hOperation['operationType']) + intOperation[:operationType] = hOperation['operationType'] + end + + if hOperation.has_key?('objective') + hOperation['objective'].each do |item| + hReturn = Objective.unpack(item, responseObj, outContext) + unless hReturn.nil? + intOperation[:objective] << hReturn + end + end + end + + if hOperation.has_key?('parentOperation') + hReturn = Operation.unpack(hOperation['parentOperation'], responseObj, outContext) + unless hReturn.nil? + intOperation[:parentOperation] = hReturn + end + else + @MessagePath.issueError(44, responseObj, outContext) + end + + if hOperation.has_key?('childOperation') + hOperation['childOperation'].each do |item| + hReturn = Operation.unpack(item, responseObj, outContext) + unless hReturn.nil? + intOperation[:childOperation] << hReturn + end + end + end + + if hOperation.has_key?('plan') + hReturn = Plan.unpack(hOperation['plan'], responseObj, outContext) + unless hReturn.nil? + intOperation[:plan] = hReturn + end + end + + if hOperation.has_key?('platform') + hOperation['platform'].each do |item| + hReturn = Platform.unpack(item, responseObj, outContext) + unless hReturn.nil? + intOperation[:platform] << hReturn + end + end + end + + if hOperation.has_key?('significantEvent') + hOperation['significantEvent'].each do |item| + hReturn = Event.unpack(item, responseObj, outContext) + unless hReturn.nil? + intOperation[:significantEvent] << hReturn + end + end + end + + intOperation + + end + end + + end + end + end +end From 195cd4aeff01cbc9a6134b0a3eda286bcb4ac5bd Mon Sep 17 00:00:00 2001 From: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com> Date: Tue, 7 May 2024 09:56:05 -0600 Subject: [PATCH 39/64] fix/mdJson-reader-objective (#367) * Update AcqObjective class to handl acq-objective * Reference Identifier class for use * Rename class and file. Change references to new name. * add relation to codelist found in mdCodes for objectiveType. Update class to handle all fields. * fixes to objective, platform, event and requirement classes --- .../mdJson/modules/module_acq-objective.rb | 15 --- .../mdJson/modules/module_acquisition.rb | 4 +- .../readers/mdJson/modules/module_event.rb | 10 +- .../mdJson/modules/module_objective.rb | 104 ++++++++++++++++++ .../readers/mdJson/modules/module_platform.rb | 4 +- .../mdJson/modules/module_requirement.rb | 2 +- 6 files changed, 114 insertions(+), 25 deletions(-) delete mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-objective.rb create mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_objective.rb diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-objective.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-objective.rb deleted file mode 100644 index f930b41e6..000000000 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-objective.rb +++ /dev/null @@ -1,15 +0,0 @@ -module ADIWG - module Mdtranslator - module Readers - module MdJson - - module AcqObjective - def self.unpack(hAcqObjective, responseObj, inContext = nil) - - end - end - - end - end - end -end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb index df3633186..efe569758 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb @@ -1,6 +1,6 @@ require_relative 'module_scope' +require_relative 'module_objective' require_relative 'module_requirement' -require_relative 'module_acq-objective' require_relative 'module_platform' require_relative 'module_instrument' require_relative 'module_operation' @@ -59,7 +59,7 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) if hAcquisition.has_key?('objective') aItems = hAcquisition['objective'] aItems.each do |item| - hReturn = AcqObjective.unpack(item, responseObj, outContext) + hReturn = Objective.unpack(item, responseObj, outContext) unless hReturn.nil? intAcquisition[:objectives] << hReturn end diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_event.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_event.rb index 3689a7dec..562e7dfad 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_event.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_event.rb @@ -1,8 +1,8 @@ require_relative 'module_identifier' require_relative 'module_dateTime' -# require_relative 'module_objective' -# require_relative 'module_pass' -# require_relative 'module_instrument' +require_relative 'module_objective' +require_relative 'module_pass' +require_relative 'module_instrument' module ADIWG module Mdtranslator @@ -56,7 +56,7 @@ def self.unpack(hEvent, responseObj, inContext = nil) end if hEvent.has_key?('expectedObjective') - intEvent['expectedObjective'].each do |item| + hEvent['expectedObjective'].each do |item| hReturn = Objective.unpack(item, responseObj, outContext) unless hReturn.nil? intEvent[:expectedObjectives] << hReturn @@ -65,7 +65,7 @@ def self.unpack(hEvent, responseObj, inContext = nil) end if hEvent.has_key?('relatedPass') - intEvent[:relatedPass] = Pass.unpack(hEvent['relatedPass'], response) + intEvent[:relatedPass] = Pass.unpack(hEvent['relatedPass'], responseObj, outContext) end if hEvent.has_key?('relatedSensor') diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_objective.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_objective.rb new file mode 100644 index 000000000..85933b3b1 --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_objective.rb @@ -0,0 +1,104 @@ +require 'adiwg/mdtranslator/internal/module_codelistFun' +require_relative 'module_identifier' +require_relative 'module_extent' +require_relative 'module_event' +require_relative 'module_pass' +require_relative 'module_instrument' + +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module Objective + def self.unpack(hObjective, responseObj, inContext = nil) + + @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson + + intMetadataClass = InternalMetadata.new + intObjective = intMetadataClass.newObjective + + outContext = 'objective' + outContext = inContext + ' > ' + outContext unless inContext.nil? + + if hObjective.has_key?('objectiveId') + intObjective[:objectiveId] = hObjective['objectiveId'] + else + @MessagePath.issueError(200, responseObj, outContext) + end + + if hObjective.has_key?('identifier') + aItems = hObjective['identifier'] + aItems.each do |item| + hReturn = Identifier.unpack(item, responseObj, outContext) + unless hReturn.nil? + intObjective[:identifiers] << hReturn + end + end + else + @MessagePath.issueError(201, responseObj, outContext) + end + + if hObjective.has_key?('priority') + intObjective[:priority] = hObjective['priority'] + end + + if hObjective.has_key?('objectiveType') + aItems = hObjective['objectiveType'] + aItems.each do |item| + if CodelistFun.validateItem('iso_objectiveTypeCode', item) + intObjective[:objectiveTypes] << item + end + end + end + + if hObjective.has_key?('function') + hObjective['function'].each do |item| + intObjective[:functions] << item + end + end + + if hObjective.has_key?('extent') + hObjective['extent'].each do |item| + hReturn = Extent.unpack(item, responseObj, outContext) + unless hReturn.nil? + intObjective[:extents] << hReturn + end + end + end + + if hObjective.has_key?('objectiveOccurrence') + hObjective['objectiveOccurrence'].each do |item| + hReturn = Event.unpack(item, responseObj, outContext) + unless hReturn.nil? + intObjective[:occurrences] << hReturn + end + end + end + + if hObjective.has_key?('pass') + hObjective['pass'].each do |item| + hReturn = Pass.unpack(item, responseObj, outContext) + unless hReturn.nil? + intObjective[:passes] << hReturn + end + end + end + + if hObjective.has_key?('sensingInstrument') + hObjective['sensingInstrument'].each do |item| + hReturn = Instrument.unpack(item, responseObj, outContext) + unless hReturn.nil? + intObjective[:sensingInstruments] << hReturn + end + end + end + + intObjective + end + end + + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb index 9a6d7c52f..8ce94f525 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb @@ -1,8 +1,8 @@ require_relative 'module_citation' require_relative 'module_identifier' require_relative 'module_responsibleParty' -require_relative 'module_acq-instrument' -require_relative 'module_acq-instrumentationEventList' +require_relative 'module_instrument' +require_relative 'module_instrumentationEventList' module ADIWG module Mdtranslator diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb index c55d4c613..447aa6529 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb @@ -79,7 +79,7 @@ def self.unpack(hRequirement, responseObj, inContext = nil) end end end - puts intRequirement + intRequirement end From 8be6f92a371fd85e84b46836a1e2c4abe81029a3 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Tue, 7 May 2024 10:17:13 -0600 Subject: [PATCH 40/64] remove puts --- .../mdtranslator/readers/mdJson/modules/module_acquisition.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb index efe569758..cb1904738 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb @@ -119,7 +119,7 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) if hAcquisition.has_key?('environment') intAcquisition[:environments] = hAcquisition['environment'] end - puts intAcquisition + return intAcquisition end From 4603eeb6d863aca9301a4121ba90fee64b67d271 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Tue, 7 May 2024 10:17:46 -0600 Subject: [PATCH 41/64] remove puts --- .../mdtranslator/readers/mdJson/modules/module_acquisition.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb index efe569758..cb1904738 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb @@ -119,7 +119,7 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) if hAcquisition.has_key?('environment') intAcquisition[:environments] = hAcquisition['environment'] end - puts intAcquisition + return intAcquisition end From 392ef241ab50aba8d860e1dd9b8d1eb8b56364c7 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Tue, 7 May 2024 11:51:27 -0600 Subject: [PATCH 42/64] fix keys to internal objects. Remove puts --- .../writers/mdJson/sections/mdJson_acquisition.rb | 4 ++-- .../mdtranslator/writers/mdJson/sections/mdJson_event.rb | 1 - .../writers/mdJson/sections/mdJson_instrument.rb | 8 ++++---- .../mdJson/sections/mdJson_instrumentationEventList.rb | 4 ++-- .../writers/mdJson/sections/mdJson_revision.rb | 4 ++-- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb index 9787e38d9..08a422e72 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb @@ -4,7 +4,7 @@ # require_relative 'mdJson_requirement' # require_relative 'mdJson_objective' # require_relative 'mdJson_platform' -# require_relative 'mdJson_instrument' +require_relative 'mdJson_instrument' # require_relative 'mdJson_operation' require_relative 'mdJson_event' # require_relative 'mdJson_pass' @@ -27,7 +27,7 @@ def self.build(hAcquisition) # json.requirement @Namespace.json_map(hAcquisition[:requirements], Requirement) # json.objective @Namespace.json_map(hAcquisition[:objectives], Objective) # json.platform @Namespace.json_map(hAcquisition[:platforms], Platform) - # json.instrument @Namespace.json_map(hAcquisition[:instruments], Instrument) + json.instrument @Namespace.json_map(hAcquisition[:instruments], Instrument) # json.operation @Namespace.json_map(hAcquisition[:operations], Operation) json.event @Namespace.json_map(hAcquisition[:events], Event) # json.pass @Namespace.json_map(hAcquisition[:passes], Pass) diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_event.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_event.rb index 9d0e64cdb..5e7328e90 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_event.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_event.rb @@ -16,7 +16,6 @@ module Event @Namespace = ADIWG::Mdtranslator::Writers::MdJson def self.build(hEvent) - puts hEvent Jbuilder.new do |json| json.eventId hEvent[:eventId] diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrument.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrument.rb index e349a8baa..fb19e524a 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrument.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrument.rb @@ -1,7 +1,7 @@ require 'jbuilder' require_relative 'mdJson_citation' require_relative 'mdJson_identifier' -require_relative 'mdJson_platform' +# require_relative 'mdJson_platform' require_relative 'mdJson_instrumentationEventList' module ADIWG @@ -14,15 +14,15 @@ module Instrument @Namespace = ADIWG::Mdtranslator::Writers::MdJson def self.build(hInstrument) - + Jbuilder.new do |json| json.instrumentId hInstrument[:instrumentId] json.citation Citation.build(hInstrument[:citation]) unless hInstrument[:citation].empty? json.identifier Identifier.build(hInstrument[:identifier]) json.instrumentType hInstrument[:instrumentType] json.description hInstrument[:description] unless hInstrument[:description].nil? - json.mountedOn Platform.build(hInstrument[:mountedOn]) unless hInstrument[:mountedOn].empty? - json.history @Namespace.json_map(hInstrument[:history], InstrumentationEventList) unless hInstrument[:history].empty? + # json.mountedOn Platform.build(hInstrument[:mountedOn]) unless hInstrument[:mountedOn].empty? + json.history @Namespace.json_map(hInstrument[:histories], InstrumentationEventList) unless hInstrument[:histories].empty? json.hostId Identifier.build(hInstrument[:hostId]) unless hInstrument[:hostId].empty? end diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEventList.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEventList.rb index c7adb30ae..e22e41c45 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEventList.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEventList.rb @@ -14,9 +14,9 @@ module InstrumentationEventList @Namespace = ADIWG::Mdtranslator::Writers::MdJson def self.build(hInstrumentationEventList) - + puts hInstrumentationEventList Jbuilder.new do |json| - json.citation Citation.build(hInstrumentationEventList[:citation]) unless hInstrumentationEventList[:citation].empty? + json.citation @Namespace.json_map(hInstrumentationEventList[:citations], Citation) unless hInstrumentationEventList[:citations].empty? json.description hInstrumentationEventList[:description] json.locale Locale.build(hInstrumentationEventList[:locale]) unless hInstrumentationEventList[:locale].empty? json.constraints @Namespace.json_map(hInstrumentationEventList[:constraints], Constraint) unless hInstrumentationEventList[:constraints].empty? diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_revision.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_revision.rb index 4b7a302fd..2459433ca 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_revision.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_revision.rb @@ -12,10 +12,10 @@ module Revision @Namespace = ADIWG::Mdtranslator::Writers::MdJson def self.build(hRevision) - # "required": ["description", "responsibleParty", "dateInfo"] + Jbuilder.new do |json| json.description hRevision[:description] - json.responsibleParty @Namespace.json_map(hRevision[:responsibleParties], ResponsibileParty) + json.responsibleParty @Namespace.json_map(hRevision[:responsibleParties], ResponsibleParty) json.dateInfo @Namespace.json_map(hRevision[:dateInfo], DateTime) end From 0c4d22c333c53229f57cb6132f1c1d676f6780b5 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Tue, 7 May 2024 12:02:20 -0600 Subject: [PATCH 43/64] fix keys in Plan class. --- .../mdtranslator/readers/mdJson/modules/module_plan.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_plan.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_plan.rb index fa5f3e25d..f09c4c15a 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_plan.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_plan.rb @@ -51,8 +51,8 @@ def self.unpack(hPlan, responseObj, inContext = nil) @MessagePath.issueError(44, responseObj, outContext) end - if hPlan.has_key?('planOperations') - hPlan['planOperations'].each do |item| + if hPlan.has_key?('planOperation') + hPlan['planOperation'].each do |item| hReturn = Operation.unpack(item, responseObj, outContext) unless hReturn.nil? intPlan[:planOperations] << hReturn @@ -60,8 +60,8 @@ def self.unpack(hPlan, responseObj, inContext = nil) end end - if hPlan.has_key?('satisfiedRequirements') - hPlan['satisfiedRequirements'].each do |item| + if hPlan.has_key?('satisfiedRequirement') + hPlan['satisfiedRequirement'].each do |item| hReturn = Requirement.unpack(item, responseObj, outContext) unless hReturn.nil? intPlan[:satisfiedRequirements] << hReturn From 839c92674ef1ef65b4c825608f6941134629058b Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Tue, 7 May 2024 13:40:38 -0600 Subject: [PATCH 44/64] fix Instrument identifier class --- .../mdtranslator/readers/mdJson/modules/module_instrument.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrument.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrument.rb index 29436d045..9426b619f 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrument.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrument.rb @@ -30,7 +30,7 @@ def self.unpack(hInstrument, responseObj, inContext = nil) end if hInstrument.has_key?('identifier') - intInstrument[:identifier] = hInstrument['identifier'] + intInstrument[:identifier] = Identifier.unpack(hInstrument['identifier'], responseObj, outContext) else @MessagePath.issueWarning(40, responseObj, outContext) end From 5d4aeef6e7629f9cf3181191b6193e0a665a7a89 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Tue, 7 May 2024 14:25:20 -0600 Subject: [PATCH 45/64] uncomment Platform class in acquisition --- .../writers/mdJson/sections/mdJson_acquisition.rb | 4 ++-- .../mdJson/sections/mdJson_instrumentationEventList.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb index 08a422e72..97f0a6f72 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb @@ -3,7 +3,7 @@ # require_relative 'mdJson_plan' # require_relative 'mdJson_requirement' # require_relative 'mdJson_objective' -# require_relative 'mdJson_platform' +require_relative 'mdJson_platform' require_relative 'mdJson_instrument' # require_relative 'mdJson_operation' require_relative 'mdJson_event' @@ -26,7 +26,7 @@ def self.build(hAcquisition) # json.plan @Namespace.json_map(hAcquisition[:plans], Plan) # json.requirement @Namespace.json_map(hAcquisition[:requirements], Requirement) # json.objective @Namespace.json_map(hAcquisition[:objectives], Objective) - # json.platform @Namespace.json_map(hAcquisition[:platforms], Platform) + json.platform @Namespace.json_map(hAcquisition[:platforms], Platform) json.instrument @Namespace.json_map(hAcquisition[:instruments], Instrument) # json.operation @Namespace.json_map(hAcquisition[:operations], Operation) json.event @Namespace.json_map(hAcquisition[:events], Event) diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEventList.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEventList.rb index e22e41c45..0ad58ebf9 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEventList.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEventList.rb @@ -14,7 +14,7 @@ module InstrumentationEventList @Namespace = ADIWG::Mdtranslator::Writers::MdJson def self.build(hInstrumentationEventList) - puts hInstrumentationEventList + Jbuilder.new do |json| json.citation @Namespace.json_map(hInstrumentationEventList[:citations], Citation) unless hInstrumentationEventList[:citations].empty? json.description hInstrumentationEventList[:description] From 98256f9a2cf41231924062fc39a68b8448317267 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Tue, 7 May 2024 14:27:41 -0600 Subject: [PATCH 46/64] fix appending result of sponsor to array. fix outContext for error handling. --- .../readers/mdJson/modules/module_platform.rb | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb index 8ce94f525..aaea1045c 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb @@ -16,57 +16,60 @@ def self.unpack(hPlatform, responseObj, inContext = nil) intMetadataClass = InternalMetadata.new intPlatform = intMetadataClass.newPlatform + outContext = 'platform' + outContext = inContext + ' > ' + outContext unless inContext.nil? + if hPlatform.has_key?('platformId') intPlatform[:platformId] = hPlatform['platformId'] else - @MessagePath.issueError(460, responseObj, inContext) + @MessagePath.issueError(460, responseObj, outContext) end if hPlatform.has_key?('citation') - hReturn = Citation.unpack(hPlatform['citation'], responseObj, inContext) + hReturn = Citation.unpack(hPlatform['citation'], responseObj, outContext) unless hReturn.nil? intPlatform[:citation] = hReturn end end if hPlatform.has_key?('identifier') - hReturn = Identifier.unpack(hPlatform['identifier'], responseObj, inContext) + hReturn = Identifier.unpack(hPlatform['identifier'], responseObj, outContext) unless hReturn.nil? intPlatform[:identifier] = hReturn else - @MessagePath.issueError(461, responseObj, inContext) + @MessagePath.issueError(461, responseObj, outContext) end end if hPlatform.has_key?('description') intPlatform[:description] = hPlatform['description'] else - @MessagePath.issueError(460, responseObj, inContext) + @MessagePath.issueError(460, responseObj, outContext) end if hPlatform.has_key?('sponsor') hPlatform['sponsor'].each do |sponsor| - hReturn = ResponsibleParty.unpack(sponsor, responseObj, inContext) + hReturn = ResponsibleParty.unpack(sponsor, responseObj, outContext) unless hReturn.nil? - intPlatform[:sponsors] = hReturn + intPlatform[:sponsors] << hReturn end end end if hPlatform.has_key?('instrument') hPlatform['instrument'].each do |instrument| - hReturn = AcqInstrument.unpack(instrument, responseObj, inContext) + hReturn = AcqInstrument.unpack(instrument, responseObj, outContext) unless hReturn.nil? intPlatform[:instruments] = hReturn else - @MessagePath.issueError(461, responseObj, inContext) + @MessagePath.issueError(461, responseObj, outContext) end end end if hPlatform.has_key?('history') hPlatform['history'].each do |history| - hReturn = AcqInstrumentationEventList.unpack(history, responseObj, inContext) + hReturn = AcqInstrumentationEventList.unpack(history, responseObj, outContext) unless hReturn.nil? intPlatform[:history] = hReturn end From ae2bce02d51259e181eacf264fb72c8890b85c6f Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Tue, 7 May 2024 15:11:48 -0600 Subject: [PATCH 47/64] fix Objective class and add Pass class to writer --- .../mdJson/sections/mdJson_acquisition.rb | 4 +-- .../mdJson/sections/mdJson_objective.rb | 5 ++-- .../writers/mdJson/sections/mdJson_pass.rb | 30 +++++++++++++++++++ 3 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_pass.rb diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb index 97f0a6f72..457ece1e8 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb @@ -2,7 +2,7 @@ require_relative 'mdJson_scope' # require_relative 'mdJson_plan' # require_relative 'mdJson_requirement' -# require_relative 'mdJson_objective' +require_relative 'mdJson_objective' require_relative 'mdJson_platform' require_relative 'mdJson_instrument' # require_relative 'mdJson_operation' @@ -25,7 +25,7 @@ def self.build(hAcquisition) # json.scope Scope.build(hAcquisition[:scope]) # json.plan @Namespace.json_map(hAcquisition[:plans], Plan) # json.requirement @Namespace.json_map(hAcquisition[:requirements], Requirement) - # json.objective @Namespace.json_map(hAcquisition[:objectives], Objective) + json.objective @Namespace.json_map(hAcquisition[:objectives], Objective) json.platform @Namespace.json_map(hAcquisition[:platforms], Platform) json.instrument @Namespace.json_map(hAcquisition[:instruments], Instrument) # json.operation @Namespace.json_map(hAcquisition[:operations], Operation) diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_objective.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_objective.rb index b1cdc2ab7..5d1b0721a 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_objective.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_objective.rb @@ -1,6 +1,5 @@ require 'jbuilder' require_relative 'mdJson_identifier' -require_relative 'mdJson_objectiveType' require_relative 'mdJson_extent' require_relative 'mdJson_event' require_relative 'mdJson_pass' @@ -21,12 +20,12 @@ def self.build(hObjective) json.objectiveId hObjective[:objectiveId] json.identifier @Namespace.json_map(hObjective[:identifiers], Identifier) json.priority hObjective[:priority] unless hObjective[:priority].nil? - json.objectiveType hObjective[:objectiveTypes] unless hObjective[:types].empty? + json.objectiveType hObjective[:objectiveTypes] unless hObjective[:objectiveTypes].empty? json.function hObjective[:functions] unless hObjective[:functions].empty? json.extent @Namespace.json_map(hObjective[:extents], Extent) unless hObjective[:extents].empty? json.objectiveOccurence @Namespace.json_map(hObjective[:occurrences], Event) unless hObjective[:occurrences].empty? json.pass @Namespace.json_map(hObjective[:passes], Pass) unless hObjective[:passes].empty? - json.sensingInstrument @Namespace.json_map(hObjective[:instruments], Instrument) unless hObjective[:instruments].empty? + json.sensingInstrument @Namespace.json_map(hObjective[:sensingInstruments], Instrument) unless hObjective[:sensingInstruments].empty? end end diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_pass.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_pass.rb new file mode 100644 index 000000000..f28aae77f --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_pass.rb @@ -0,0 +1,30 @@ +require 'jbuilder' +require_relative 'mdJson_identifier' +require_relative 'mdJson_extent' +require_relative 'mdJson_event' + +module ADIWG + module Mdtranslator + module Writers + module MdJson + + module Pass + + @Namespace = ADIWG::Mdtranslator::Writers::MdJson + + def self.build(hPass) + + Jbuilder.new do |json| + json.passId hPass[:passId] + json.identifier Identifier.build(hPass[:identifier]) + json.extent Extent.build(hPass[:extent]) unless hPass[:extent].empty? + json.relatedEvent @Namespace.json_map(hPass[:relatedEvents], Event) unless hPass[:relatedEvents].empty? + end + + end + end # Pass + + end + end + end +end From 0764c4d1c59fde7ef393088f9d3a9ca24e12749e Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Tue, 7 May 2024 16:26:52 -0600 Subject: [PATCH 48/64] Add Plan class and fix requirement class in writer. --- .../mdJson/sections/mdJson_acquisition.rb | 4 +-- .../writers/mdJson/sections/mdJson_plan.rb | 32 +++++++++++++++++++ .../mdJson/sections/mdJson_requirement.rb | 6 ++-- 3 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_plan.rb diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb index 457ece1e8..d83df050d 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb @@ -1,7 +1,7 @@ require 'jbuilder' require_relative 'mdJson_scope' # require_relative 'mdJson_plan' -# require_relative 'mdJson_requirement' +require_relative 'mdJson_requirement' require_relative 'mdJson_objective' require_relative 'mdJson_platform' require_relative 'mdJson_instrument' @@ -24,7 +24,7 @@ def self.build(hAcquisition) Jbuilder.new do |json| # json.scope Scope.build(hAcquisition[:scope]) # json.plan @Namespace.json_map(hAcquisition[:plans], Plan) - # json.requirement @Namespace.json_map(hAcquisition[:requirements], Requirement) + json.requirement @Namespace.json_map(hAcquisition[:requirements], Requirement) json.objective @Namespace.json_map(hAcquisition[:objectives], Objective) json.platform @Namespace.json_map(hAcquisition[:platforms], Platform) json.instrument @Namespace.json_map(hAcquisition[:instruments], Instrument) diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_plan.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_plan.rb new file mode 100644 index 000000000..9bde484a3 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_plan.rb @@ -0,0 +1,32 @@ +require 'jbuilder' +require_relative 'mdJson_citation' +# require_relative 'mdJson_operation' +require_relative 'mdJson_requirement' + +module ADIWG + module Mdtranslator + module Writers + module MdJson + + module Plan + + @Namespace = ADIWG::Mdtranslator::Writers::MdJson + + def self.build(hPlan) + + Jbuilder.new do |json| + json.planId hPlan[:planId] + json.planType hPlan[:planType] unless hPlan[:planType].nil? + json.status hPlan[:status] + json.citation Citation.build(hPlan[:citation]) + # json.planOperation @Namespace.json_map(hPlan[:operations], Operation) + json.satisfiedRequirement @Namespace.json_map(hPlan[:satisfiedRequirements], Requirement) + + end + + end + end # Requirement + end + end + end +end diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_requirement.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_requirement.rb index 2b5e0a683..578048ad3 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_requirement.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_requirement.rb @@ -1,7 +1,9 @@ require 'jbuilder' require_relative 'mdJson_citation' require_relative 'mdJson_identifier' +require_relative 'mdJson_responsibleParty' require_relative 'mdJson_requestedDate' +require_relative 'mdJson_plan' module ADIWG module Mdtranslator @@ -18,8 +20,8 @@ def self.build(hRequirement) json.requirementId hRequirement[:requirementId] json.citation Citation.build(hRequirement[:citation]) json.identifier Identifier.build(hRequirement[:identifier]) - json.requestor @Namespace.json_map(hRequirement[:requestors], Requestor) - json.recipient @Namespace.json_map(hRequirement[:recipients], Recipient) + json.requestor @Namespace.json_map(hRequirement[:requestors], ResponsibleParty) + json.recipient @Namespace.json_map(hRequirement[:recipients], ResponsibleParty) json.priority hRequirement[:priority] json.requestedDate RequestedDate.build(hRequirement[:requestedDate]) json.expiryDate hRequirement[:expiryDate] From 94d330876618ce8b3ec611771400173d38d853f9 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Tue, 7 May 2024 16:28:23 -0600 Subject: [PATCH 49/64] fix identifier key in requirement class for reader --- .../mdtranslator/readers/mdJson/modules/module_requirement.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb index 447aa6529..5073d5a89 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb @@ -39,7 +39,7 @@ def self.unpack(hRequirement, responseObj, inContext = nil) if hRequirement.has_key?('identifier') hReturn = Identifier.unpack(hRequirement['identifier'], responseObj, outContext) unless hReturn.nil? - intRequirement[:identifiers] = hReturn + intRequirement[:identifier] = hReturn end end From 1a7daf874b3f9d655c5fe8576347365a07fd8555 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Wed, 8 May 2024 10:44:44 -0600 Subject: [PATCH 50/64] fix keys for Event class writer. --- .../writers/mdJson/sections/mdJson_event.rb | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_event.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_event.rb index 5e7328e90..047a784bf 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_event.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_event.rb @@ -1,9 +1,9 @@ require 'jbuilder' require_relative 'mdJson_identifier' require_relative 'mdJson_dateTime' -# require_relative 'mdJson_objective' -# require_relative 'mdJson_pass' -# require_relative 'mdJson_instrument' +require_relative 'mdJson_objective' +require_relative 'mdJson_pass' +require_relative 'mdJson_instrument' module ADIWG @@ -16,17 +16,17 @@ module Event @Namespace = ADIWG::Mdtranslator::Writers::MdJson def self.build(hEvent) - + puts hEvent Jbuilder.new do |json| json.eventId hEvent[:eventId] - json.identifiers Identifier.build(hEvent[:identifier]) - json.trigger hEvent[:eventTrigger] - json.context hEvent[:eventContext] + json.identifier Identifier.build(hEvent[:identifier]) + json.trigger hEvent[:trigger] + json.context hEvent[:context] json.sequence hEvent[:sequence] json.time DateTime.build(hEvent[:time]) - # json.expectedObjective @Namespace.json_map(hEvent[:expectedObjectives], Objective) - # json.relatedPass Pass.build(hEvent[:relatedPass]) - # json.relatedSensor @Namespace.json_map(hEvent[:relatedSensors], Instrument) + json.expectedObjective @Namespace.json_map(hEvent[:expectedObjectives], Objective) + json.relatedPass Pass.build(hEvent[:relatedPass]) + json.relatedSensor @Namespace.json_map(hEvent[:relatedSensors], Instrument) end end From 33357b6ee2b2dd966ac0f439b2439995ec17763d Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Wed, 8 May 2024 11:06:31 -0600 Subject: [PATCH 51/64] uncomment Pass class from acquisition. Minor clarification fixes. --- .../writers/mdJson/sections/mdJson_acquisition.rb | 8 ++++---- .../mdtranslator/writers/mdJson/sections/mdJson_event.rb | 2 +- .../mdtranslator/writers/mdJson/sections/mdJson_plan.rb | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb index d83df050d..94ecbbf14 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb @@ -1,13 +1,13 @@ require 'jbuilder' require_relative 'mdJson_scope' -# require_relative 'mdJson_plan' +require_relative 'mdJson_plan' require_relative 'mdJson_requirement' require_relative 'mdJson_objective' require_relative 'mdJson_platform' require_relative 'mdJson_instrument' # require_relative 'mdJson_operation' require_relative 'mdJson_event' -# require_relative 'mdJson_pass' +require_relative 'mdJson_pass' # require_relative 'mdJson_environment' module ADIWG @@ -23,14 +23,14 @@ def self.build(hAcquisition) Jbuilder.new do |json| # json.scope Scope.build(hAcquisition[:scope]) - # json.plan @Namespace.json_map(hAcquisition[:plans], Plan) + json.plan @Namespace.json_map(hAcquisition[:plans], Plan) json.requirement @Namespace.json_map(hAcquisition[:requirements], Requirement) json.objective @Namespace.json_map(hAcquisition[:objectives], Objective) json.platform @Namespace.json_map(hAcquisition[:platforms], Platform) json.instrument @Namespace.json_map(hAcquisition[:instruments], Instrument) # json.operation @Namespace.json_map(hAcquisition[:operations], Operation) json.event @Namespace.json_map(hAcquisition[:events], Event) - # json.pass @Namespace.json_map(hAcquisition[:passes], Pass) + json.pass @Namespace.json_map(hAcquisition[:passes], Pass) # json.environment Environment.build(hAcquisition[:environment]) end diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_event.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_event.rb index 047a784bf..cb8da25cf 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_event.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_event.rb @@ -16,7 +16,7 @@ module Event @Namespace = ADIWG::Mdtranslator::Writers::MdJson def self.build(hEvent) - puts hEvent + Jbuilder.new do |json| json.eventId hEvent[:eventId] json.identifier Identifier.build(hEvent[:identifier]) diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_plan.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_plan.rb index 9bde484a3..f315f0062 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_plan.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_plan.rb @@ -25,7 +25,7 @@ def self.build(hPlan) end end - end # Requirement + end # Plan end end end From 739a9fe3462515d0d43ddcca44cf1008c853175f Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Wed, 8 May 2024 11:17:21 -0600 Subject: [PATCH 52/64] Add Environment class for use in acquisition writer. --- .../mdJson/sections/mdJson_acquisition.rb | 6 ++-- .../mdJson/sections/mdJson_environment.rb | 28 +++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_environment.rb diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb index 94ecbbf14..52f82c965 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb @@ -8,7 +8,7 @@ # require_relative 'mdJson_operation' require_relative 'mdJson_event' require_relative 'mdJson_pass' -# require_relative 'mdJson_environment' +require_relative 'mdJson_environment' module ADIWG module Mdtranslator @@ -22,7 +22,7 @@ module Acquisition def self.build(hAcquisition) Jbuilder.new do |json| - # json.scope Scope.build(hAcquisition[:scope]) + json.scope Scope.build(hAcquisition[:scope]) json.plan @Namespace.json_map(hAcquisition[:plans], Plan) json.requirement @Namespace.json_map(hAcquisition[:requirements], Requirement) json.objective @Namespace.json_map(hAcquisition[:objectives], Objective) @@ -31,7 +31,7 @@ def self.build(hAcquisition) # json.operation @Namespace.json_map(hAcquisition[:operations], Operation) json.event @Namespace.json_map(hAcquisition[:events], Event) json.pass @Namespace.json_map(hAcquisition[:passes], Pass) - # json.environment Environment.build(hAcquisition[:environment]) + json.environment Environment.build(hAcquisition[:environment]) end end diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_environment.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_environment.rb new file mode 100644 index 000000000..484ea3b2b --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_environment.rb @@ -0,0 +1,28 @@ +require 'jbuilder' + +module ADIWG + module Mdtranslator + module Writers + module MdJson + + module Environment + + @Namespace = ADIWG::Mdtranslator::Writers::MdJson + + def self.build(hEnvironment) + puts hEnvironment + Jbuilder.new do |json| + json.averageAirTemperature hEnvironment[:averageAirTemperature] unless hEnvironment[:averageAirTemperature].nil? + json.maxRelativeHumidity hEnvironment[:maxRelativeHumidity] unless hEnvironment[:maxRelativeHumidity].nil? + json.maxAltitude hEnvironment[:maxAltitude] unless hEnvironment[:maxAltitude].nil? + json.meteorologicalConditions hEnvironment[:meteorologicalConditions] unless hEnvironment[:meteorologicalConditions].nil? + json.solarAzimuth hEnvironment[:solarAzimuth] unless hEnvironment[:solarAzimuth].nil? + json.solarElevation hEnvironment[:solarElevation] unless hEnvironment[:solarElevation].nil? + end + + end + end # Environment + end + end + end +end From 295166c421879ce8c647488f517d45e511caa459 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Wed, 8 May 2024 11:20:41 -0600 Subject: [PATCH 53/64] Fix Environment class for use in Acquisition --- .../readers/mdJson/modules/module_acquisition.rb | 2 +- .../readers/mdJson/modules/module_environment.rb | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb index cb1904738..552326e5f 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb @@ -117,7 +117,7 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) end if hAcquisition.has_key?('environment') - intAcquisition[:environments] = hAcquisition['environment'] + intAcquisition[:environments] = Environment.unpack(hAcquisition['environment'], responseObj, outContext) end return intAcquisition diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_environment.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_environment.rb index f2fc08002..560992851 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_environment.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_environment.rb @@ -5,32 +5,34 @@ module MdJson module Environment def self.unpack(hEnvironment, responseObj, inContext = nil) + + intMetadataClass = InternalMetadata.new intEnvironment = intMetadataClass.newEnvironment outContext = 'environment' outContext = inContext + ' > ' + outContext unless inContext.nil? - if hEnvironment.has_key('averageAirTemperature') + if hEnvironment.has_key?('averageAirTemperature') intEnvironment[:averageAirTemperature] = hEnvironment['averageAirTemperature'] end - if hEnvironment.has_key('maxRelativeHumidity') + if hEnvironment.has_key?('maxRelativeHumidity') intEnvironment[:maxRelativeHumidity] = hEnvironment['maxRelativeHumidity'] end - if hEnvironment.has_key('maxAltitude') + if hEnvironment.has_key?('maxAltitude') intEnvironment[:maxAltitude] = hEnvironment['maxAltitude'] end - if hEnvironment.has_key('meteorologicalConditions') + if hEnvironment.has_key?('meteorologicalConditions') intEnvironment[:meteorologicalConditions] = hEnvironment['meteorologicalConditions'] end - if hEnvironment.has_key('solarAzimuth') + if hEnvironment.has_key?('solarAzimuth') intEnvironment[:solarAzimuth] = hEnvironment['solarAzimuth'] end - if hEnvironment.has_key('solarElevation') + if hEnvironment.has_key?('solarElevation') intEnvironment[:solarElevation] = hEnvironment['solarElevation'] end From 3b0dc10115ad9717c4c8d9e72e2843aebc106e7d Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Wed, 8 May 2024 11:26:22 -0600 Subject: [PATCH 54/64] fix environment key for acquisition class. --- .../mdtranslator/readers/mdJson/modules/module_acquisition.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb index 552326e5f..eee8dc706 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb @@ -117,7 +117,7 @@ def self.unpack(hAcquisition, responseObj, inContext = nil) end if hAcquisition.has_key?('environment') - intAcquisition[:environments] = Environment.unpack(hAcquisition['environment'], responseObj, outContext) + intAcquisition[:environment] = Environment.unpack(hAcquisition['environment'], responseObj, outContext) end return intAcquisition From 0093c7120243aef1f110dd23ed5e9079af5c9167 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Wed, 8 May 2024 11:27:49 -0600 Subject: [PATCH 55/64] remove puts --- .../mdtranslator/writers/mdJson/sections/mdJson_environment.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_environment.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_environment.rb index 484ea3b2b..5bd96f359 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_environment.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_environment.rb @@ -10,7 +10,7 @@ module Environment @Namespace = ADIWG::Mdtranslator::Writers::MdJson def self.build(hEnvironment) - puts hEnvironment + Jbuilder.new do |json| json.averageAirTemperature hEnvironment[:averageAirTemperature] unless hEnvironment[:averageAirTemperature].nil? json.maxRelativeHumidity hEnvironment[:maxRelativeHumidity] unless hEnvironment[:maxRelativeHumidity].nil? From 2d1991bb9b6e51377af46bbbb3f45c6028fcd1df Mon Sep 17 00:00:00 2001 From: joliveros Date: Mon, 13 May 2024 15:43:49 -0600 Subject: [PATCH 56/64] Fix test cases. internal object and changes for bugfixes to mdJson read/write errors related to acquisition. --- .../internal/internal_metadata_obj.rb | 2 +- .../readers/mdJson/modules/module_platform.rb | 4 +- .../mdJson/modules/module_requirement.rb | 4 +- .../mdJson/sections/mdJson_instrument.rb | 4 +- test/helpers/mdJson_hash_functions.rb | 8 +- test/helpers/mdJson_hash_objects.rb | 266 ++++++++++++++++++ test/writers/mdJson/tc_mdjson_metadata.rb | 5 + 7 files changed, 285 insertions(+), 8 deletions(-) diff --git a/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb b/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb index 9fbf702b5..2a7e82694 100644 --- a/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +++ b/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb @@ -205,7 +205,7 @@ def newInstrument identifier: {}, instrumentType: nil, description: nil, - mountedOn: nil, + mountedOn: {}, histories: [], hostId: {} } diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb index aaea1045c..75d04d2d9 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb @@ -58,9 +58,9 @@ def self.unpack(hPlatform, responseObj, inContext = nil) if hPlatform.has_key?('instrument') hPlatform['instrument'].each do |instrument| - hReturn = AcqInstrument.unpack(instrument, responseObj, outContext) + hReturn = Instrument.unpack(instrument, responseObj, outContext) unless hReturn.nil? - intPlatform[:instruments] = hReturn + intPlatform[:instruments] << hReturn else @MessagePath.issueError(461, responseObj, outContext) end diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb index 5073d5a89..5ae2ed67d 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb @@ -43,8 +43,8 @@ def self.unpack(hRequirement, responseObj, inContext = nil) end end - if hRequirement.has_key?('requestors') - hRequirement['requestors'].each do |requestor| + if hRequirement.has_key?('requestor') + hRequirement['requestor'].each do |requestor| intRequirement[:requestors] << requestor end end diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrument.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrument.rb index fb19e524a..b1a87cb51 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrument.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrument.rb @@ -1,7 +1,7 @@ require 'jbuilder' require_relative 'mdJson_citation' require_relative 'mdJson_identifier' -# require_relative 'mdJson_platform' +require_relative 'mdJson_platform' require_relative 'mdJson_instrumentationEventList' module ADIWG @@ -21,7 +21,7 @@ def self.build(hInstrument) json.identifier Identifier.build(hInstrument[:identifier]) json.instrumentType hInstrument[:instrumentType] json.description hInstrument[:description] unless hInstrument[:description].nil? - # json.mountedOn Platform.build(hInstrument[:mountedOn]) unless hInstrument[:mountedOn].empty? + json.mountedOn Platform.build(hInstrument[:mountedOn]) unless hInstrument[:mountedOn].empty? json.history @Namespace.json_map(hInstrument[:histories], InstrumentationEventList) unless hInstrument[:histories].empty? json.hostId Identifier.build(hInstrument[:hostId]) unless hInstrument[:hostId].empty? end diff --git a/test/helpers/mdJson_hash_functions.rb b/test/helpers/mdJson_hash_functions.rb index 0efdf3fd3..dd16efc5d 100644 --- a/test/helpers/mdJson_hash_functions.rb +++ b/test/helpers/mdJson_hash_functions.rb @@ -3,6 +3,11 @@ class MdJsonHashWriter + def build_acquisition + hAcquisition = acquisition + return hAcquisition + end + def build_additionalDocumentation hDoc = additionalDocumentation return hDoc @@ -72,7 +77,7 @@ def build_dataQuality hDataQuality[:report] = [ { - type: 'AbsolutePositionalAccuracy', + type: 'AbsoluteExternalPositionalAccuracy', standaloneQualityReportDetails: "standalone quality report details 1", qualityMeasure: { identifier: { @@ -473,6 +478,7 @@ def build_metadata_full hMetadata[:funding] << build_funding hMetadata[:funding] << build_funding hMetadata[:dataQuality] << build_dataQuality + hMetadata[:acquisition] << build_acquisition removeEmptyObjects(hMetadata) return hMetadata end diff --git a/test/helpers/mdJson_hash_objects.rb b/test/helpers/mdJson_hash_objects.rb index e872a5bc0..e10f60ed3 100644 --- a/test/helpers/mdJson_hash_objects.rb +++ b/test/helpers/mdJson_hash_objects.rb @@ -224,6 +224,272 @@ def base } end + # acquisition ----------------------------- + def acquisition + { + scope: { + scopeCode: "scopeCode", + scopeDescription: [{ + dataset: "dataset" + }], + scopeExtent: [{ + temporalExtent: [{ + 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", + timeInterval: { + interval: 9, + units: "year" + }, + duration: { + years: 1, + months: 1, + days: 1, + hours: 1, + minutes: 1, + seconds: 1 + } + } + }] + }] + }, + plan: [ + { + planId: "plan ID", + planType: "linear", + status: "accepted", + citation: { + title: "citation title", + }, + planOperation: [ ], + satisfiedRequirement: [ ] + } + ], + requirement: [ + { + requirementId: "requirement ID", + citation: { + title: "requirement citation title", + }, + identifier: { + identifier: "requirement identifier", + }, + requestor: [ + { + "role": "role", + "roleExtent": [{ + "temporalExtent": [{ + "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", + "timeInterval": { + "interval": 9.9, + "units": "year" + }, + "duration": { + "years": 1, + "months": 1, + "days": 1, + "hours": 1, + "minutes": 1, + "seconds": 1 + } + } + }] + }], + "party": [{ + "contactId": "individualId0" + }] + } + ], + recipient: [ + { + "role": "role", + "roleExtent": [{ + "temporalExtent": [{ + "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", + "timeInterval": { + "interval": 9.9, + "units": "year" + }, + "duration": { + "years": 1, + "months": 1, + "days": 1, + "hours": 1, + "minutes": 1, + "seconds": 1 + } + } + }] + }], + "party": [{ + "contactId": "individualId0" + }] + } + ], + priority: "critical", + requestedDate: { + "requestedDateOfCollection": "2019-06-10", + "latestAcceptableDate": "2019-06-13" + }, + expiryDate: "2019-06-10T15:50:00", + satisfiedPlan: [ ] + } + ], + objective: [ + { + objectiveId: "objective ID", + identifier: [ + { + identifier: "objective identifier" + } + ], + priority: "objective priority", + objectiveType: ["instantaneousCollection"], + function: [], + extent: [ ], + objectiveOccurrence: [ ], + pass: [ ], + sensingInstrument: [ ] + } + ], + platform: [ + { + platformId: "platform ID", + citation: { + title: "platform citation title", + }, + identifier: { + identifier: "platform identifier", + }, + description: "platform description", + sponsor: [ ], + instrument: [ + { + instrumentId: "instrument ID", + citation: [], + identifier: { + identifier: "instrument identifier", + }, + instrumentType: "instrument type", + description: "instrument description", + mountedOn: { + platformId: "platform ID", + citation: { + title: "platform citation title", + }, + identifier: { + identifier: "platform identifier", + }, + description: "platform description", + sponsor: [ ], + instrument: [ + { + instrumentId: "instrument ID", + identifier: { + identifier: "instrument identifier", + }, + instrumentType: "instrument type" + } + ], + history: [ ] + }, + history: [ ], + hostId: { + identifier: "host instrument ID" + } + } + ], + history: [ ] + } + ], + instrument: [ + { + instrumentId: "instrument ID", + citation: [], + identifier: { + identifier: "instrument identifier", + }, + instrumentType: "instrument type" + } + ], + operation: [], + event: [ + { + eventId: "event ID", + identifier: { + identifier: "event identifier", + }, + trigger: "manual", + context: "pass", + sequence: "start", + time: "2019-06-10T16:07:00", + expectedObjective: [], + relatedPass: { + passId: "pass ID", + identifier: { + identifier: "pass identifier" + }, + extent: { }, + relatedEvent: [ ] + }, + relatedSensor: [] + } + ], + pass: [ + { + passId: "pass ID", + identifier: { + identifier: "pass identifier" + }, + extent: { }, + relatedEvent: [ ] + } + ], + environment: { + averageAirTemperature: 9.9, + maxRelativeHumidity: 9.9, + maxAltitude: 9.9, + meteorologicalConditions: "meteorological conditions", + solarAzimuth: 9.9, + solarElevation: 9.9 + } + } + end + # additional documentation ---------------- def additionalDocumentation diff --git a/test/writers/mdJson/tc_mdjson_metadata.rb b/test/writers/mdJson/tc_mdjson_metadata.rb index 4c0d4fd7d..df1f16548 100644 --- a/test/writers/mdJson/tc_mdjson_metadata.rb +++ b/test/writers/mdJson/tc_mdjson_metadata.rb @@ -27,6 +27,11 @@ class TestWriterMdJsonMetadata < TestWriterMdJsonParent mdHash[:metadata][:resourceLineage] << TDClass.build_lineage mdHash[:metadata][:resourceLineage] << TDClass.build_lineage + # data quality [] + mdHash[:metadata][:acquisition] = [] + mdHash[:metadata][:acquisition] << TDClass.build_acquisition + mdHash[:metadata][:acquisition] << TDClass.build_acquisition + # distribution [] mdHash[:metadata][:resourceDistribution] = [] mdHash[:metadata][:resourceDistribution] << TDClass.build_distribution From f7b8240bddbdf4be722035a51f974094becd7847 Mon Sep 17 00:00:00 2001 From: joliveros Date: Tue, 14 May 2024 13:13:23 -0600 Subject: [PATCH 57/64] Update mdJson-schemas gem version. Change ordering of acquisition in mdJson_hash_object and metadata test case. --- adiwg-mdtranslator.gemspec | 2 +- test/helpers/mdJson_hash_objects.rb | 282 +++++++++++----------- test/writers/mdJson/tc_mdjson_metadata.rb | 10 +- 3 files changed, 152 insertions(+), 142 deletions(-) diff --git a/adiwg-mdtranslator.gemspec b/adiwg-mdtranslator.gemspec index a0a31e44c..44a28a448 100644 --- a/adiwg-mdtranslator.gemspec +++ b/adiwg-mdtranslator.gemspec @@ -34,7 +34,7 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency "thor", "~> 0.19" spec.add_runtime_dependency "uuidtools", "~> 2.1" spec.add_runtime_dependency "json-schema", "~> 2.7" - spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.9.2" + spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.10.0.pre.beta.0" spec.add_runtime_dependency "adiwg-mdcodes", "2.9.3" spec.add_runtime_dependency "jbuilder", "~> 2.5" spec.add_runtime_dependency "kramdown", ">= 1.13", "< 3.0" diff --git a/test/helpers/mdJson_hash_objects.rb b/test/helpers/mdJson_hash_objects.rb index e10f60ed3..e24e09c13 100644 --- a/test/helpers/mdJson_hash_objects.rb +++ b/test/helpers/mdJson_hash_objects.rb @@ -216,8 +216,7 @@ def base } ] }, - dataQuality: [], - acquisition: [] + dataQuality: [] }, metadataRepository: [], dataDictionary: [] @@ -230,37 +229,37 @@ def acquisition scope: { scopeCode: "scopeCode", scopeDescription: [{ - dataset: "dataset" + dataset: "dataset" }], scopeExtent: [{ - temporalExtent: [{ - 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", - timeInterval: { - interval: 9, - units: "year" - }, - duration: { - years: 1, - months: 1, - days: 1, - hours: 1, - minutes: 1, - seconds: 1 + temporalExtent: [{ + 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", + timeInterval: { + interval: 9, + units: "year" + }, + duration: { + years: 1, + months: 1, + days: 1, + hours: 1, + minutes: 1, + seconds: 1 + } } - } - }] + }] }] }, plan: [ @@ -268,111 +267,122 @@ def acquisition planId: "plan ID", planType: "linear", status: "accepted", - citation: { - title: "citation title", + citation: { + title: "citation title" }, - planOperation: [ ], - satisfiedRequirement: [ ] + planOperation: [], + satisfiedRequirement: [] } ], requirement: [ { requirementId: "requirement ID", - citation: { - title: "requirement citation title", + citation: { + title: "requirement citation title" }, - identifier: { - identifier: "requirement identifier", + identifier: { + identifier: "requirement identifier" }, - requestor: [ + requestor: [ { - "role": "role", - "roleExtent": [{ - "temporalExtent": [{ - "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", - "timeInterval": { - "interval": 9.9, - "units": "year" - }, - "duration": { - "years": 1, - "months": 1, - "days": 1, - "hours": 1, - "minutes": 1, - "seconds": 1 + role: "role", + roleExtent: [{ + temporalExtent: [{ + 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", + timeInterval: { + interval: 9.9, + units: "year" + }, + duration: { + years: 1, + months: 1, + days: 1, + hours: 1, + minutes: 1, + seconds: 1 + } } - } - }] + }] }], - "party": [{ - "contactId": "individualId0" + party: [{ + contactId: "individualId0" }] } ], - recipient: [ + recipient: [ { - "role": "role", - "roleExtent": [{ - "temporalExtent": [{ - "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", - "timeInterval": { - "interval": 9.9, - "units": "year" - }, - "duration": { - "years": 1, - "months": 1, - "days": 1, - "hours": 1, - "minutes": 1, - "seconds": 1 + role: "role", + roleExtent: [{ + temporalExtent: [{ + 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", + timeInterval: { + interval: 9.9, + units: "year" + }, + duration: { + years: 1, + months: 1, + days: 1, + hours: 1, + minutes: 1, + seconds: 1 + } } - } - }] + }] }], - "party": [{ - "contactId": "individualId0" + party: [{ + contactId: "individualId0" }] } ], priority: "critical", requestedDate: { - "requestedDateOfCollection": "2019-06-10", - "latestAcceptableDate": "2019-06-13" + requestedDateOfCollection: "2019-06-10", + latestAcceptableDate: "2019-06-13" }, expiryDate: "2019-06-10T15:50:00", - satisfiedPlan: [ ] + satisfiedPlan: [ + { + planId: "plan ID", + planType: "linear", + status: "accepted", + citation: { + title: "citation title" + }, + planOperation: [], + satisfiedRequirement: [] + } + ] } ], objective: [ { objectiveId: "objective ID", - identifier: [ + identifier: [ { identifier: "objective identifier" } @@ -380,60 +390,60 @@ def acquisition priority: "objective priority", objectiveType: ["instantaneousCollection"], function: [], - extent: [ ], - objectiveOccurrence: [ ], - pass: [ ], - sensingInstrument: [ ] + extent: [], + objectiveOccurrence: [], + pass: [], + sensingInstrument: [] } ], platform: [ { platformId: "platform ID", - citation: { - title: "platform citation title", + citation: { + title: "platform citation title" }, - identifier: { - identifier: "platform identifier", + identifier: { + identifier: "platform identifier" }, description: "platform description", - sponsor: [ ], - instrument: [ + sponsor: [], + instrument: [ { instrumentId: "instrument ID", citation: [], identifier: { - identifier: "instrument identifier", + identifier: "instrument identifier" }, instrumentType: "instrument type", description: "instrument description", mountedOn: { platformId: "platform ID", - citation: { - title: "platform citation title", + citation: { + title: "platform citation title" }, - identifier: { - identifier: "platform identifier", + identifier: { + identifier: "platform identifier" }, description: "platform description", - sponsor: [ ], - instrument: [ + sponsor: [], + instrument: [ { instrumentId: "instrument ID", identifier: { - identifier: "instrument identifier", + identifier: "instrument identifier" }, instrumentType: "instrument type" } ], - history: [ ] + history: [] }, - history: [ ], + history: [], hostId: { identifier: "host instrument ID" } } ], - history: [ ] + history: [] } ], instrument: [ @@ -441,7 +451,7 @@ def acquisition instrumentId: "instrument ID", citation: [], identifier: { - identifier: "instrument identifier", + identifier: "instrument identifier" }, instrumentType: "instrument type" } @@ -450,8 +460,8 @@ def acquisition event: [ { eventId: "event ID", - identifier: { - identifier: "event identifier", + identifier: { + identifier: "event identifier" }, trigger: "manual", context: "pass", @@ -460,11 +470,11 @@ def acquisition expectedObjective: [], relatedPass: { passId: "pass ID", - identifier: { + identifier: { identifier: "pass identifier" }, - extent: { }, - relatedEvent: [ ] + extent: {}, + relatedEvent: [] }, relatedSensor: [] } @@ -472,11 +482,11 @@ def acquisition pass: [ { passId: "pass ID", - identifier: { + identifier: { identifier: "pass identifier" }, - extent: { }, - relatedEvent: [ ] + extent: {}, + relatedEvent: [] } ], environment: { diff --git a/test/writers/mdJson/tc_mdjson_metadata.rb b/test/writers/mdJson/tc_mdjson_metadata.rb index df1f16548..fc38854bd 100644 --- a/test/writers/mdJson/tc_mdjson_metadata.rb +++ b/test/writers/mdJson/tc_mdjson_metadata.rb @@ -27,11 +27,6 @@ class TestWriterMdJsonMetadata < TestWriterMdJsonParent mdHash[:metadata][:resourceLineage] << TDClass.build_lineage mdHash[:metadata][:resourceLineage] << TDClass.build_lineage - # data quality [] - mdHash[:metadata][:acquisition] = [] - mdHash[:metadata][:acquisition] << TDClass.build_acquisition - mdHash[:metadata][:acquisition] << TDClass.build_acquisition - # distribution [] mdHash[:metadata][:resourceDistribution] = [] mdHash[:metadata][:resourceDistribution] << TDClass.build_distribution @@ -52,6 +47,11 @@ class TestWriterMdJsonMetadata < TestWriterMdJsonParent mdHash[:metadata][:funding] << TDClass.build_funding mdHash[:metadata][:funding] << TDClass.build_funding + # acquisition [] + mdHash[:metadata][:acquisition] = [] + mdHash[:metadata][:acquisition] << TDClass.build_acquisition + mdHash[:metadata][:acquisition] << TDClass.build_acquisition + TDClass.removeEmptyObjects(mdHash) @@mdHash = mdHash From 6a7dd7e7e32e48173bde775eb40ec6da2ca06523 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Tue, 21 May 2024 11:34:09 -0600 Subject: [PATCH 58/64] fix handling of parties within requirement class. Fix datetime strings in internal hash testing object. --- .../mdJson/modules/module_requirement.rb | 19 +++++++++++++------ test/helpers/mdJson_hash_objects.rb | 10 +++++----- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb index 5ae2ed67d..223f0b172 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb @@ -2,6 +2,7 @@ require_relative 'module_identifier' require_relative 'module_requestedDate' require_relative 'module_plan' +require_relative 'module_responsibleParty' module ADIWG module Mdtranslator @@ -45,13 +46,19 @@ def self.unpack(hRequirement, responseObj, inContext = nil) if hRequirement.has_key?('requestor') hRequirement['requestor'].each do |requestor| - intRequirement[:requestors] << requestor + hReturn = ResponsibleParty.unpack(requestor, responseObj, outContext) + unless hReturn.nil? + intRequirement[:requestors] << hReturn + end end end - if hRequirement.has_key?('recipients') - hRequirement['recipients'].each do |recipient| - intRequirement[:recipients] << recipient + if hRequirement.has_key?('recipient') + hRequirement['recipient'].each do |recipient| + hReturn = ResponsibleParty.unpack(recipient, responseObj, outContext) + unless hReturn.nil? + intRequirement[:recipients] << hReturn + end end end @@ -70,8 +77,8 @@ def self.unpack(hRequirement, responseObj, inContext = nil) intRequirement[:expiryDate] = hRequirement['expiryDate'] end - if hRequirement.has_key?('satisfiedPlans') - aItems = hRequirement['satisfiedPlans'] + if hRequirement.has_key?('satisfiedPlan') + aItems = hRequirement['satisfiedPlan'] aItems.each do |item| hReturn = Plan.unpack(item, responseObj, outContext) unless hReturn.nil? diff --git a/test/helpers/mdJson_hash_objects.rb b/test/helpers/mdJson_hash_objects.rb index e24e09c13..8e4ea7fbe 100644 --- a/test/helpers/mdJson_hash_objects.rb +++ b/test/helpers/mdJson_hash_objects.rb @@ -244,7 +244,7 @@ def acquisition "periodName0", "periodName1" ], - startDateTime: "2016-10-14T11:10:15.2-10:00", + startDateTime: "2016-10-14T11:10:15.200-10:00", endDateTime: "2016-12-31", timeInterval: { interval: 9, @@ -299,7 +299,7 @@ def acquisition "periodName0", "periodName1" ], - startDateTime: "2016-10-14T11:10:15.2-10:00", + startDateTime: "2016-10-14T11:10:15.200-10:00", endDateTime: "2016-12-31", timeInterval: { interval: 9.9, @@ -317,7 +317,7 @@ def acquisition }] }], party: [{ - contactId: "individualId0" + contactId: "CID001" }] } ], @@ -337,7 +337,7 @@ def acquisition "periodName0", "periodName1" ], - startDateTime: "2016-10-14T11:10:15.2-10:00", + startDateTime: "2016-10-14T11:10:15.200-10:00", endDateTime: "2016-12-31", timeInterval: { interval: 9.9, @@ -355,7 +355,7 @@ def acquisition }] }], party: [{ - contactId: "individualId0" + contactId: "CID003" }] } ], From 996677289e0d706b1afbf31bab79f5f5b3bf54a1 Mon Sep 17 00:00:00 2001 From: Jonathan Oliveros Date: Wed, 22 May 2024 11:45:38 -0600 Subject: [PATCH 59/64] Fix acquistion to include operation. Update instrumentation event and event list to their respective citation formats. Fix operation class in test cases and mdJson writer. --- .../internal/internal_metadata_obj.rb | 9 +- .../modules/module_instrumentationEvent.rb | 7 +- .../module_instrumentationEventList.rb | 19 +- .../mdJson/modules/module_operation.rb | 8 +- .../mdJson/sections/mdJson_acquisition.rb | 4 +- .../sections/mdJson_instrumentationEvent.rb | 2 +- .../mdJson_instrumentationEventList.rb | 2 +- .../mdJson/sections/mdJson_operation.rb | 34 ++++ .../writers/mdJson/sections/mdJson_plan.rb | 4 +- test/helpers/mdJson_hash_objects.rb | 177 +++++++++++++++++- 10 files changed, 239 insertions(+), 27 deletions(-) create mode 100644 lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_operation.rb diff --git a/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb b/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb index 2a7e82694..077f18b1e 100644 --- a/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +++ b/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb @@ -213,7 +213,7 @@ def newInstrument def newInstrumentationEvent { - citation: {}, + citations: [], description: nil, extent: {}, eventType: nil, @@ -223,7 +223,7 @@ def newInstrumentationEvent def newInstrumentationEventList { - citations: [], + citation: {}, description: nil, locale: {}, constraints: [], @@ -268,14 +268,15 @@ def newPlan def newOperation { operationId: nil, + description: nil, citation: {}, identifier: {}, status: nil, operationType: nil, objectives: [], - parentOperations: nil, + parentOperation: {}, childOperations: [], - plan: nil, + plan: {}, platforms: [], significantEvents: [] } diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrumentationEvent.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrumentationEvent.rb index 360852a18..61727a1eb 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrumentationEvent.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrumentationEvent.rb @@ -34,7 +34,12 @@ def self.unpack(hInstrumentationEvent, responseObj, inContext = nil) ] if hInstrumentationEvent.has_key?('citation') - intInstrumentationEvent[:citation] = Citation.unpack(hInstrumentationEvent['citation'], responseObj, outContext) + hInstrumentationEvent['citation'].each do |citation| + hReturn = Citation.unpack(citation, responseObj, outContext) + unless hReturn.nil? + intInstrumentationEvent[:citations] << hReturn + end + end end if hInstrumentationEvent.has_key?('description') diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrumentationEventList.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrumentationEventList.rb index 510ba7c5c..40a6b6a7f 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrumentationEventList.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrumentationEventList.rb @@ -15,31 +15,28 @@ def self.unpack(hInstrumentationEventList, responseObj, inContext = nil) intMetadataClass = InternalMetadata.new intInstrumentationEventList = intMetadataClass.newInstrumentationEventList + outContext = 'instrumentation event list' + outContext = inContext + ' > ' + outContext unless inContext.nil? + if hInstrumentationEventList.has_key?('citation') - citations = hInstrumentationEventList['citation'] - citations.each do |citation| - hReturn = Citation.unpack(hInstrumentationEventList['citation'], responseObj, inContext) - unless hReturn.nil? - intInstrumentationEventList[:citations] << hReturn - end - end + intInstrumentationEventList[:citation] = Citation.unpack(hInstrumentationEventList['citation'], responseObj, outContext) end if hInstrumentationEventList.has_key?('description') intInstrumentationEventList[:description] = hInstrumentationEventList['description'] else - @MessagePath.issueWarning(40, responseObj, inContext, 'instrumentation event description') + @MessagePath.issueWarning(40, responseObj, outContext, 'instrumentation event description') end if hInstrumentationEventList.has_key?('locale') - hReturn = Locale.unpack(hInstrumentationEventList['locale'], responseObj, inContext) + hReturn = Locale.unpack(hInstrumentationEventList['locale'], responseObj, outContext) end if hInstrumentationEventList.has_key?('constraint') constraints = hInstrumentationEventList['constraint'] constraints.each do |constraint| - hReturn = Constraint.unpack(hInstrumentationEventList['constraint'], responseObj, inContext) + hReturn = Constraint.unpack(hInstrumentationEventList['constraint'], responseObj, outContext) unless hReturn.nil? intInstrumentationEventList[:constraints] << hReturn end @@ -48,7 +45,7 @@ def self.unpack(hInstrumentationEventList, responseObj, inContext = nil) if hInstrumentationEventList.has_key?('instrumentationEvent') hInstrumentationEventList['instrumentationEvent'].each do |item| - hReturn = InstrumentationEvent.unpack(item, responseObj, inContext) + hReturn = InstrumentationEvent.unpack(item, responseObj, outContext) unless hReturn.nil? intInstrumentationEventList[:instrumentationEvents] << hReturn end diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_operation.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_operation.rb index 33adfaa97..b07cf172b 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_operation.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_operation.rb @@ -60,7 +60,7 @@ def self.unpack(hOperation, responseObj, inContext = nil) hOperation['objective'].each do |item| hReturn = Objective.unpack(item, responseObj, outContext) unless hReturn.nil? - intOperation[:objective] << hReturn + intOperation[:objectives] << hReturn end end end @@ -78,7 +78,7 @@ def self.unpack(hOperation, responseObj, inContext = nil) hOperation['childOperation'].each do |item| hReturn = Operation.unpack(item, responseObj, outContext) unless hReturn.nil? - intOperation[:childOperation] << hReturn + intOperation[:childOperations] << hReturn end end end @@ -94,7 +94,7 @@ def self.unpack(hOperation, responseObj, inContext = nil) hOperation['platform'].each do |item| hReturn = Platform.unpack(item, responseObj, outContext) unless hReturn.nil? - intOperation[:platform] << hReturn + intOperation[:platforms] << hReturn end end end @@ -103,7 +103,7 @@ def self.unpack(hOperation, responseObj, inContext = nil) hOperation['significantEvent'].each do |item| hReturn = Event.unpack(item, responseObj, outContext) unless hReturn.nil? - intOperation[:significantEvent] << hReturn + intOperation[:significantEvents] << hReturn end end end diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb index 52f82c965..85c4ee47a 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_acquisition.rb @@ -5,7 +5,7 @@ require_relative 'mdJson_objective' require_relative 'mdJson_platform' require_relative 'mdJson_instrument' -# require_relative 'mdJson_operation' +require_relative 'mdJson_operation' require_relative 'mdJson_event' require_relative 'mdJson_pass' require_relative 'mdJson_environment' @@ -28,7 +28,7 @@ def self.build(hAcquisition) json.objective @Namespace.json_map(hAcquisition[:objectives], Objective) json.platform @Namespace.json_map(hAcquisition[:platforms], Platform) json.instrument @Namespace.json_map(hAcquisition[:instruments], Instrument) - # json.operation @Namespace.json_map(hAcquisition[:operations], Operation) + json.operation @Namespace.json_map(hAcquisition[:operations], Operation) json.event @Namespace.json_map(hAcquisition[:events], Event) json.pass @Namespace.json_map(hAcquisition[:passes], Pass) json.environment Environment.build(hAcquisition[:environment]) diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEvent.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEvent.rb index 78967bdbf..21717c415 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEvent.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEvent.rb @@ -14,7 +14,7 @@ module InstrumentationEvent def self.build(hInstrumentationEvent) # "required": ["description","eventType"], Jbuilder.new do |json| - json.citation Citation.build(hInstrumentationEvent[:citation]) unless hInstrumentationEvent[:citation].empty? + json.citation @Namespace.json_map(hInstrumentationEvent[:citations], Citation) unless hInstrumentationEvent[:citations].empty? json.description hInstrumentationEvent[:description] json.extent hInstrumentationEvent[:extent] unless hInstrumentationEvent[:extent].empty? json.eventType hInstrumentationEvent[:eventType] diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEventList.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEventList.rb index 0ad58ebf9..c7adb30ae 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEventList.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_instrumentationEventList.rb @@ -16,7 +16,7 @@ module InstrumentationEventList def self.build(hInstrumentationEventList) Jbuilder.new do |json| - json.citation @Namespace.json_map(hInstrumentationEventList[:citations], Citation) unless hInstrumentationEventList[:citations].empty? + json.citation Citation.build(hInstrumentationEventList[:citation]) unless hInstrumentationEventList[:citation].empty? json.description hInstrumentationEventList[:description] json.locale Locale.build(hInstrumentationEventList[:locale]) unless hInstrumentationEventList[:locale].empty? json.constraints @Namespace.json_map(hInstrumentationEventList[:constraints], Constraint) unless hInstrumentationEventList[:constraints].empty? diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_operation.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_operation.rb new file mode 100644 index 000000000..72b061973 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_operation.rb @@ -0,0 +1,34 @@ +require 'jbuilder' + +module ADIWG + module Mdtranslator + module Writers + module MdJson + + module Operation + + @Namespace = ADIWG::Mdtranslator::Writers::MdJson + + def self.build(hOperation) + + Jbuilder.new do |json| + json.operationId hOperation[:operationId] + json.description hOperation[:description] unless hOperation[:description].nil? + json.citation Citation.build(hOperation[:citation]) unless hOperation[:citation].empty? + json.identifier Identifier.build(hOperation[:identifier]) + json.status hOperation[:status] + json.operationType hOperation[:operationType] unless hOperation[:operationType].nil? + json.objective @Namespace.json_map(hOperation[:objectives], Objective) unless hOperation[:objectives].empty? + json.parentOperation Operation.build(hOperation[:parentOperation]) unless hOperation[:parentOperation].empty? + json.childOperation @Namespace.json_map(hOperation[:childOperations], Operation) unless hOperation[:childOperations].empty? + json.plan Plan.build(hOperation[:plan]) unless hOperation[:plan].empty? + json.platform @Namespace.json_map(hOperation[:platforms], Platform) unless hOperation[:platforms].empty? + json.significantEvent @Namespace.json_map(hOperation[:significantEvents], Event) unless hOperation[:significantEvents].empty? + end + + end + end # Operation + end + end + end +end diff --git a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_plan.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_plan.rb index f315f0062..0000e33d0 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_plan.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_plan.rb @@ -1,6 +1,6 @@ require 'jbuilder' require_relative 'mdJson_citation' -# require_relative 'mdJson_operation' +require_relative 'mdJson_operation' require_relative 'mdJson_requirement' module ADIWG @@ -19,7 +19,7 @@ def self.build(hPlan) json.planType hPlan[:planType] unless hPlan[:planType].nil? json.status hPlan[:status] json.citation Citation.build(hPlan[:citation]) - # json.planOperation @Namespace.json_map(hPlan[:operations], Operation) + json.planOperation @Namespace.json_map(hPlan[:operations], Operation) json.satisfiedRequirement @Namespace.json_map(hPlan[:satisfiedRequirements], Requirement) end diff --git a/test/helpers/mdJson_hash_objects.rb b/test/helpers/mdJson_hash_objects.rb index 8e4ea7fbe..23a0aa9cd 100644 --- a/test/helpers/mdJson_hash_objects.rb +++ b/test/helpers/mdJson_hash_objects.rb @@ -456,7 +456,182 @@ def acquisition instrumentType: "instrument type" } ], - operation: [], + operation: [ + { + operationId: 'operation ID', + description: 'operation description', + citation: { + title: 'title' + }, + identifier: { + identifier: 'identifier' + }, + status: 'pending', + operationType: 'real', + objective: [ + { + objectiveId: 'objective ID', + identifier: [ + { + identifier: 'objective identifier' + } + ], + priority: 'objective priority', + objectiveType: [ + 'instantaneousCollection' + ], + function: [], + extent: [], + objectiveOccurrence: [], + pass: [], + sensingInstrument: [] + } + ], + plan: { + planId: 'plan ID', + planType: 'linear', + status: 'accepted', + citation: { + title: 'USGS US Topo Map Collection', + date: [ + { + date: '2022', + dateType: 'publication' + } + ], + responsibleParty: [ + { + role: 'publisher', + party: [ + { + contactId: 'CID002' + } + ] + } + ], + presentationForm: [ + 'map, raster digital data' + ], + onlineResource: [ + { + uri: 'https://thor-f5.er.usgs.gov/ngtoc/metadata/waf/ustopo/geopdf/', + description: 'Link to the resource described in this citation' + } + ] + }, + planOperation: [], + satisfiedRequirement: [ + { + requirementId: 'requirement ID', + citation: { + title: 'title' + }, + identifier: { + identifier: 'identifier' + }, + requestor: [], + recipient: [], + priority: 'critical', + requestedDate: { + requestedDateOfCollection: '2019-06-10T15:50:00', + latestAcceptableDate: '2019-06-10T15:50:00' + }, + expiryDate: '2019-06-10T15:50:00', + satisfiedPlan: [] + } + ] + }, + platform: [ + { + platformId: 'platform ID', + citation: { + title: 'title' + }, + identifier: { + identifier: 'identifier' + }, + description: 'platform description', + sponsor: [ + { + role: 'role', + roleExtent: [ + { + temporalExtent: [ + { + timePeriod: { + id: 'id', + description: 'description', + identifier: { + identifier: 'identifier', + namespace: 'namespace' + }, + periodName: [ + 'periodName0', + 'periodName1' + ], + startDateTime: '2016-10-14T11:10:15.200-10:00', + endDateTime: '2016-12-31', + timeInterval: { + interval: 9.9, + units: 'year' + }, + duration: { + years: 1, + months: 1, + days: 1, + hours: 1, + minutes: 1, + seconds: 1 + } + } + } + ] + } + ], + party: [ + { + contactId: 'CID002' + } + ] + } + ], + instrument: [ + { + instrumentId: 'instrument ID', + citation: { + title: 'title' + }, + identifier: { + identifier: 'identifier' + }, + instrumentType: 'instrument type' + } + ], + history: [] + } + ], + significantEvent: [ + { + eventId: 'event ID', + identifier: { + identifier: 'identifier' + }, + trigger: 'manual', + context: 'pass', + sequence: 'start', + time: '2019-06-10T16:07:00', + expectedObjective: [], + relatedPass: { + passId: 'pass ID', + identifier: { + identifier: 'identifier' + } + }, + relatedSensor: [] + } + ] + } + ], event: [ { eventId: "event ID", From 02daf6aad6e85ea63c454a5d0e8e3e9d0fd29dc9 Mon Sep 17 00:00:00 2001 From: Johnathan Aspinwall Date: Wed, 22 May 2024 12:52:26 -0600 Subject: [PATCH 60/64] Update adiwg-mdjson_schemas gem version to 2.10.0.pre.beta.1 --- Gemfile.lock | 4 ++-- adiwg-mdtranslator.gemspec | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6a19d8dcf..4c196670a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ PATH specs: adiwg-mdtranslator (2.20.0.pre.beta.0) adiwg-mdcodes (= 2.9.3) - adiwg-mdjson_schemas (= 2.9.2) + adiwg-mdjson_schemas (= 2.10.0.pre.beta.1) builder (~> 3.2) coderay (~> 1.1) jbuilder (~> 2.5) @@ -37,7 +37,7 @@ GEM public_suffix (>= 2.0.2, < 6.0) adiwg-mdcodes (2.9.3) json (~> 2.0) - adiwg-mdjson_schemas (2.9.2) + adiwg-mdjson_schemas (2.10.0.pre.beta.1) base64 (0.2.0) bigdecimal (3.1.8) builder (3.2.4) diff --git a/adiwg-mdtranslator.gemspec b/adiwg-mdtranslator.gemspec index 44a28a448..8bc7471fe 100644 --- a/adiwg-mdtranslator.gemspec +++ b/adiwg-mdtranslator.gemspec @@ -34,7 +34,7 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency "thor", "~> 0.19" spec.add_runtime_dependency "uuidtools", "~> 2.1" spec.add_runtime_dependency "json-schema", "~> 2.7" - spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.10.0.pre.beta.0" + spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.10.0.pre.beta.1" spec.add_runtime_dependency "adiwg-mdcodes", "2.9.3" spec.add_runtime_dependency "jbuilder", "~> 2.5" spec.add_runtime_dependency "kramdown", ">= 1.13", "< 3.0" From b141e48299a80ebbf2289f69d24882c87e7a8ced Mon Sep 17 00:00:00 2001 From: Johnathan Aspinwall Date: Wed, 22 May 2024 12:52:36 -0600 Subject: [PATCH 61/64] Fix typo in MdJsonHashWriter class --- test/helpers/mdJson_hash_functions.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/helpers/mdJson_hash_functions.rb b/test/helpers/mdJson_hash_functions.rb index dd16efc5d..b7bb0de2e 100644 --- a/test/helpers/mdJson_hash_functions.rb +++ b/test/helpers/mdJson_hash_functions.rb @@ -77,7 +77,7 @@ def build_dataQuality hDataQuality[:report] = [ { - type: 'AbsoluteExternalPositionalAccuracy', + type: 'DQ_AbsoluteExternalPositionalAccuracy', standaloneQualityReportDetails: "standalone quality report details 1", qualityMeasure: { identifier: { From 63477f298ee60fb3168f7b1492f4421d58eee65c Mon Sep 17 00:00:00 2001 From: J-Oliveros <97468338+J-Oliveros@users.noreply.github.com> Date: Sun, 26 May 2024 10:15:01 -0600 Subject: [PATCH 62/64] Feature/acquisition html writer (#381) * Add acquisiton class to body. Create Acquisition class. * Add operation and plan classes to html writer. * Add objective and requirement classes to html writer. * Add event class to html writer. Fix objective class. * Add pass class to html writer. fix event class typos and requires * Add instrument and platform classes. * Add environment, instrumentationEvent, instrumentationEventList, requestedDate classes. fix platform class. * Add Revision class. fix html_requirement file name. * Fixes to requestedDate, requirement, acquisition, and plan. fix key to retrieve acquisition array. * Bugfixes to html writer for acquisitions section * fix revision datetime in revision class for mdJson reader * HTML formatting to fit standard of rest of page * Add acquisition button to sidebar within body --- .../readers/mdJson/modules/module_revision.rb | 4 +- .../writers/html/sections/html_acquisition.rb | 199 ++++++++++++++++++ .../writers/html/sections/html_body.rb | 19 ++ .../writers/html/sections/html_environment.rb | 58 +++++ .../writers/html/sections/html_event.rb | 121 +++++++++++ .../writers/html/sections/html_instrument.rb | 98 +++++++++ .../sections/html_instrumentationEvent.rb | 84 ++++++++ .../sections/html_instrumentationEventList.rb | 90 ++++++++ .../writers/html/sections/html_objective.rb | 155 ++++++++++++++ .../writers/html/sections/html_operation.rb | 178 ++++++++++++++++ .../writers/html/sections/html_pass.rb | 72 +++++++ .../writers/html/sections/html_plan.rb | 93 ++++++++ .../writers/html/sections/html_platform.rb | 117 ++++++++++ .../html/sections/html_requestedDate.rb | 33 +++ .../writers/html/sections/html_requirement.rb | 139 ++++++++++++ .../writers/html/sections/html_revision.rb | 55 +++++ 16 files changed, 1513 insertions(+), 2 deletions(-) create mode 100644 lib/adiwg/mdtranslator/writers/html/sections/html_acquisition.rb create mode 100644 lib/adiwg/mdtranslator/writers/html/sections/html_environment.rb create mode 100644 lib/adiwg/mdtranslator/writers/html/sections/html_event.rb create mode 100644 lib/adiwg/mdtranslator/writers/html/sections/html_instrument.rb create mode 100644 lib/adiwg/mdtranslator/writers/html/sections/html_instrumentationEvent.rb create mode 100644 lib/adiwg/mdtranslator/writers/html/sections/html_instrumentationEventList.rb create mode 100644 lib/adiwg/mdtranslator/writers/html/sections/html_objective.rb create mode 100644 lib/adiwg/mdtranslator/writers/html/sections/html_operation.rb create mode 100644 lib/adiwg/mdtranslator/writers/html/sections/html_pass.rb create mode 100644 lib/adiwg/mdtranslator/writers/html/sections/html_plan.rb create mode 100644 lib/adiwg/mdtranslator/writers/html/sections/html_platform.rb create mode 100644 lib/adiwg/mdtranslator/writers/html/sections/html_requestedDate.rb create mode 100644 lib/adiwg/mdtranslator/writers/html/sections/html_requirement.rb create mode 100644 lib/adiwg/mdtranslator/writers/html/sections/html_revision.rb diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_revision.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_revision.rb index 8d3338f8a..c747d7af3 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_revision.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_revision.rb @@ -29,8 +29,8 @@ def self.unpack(hRevision, responseObj, inContext = nil) end if hRevision.has_key?('dateInfo') - intRevision[:dateInfo].each do |item| - hReturn = DateTime.unpack(item, responseObj, outContex) + hRevision['dateInfo'].each do |item| + hReturn = DateTime.unpack(item, responseObj, outContext) unless hReturn.nil? intRevision[:dateInfo] << hReturn end diff --git a/lib/adiwg/mdtranslator/writers/html/sections/html_acquisition.rb b/lib/adiwg/mdtranslator/writers/html/sections/html_acquisition.rb new file mode 100644 index 000000000..0f776e51e --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/html/sections/html_acquisition.rb @@ -0,0 +1,199 @@ +require_relative 'html_scope' +require_relative 'html_plan' +require_relative 'html_requirement' +require_relative 'html_objective' +require_relative 'html_platform' +require_relative 'html_instrument' +require_relative 'html_operation' +require_relative 'html_event' +require_relative 'html_pass' +require_relative 'html_environment' + +module ADIWG + module Mdtranslator + module Writers + module Html + class Html_Acquisition + def initialize(html) + @html = html + end + + def writeHtml(hAcquisition) + scopeClass = Html_Scope.new(@html) + planClass = Html_Plan.new(@html) + requirementClass = Html_Requirement.new(@html) + objectiveClass = Html_Objective.new(@html) + platformClass = Html_Platform.new(@html) + instrumentClass = Html_Instrument.new(@html) + operationClass = Html_Operation.new(@html) + eventClass = Html_Event.new(@html) + passClass = Html_Pass.new(@html) + environmentClass = Html_Environment.new(@html) + + # scope + unless hAcquisition[:scope].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Scope', {'class' => 'h4'}) + @html.section(:class => 'block') do + scopeClass.writeHtml(hAcquisition[:scope]) + end + end + end + end + + # plan + unless hAcquisition[:plans].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Plans', {'class' => 'h4'}) + hAcquisition[:plans].each do |plan| + @html.section(:class => 'block') do + @html.details do + @html.summary('Plan', {'class' => 'h5'}) + planClass.writeHtml(plan) + end + end + end + end + end + end + + # requirement + unless hAcquisition[:requirements].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Requirements', {'class' => 'h4'}) + hAcquisition[:requirements].each do |requirement| + @html.section(:class => 'block') do + @html.details do + @html.summary('Requirement', {'class' => 'h5'}) + requirementClass.writeHtml(requirement) + end + end + end + end + end + end + + # objective + unless hAcquisition[:objectives].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Objectives', {'class' => 'h4'}) + hAcquisition[:objectives].each do |objective| + @html.section(:class => 'block') do + @html.details do + @html.summary('Objective', {'class' => 'h5'}) + objectiveClass.writeHtml(objective) + end + end + end + end + end + end + + + # platform + unless hAcquisition[:platforms].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Platforms', {'class' => 'h4'}) + hAcquisition[:platforms].each do |platform| + @html.section(:class => 'block') do + @html.details do + @html.summary('Platform', {'class' => 'h5'}) + platformClass.writeHtml(platform) + end + end + end + end + end + end + + # Instrument + unless hAcquisition[:instruments].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Instruments', {'class' => 'h4'}) + hAcquisition[:instruments].each do |instrument| + @html.section(:class => 'block') do + @html.details do + @html.summary('Instrument', {'class' => 'h5'}) + instrumentClass.writeHtml(instrument) + end + end + end + end + end + end + + # operation + unless hAcquisition[:operations].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Operations', {'class' => 'h4'}) + hAcquisition[:operations].each do |operation| + @html.section(:class => 'block') do + @html.details do + @html.summary('Operation', {'class' => 'h5'}) + operationClass.writeHtml(operation) + end + end + end + end + end + end + + # Event + unless hAcquisition[:events].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Events', {'class' => 'h4'}) + hAcquisition[:events].each do |event| + @html.section(:class => 'block') do + @html.details do + @html.summary('Event', {'class' => 'h5'}) + eventClass.writeHtml(event) + end + end + end + end + end + end + + # Pass + unless hAcquisition[:passes].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Passes', {'class' => 'h4'}) + hAcquisition[:passes].each do |pass| + @html.section(:class => 'block') do + @html.details do + @html.summary('Pass', {'class' => 'h5'}) + passClass.writeHtml(pass) + end + end + end + end + end + end + + # Environment + unless hAcquisition[:environment].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Environment', {'class' => 'h4'}) + @html.section(:class => 'block') do + environmentClass.writeHtml(hAcquisition[:environment]) + end + end + end + end + + end + end + end + end + end +end diff --git a/lib/adiwg/mdtranslator/writers/html/sections/html_body.rb b/lib/adiwg/mdtranslator/writers/html/sections/html_body.rb index e7bff9ca7..47e8459f6 100644 --- a/lib/adiwg/mdtranslator/writers/html/sections/html_body.rb +++ b/lib/adiwg/mdtranslator/writers/html/sections/html_body.rb @@ -20,6 +20,7 @@ require_relative 'html_funding' require_relative 'html_dataDictionary' require_relative 'html_metadataRepository' +require_relative 'html_acquisition' module ADIWG module Mdtranslator @@ -47,6 +48,7 @@ def writeHtml(version, intObj) fundingClass = Html_Funding.new(@html) dictionaryClass = Html_DataDictionary.new(@html) repositoryClass = Html_Repository.new(@html) + acquisitionClass = Html_Acquisition.new(@html) # make sections of the internal data store convenient hSchema = intObj[:schema] @@ -61,6 +63,7 @@ def writeHtml(version, intObj) aFunding = intObj[:metadata][:funding] aDictionaries = intObj[:dataDictionaries] aRepositories = intObj[:metadataRepositories] + aAcquisitions = intObj[:metadata][:acquisitions] # set page title and logo # side navigation @@ -72,6 +75,7 @@ def writeHtml(version, intObj) @html.a(' Metadata', {'href' => '#body-metadataInfo', 'class' => 'btn navBtn', 'id' => 'metadataButton'}) @html.a(' Resource', {'href' => '#body-resourceInfo', 'class' => 'btn navBtn', 'id' => 'resourceButton'}) @html.a(' Quality', {'href' => '#body-dataQuality', 'class' => 'btn navBtn', 'id' => 'qualityButton'}) + @html.a(' Acquistion', {'href' => '#body-acquisition', 'class' => 'btn navBtn', 'id' => 'acquisitionButton'}) @html.a(' Lineage', {'href' => '#body-lineage', 'class' => 'btn navBtn', 'id' => 'lineageButton'}) @html.a(' Distribution', {'href' => '#body-distribution', 'class' => 'btn navBtn', 'id' => 'distributionButton'}) @html.a(' Associated', {'href' => '#body-associatedResource', 'class' => 'btn navBtn', 'id' => 'associatedButton'}) @@ -215,6 +219,21 @@ def writeHtml(version, intObj) end end + # acquisition section + unless aAcquisitions.empty? + @html.details do + @html.summary('Acquisition', {'id' => 'body-acquisition', 'class' => 'h2'}) + aAcquisitions.each do |hAcquisition| + @html.section(:class => 'block') do + @html.details do + @html.summary('Acquisition', {'class' => 'h3'}) + acquisitionClass.writeHtml(hAcquisition) + end + end + end + end + end + # associated resource section unless aAssociated.empty? @html.details do diff --git a/lib/adiwg/mdtranslator/writers/html/sections/html_environment.rb b/lib/adiwg/mdtranslator/writers/html/sections/html_environment.rb new file mode 100644 index 000000000..242947158 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/html/sections/html_environment.rb @@ -0,0 +1,58 @@ +module ADIWG + module Mdtranslator + module Writers + module Html + class Html_Environment + def initialize(html) + @html = html + end + + def writeHtml(hEnvironment) + # averageAirTemperature + unless hEnvironment[:averageAirTemperature].nil? + @html.em('Average Air Temperature: ') + @html.text!(hEnvironment[:averageAirTemperature].to_s) + @html.br + end + + # maxRelativeHumidity + unless hEnvironment[:maxRelativeHumidity].nil? + @html.em('Maximum Relative Humidity: ') + @html.text!(hEnvironment[:maxRelativeHumidity].to_s) + @html.br + end + + # maxAltitude + unless hEnvironment[:maxAltitude].nil? + @html.em('Maximum Altitude: ') + @html.text!(hEnvironment[:maxAltitude].to_s) + @html.br + end + + # meteorologicalConditions + unless hEnvironment[:meteorologicalConditions].nil? + @html.em('Meteorological Conditions: ') + @html.text!(hEnvironment[:meteorologicalConditions]) + @html.br + end + + # solarAzimuth + unless hEnvironment[:solarAzimuth].nil? + @html.em('Solar Azimuth: ') + @html.text!(hEnvironment[:solarAzimuth].to_s) + @html.br + end + + # solarElevation + unless hEnvironment[:solarElevation].nil? + @html.em('Solar Elevation: ') + @html.text!(hEnvironment[:solarElevation].to_s) + @html.br + end + + end + end + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/writers/html/sections/html_event.rb b/lib/adiwg/mdtranslator/writers/html/sections/html_event.rb new file mode 100644 index 000000000..023dbc9fd --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/html/sections/html_event.rb @@ -0,0 +1,121 @@ +require_relative 'html_pass' +require_relative 'html_instrument' +require_relative 'html_extent' +require_relative 'html_identifier' + +module ADIWG + module Mdtranslator + module Writers + module Html + class Html_Event + def initialize(html) + @html = html + end + + def writeHtml(hEvent) + passClass = Html_Pass.new(@html) + instrumentClass = Html_Instrument.new(@html) + extentClass = Html_Extent.new(@html) + identifierClass = Html_Identifier.new(@html) + + # eventId + unless hEvent[:eventId].nil? + @html.em('Event ID: ') + @html.text!(hEvent[:eventId]) + @html.br + end + + # identifier + unless hEvent[:identifier].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Identifier', {'class' => 'h4'}) + @html.section(:class => 'block') do + identifierClass.writeHtml(hEvent[:identifier]) + end + end + end + end + + # trigger + unless hEvent[:trigger].nil? + @html.em('Trigger: ') + @html.text!(hEvent[:trigger]) + @html.br + end + + # context + unless hEvent[:context].nil? + @html.em('Context: ') + @html.text!(hEvent[:context]) + @html.br + end + + # sequence + unless hEvent[:sequence].nil? + @html.em('Sequence: ') + @html.text!(hEvent[:sequence]) + @html.br + end + + # time + unless hEvent[:dateTime].nil? || hEvent[:dateTime].empty? + @html.em('Datetime: ') + @html.section(:class => 'block') do + @html.text!.writeHtml(hEvent[:dateTime][:dateTime].to_s) + end + end + + # expectedObjective + unless hEvent[:expectedObjectives].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Expected Objective', {'class' => 'h4'}) + hEvent[:expectedObjectives].each do |objective| + @html.section(:class => 'block') do + @html.details do + @html.summary('Objective', {'class' => 'h5'}) + objectiveClass.writeHtml(objective) + end + end + end + end + end + end + + # relatedPass + unless hEvent[:relatedPass].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Related Pass', {'class' => 'h4'}) + @html.section(:class => 'block') do + passClass.writeHtml(hEvent[:relatedPass]) + end + end + end + end + + #relatedSensor + unless hEvent[:relatedSensors].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Related Sensors', {'class' => 'h4'}) + hEvent[:relatedSensors].each do |instrument| + @html.section(:class => 'block') do + @html.details do + @html.summary('Instrument', {'class' => 'h5'}) + instrumentClass.writeHtml(instrument) + end + end + end + end + end + end + + end # writeHtml + end # Html_Event + + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/writers/html/sections/html_instrument.rb b/lib/adiwg/mdtranslator/writers/html/sections/html_instrument.rb new file mode 100644 index 000000000..f48d36198 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/html/sections/html_instrument.rb @@ -0,0 +1,98 @@ +require_relative 'html_identifier' +require_relative 'html_platform' +require_relative 'html_instrumentationEventList' + +module ADIWG + module Mdtranslator + module Writers + module Html + class Html_Instrument + def initialize(html) + @html = html + end + + def writeHtml(hInstrument) + identifierClass = Html_Identifier.new(@html) + platformClass = Html_Platform.new(@html) + instrumentationEventListClass = Html_InstrumentationEventList.new(@html) + + # instrumentId + unless hInstrument[:instrumentId].nil? + @html.em('Instrument ID: ') + @html.text!(hInstrument[:instrumentId]) + @html.br + end + + # identifier + unless hInstrument[:identifier].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Identifier', {'class' => 'h4'}) + @html.section(:class => 'block') do + identifierClass.writeHtml(hInstrument[:identifier]) + end + end + end + end + + # instrumentType + unless hInstrument[:instrumentType].nil? + @html.em('Instrument Type: ') + @html.text!(hInstrument[:instrumentType]) + @html.br + end + + # description + unless hInstrument[:description].nil? + @html.em('Description: ') + @html.text!(hInstrument[:description]) + @html.br + end + + # mountedOn + unless hInstrument[:mountedOn].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Mounted On', {'class' => 'h4'}) + @html.section(:class => 'block') do + platformClass.writeHtml(hInstrument[:mountedOn]) + end + end + end + end + + # history + unless hInstrument[:histories].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Histories', {'class' => 'h4'}) + hInstrument[:histories].each do |instrumentationEventList| + @html.section(:class => 'block') do + @html.details do + @html.summary('Instrumentation Event List', {'class' => 'h5'}) + instrumentationEventListClass.writeHtml(instrumentationEventList) + end + end + end + end + end + end + + # hostId + unless hInstrument[:hostId].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Host ID', {'class' => 'h4'}) + @html.section(:class => 'block') do + identifierClass.writeHtml(hInstrument[:hostId]) + end + end + end + end + + end # writeHtml + end # Html_Instrument + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/writers/html/sections/html_instrumentationEvent.rb b/lib/adiwg/mdtranslator/writers/html/sections/html_instrumentationEvent.rb new file mode 100644 index 000000000..00fd80e19 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/html/sections/html_instrumentationEvent.rb @@ -0,0 +1,84 @@ +require_relative 'html_citation' +require_relative 'html_extent' +require_relative 'html_revision' + +module ADIWG + module Mdtranslator + module Writers + module Html + class Html_InstrumentationEvent + def initialize(html) + @html = html + end + + def writeHtml(hInstrumentationEvent) + citationClass = Html_Citation.new(@html) + extentClass = Html_Extent.new(@html) + revisionClass = Html_Revision.new(@html) + + # citation + unless hInstrumentationEvent[:citations].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Citations', {'class' => 'h4'}) + hInstrumentationEvent[:citations].each do |citation| + @html.section(:class => 'block') do + @html.details do + @html.summary('Citation', {'class' => 'h5'}) + citationClass.writeHtml(citation) + end + end + end + end + end + end + + # description + unless hInstrumentationEvent[:description].nil? + @html.em('Description: ') + @html.text!(hInstrumentationEvent[:description]) + @html.br + end + + # extent + unless hInstrumentationEvent[:extent].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Extent', {'class' => 'h4'}) + @html.section(:class => 'block') do + extentClass.writeHtml(hInstrumentationEvent[:extent]) + end + end + end + end + + # eventType + unless hInstrumentationEvent[:eventType].nil? + @html.em('Event Type: ') + @html.text!(hInstrumentationEvent[:eventType]) + @html.br + end + + # revisionHistory + unless hInstrumentationEvent[:revisionHistories].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Revision History', {'class' => 'h4'}) + hInstrumentationEvent[:revisionHistories].each do |revision| + @html.section(:class => 'block') do + @html.details do + @html.summary('Revision', {'class' => 'h5'}) + revisionClass.writeHtml(revision) + end + end + end + end + end + end + + end + end + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/writers/html/sections/html_instrumentationEventList.rb b/lib/adiwg/mdtranslator/writers/html/sections/html_instrumentationEventList.rb new file mode 100644 index 000000000..1e6dbd64f --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/html/sections/html_instrumentationEventList.rb @@ -0,0 +1,90 @@ +require_relative 'html_citation' +require_relative 'html_locale' +require_relative 'html_constraint' +require_relative 'html_instrumentationEvent' + +module ADIWG + module Mdtranslator + module Writers + module Html + class Html_InstrumentationEventList + def initialize(html) + @html = html + end + + def writeHtml(hInstrumentationEventList) + citationClass = Html_Citation.new(@html) + localeClass = Html_Locale.new(@html) + constraintClass = Html_Constraint.new(@html) + instrumentationEventClass = Html_InstrumentationEvent.new(@html) + + # citation + unless hInstrumentationEventList[:citation].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Citation', {'class' => 'h4'}) + @html.section(:class => 'block') do + citationClass.writeHtml(hInstrumentationEventList[:citation]) + end + end + end + end + + # desctiption + unless hInstrumentationEventList[:description].nil? + @html.em('Description: ') + @html.text!(hInstrumentationEventList[:description]) + @html.br + end + + # locale + unless hInstrumentationEventList[:locale].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Locale', {'class' => 'h4'}) + @html.section(:class => 'block') do + localeClass.writeHtml(hInstrumentationEventList[:locale]) + end + end + end + end + + # constraints + unless hInstrumentationEventList[:constraints].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Constraints', {'class' => 'h4'}) + hInstrumentationEventList[:constraints].each do |constraint| + @html.section(:class => 'block') do + @html.details do + @html.summary('Constraint', {'class' => 'h5'}) + constraintClass.writeHtml(constraint) + end + end + end + end + end + end + + # instrumentationEvent + unless hInstrumentationEventList[:instrumentationEvents].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Instrumentation Events', {'class' => 'h4'}) + hInstrumentationEventList[:instrumentationEvents].each do |instrumentationEvent| + @html.section(:class => 'block') do + @html.details do + @html.summary('Instrumentation Event', {'class' => 'h5'}) + instrumentationEventClass.writeHtml(instrumentationEvent) + end + end + end + end + end + end + end + end + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/writers/html/sections/html_objective.rb b/lib/adiwg/mdtranslator/writers/html/sections/html_objective.rb new file mode 100644 index 000000000..1c00044d2 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/html/sections/html_objective.rb @@ -0,0 +1,155 @@ +require_relative 'html_identifier' +require_relative 'html_extent' +require_relative 'html_event' +require_relative 'html_pass' +require_relative 'html_instrument' + +module ADIWG + module Mdtranslator + module Writers + module Html + class Html_Objective + def initialize(html) + @html = html + end + + def writeHtml(hObjective) + identifierClass = Html_Identifier.new(@html) + extentClass = Html_Extent.new(@html) + eventClass = Html_Event.new(@html) + passClass = Html_Pass.new(@html) + instrumentClass = Html_Instrument.new(@html) + + # objectiveId + unless hObjective[:objectiveId].nil? + @html.em('Objective ID: ') + @html.text!(hObjective[:objectiveId]) + @html.br + end + + # identifier + unless hObjective[:identifiers].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Identifiers', {'class' => 'h4'}) + hObjective[:identifiers].each do |identifier| + @html.section(:class => 'block') do + @html.details do + @html.summary('Identifier', {'class' => 'h5'}) + identifierClass.writeHtml(identifier) + end + end + end + end + end + end + + # priority + unless hObjective[:priority].nil? + @html.em('Priority: ') + @html.text!(hObjective[:priority]) + @html.br + end + + # objectiveType + unless hObjective[:objectiveTypes].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Objective Types', {'class' => 'h4'}) + hObjective[:objectiveTypes].each do |type| + @html.em('Type: ') + @html.text!(type) + @html.br + end + end + end + end + + # function + unless hObjective[:functions].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Functions', {'class' => 'h4'}) + hObjective[:functions].each do |function| + @html.em('Function: ') + @html.text!(function) + @html.br + end + end + end + end + + # extent + unless hObjective[:extents].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Extents', {'class' => 'h4'}) + hObjective[:extents].each do |extent| + @html.section(:class => 'block') do + @html.details do + @html.summary('Extent', {'class' => 'h5'}) + extentClass.writeHtml(extent) + end + end + end + end + end + end + + # Occurrence + unless hObjective[:occurrences].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Occurrences', {'class' => 'h4'}) + hObjective[:occurrences].each do |occurrence| + @html.section(:class => 'block') do + @html.details do + @html.summary('Occurrence', {'class' => 'h5'}) + eventClass.writeHtml(occurrence) + end + end + end + end + end + end + + # pass + unless hObjective[:passes].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Passes', {'class' => 'h4'}) + hObjective[:passes].each do |pass| + @html.section(:class => 'block') do + @html.details do + @html.summary('Pass', {'class' => 'h5'}) + passClass.writeHtml(pass) + end + end + end + end + end + end + + # sensingInstrument + unless hObjective[:sensingInstruments].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Sensing Instruments', {'class' => 'h4'}) + hObjective[:sensingInstruments].each do |instrument| + @html.section(:class => 'block') do + @html.details do + @html.summary('Instrument', {'class' => 'h5'}) + instrumentClass.writeHtml(instrument) + end + end + end + end + end + end + end # writeHtml + + end # Html_Requirement + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/writers/html/sections/html_operation.rb b/lib/adiwg/mdtranslator/writers/html/sections/html_operation.rb new file mode 100644 index 000000000..4030e54f5 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/html/sections/html_operation.rb @@ -0,0 +1,178 @@ +require_relative 'html_citation' +require_relative 'html_identifier' +require_relative 'html_objective' +require_relative 'html_operation' +require_relative 'html_plan' +require_relative 'html_platform' +require_relative 'html_event' + +module ADIWG + module Mdtranslator + module Writers + module Html + class Html_Operation + def initialize(html) + @html = html + end + + def writeHtml(hOperation) + citationClass = Html_Citation.new(@html) + identifierClass = Html_Identifier.new(@html) + objectiveClass = Html_Objective.new(@html) + operationClass = Html_Operation.new(@html) + planClass = Html_Plan.new(@html) + platformClass = Html_Platform.new(@html) + eventClass = Html_Event.new(@html) + + + # operationId + unless hOperation[:operationId].nil? + @html.em('Operation ID: ') + @html.text!(hOperation[:operationId]) + @html.br + end + + # description + unless hOperation[:description].nil? + @html.em('Description: ') + @html.text!(hOperation[:description]) + @html.br + end + + # citation + unless hOperation[:citation].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Citation', {'class' => 'h4'}) + @html.section(:class => 'block') do + citationClass.writeHtml(hOperation[:citation]) + end + end + end + end + + # identifier + unless hOperation[:identifier].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Identifier', {'class' => 'h4'}) + @html.section(:class => 'block') do + identifierClass.writeHtml(hOperation[:identifier]) + end + end + end + end + + # status + unless hOperation[:status].nil? + @html.em('Status: ') + @html.text!(hOperation[:status]) + @html.br + end + + # operationType + unless hOperation[:operationType].nil? + @html.em('Operation Type: ') + @html.text!(hOperation[:operationType]) + @html.br + end + + # objective + unless hOperation[:objectives].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Objectives', {'class' => 'h4'}) + hOperation[:objectives].each do |objective| + @html.section(:class => 'block') do + @html.details do + @html.summary('Objective', {'class' => 'h5'}) + objectiveClass.writeHtml(objective) + end + end + end + end + end + end + + # parentOperation + unless hOperation[:parentOperation].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Parent Operation', {'class' => 'h4'}) + @html.section(:class => 'block') do + operationClass.writeHtml(hOperation[:parentOperation]) + end + end + end + end + + # childOperation + unless hOperation[:childOperations].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Child Operations', {'class' => 'h4'}) + hOperation[:childOperations].each do |operation| + @html.section(:class => 'block') do + @html.details do + @html.summary('Operation', {'class' => 'h5'}) + operationClass.writeHtml(operation) + end + end + end + end + end + end + + # plan + unless hOperation[:plan].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Plan', {'class' => 'h4'}) + @html.section(:class => 'block') do + planClass.writeHtml(hOperation[:plan]) + end + end + end + end + + # platform + unless hOperation[:platforms].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Platforms', {'class' => 'h4'}) + hOperation[:platforms].each do |platform| + @html.section(:class => 'block') do + @html.details do + @html.summary('Platform', {'class' => 'h5'}) + platformClass.writeHtml(platform) + end + end + end + end + end + end + + # significantEvent + unless hOperation[:significantEvents].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Significant Events', {'class' => 'h4'}) + hOperation[:significantEvents].each do |event| + @html.section(:class => 'block') do + @html.details do + @html.summary('Event', {'class' => 'h5'}) + eventClass.writeHtml(event) + end + end + end + end + end + end + + end # writeHtml + + end # Html_Operation + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/writers/html/sections/html_pass.rb b/lib/adiwg/mdtranslator/writers/html/sections/html_pass.rb new file mode 100644 index 000000000..32a3a09c1 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/html/sections/html_pass.rb @@ -0,0 +1,72 @@ +require_relative 'html_identifier' +require_relative 'html_extent' +require_relative 'html_event' + +module ADIWG + module Mdtranslator + module Writers + module Html + class Html_Pass + def initialize(html) + @html = html + end + + def writeHtml(hPass) + identifierClass = Html_Identifier.new(@html) + extentClass = Html_Extent.new(@html) + eventClass = Html_Event.new(@html) + + # passId + unless hPass[:passId].nil? + @html.em('Pass ID: ') + @html.text!(hPass[:passId]) + @html.br + end + + # identifier + unless hPass[:identifier].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Identifier', {'class' => 'h4'}) + @html.section(:class => 'block') do + identifierClass.writeHtml(hPass[:identifier]) + end + end + end + end + + # extent + unless hPass[:extent].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Extent', {'class' => 'h4'}) + @html.section(:class => 'block') do + extentClass.writeHtml(hPass[:extent]) + end + end + end + end + + # relatedEvent + unless hPass[:relatedEvents].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Related Events', {'class' => 'h4'}) + hPass[:relatedEvents].each do |event| + @html.section(:class => 'block') do + @html.details do + @html.summary('Event', {'class' => 'h5'}) + eventClass.writeHtml(event) + end + end + end + end + end + end + + end # writeHtml + end # Html_Pass + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/writers/html/sections/html_plan.rb b/lib/adiwg/mdtranslator/writers/html/sections/html_plan.rb new file mode 100644 index 000000000..c3e7162b4 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/html/sections/html_plan.rb @@ -0,0 +1,93 @@ +require_relative 'html_citation' +require_relative 'html_operation' +require_relative 'html_requirement' + +module ADIWG + module Mdtranslator + module Writers + module Html + class Html_Plan + def initialize(html) + @html = html + end + + def writeHtml(hPlan) + citationClass = Html_Citation.new(@html) + operationClass = Html_Operation.new(@html) + requirementClass = Html_Requirement.new(@html) + planClass = Html_Plan.new(@html) + + # planId + unless hPlan[:planId].empty? + @html.em('Plan ID: ') + @html.text!(hPlan[:planId]) + @html.br + end + + # planType + unless hPlan[:planType].empty? + @html.em('Type: ') + @html.text!(hPlan[:planType]) + @html.br + end + + # status + unless hPlan[:status].empty? + @html.em('Status: ') + @html.text!(hPlan[:status]) + @html.br + end + + # citation + unless hPlan[:citation].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Citation', {'class' => 'h4'}) + @html.section(:class => 'block') do + citationClass.writeHtml(hPlan[:citation]) + end + end + end + end + + # planOperation + unless hPlan[:planOperations].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Operations', {'class' => 'h4'}) + hPlan[:planOperations].each do |operation| + @html.section(:class => 'block') do + @html.details do + @html.summary('Operation', {'class' => 'h5'}) + operationClass.writeHtml(operation) + end + end + end + end + end + end + + # satisfiedRequirement + unless hPlan[:satisfiedRequirements].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Requirements', {'class' => 'h4'}) + hPlan[:satisfiedRequirements].each do |requirement| + @html.section(:class => 'block') do + @html.details do + @html.summary('Requirement', {'class' => 'h5'}) + requirementClass.writeHtml(requirement) + end + end + end + end + end + end + + end # writeHtml + + end # Html_Plan + end + end + end +end diff --git a/lib/adiwg/mdtranslator/writers/html/sections/html_platform.rb b/lib/adiwg/mdtranslator/writers/html/sections/html_platform.rb new file mode 100644 index 000000000..8deea0934 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/html/sections/html_platform.rb @@ -0,0 +1,117 @@ +require_relative 'html_identifier' +require_relative 'html_citation' +require_relative 'html_responsibility' +require_relative 'html_instrument' +require_relative 'html_instrumentationEventList' + +module ADIWG + module Mdtranslator + module Writers + module Html + class Html_Platform + def initialize(html) + @html = html + end + + def writeHtml(hPlatform) + identifierClass = Html_Identifier.new(@html) + citationClass = Html_Citation.new(@html) + responsibilityClass = Html_Responsibility.new(@html) + instrumentClass = Html_Instrument.new(@html) + instrumentationEventListClass = Html_InstrumentationEventList.new(@html) + + # platformId + unless hPlatform[:platformId].nil? + @html.em('Platform ID: ') + @html.text!(hPlatform[:platformId]) + @html.br + end + + # citation + unless hPlatform[:citation].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Citation', {'class' => 'h4'}) + @html.section(:class => 'block') do + citationClass.writeHtml(hPlatform[:citation]) + end + end + end + end + + # identifier + unless hPlatform[:identifier].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Identifier', {'class' => 'h4'}) + @html.section(:class => 'block') do + identifierClass.writeHtml(hPlatform[:identifier]) + end + end + end + end + + # description + unless hPlatform[:description].nil? + @html.em('Description: ') + @html.text!(hPlatform[:description]) + @html.br + end + + # sponsor + unless hPlatform[:sponsors].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Sponsors', {'class' => 'h4'}) + hPlatform[:sponsors].each do |responsibility| + @html.section(:class => 'block') do + @html.details do + @html.summary('Responsibility', {'class' => 'h5'}) + responsibilityClass.writeHtml(responsibility) + end + end + end + end + end + end + + # instrument + unless hPlatform[:instruments].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Instruments', {'class' => 'h4'}) + hPlatform[:instruments].each do |instrument| + @html.section(:class => 'block') do + @html.details do + @html.summary('Instrument', {'class' => 'h5'}) + instrumentClass.writeHtml(instrument) + end + end + end + end + end + end + + # history + unless hPlatform[:history].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('History', {'class' => 'h4'}) + hPlatform[:history].each do |instrumentationEventList| + @html.section(:class => 'block') do + @html.details do + @html.summary('Instrumentation Event List', {'class' => 'h5'}) + instrumentationEventListClass.writeHtml(instrumentationEventList) + end + end + end + end + end + end + + end + end + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/writers/html/sections/html_requestedDate.rb b/lib/adiwg/mdtranslator/writers/html/sections/html_requestedDate.rb new file mode 100644 index 000000000..c498931f9 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/html/sections/html_requestedDate.rb @@ -0,0 +1,33 @@ +require_relative 'html_datetime' + +module ADIWG + module Mdtranslator + module Writers + module Html + class Html_RequestedDate + def initialize(html) + @html = html + end + + def writeHtml(hRequestedDate) + datetimeClass = Html_Datetime.new(@html) + + # requestedDateOfCollection + unless hRequestedDate[:requestedDateOfCollection].empty? + @html.em('Requested Date of Collection: ') + @html.text!(hRequestedDate[:requestedDateOfCollection][:dateTime].to_s) + @html.br + end + + # latestAcceptableDate + unless hRequestedDate[:latestAcceptableDate].empty? + @html.em('Latest Acceptable Date: ') + @html.text!(hRequestedDate[:latestAcceptableDate][:dateTime].to_s) + end + + end + end + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/writers/html/sections/html_requirement.rb b/lib/adiwg/mdtranslator/writers/html/sections/html_requirement.rb new file mode 100644 index 000000000..6a961f13f --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/html/sections/html_requirement.rb @@ -0,0 +1,139 @@ +require_relative 'html_citation' +require_relative 'html_identifier' +require_relative 'html_responsibility' +require_relative 'html_requestedDate' +require_relative 'html_date' +require_relative 'html_plan' + +module ADIWG + module Mdtranslator + module Writers + module Html + class Html_Requirement + def initialize(html) + @html = html + end + + def writeHtml(hRequirement) + citationClass = Html_Citation.new(@html) + identifierClass = Html_Identifier.new(@html) + responsibilityClass = Html_Responsibility.new(@html) + requestedDateClass = Html_RequestedDate.new(@html) + dateClass = Html_Date.new(@html) + planClass = Html_Plan.new(@html) + + # requirementId + unless hRequirement[:requirementId].nil? + @html.em('Requirement ID: ') + @html.text!(hRequirement[:requirementId]) + @html.br + end + + # citation + unless hRequirement[:citation].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Citation', {'class' => 'h4'}) + @html.section(:class => 'block') do + citationClass.writeHtml(hRequirement[:citation]) + end + end + end + end + + # identifier + unless hRequirement[:identifier].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Identifier ', {'class' => 'h4'}) + @html.section(:class => 'block') do + identifierClass.writeHtml(hRequirement[:identifier]) + end + end + end + end + + # requestor + unless hRequirement[:requestors].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Requestors', {'class' => 'h4'}) + hRequirement[:requestors].each do |requestor| + @html.section(:class => 'block') do + @html.details do + @html.summary('Requestor', {'class' => 'h5'}) + operationClass.writeHtml(requestor) + end + end + end + end + end + end + + # recipient + unless hRequirement[:recipients].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Recipients', {'class' => 'h4'}) + hRequirement[:recipients].each do |recipient| + @html.section(:class => 'block') do + @html.details do + @html.summary('Recipient', {'class' => 'h5'}) + operationClass.writeHtml(recipient) + end + end + end + end + end + end + + # priority + unless hRequirement[:priority].nil? + @html.em('Priority: ') + @html.text!(hRequirement[:priority]) + @html.br + end + + # requested date + unless hRequirement[:requestedDate].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Requested Date ', {'class' => 'h4'}) + @html.section(:class => 'block') do + requestedDateClass.writeHtml(hRequirement[:requestedDate]) + end + end + end + end + + # expiry date + unless hRequirement[:expiryDate].nil? + @html.em('Expiry Date: ') + @html.text!(hRequirement[:expiryDate]) + @html.br + end + + # satisfied plan + unless hRequirement[:satisfiedPlans].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Satisfied Plans', {'class' => 'h4'}) + hRequirement[:satisfiedPlans].each do |plan| + @html.section(:class => 'block') do + @html.details do + @html.summary('Plan', {'class' => 'h5'}) + planClass.writeHtml(plan) + end + end + end + end + end + end + + end # writeHtml + end # Html_Requirement + + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/writers/html/sections/html_revision.rb b/lib/adiwg/mdtranslator/writers/html/sections/html_revision.rb new file mode 100644 index 000000000..9dc4f6376 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/html/sections/html_revision.rb @@ -0,0 +1,55 @@ +require_relative 'html_responsibility' +require_relative 'html_date' + +module ADIWG + module Mdtranslator + module Writers + module Html + class Html_Revision + def initialize(html) + @html = html + end + + def writeHtml(hRevision) + responsibilityClass = Html_Responsibility.new(@html) + dateClass = Html_Date.new(@html) + + # description + unless hRevision[:description].nil? + @html.em('Description: ') + @html.text!(hRevision[:description]) + @html.br + end + + # responsibleParty + unless hRevision[:responsibleParty].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Responsible Party', {'class' => 'h4'}) + @html.section(:class => 'block') do + responsibilityClass.writeHtml(hRevision[:responsibleParty]) + end + end + end + end + + # dateInfo + unless hRevision[:dateInfo].empty? + @html.section(:class => 'block') do + @html.details do + @html.summary('Date Info', {'class' => 'h4'}) + hRevision[:dateInfo].each do |date| + @html.em('Datetime: ') + @html.text!(date[:dateTime].to_s) + @html.br + end + end + end + end + + end + end + end + end + end +end \ No newline at end of file From 0ec1e1f9ca359ead624748ab5c4336058677666f Mon Sep 17 00:00:00 2001 From: Johnathan Aspinwall Date: Sun, 26 May 2024 10:17:15 -0600 Subject: [PATCH 63/64] chore: Update adiwg-mdtranslator gem dependency to version 2.9.4.pre.beta.4 --- Gemfile.lock | 14 ++++++++------ adiwg-mdtranslator.gemspec | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index be9c8c299..aeb46f230 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,7 +2,7 @@ PATH remote: . specs: adiwg-mdtranslator (2.20.0.pre.beta.0) - adiwg-mdcodes (= 2.9.3) + adiwg-mdcodes (= 2.9.4.pre.beta.4) adiwg-mdjson_schemas (= 2.10.0.pre.beta.1) builder (~> 3.2) coderay (~> 1.1) @@ -17,13 +17,13 @@ PATH GEM remote: https://rubygems.org/ specs: - actionview (7.1.3.2) - activesupport (= 7.1.3.2) + actionview (7.1.3.3) + activesupport (= 7.1.3.3) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activesupport (7.1.3.2) + activesupport (7.1.3.3) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -67,7 +67,7 @@ GEM nokogiri (1.15.6-x86_64-linux) racc (~> 1.4) public_suffix (5.0.5) - racc (1.7.3) + racc (1.8.0) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -76,7 +76,9 @@ GEM loofah (~> 2.21) nokogiri (~> 1.14) rake (13.1.0) - rexml (3.2.6) + rexml (3.2.8) + strscan (>= 3.0.9) + strscan (3.1.0) thor (0.20.3) tzinfo (2.0.6) concurrent-ruby (~> 1.0) diff --git a/adiwg-mdtranslator.gemspec b/adiwg-mdtranslator.gemspec index 8bc7471fe..f3c429d1d 100644 --- a/adiwg-mdtranslator.gemspec +++ b/adiwg-mdtranslator.gemspec @@ -35,7 +35,7 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency "uuidtools", "~> 2.1" spec.add_runtime_dependency "json-schema", "~> 2.7" spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.10.0.pre.beta.1" - spec.add_runtime_dependency "adiwg-mdcodes", "2.9.3" + spec.add_runtime_dependency "adiwg-mdcodes", "2.9.4.pre.beta.4" spec.add_runtime_dependency "jbuilder", "~> 2.5" spec.add_runtime_dependency "kramdown", ">= 1.13", "< 3.0" spec.add_runtime_dependency "coderay", "~> 1.1" From 5f2c062c007af562bf5b62b71516581980e77254 Mon Sep 17 00:00:00 2001 From: Johnathan Aspinwall Date: Sun, 26 May 2024 10:18:39 -0600 Subject: [PATCH 64/64] Refactor module_acq-operation.rb file --- .../mdJson/modules/module_acq-operation.rb | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-operation.rb diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-operation.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-operation.rb deleted file mode 100644 index 503677fe7..000000000 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-operation.rb +++ /dev/null @@ -1,15 +0,0 @@ -module ADIWG - module Mdtranslator - module Readers - module MdJson - - module AcqOperation - def self.unpack(hAcqOperation, responseObj, inContext = nil) - - end - end - - end - end - end -end \ No newline at end of file