diff --git a/Gemfile.lock b/Gemfile.lock index 670eaa0f..dea77a89 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,9 +1,9 @@ PATH remote: . specs: - adiwg-mdtranslator (2.20.0.pre.beta.5) - adiwg-mdcodes (= 2.10.0) - adiwg-mdjson_schemas (= 2.9.5) + adiwg-mdtranslator (2.21.0.pre.beta.1) + adiwg-mdcodes (= 2.10.1) + adiwg-mdjson_schemas (= 2.10.1) builder (~> 3.2) coderay (~> 1.1) jbuilder (~> 2.5) @@ -11,7 +11,6 @@ PATH json-schema (~> 2.7) kramdown (>= 1.13, < 3.0) nokogiri (~> 1.15) - nokogiri (~> 1.15) thor (~> 0.19) uuidtools (~> 2.1) @@ -36,10 +35,9 @@ GEM tzinfo (~> 2.0) addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) - adiwg-mdcodes (2.10.0) - adiwg-mdcodes (2.10.0) + adiwg-mdcodes (2.10.1) json (~> 2.0) - adiwg-mdjson_schemas (2.9.5) + adiwg-mdjson_schemas (2.10.1) base64 (0.2.0) bigdecimal (3.1.8) builder (3.2.4) diff --git a/adiwg-mdtranslator.gemspec b/adiwg-mdtranslator.gemspec index 86dd8336..221ba702 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.5" - spec.add_runtime_dependency "adiwg-mdcodes", "2.10.0" + spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.10.1" + spec.add_runtime_dependency "adiwg-mdcodes", "2.10.1" spec.add_runtime_dependency "jbuilder", "~> 2.5" spec.add_runtime_dependency "kramdown", ">= 1.13", "< 3.0" spec.add_runtime_dependency "coderay", "~> 1.1" diff --git a/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb b/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb index a16cb449..077f18b1 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 @@ -158,6 +159,7 @@ def newSchema # acquisition ---------------------------- def newAcquisition { + scope: {}, plans: [], requirements: [], objectives: [], @@ -175,19 +177,23 @@ def newEnvironment averageAirTemperature: nil, maxRelativeHumidity: nil, maxAltitude: nil, - meteorologicalConditions: nil + meteorologicalConditions: nil, + solarAzimuth: nil, + solarElevation: nil + } end def newEvent { eventId: nil, + identifier: {}, trigger: nil, context: nil, sequence: nil, dateTime: nil, expectedObjectives: [], - relatedPass: nil, + relatedPass: {}, relatedSensors: [] } end @@ -199,7 +205,29 @@ def newInstrument identifier: {}, instrumentType: nil, description: nil, - mountedOn: nil + mountedOn: {}, + histories: [], + hostId: {} + } + end + + def newInstrumentationEvent + { + citations: [], + description: nil, + extent: {}, + eventType: nil, + revisionHistories: [], + } + end + + def newInstrumentationEventList + { + citation: {}, + description: nil, + locale: {}, + constraints: [], + instrumentationEvents: [] } end @@ -240,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: [] } @@ -267,6 +296,14 @@ def newRequirement } end + def newRevision + { + description: nil, + responsibleParty: {}, + dateInfo: [] + } + end + def newPlatform { platformId: nil, @@ -274,7 +311,8 @@ def newPlatform identifier: {}, description: nil, sponsors: [], - instruments: [] + instruments: [], + history: [] } end 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 00000000..eee8dc70 --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_acquisition.rb @@ -0,0 +1,133 @@ +require_relative 'module_scope' +require_relative 'module_objective' +require_relative 'module_requirement' +require_relative 'module_platform' +require_relative 'module_instrument' +require_relative 'module_operation' +require_relative 'module_pass' +require_relative 'module_event' +require_relative 'module_environment' +require_relative 'module_plan' + +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module Acquisition + + 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 + intAcquisition = intMetadataClass.newAcquisition + + if hAcquisition.has_key?('scope') + unless hAcquisition['scope'].empty? + hReturn = Scope.unpack(hAcquisition['scope'], responseObj, outContext) + unless hReturn.nil? + intAcquisition[:scope] = 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'] + aItems.each do |item| + hReturn = Requirement.unpack(item, responseObj, outContext) + unless hReturn.nil? + intAcquisition[:requirements] << hReturn + end + end + end + + if hAcquisition.has_key?('objective') + aItems = hAcquisition['objective'] + aItems.each do |item| + hReturn = Objective.unpack(item, responseObj, outContext) + unless hReturn.nil? + intAcquisition[:objectives] << hReturn + end + end + end + + if hAcquisition.has_key?('platform') + aItems = hAcquisition['platform'] + aItems.each do |item| + hReturn = Platform.unpack(item, responseObj, outContext) + unless hReturn.nil? + intAcquisition[:platforms] << hReturn + end + end + end + + if hAcquisition.has_key?('instrument') + aItems = hAcquisition['instrument'] + aItems.each do |item| + hReturn = Instrument.unpack(item, responseObj, outContext) + unless hReturn.nil? + intAcquisition[:instruments] << hReturn + end + end + end + + if hAcquisition.has_key?('operation') + aItems = hAcquisition['operation'] + aItems.each do |item| + hReturn = Operation.unpack(item, responseObj, outContext) + unless hReturn.nil? + intAcquisition[:operations] << hReturn + end + end + end + + if hAcquisition.has_key?('event') + aItems = hAcquisition['event'] + aItems.each do |item| + hReturn = Event.unpack(item, responseObj, outContext) + unless hReturn.nil? + intAcquisition[:events] << hReturn + end + end + end + + if hAcquisition.has_key?('pass') + aItems = hAcquisition['pass'] + aItems.each do |item| + hReturn = Pass.unpack(item, responseObj, outContext) + unless hReturn.nil? + intAcquisition[:passes] << hReturn + end + end + end + + if hAcquisition.has_key?('environment') + intAcquisition[:environment] = Environment.unpack(hAcquisition['environment'], responseObj, outContext) + 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_dataDictionary.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataDictionary.rb index 6eeebc93..4c7bf48d 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataDictionary.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataDictionary.rb @@ -38,6 +38,14 @@ def self.unpack(hDictionary, responseObj) intMetadataClass = InternalMetadata.new intDictionary = intMetadataClass.newDataDictionary + # dictionary - id + if hDictionary.has_key?('dictionaryId') + s = hDictionary['dictionaryId'] + if s != '' + intDictionary[:dictionaryId] = s + end + end + # dictionary - description if hDictionary.has_key?('description') s = hDictionary['description'] 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 00000000..56099285 --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_environment.rb @@ -0,0 +1,47 @@ +module ADIWG + module Mdtranslator + module Readers + 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') + 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 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 00000000..562e7dfa --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_event.rb @@ -0,0 +1,88 @@ +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 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') + hEvent['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'], responseObj, outContext) + 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 + + end + end + end +end \ No newline at end of file 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 00000000..9426b619 --- /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] = Identifier.unpack(hInstrument['identifier'], responseObj, outContext) + 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 00000000..61727a1e --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrumentationEvent.rb @@ -0,0 +1,77 @@ +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') + 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') + 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 00000000..40a6b6a7 --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_instrumentationEventList.rb @@ -0,0 +1,62 @@ +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 + + outContext = 'instrumentation event list' + outContext = inContext + ' > ' + outContext unless inContext.nil? + + if hInstrumentationEventList.has_key?('citation') + intInstrumentationEventList[:citation] = Citation.unpack(hInstrumentationEventList['citation'], responseObj, outContext) + end + + if hInstrumentationEventList.has_key?('description') + intInstrumentationEventList[:description] = hInstrumentationEventList['description'] + else + @MessagePath.issueWarning(40, responseObj, outContext, 'instrumentation event description') + end + + if hInstrumentationEventList.has_key?('locale') + 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, outContext) + unless hReturn.nil? + intInstrumentationEventList[:constraints] << hReturn + end + end + end + + if hInstrumentationEventList.has_key?('instrumentationEvent') + hInstrumentationEventList['instrumentationEvent'].each do |item| + hReturn = InstrumentationEvent.unpack(item, responseObj, outContext) + 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_metadata.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb index c4d31229..5cb16aa1 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[:acquisitions] << hReturn + end + end + end + return intMetadata end 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 00000000..85933b3b --- /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_operation.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_operation.rb new file mode 100644 index 00000000..b07cf172 --- /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[:objectives] << 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[:childOperations] << 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[:platforms] << hReturn + end + end + end + + if hOperation.has_key?('significantEvent') + hOperation['significantEvent'].each do |item| + hReturn = Event.unpack(item, responseObj, outContext) + unless hReturn.nil? + intOperation[:significantEvents] << hReturn + end + end + end + + intOperation + + end + end + + end + 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 00000000..ca8d70f6 --- /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 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 00000000..f09c4c15 --- /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?('planOperation') + hPlan['planOperation'].each do |item| + hReturn = Operation.unpack(item, responseObj, outContext) + unless hReturn.nil? + intPlan[:planOperations] << hReturn + end + end + end + + if hPlan.has_key?('satisfiedRequirement') + hPlan['satisfiedRequirement'].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 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 00000000..75d04d2d --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb @@ -0,0 +1,87 @@ +require_relative 'module_citation' +require_relative 'module_identifier' +require_relative 'module_responsibleParty' +require_relative 'module_instrument' +require_relative 'module_instrumentationEventList' + +module ADIWG + module Mdtranslator + module Readers + module MdJson + + module Platform + def self.unpack(hPlatform, responseObj, inContext = nil) + @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson + + 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, outContext) + end + + if hPlatform.has_key?('citation') + 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, outContext) + unless hReturn.nil? + intPlatform[:identifier] = hReturn + else + @MessagePath.issueError(461, responseObj, outContext) + end + end + + if hPlatform.has_key?('description') + intPlatform[:description] = hPlatform['description'] + else + @MessagePath.issueError(460, responseObj, outContext) + end + + if hPlatform.has_key?('sponsor') + hPlatform['sponsor'].each do |sponsor| + hReturn = ResponsibleParty.unpack(sponsor, responseObj, outContext) + unless hReturn.nil? + intPlatform[:sponsors] << hReturn + end + end + end + + if hPlatform.has_key?('instrument') + hPlatform['instrument'].each do |instrument| + hReturn = Instrument.unpack(instrument, responseObj, outContext) + unless hReturn.nil? + intPlatform[:instruments] << hReturn + else + @MessagePath.issueError(461, responseObj, outContext) + end + end + end + + if hPlatform.has_key?('history') + hPlatform['history'].each do |history| + hReturn = AcqInstrumentationEventList.unpack(history, responseObj, outContext) + unless hReturn.nil? + intPlatform[:history] = hReturn + end + end + end + + intPlatform + + end + end + + end + end + end +end \ No newline at end of file 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 00000000..070fc414 --- /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 00000000..223f0b17 --- /dev/null +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_requirement.rb @@ -0,0 +1,98 @@ +require_relative 'module_citation' +require_relative 'module_identifier' +require_relative 'module_requestedDate' +require_relative 'module_plan' +require_relative 'module_responsibleParty' + +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[:identifier] = hReturn + end + end + + if hRequirement.has_key?('requestor') + hRequirement['requestor'].each do |requestor| + hReturn = ResponsibleParty.unpack(requestor, responseObj, outContext) + unless hReturn.nil? + intRequirement[:requestors] << hReturn + end + end + end + + 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 + + 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?('satisfiedPlan') + aItems = hRequirement['satisfiedPlan'] + aItems.each do |item| + hReturn = Plan.unpack(item, responseObj, outContext) + unless hReturn.nil? + intRequirement[:satisfiedPlans] << hReturn + end + end + end + + intRequirement + + 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 00000000..c747d7af --- /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') + hRevision['dateInfo'].each do |item| + hReturn = DateTime.unpack(item, responseObj, outContext) + 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 diff --git a/lib/adiwg/mdtranslator/version.rb b/lib/adiwg/mdtranslator/version.rb index e7b95e78..db58a024 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.5" + VERSION = "2.21.0-beta.1" end 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 00000000..0f776e51 --- /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 e7bff9ca..1ec30f84 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'}) @@ -174,6 +178,10 @@ def writeHtml(version, intObj) @html.summary('Quality', {'class' => 'h3'}) dataQualityClass.writeHtml(hDataQuality) end + @html.details do + @html.summary('Quality', {'class' => 'h3'}) + dataQualityClass.writeHtml(hDataQuality) + end end end end @@ -215,6 +223,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 00000000..24294715 --- /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 00000000..023dbc9f --- /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 00000000..f48d3619 --- /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 00000000..00fd80e1 --- /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 00000000..1e6dbd64 --- /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 00000000..1c00044d --- /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 00000000..4030e54f --- /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 00000000..32a3a09c --- /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 00000000..c3e7162b --- /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 00000000..8deea093 --- /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 00000000..c498931f --- /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 00000000..6a961f13 --- /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 00000000..9dc4f637 --- /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 diff --git a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_acquisition.rb b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_acquisition.rb new file mode 100644 index 00000000..212b0d23 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_acquisition.rb @@ -0,0 +1,103 @@ +require_relative 'class_scope' +require_relative 'class_plan' +require_relative 'class_requirement' +require_relative 'class_environment' +require_relative 'class_instrument' +require_relative 'class_objective' +require_relative 'class_operation' +require_relative 'class_platform' + +module ADIWG + module Mdtranslator + module Writers + module Iso19115_3 + + class MI_AcquisitionInformation + def initialize(xml, hResponseObj) + @xml = xml + @hResponseObj = hResponseObj + end + + def writeXML(hAcquisition) + + scopeClass = MD_Scope.new(@xml, @hResponseObj) + planClass = MI_Plan.new(@xml, @hResponseObj) + requirementClass = MI_Requirement.new(@xml, @hResponseObj) + environmentClass = MI_EnvironmentalRecord.new(@xml, @hResponseObj) + instrumentClass = MI_Instrument.new(@xml, @hResponseObj) + objectiveClass = MI_Objective.new(@xml, @hResponseObj) + operationClass = MI_Operation.new(@xml, @hResponseObj) + platformClass = MI_Platform.new(@xml, @hResponseObj) + + unless hAcquisition.empty? + @xml.tag!('mac:MI_AcquisitionInformation') do + unless hAcquisition[:scope].empty? + @xml.tag!('mac:scope') do + scopeClass.writeXML(hAcquisition[:scope]) + end + end + + unless hAcquisition[:plans].empty? + hAcquisition[:plans].each do |hPlan| + @xml.tag!('mac:acquisitionPlan') do + planClass.writeXML(hPlan) + end + end + end + + unless hAcquisition[:requirements].empty? + hAcquisition[:requirements].each do |hRequirement| + @xml.tag!('mac:acquisitionRequirement') do + requirementClass.writeXML(hRequirement) + end + end + end + + unless hAcquisition[:environment].empty? + @xml.tag!('mac:environmentalConditions') do + environmentClass.writeXML(hAcquisition[:environment]) + end + end + + unless hAcquisition[:instruments].empty? + hAcquisition[:instruments].each do |hInstrument| + @xml.tag!('mac:instrument') do + instrumentClass.writeXML(hInstrument) + end + end + end + + unless hAcquisition[:objectives].empty? + hAcquisition[:objectives].each do |hObjective| + @xml.tag!('mac:objective') do + objectiveClass.writeXML(hObjective) + end + end + end + + unless hAcquisition[:operations].empty? + hAcquisition[:operations].each do |hOperation| + @xml.tag!('mac:operation') do + operationClass.writeXML(hOperation) + end + end + end + + unless hAcquisition[:platforms].empty? + hAcquisition[:platforms].each do |hPlatform| + @xml.tag!('mac:platform') do + platformClass.writeXML(hPlatform) + end + end + end + + end + end + + end + + end + end + end + end +end diff --git a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_environment.rb b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_environment.rb new file mode 100644 index 00000000..346523cc --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_environment.rb @@ -0,0 +1,82 @@ +module ADIWG + module Mdtranslator + module Writers + module Iso19115_3 + + class MI_EnvironmentalRecord + def initialize(xml, hResponseObj) + @xml = xml + @hResponseObj = hResponseObj + end + + def writeXML(hEnvironment) + + @xml.tag!('mac:MI_EnvironmentalRecord') do + unless hEnvironment[:averageAirTemperature].nil? + @xml.tag!('mac:averageAirTemperature') do + @xml.tag!('gco:Real', hEnvironment[:averageAirTemperature]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:averageAirTemperature') + end + end + + unless hEnvironment[:maxRelativeHumidity].nil? + @xml.tag!('mac:maxRelativeHumidity') do + @xml.tag!('gco:Real', hEnvironment[:maxRelativeHumidity]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:maxRelativeHumidity') + end + end + + unless hEnvironment[:maxAltitude].nil? + @xml.tag!('mac:maxAltitude') do + @xml.tag!('gco:Real', hEnvironment[:maxAltitude]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:maxAltitude') + end + end + + unless hEnvironment[:meteorologicalConditions].nil? + @xml.tag!('mac:meteorologicalConditions') do + @xml.tag!('gco:CharacterString', hEnvironment[:meteorologicalConditions]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:meteorologicalConditions') + end + end + + unless hEnvironment[:solarAzimuth].nil? + @xml.tag!('mac:solarAzimuth') do + @xml.tag!('gco:Real', hEnvironment[:solarAzimuth]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:solarAzimuth') + end + end + + unless hEnvironment[:solarElevation].nil? + @xml.tag!('mac:solarElevation') do + @xml.tag!('gco:Real', hEnvironment[:solarElevation]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:solarElevation') + end + end + end + + end + end + + end + end + end +end diff --git a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_event.rb b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_event.rb new file mode 100644 index 00000000..10ce36fe --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_event.rb @@ -0,0 +1,123 @@ +require_relative 'class_identifier' +require_relative 'class_codelist' +require_relative 'class_gcoDateTime' +require_relative 'class_objective' +require_relative 'class_pass' +require_relative 'class_instrument' + +module ADIWG + module Mdtranslator + module Writers + module Iso19115_3 + + class MI_Event + def initialize(xml, hResponseObj) + @xml = xml + @hResponseObj = hResponseObj + end + + def writeXML(hEvent) + + identifierClass = Identifier.new(@xml, @hResponseObj) + codelistClass = MD_Codelist.new(@xml, @hResponseObj) + gcoDateTimeClass = GcoDateTime.new(@xml, @hResponseObj) + objectiveClass = MI_Objective.new(@xml, @hResponseObj) + passClass = MI_Pass.new(@xml, @hResponseObj) + instrumentClass = MI_Instrument.new(@xml, @hResponseObj) + + @xml.tag!('mac:MI_Event', id: hEvent[:eventId]) do + + unless hEvent[:identifier].empty? + @xml.tag!('mac:identifier') do + identifierClass.writeXML(hEvent[:identifier]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:identifier') + end + end + + unless hEvent[:trigger].nil? + @xml.tag!('mac:trigger') do + codelistClass.writeXML('mac', 'iso_triggerCode', hEvent[:trigger]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:trigger') + end + end + + unless hEvent[:context].nil? + @xml.tag!('mac:context') do + codeListClass.writeXML('mac', 'iso_contextCode', hEvent[:context]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:context') + end + end + + unless hEvent[:sequence].nil? + @xml.tag!('mac:sequence') do + codelistClass.writeXML('mac', 'iso_sequenceCode', hEvent[:sequence]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:sequence') + end + end + + unless hEvent[:time].nil? + @xml.tag!('mac:time') do + gcoDateTimeClass.writeXML(hEvent[:time]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:time') + end + end + + unless hEvent[:expectedObjectives].empty? + hEvent[:expectedObjectives].each do |hObjective| + @xml.tag!('mac:expectedObjective') do + objectiveClass.writeXML(hObjective) + end + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:expectedObjective') + end + end + + unless hEvent[:relatedPass].empty? + hEvent[:relatedPass].each do |hPass| + @xml.tag!('mac:relatedPass') do + passClass.writeXML(hPass) + end + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:relatedPass') + end + end + + unless hEvent[:relatedSensors].empty? + hEvent[:relatedSensors].each do |hSensor| + @xml.tag!('mac:relatedInstrument') do + instrumentClass.writeXML(hSensor) + end + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:relatedInstrument') + end + end + + end + end + end + + end + end + end +end diff --git a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_instrument.rb b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_instrument.rb new file mode 100644 index 00000000..a0f2644a --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_instrument.rb @@ -0,0 +1,92 @@ +require_relative 'class_citation' +require_relative 'class_identifier' +require_relative 'class_platform' +require_relative 'class_instrumentationEventList' + + +module ADIWG + module Mdtranslator + module Writers + module Iso19115_3 + + class MI_Instrument + def initialize(xml, hResponseObj) + @xml = xml + @hResponseObj = hResponseObj + end + + def writeXML(hInstrument) + + citationClass = CI_Citation.new(@xml, @hResponseObj) + identifierClass = MD_Identifier.new(@xml, @hResponseObj) + platformClass = MI_Platform.new(@xml, @hResponseObj) + instrumentationEventListClass = MI_InstrumentationEventList.new(@xml, @hResponseObj) + + @xml.tag!('mac:MI_Instrument', id: hInstrument[:instrumentId]) do + unless hInstrument[:citation].empty? + @xml.tag!('mac:citation') do + citationClass.writeXML(hInstrument[:citation]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:citation') + end + end + + unless hInstrument[:identifier].empty? + @xml.tag!('mac:identifier') do + identifierClass.writeXML(hInstrument[:identifier]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:identifier') + end + end + + unless hInstrument[:instrumentType].empty? + @xml.tag!('mac:type') do + @xml.tag!('gco:CharacterString', hInstrument[:instrumentType]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:type') + end + end + + unless hInstrument[:description].nil? + @xml.tag!('mac:description') do + @xml.tag!('gco:CharacterString', hInstrument[:description]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:description') + end + end + + unless hInstrument[:mountedOn].empty? + @xml.tag!('mac:mountedOn') do + platformClass.writeXML(hInstrument[:mountedOn]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:mountedOn') + end + end + + unless hInstrument[:histories].empty? + @xml.tag!('mac:history') do + hInstrument[:histories].each do |history| + instrumentationEventListClass.writeXML(history) + end + end + end + + end + + end + end + end + end + end +end + diff --git a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_instrumentationEvent.rb b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_instrumentationEvent.rb new file mode 100644 index 00000000..e1f74553 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_instrumentationEvent.rb @@ -0,0 +1,83 @@ +require_relative 'class_citation' +require_relative 'class_extent' +require_relative 'class_revision' + +module ADIWG + module Mdtranslator + module Writers + module Iso19115_3 + + class MI_InstrumentationEvent + def initialize(xml, hResponseObj) + @xml = xml + @hResponseObj = hResponseObj + end + + def writeXML(hInstrumentationEvent) + + citationClass = CI_Citation.new(@xml, @hResponseObj) + extentClass = EX_Extent.new(@xml, @hResponseObj) + revisionClass = MI_Revision.new(@xml, @hResponseObj) + codeListClass = MD_Codelist.new(@xml, @hResponseObj) + + @xml.tag!('mac:MI_InstrumentationEvent') do + unless hInstrumentationEvent[:citations].empty? + hInstrumentationEvent[:citations].each do |hCitation| + @xml.tag!('mac:citation') do + citationClass.writeXML(hCitation) + end + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:citation') + end + end + + unless hInstrumentationEvent[:description].nil? + @xml.tag!('mac:description') do + @xml.tag!('gco:CharacterString', hInstrumentationEvent[:description]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:description') + end + end + + unless hInstrumentationEvent[:extent].empty? + @xml.tag!('mac:extent') do + extentClass.writeXML(hInstrumentationEvent[:extent]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:extent') + end + end + + unless hInstrumentationEvent[:eventType].nil? + @xml.tag!('mac:type') do + codeListClass.writeXML('mac', 'iso_eventTypeCode', hInstrumentationEvent[:eventType]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:type') + end + end + + unless hInstrumentationEvent[:revisionHistories].empty? + hInstrumentationEvent[:revisionHistories].each do |hRevision| + @xml.tag!('mac:revisionHistory') do + revisionClass.writeXML(hRevision) + end + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:revisionHistory') + end + end + end + end + end + end + end + end +end diff --git a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_instrumentationEventList.rb b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_instrumentationEventList.rb new file mode 100644 index 00000000..23b617bc --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_instrumentationEventList.rb @@ -0,0 +1,73 @@ +require_relative 'class_citation' +require_relative 'class_locale' +require_relative 'class_constraint' +require_relative 'class_instrumentationEvent' + +module ADIWG + module Mdtranslator + module Writers + module Iso19115_3 + + class MI_InstrumentationEventList + def initialize(xml, hResponseObj) + @xml = xml + @hResponseObj = hResponseObj + end + + def writeXML(hInstrumentationEventList) + + citationClass = CI_Citation.new(@xml, @hResponseObj) + localeClass = PT_Locale.new(@xml, @hResponseObj) + constraintClass = Constraint.new(@xml, @hResponseObj) + instrumentationEventClass = MI_InstrumentationEvent.new(@xml, @hResponseObj) + + @xml.tag!('mac:MI_InstrumentationEventList') do + unless hInstrumentationEventList[:citation].empty? + @xml.tag!('mac:citation') do + citationClass.writeXML(hInstrumentationEventList[:citation]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:citation') + end + end + + unless hInstrumentationEventList[:description].nil? + @xml.tag!('mac:description') do + @xml.tag!('gco:CharacterString', hInstrumentationEventList[:description]) + end + else + @xml.tag!('mac:description') + end + + unless hInstrumentationEventList[:locale].empty? + @xml.tag!('mac:locale') do + localeClass.writeXML(hInstrumentationEventList[:locale]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:locale') + end + end + + unless hInstrumentationEventList[:instrumentationEvents].empty? + hInstrumentationEventList[:instrumentationEvents].each do |hEvent| + @xml.tag!('mac:instrumentationEvent') do + instrumentationEventClass.writeXML(hEvent) + end + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:instrumentationEvent') + end + end + end + + end + + end + + end + end + end +end 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 f49ac14a..46c76411 100644 --- a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_mdMetadata.rb +++ b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_mdMetadata.rb @@ -27,6 +27,7 @@ require_relative 'class_referenceSystem' require_relative 'class_featureCatalog' require_relative 'class_extension' +require_relative 'class_acquisition' module ADIWG module Mdtranslator @@ -64,6 +65,7 @@ def writeXML(intObj) referenceSystemClass = MD_ReferenceSystem.new(@xml, @hResponseObj) mdCatalogClass = MD_FeatureCatalogue.new(@xml, @hResponseObj) extensionClass = MD_MetadataExtensionInformation.new(@xml, @hResponseObj) + acquisitionClass = MI_AcquisitionInformation.new(@xml, @hResponseObj) # create shortcuts to sections of internal object hMetadata = intObj[:metadata] @@ -73,6 +75,7 @@ def writeXML(intObj) aDataQuality = hMetadata[:dataQuality] aLineage = hMetadata[:lineageInfo] aDictionaries = intObj[:dataDictionaries] + aAcquisition = hMetadata[:acquisitions] version = @hResponseObj[:translatorVersion] # document head @@ -88,6 +91,7 @@ def writeXML(intObj) # set to 'remoteSchema' before publishing localSchema = 'C:\Users\StanSmith\Projects\ISO\19115\-3\mdt\1.0\mdt.xsd' remoteSchema = 'https://schemas.isotc211.org/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', @@ -318,6 +322,31 @@ def writeXML(intObj) end end + taxonomyArray = hResInfo[:taxonomy] + unless taxonomyArray.empty? + # metadata information - metadata extension info + # add biological profile to all metadata records + intBio = intMetadataClass.newMetadataExtension + intBio[:name] = 'Taxonomy System' + intBio[:shortName] = 'TaxonSys' + intBio[:definition] = 'Documentation of taxonomic sources, procedures, and treatments' + intBio[:obligation] = 'optional' + intBio[:dataType] = 'class' + intBio[:maxOccurrence] = '1' + intBio[:parentEntities] << 'MD_Identification' + intBio[:rule] = 'New Metadata section as a class to MD_Identification' + intBio[:rationales] << 'The set of data elements contained within this class element ' + + 'represents an attempt to provide better documentation of ' + + 'taxonomic sources, procedures, and treatments.' + intBio[:sourceOrganization] = 'National Biological Information Infrastructure' + intBio[:sourceURI] = 'https://www2.usgs.gov/core_science_systems/Access/p1111-1.html' + intBio[:sourceRole] = 'author' + + @xml.tag!('gmd:metadataExtensionInfo') do + extensionClass.writeXML(intBio) + end + end + # ###################### Begin Data Identification ##################### # metadata information - data identification info - required @@ -417,6 +446,14 @@ def writeXML(intObj) @xml.tag!('mdb:metadataMaintenance') end + aAcquisition.each do |hAcquisition| + unless hAcquisition.empty? + @xml.tag!('mdb:acquisitionInformation') do + acquisitionClass.writeXML(hAcquisition) + end + end + end + end # mdb:MD_Metadata tag return metadata diff --git a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_objective.rb b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_objective.rb new file mode 100644 index 00000000..daf3a857 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_objective.rb @@ -0,0 +1,121 @@ +require_relative 'class_identifier' +require_relative 'class_codelist' +require_relative 'class_extent' +require_relative 'class_event' +require_relative 'class_pass' +require_relative 'class_instrument' + +module ADIWG + module Mdtranslator + module Writers + module Iso19115_3 + + class MI_Objective + def initialize(xml, hResponseObj) + @xml = xml + @hResponseObj = hResponseObj + end + + def writeXML(hObjective) + + identifierClass = MD_Identifier.new(@xml, @hResponseObj) + codelistClass = MD_Codelist.new(@xml, @hResponseObj) + extentClass = EX_Extent.new(@xml, @hResponseObj) + eventClass = MI_Event.new(@xml, @hResponseObj) + passClass = MI_Pass.new(@xml, @hResponseObj) + instrumentClass = MI_Instrument.new(@xml, @hResponseObj) + + @xml.tag!('mac:MI_Objective', id: hObjective[:objectiveId]) do + unless hObjective[:identifiers].empty? + hObjective[:identifiers].each do |hIdentifier| + @xml.tag!('mac:identifier') do + identifierClass.writeXML(hIdentifier) + end + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:identifier') + end + end + + unless hObjective[:priority].nil? + @xml.tag!('mac:priority') do + @xml.tag!('gco:CharacterString', hObjective[:priority]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:priority') + end + end + + unless hObjective[:type].nil? + @xml.tag!('mac:type') do + codelistClass.writeXML('mac', 'iso_objectiveTypeCode', hObjective[:type]) + end + else + @xml.tag!('mac:type') + end + + unless hObjective[:function].nil? + @xml.tag!('mac:function') do + @xml.tag!('gco:CharacterString', hObjective[:function]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:function') + end + end + + unless hObjective[:extent].nil? + @xml.tag!('mac:extent') do + extentClass.writeXML(hObjective[:extent]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:extent') + end + end + + unless hObjective[:occurrences].empty? + hObjective[:occurrences].each do |hOccurrence| + @xml.tag!('mac:occurrence') do + eventClass.writeXML(hOccurrence) + end + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:occurrence') + end + end + + unless hObjective[:passes].empty? + hObjective[:passes].each do |hPass| + @xml.tag!('mac:pass') do + passClass.writeXML(hPass) + end + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:pass') + end + end + + unless hObjective[:sensingInstruments].empty? + hObjective[:sensingInstruments].each do |hInstrument| + @xml.tag!('mac:sensingInstrument') do + instrumentClass.writeXML(hInstrument) + end + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:sensingInstrument') + end + end + end + end + + end + end + end + end +end diff --git a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_operation.rb b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_operation.rb new file mode 100644 index 00000000..a26051ad --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_operation.rb @@ -0,0 +1,131 @@ +require_relative 'class_citation' +require_relative 'class_identifier' +require_relative 'class_objective' +require_relative 'class_plan' +require_relative 'class_platform' + +module ADIWG + module Mdtranslator + module Writers + module Iso19115_3 + + class MI_Operation + def initialize(xml, hResponseObj) + @xml = xml + @hResponseObj = hResponseObj + end + + def writeXML(hOperation) + + codelistClass = MD_Codelist.new(@xml, @hResponseObj) + citationClass = CI_Citation.new(@xml, @hResponseObj) + identifierClass = MD_Identifier.new(@xml, @hResponseObj) + objectiveClass = MI_Objective.new(@xml, @hResponseObj) + planClass = MI_Plan.new(@xml, @hResponseObj) + platformClass = MI_Platform.new(@xml, @hResponseObj) + operationClass = MI_Operation.new(@xml, @hResponseObj) + + @xml.tag!('mac:MI_Operation', id: hOperation[:operationId]) do + + unless hOperation[:description].nil? + @xml.tag!('mac:description') do + @xml.tag!('gco:CharacterString', hOperation[:description]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:description') + end + end + + unless hOperation[:citation].empty? + @xml.tag!('mac:citation') do + citationClass.writeXML(hOperation[:citation]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:citation') + end + end + + unless hOperation[:identifier].empty? + @xml.tag!('mac:identifier') do + identifierClass.writeXML(hOperation[:identifier]) + end + end + + unless hOperation[:status].nil? + @xml.tag!('mac:status') do + codelistClass.writeXML('mac', 'iso_progress', hOperation[:status]) + end + end + + unless hOperation[:operationType].nil? + @xml.tag!('mac:type') do + codelistClass.writeXML('mac', 'iso_operationTypeCode', hOperation[:operationType]) + end + end + + unless hOperation[:platforms].empty? + hOperation[:platforms].each do |hPlatform| + @xml.tag!('mac:platform') do + platformClass.writeXML(hPlatform) + end + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:platform') + end + end + + unless hOperation[:childOperations].empty? + hOperation[:childOperations].each do |hChildOp| + @xml.tag!('mac:childOperation') do + operationClass.writeXML(hChildOp) + end + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:childOperation') + end + end + + unless hOperation[:objectives].empty? + hOperation[:objectives].each do |hObjective| + @xml.tag!('mac:objective') do + objectiveClass.writeXML(hObjective) + end + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:objective') + end + end + + unless hOperation[:parentOperation].empty? + @xml.tag!('mac:parentOperation') do + operationClass.writeXML(hOperation[:parentOperation]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:parentOperation') + end + end + + unless hOperation[:plan].empty? + @xml.tag!('mac:plan') do + planClass.writeXML(hOperation[:plan]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:plan') + end + end + + end + end + end + + end + end + end +end diff --git a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_pass.rb b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_pass.rb new file mode 100644 index 00000000..2b1f8032 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_pass.rb @@ -0,0 +1,63 @@ +require_relative 'class_identifier' +require_relative 'class_extent' +require_relative 'class_event' + +module ADIWG + module Mdtranslator + module Writers + module Iso19115_3 + + class MI_Pass + def initialize(xml, hResponseObj) + @xml = xml + @hResponseObj = hResponseObj + end + + def writeXML(hPass) + + identifierClass = MD_Identifier.new(@xml, @hResponseObj) + extentClass = EX_Extent.new(@xml, @hResponseObj) + eventClass = MI_Event.new(@xml, @hResponseObj) + + @xml.tag!('mac:MI_Pass') do + + unless hPass[:identifier].empty? + @xml.tag!('mac:identifier') do + identifierClass.writeXML(hPass[:identifier]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:identifier') + end + end + + unless hPass[:extent].empty? + @xml.tag!('mac:extent') do + extentClass.writeXML(hPass[:extent]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:extent') + end + end + + unless hPass[:relatedEvents].empty? + hPass[:relatedEvents].each do |hEvent| + @xml.tag!('mac:relatedEvent') do + eventClass.writeXML(hEvent) + end + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:related') + end + end + end + + end + end + end + + end + end +end diff --git a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_plan.rb b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_plan.rb new file mode 100644 index 00000000..32e023b9 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_plan.rb @@ -0,0 +1,76 @@ +require_relative 'class_citation' +require_relative 'class_operation' +require_relative 'class_requirement' + +module ADIWG + module Mdtranslator + module Writers + module Iso19115_3 + + class MI_Plan + def initialize(xml, hResponseObj) + @xml = xml + @hResponseObj = hResponseObj + end + + def writeXML(hPlan) + + codelistClass = MD_Codelist.new(@xml, @hResponseObj) + citationClass = CI_Citation.new(@xml, @hResponseObj) + operationClass = MI_Operation.new(@xml, @hResponseObj) + requirementClass = MI_Requirement.new(@xml, @hResponseObj) + + @xml.tag!('mac:MI_Plan', id: hPlan[:planId]) do + unless hPlan[:planType].nil? + @xml.tag!('mac:type') do + codelistClass.writeXML('mac', 'iso_geometryTypeCode', hPlan[:planType]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:type') + end + end + + unless hPlan[:status].nil? + @xml.tag!('mac:status') do + codelistClass.writeXML('mac', 'iso_progress', hPlan[:status]) + end + end + + unless hPlan[:citation].empty? + @xml.tag!('mac:citation') do + citationClass.writeXML(hPlan[:citation]) + end + end + + unless hPlan[:planOperations].empty? + hPlan[:planOperations].each do |hOperation| + @xml.tag!('mac:operation') do + operationClass.writeXML(hOperation) + end + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:operation') + end + end + + unless hPlan[:satisfiedRequirements].empty? + hPlan[:satisfiedRequirements].each do |hRequirement| + @xml.tag!('mac:satisfiedRequirement') do + requirementClass.writeXML(hRequirement) + end + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:satisfiedRequirement') + end + end + end + + end + end + end + end + end +end diff --git a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_platform.rb b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_platform.rb new file mode 100644 index 00000000..01bb01e3 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_platform.rb @@ -0,0 +1,102 @@ +require_relative 'class_citation' +require_relative 'class_identifier' +require_relative 'class_responsibility' +require_relative 'class_instrument' +require_relative 'class_instrumentationEventList' + +module ADIWG + module Mdtranslator + module Writers + module Iso19115_3 + + class MI_Platform + def initialize(xml, hResponseObj) + @xml = xml + @hResponseObj = hResponseObj + end + + def writeXML(hPlatform) + + codelistClass = MD_Codelist.new(@xml, @hResponseObj) + citationClass = CI_Citation.new(@xml, @hResponseObj) + identifierClass = MD_Identifier.new(@xml, @hResponseObj) + responsibilityClass = CI_Responsibility.new(@xml, @hResponseObj) + instrumentClass = MI_Instrument.new(@xml, @hResponseObj) + instrumentationEventListClass = MI_InstrumentationEventList.new(@xml, @hResponseObj) + + @xml.tag!('mac:MI_Platform', id: hPlatform[:platformId]) do + + unless hPlatform[:citation].empty? + @xml.tag!('mac:citation') do + citationClass.writeXML(hPlatform[:citation]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:citation') + end + end + + unless hPlatform[:identifier].empty? + @xml.tag!('mac:identifier') do + identifierClass.writeXML(hPlatform[:identifier]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:identifier') + end + end + + unless hPlatform[:description].nil? + @xml.tag!('mac:description') do + @xml.tag!('gco:CharacterString', hPlatform[:description]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:description') + end + end + + unless hPlatform[:sponsors].empty? + hPlatform[:sponsors].each do |hResponsibility| + @xml.tag!('mac:sponsor') do + responsibilityClass.writeXML(hResponsibility) + end + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:sponsor') + end + end + + unless hPlatform[:instruments].empty? + hPlatform[:instruments].each do |hInstrument| + @xml.tag!('mac:instrument') do + instrumentClass.writeXML(hInstrument) + end + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:instrument') + end + end + + unless hPlatform[:history].empty? + @xml.tag!('mac:history') do + hPlatform[:history].each do |history| + instrumentationEventListClass.writeXML(history) + end + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:history') + end + end + + end + end + + end + end + end + end +end \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_requestedDate.rb b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_requestedDate.rb new file mode 100644 index 00000000..dd6e4c8a --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_requestedDate.rb @@ -0,0 +1,44 @@ +module ADIWG + module Mdtranslator + module Writers + module Iso19115_3 + + class MI_RequestedDate + def initialize(xml, hResponseObj) + @xml = xml + @hResponseObj = hResponseObj + end + + def writeXML(hRequestedDate) + + gcoDateTimeClass = GcoDateTime.new(@xml, @hResponseObj) + + @xml.tag!('mac:MI_RequestedDate') do + unless hRequestedDate[:requestedDateOfCollection].empty? + @xml.tag!('mac:requestedDateOfCollection') do + gcoDateTimeClass.writeXML(hRequestedDate[:requestedDateOfCollection]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:requestedDateOfCollection') + end + end + + unless hRequestedDate[:latestAcceptableDate].empty? + @xml.tag!('mac:latestAcceptableDate') do + gcoDateTimeClass.writeXML(hRequestedDate[:latestAcceptableDate]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:latestAcceptableDate') + end + end + end + end + end + end + end + end +end + + \ No newline at end of file diff --git a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_requirement.rb b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_requirement.rb new file mode 100644 index 00000000..198a7ac0 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_requirement.rb @@ -0,0 +1,111 @@ +require_relative 'class_citation' +require_relative 'class_identifier' +require_relative 'class_responsibility' +require_relative 'class_codelist' +require_relative 'class_requestedDate' +require_relative 'class_gcoDateTime' +require_relative 'class_plan' + +module ADIWG + module Mdtranslator + module Writers + module Iso19115_3 + + class MI_Requirement + def initialize(xml, hResponseObj) + @xml = xml + @hResponseObj = hResponseObj + end + + def writeXML(hRequirement) + + citationClass = CI_Citation.new(@xml, @hResponseObj) + identifierClass = MD_Identifier.new(@xml, @hResponseObj) + responsibilityClass = CI_Responsibility.new(@xml, @hResponseObj) + codelistClass = MD_Codelist.new(@xml, @hResponseObj) + requestedDateClass = MI_RequestedDate.new(@xml, @hResponseObj) + gcoDateTimeClass = GcoDateTime.new(@xml, @hResponseObj) + planClass = MI_Plan.new(@xml, @hResponseObj) + + @xml.tag!('mac:MI_Requirement', id: hRequirement[:requirementId]) do + unless hRequirement[:citation].empty? + @xml.tag!('mac:citation') do + citationClass.writeXML(hRequirement[:citation]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:citation') + end + end + + unless hRequirement[:identifier].empty? + @xml.tag!('mac:identifier') do + identifierClass.writeXML(hRequirement[:identifier]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:identifier') + end + end + + unless hRequirement[:requestors].empty? + hRequirement[:requestors].each do |hResponsibility| + @xml.tag!('mac:requestor') do + responsibilityClass.writeXML(hResponsibility) + end + end + end + + unless hRequirement[:recipients].empty? + hRequirement[:recipients].each do |hResponsibility| + @xml.tag!('mac:recipient') do + responsibilityClass.writeXML(hResponsibility) + end + end + end + + unless hRequirement[:priority].nil? + @xml.tag!('mac:priority') do + codelistClass.writeXML('mac', 'iso_priorityCode', hRequirement[:priority]) + end + end + + unless hRequirement[:requestedDate].nil? + @xml.tag!('mac:requestedDate') do + requestedDateClass.writeXML(hRequirement[:requestedDate]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:requestedDate') + end + end + + # unless hRequirement[:expiryDate].nil? + # @xml.tag!('mac:expiryDate') do + # gcoDateTimeClass.writeXML(hRequirement[:expiryDate]) + # end + # else + # if @hResponseObj[:writerShowTags] + # @xml.tag!('mac:expiryDate') + # end + # end + + unless hRequirement[:satisfiedPlans].empty? + hRequirement[:satisfiedPlans].each do |hPlan| + @xml.tag!('mac:satisifiedPlan') do + planClass.writeXML(hPlan) + end + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:satisifiedPlan') + end + end + end + end + end + + end + end + end +end diff --git a/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_revision.rb b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_revision.rb new file mode 100644 index 00000000..a5de8876 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_revision.rb @@ -0,0 +1,55 @@ +require_relative 'class_responsibility' +require_relative 'class_gcoDateTime' + +module ADIWG + module Mdtranslator + module Writers + module Iso19115_3 + + class MI_Revision + def initialize(xml, hResponseObj) + @xml = xml + @hResponseObj = hResponseObj + end + + def writeXML(hRevision) + + responsibilityClass = CI_Responsibility.new(@xml, @hResponseObj) + gcoDateTimeClass = GcoDateTime.new(@xml, @hResponseObj) + + @xml.tag!('mac:MI_Revision') do + unless hRevision[:description].nil? + @xml.tag!('mac:description') do + @xml.tag!('gco:CharacterString', hRevision[:description]) + end + else + if @hResponseObj[:writerShowTags] + @xml.tag!('mac:description') + end + end + + unless hRevision[:responsibleParty].empty? + @xml.tag!('mac:author') do + responsibilityClass.writeXML(hRevision[:responsibleParty]) + end + else + @xml.tag!('mac:author') + end + + unless hRevision[:dateInfo].empty? + @xml.tag!('mac:dateInfo') do + hRevision[:dateInfo].each do |hDate| + gcoDateTimeClass.writeXML(hDate) + end + end + else + @xml.tag!('mac:dateInfo') + end + end + end + end + + end + 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 new file mode 100644 index 00000000..85c4ee47 --- /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_dictionary.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_dictionary.rb index ac6e4c88..20c1f487 100644 --- a/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_dictionary.rb +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_dictionary.rb @@ -24,6 +24,7 @@ module Dictionary def self.build(hDictionary) Jbuilder.new do |json| + json.dictionaryId hDictionary[:dictionaryId] unless hDictionary[:dictionaryId].empty? json.citation Citation.build(hDictionary[:citation]) unless hDictionary[:citation].empty? json.description hDictionary[:description] json.subject hDictionary[:subjects] unless hDictionary[:subjects].empty? 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 00000000..5bd96f35 --- /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) + + 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 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 00000000..cb8da25c --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_event.rb @@ -0,0 +1,37 @@ +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) + + Jbuilder.new do |json| + json.eventId hEvent[:eventId] + 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) + end + + end + end # Event + end + end + end +end 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 00000000..b1a87cb5 --- /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[:histories], InstrumentationEventList) unless hInstrument[:histories].empty? + json.hostId Identifier.build(hInstrument[:hostId]) unless hInstrument[:hostId].empty? + end + + end + end # Instrument + + end + end + end +end 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 00000000..21717c41 --- /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 @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] + 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 00000000..c7adb30a --- /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_metadata.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_metadata.rb index 5a646955..74464474 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 @@ -29,11 +30,13 @@ def self.build(hMetadata) json.metadataInfo MetadataInfo.build(hMetadata[:metadataInfo]) json.resourceInfo ResourceInfo.build(hMetadata[:resourceInfo]) json.dataQuality @Namespace.json_map(hMetadata[:dataQuality], DataQuality) + json.dataQuality @Namespace.json_map(hMetadata[:dataQuality], DataQuality) json.resourceLineage @Namespace.json_map(hMetadata[:lineageInfo], LineageInfo) json.resourceDistribution @Namespace.json_map(hMetadata[:distributorInfo], Distribution) 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 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 00000000..5d1b0721 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_objective.rb @@ -0,0 +1,37 @@ +require 'jbuilder' +require_relative 'mdJson_identifier' +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[: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[:sensingInstruments], Instrument) unless hObjective[:sensingInstruments].empty? + end + + end + end # Objective + + end + end + end +end 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 00000000..72b06197 --- /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_pass.rb b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_pass.rb new file mode 100644 index 00000000..f28aae77 --- /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 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 00000000..0000e33d --- /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 # Plan + end + end + end +end 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 00000000..2c5ed83c --- /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 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 00000000..63457467 --- /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 RequestedDate + + @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 00000000..578048ad --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_requirement.rb @@ -0,0 +1,36 @@ +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 + 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], ResponsibleParty) + json.recipient @Namespace.json_map(hRequirement[:recipients], ResponsibleParty) + 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 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 00000000..2459433c --- /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) + + Jbuilder.new do |json| + json.description hRevision[:description] + json.responsibleParty @Namespace.json_map(hRevision[:responsibleParties], ResponsibleParty) + json.dateInfo @Namespace.json_map(hRevision[:dateInfo], DateTime) + end + + end + end # Revision + + end + end + end +end diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_acquisition.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_acquisition.rb new file mode 100644 index 00000000..e71ef4a6 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_acquisition.rb @@ -0,0 +1,195 @@ +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 Simple_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.div do + @html.h5('Scope', {'class' => 'h5'}) + @html.div(:class => 'block') do + scopeClass.writeHtml(hDataQuality[:scope]) + end + end + end + + # plan + unless hAcquisition[:plans].empty? + @html.div(:class =>'block') do + @html.div do + @html.h4('Plans', {'class' => 'h4'}) + hAcquisition[:plans].each do |plan| + @html.div(:class =>'block') do + @html.div do + @html.h5('Plan', {'class' => 'h5'}) + planClass.writeHtml(plan) + end + end + end + end + end + end + + # requirement + unless hAcquisition[:requirements].empty? + @html.div(:class =>'block') do + @html.div do + @html.h4('Requirements', {'class' => 'h4'}) + hAcquisition[:requirements].each do |requirement| + @html.div(:class =>'block') do + @html.div do + @html.h5('Requirement', {'class' => 'h5'}) + requirementClass.writeHtml(requirement) + end + end + end + end + end + end + + # objective + unless hAcquisition[:objectives].empty? + @html.div(:class =>'block') do + @html.div do + @html.h4('Objectives', {'class' => 'h4'}) + hAcquisition[:objectives].each do |objective| + @html.div(:class =>'block') do + @html.div do + @html.h5('Objective', {'class' => 'h5'}) + objectiveClass.writeHtml(objective) + end + end + end + end + end + end + + + # platform + unless hAcquisition[:platforms].empty? + @html.div(:class =>'block') do + @html.div do + @html.h4('Platforms', {'class' => 'h4'}) + hAcquisition[:platforms].each do |platform| + @html.div(:class =>'block') do + @html.div do + @html.h5('Platform', {'class' => 'h5'}) + platformClass.writeHtml(platform) + end + end + end + end + end + end + + # Instrument + unless hAcquisition[:instruments].empty? + @html.div(:class =>'block') do + @html.div do + @html.h4('Instrument', {'class' => 'h4'}) + hAcquisition[:instruments].each do |instrument| + @html.div(:class =>'block') do + @html.div do + @html.h5('Instrument', {'class' => 'h5'}) + instrumentClass.writeHtml(instrument) + end + end + end + end + end + end + + # operation + unless hAcquisition[:operations].empty? + @html.div(:class =>'block') do + @html.div do + @html.h4('Operations', {'class' => 'h4'}) + hAcquisition[:operations].each do |operations| + @html.div(:class =>'block') do + @html.div do + @html.h5('Operation', {'class' => 'h5'}) + operationClass.writeHtml(operations) + end + end + end + end + end + end + + # Event + unless hAcquisition[:events].empty? + @html.div(:class =>'block') do + @html.div do + @html.h4('Events', {'class' => 'h4'}) + hAcquisition[:events].each do |event| + @html.div(:class =>'block') do + @html.div do + @html.h5('Event', {'class' => 'h5'}) + eventClass.writeHtml(event) + end + end + end + end + end + end + + # Pass + unless hAcquisition[:passes].empty? + @html.div(:class =>'block') do + @html.div do + @html.h4('Passes', {'class' => 'h4'}) + hAcquisition[:passes].each do |pass| + @html.div(:class =>'block') do + @html.div do + @html.h5('Pass', {'class' => 'h5'}) + passClass.writeHtml(pass) + end + end + end + end + end + end + + # Environment + unless hAcquisition[:environment].empty? + @html.div do + @html.h5('Scope', {'class' => 'h5'}) + @html.div(:class => 'block') do + environmentClass.writeHtml(hAcquisition[:environment]) + end + end + end + + end + end + end + end + end +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 3b2d1474..16ed8427 100644 --- a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_body.rb +++ b/lib/adiwg/mdtranslator/writers/simple_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) + aquisitionClass = 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 @@ -73,11 +76,13 @@ def writeHtml(version, intObj) @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.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'}) + @html.a(' Acquisition', {'href' => '#body-acquisition', 'class' => 'btn navBtn', 'id' => 'acquisitionButton'}) end @@ -99,6 +104,7 @@ def writeHtml(version, intObj) @html.div(:class => 'block') do @html.em('Report Generated:') @html.text!(Time.new.strftime('%Y-%m-%d %H:%M:%S')) + @html.text!(Time.new.strftime('%Y-%m-%d %H:%M:%S')) end # metadata source @@ -118,6 +124,7 @@ def writeHtml(version, intObj) @html.div do @html.h2('Contacts', {'id' => 'body-contacts', 'class' => 'h2'}) @html.span('', {'style' => 'mso-bookmark:body-contacts'}) + @html.span('', {'style' => 'mso-bookmark:body-contacts'}) @html.div(:class => 'block') do aContacts.each do |hContact| @html.div(:class => 'block') do @@ -126,6 +133,7 @@ def writeHtml(version, intObj) end @html.hr @html.br + @html.br end end end @@ -135,6 +143,7 @@ def writeHtml(version, intObj) @html.div do @html.h2('Metadata Information', {'id' => 'body-metadataInfo', 'class' => 'h2'}) @html.span('', {'style' => 'mso-bookmark:body-metadataInfo'}) + @html.span('', {'style' => 'mso-bookmark:body-metadataInfo'}) @html.div(:class => 'block') do @html.div(:class => 'block') do metaInfoClass.writeHtml(hMetaInfo) @@ -149,6 +158,8 @@ def writeHtml(version, intObj) @html.div do @html.h2('Resource Information', {'id' => 'body-resourceInfo', 'class' => 'h2'}) @html.span('', {'style' => 'mso-bookmark:body-resourceInfo'}) + @html.div(:class => 'block') do + @html.span('', {'style' => 'mso-bookmark:body-resourceInfo'}) @html.div(:class => 'block') do resourceClass.writeHtml(hResourceInfo) end @@ -160,6 +171,7 @@ def writeHtml(version, intObj) @html.div do @html.h2('Data Quality', {'id' => 'body-dataQuality', 'class' => 'h2'}) @html.span('', {'style' => 'mso-bookmark:body-dataQuality'}) + @html.span('', {'style' => 'mso-bookmark:body-dataQuality'}) aDataQuality.each do |hDataQuality| @html.div(:class => 'block') do dataQualityClass.writeHtml(hDataQuality) @@ -173,6 +185,7 @@ def writeHtml(version, intObj) @html.div do @html.h2('Resource Lineage', {'id' => 'body-lineage', 'class' => 'h2'}) @html.span('', {'style' => 'mso-bookmark:body-lineage'}) + @html.span('', {'style' => 'mso-bookmark:body-lineage'}) @html.div(:class => 'block') do aLineage.each do |hLineage| @html.div do @@ -192,6 +205,7 @@ def writeHtml(version, intObj) @html.div do @html.h2('Resource Distribution', {'id' => 'body-distribution', 'class' => 'h2'}) @html.span('', {'style' => 'mso-bookmark:body-distribution'}) + @html.span('', {'style' => 'mso-bookmark:body-distribution'}) @html.div(:class => 'block') do aDistribution.each do |hDistribution| @html.div do @@ -211,6 +225,7 @@ def writeHtml(version, intObj) @html.div do @html.h2('Associated Resources', {'id' => 'body-associatedResource', 'class' => 'h2'}) @html.span('', {'style' => 'mso-bookmark:body-associatedResource'}) + @html.span('', {'style' => 'mso-bookmark:body-associatedResource'}) @html.div(:class => 'block') do aAssociated.each do |hAssociated| @html.div do @@ -230,6 +245,7 @@ def writeHtml(version, intObj) @html.div do @html.h2('Additional Documentation', {'id' => 'body-additionalDocument', 'class' => 'h2'}) @html.span('', {'style' => 'mso-bookmark:body-additionalDocument'}) + @html.span('', {'style' => 'mso-bookmark:body-additionalDocument'}) @html.div(:class => 'block') do aAdditional.each do |hAdditional| @html.div do @@ -249,6 +265,7 @@ def writeHtml(version, intObj) @html.div do @html.h2('Data Dictionaries', {'id' => 'body-dataDictionary', 'class' => 'h2'}) @html.span('', {'style' => 'mso-bookmark:body-dataDictionary'}) + @html.span('', {'style' => 'mso-bookmark:body-dataDictionary'}) @html.div(:class => 'block') do aDictionaries.each do |hDictionary| @html.div do @@ -267,6 +284,7 @@ def writeHtml(version, intObj) @html.div do @html.h2('Funding', {'id' => 'body-funding', 'class' => 'h2'}) @html.span('', {'style' => 'mso-bookmark:body-funding'}) + @html.span('', {'style' => 'mso-bookmark:body-funding'}) @html.div(:class => 'block') do aFunding.each do |hFunding| @html.div do @@ -285,6 +303,7 @@ def writeHtml(version, intObj) @html.div do @html.h2('Metadata Repositories', {'id' => 'body-repository', 'class' => 'h2'}) @html.span('', {'style' => 'mso-bookmark:body-repository'}) + @html.span('', {'style' => 'mso-bookmark:body-repository'}) @html.div(:class => 'block') do aRepositories.each do |hRepository| @html.div do @@ -298,6 +317,18 @@ def writeHtml(version, intObj) end end + unless aAcquisitions.nil? || aAcquisitions.empty? + @html.div do + @html.h2('Acquisitions', {'id' => 'body-acquisition', 'class' => 'h2'}) + @html.span('', {'style' => 'mso-bookmark:body-acquisition'}) + aAcquisitions.each do |hAcquisition| + @html.div(:class => 'block') do + aquisitionClass.writeHtml(hAcquisition) + end + end + end + end + end # body end # writeHtml end # Html_Body diff --git a/lib/adiwg/mdtranslator/writers/simple_html/sections/html_environment.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_environment.rb new file mode 100644 index 00000000..7d99966c --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_environment.rb @@ -0,0 +1,58 @@ +module ADIWG + module Mdtranslator + module Writers + module Simple_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/simple_html/sections/html_event.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_event.rb new file mode 100644 index 00000000..0c4ad78a --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/simple_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 Simple_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.div(:class => 'block') do + @html.div do + @html.summary('Identifier', {'class' => 'h4'}) + @html.div(: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.div(:class => 'block') do + @html.text!.writeHtml(hEvent[:dateTime][:dateTime].to_s) + end + end + + # expectedObjective + unless hEvent[:expectedObjectives].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Expected Objective', {'class' => 'h4'}) + hEvent[:expectedObjectives].each do |objective| + @html.div(:class => 'block') do + @html.div do + @html.summary('Objective', {'class' => 'h5'}) + objectiveClass.writeHtml(objective) + end + end + end + end + end + end + + # relatedPass + unless hEvent[:relatedPass].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Related Pass', {'class' => 'h4'}) + @html.div(:class => 'block') do + passClass.writeHtml(hEvent[:relatedPass]) + end + end + end + end + + #relatedSensor + unless hEvent[:relatedSensors].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Related Sensors', {'class' => 'h4'}) + hEvent[:relatedSensors].each do |instrument| + @html.div(:class => 'block') do + @html.div 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/simple_html/sections/html_instrument.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_instrument.rb new file mode 100644 index 00000000..6afef5a0 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/simple_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 Simple_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.div(:class => 'block') do + @html.div do + @html.summary('Identifier', {'class' => 'h4'}) + @html.div(: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.div(:class => 'block') do + @html.div do + @html.summary('Mounted On', {'class' => 'h4'}) + @html.div(:class => 'block') do + platformClass.writeHtml(hInstrument[:mountedOn]) + end + end + end + end + + # history + unless hInstrument[:histories].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Histories', {'class' => 'h4'}) + hInstrument[:histories].each do |instrumentationEventList| + @html.div(:class => 'block') do + @html.div do + @html.summary('Instrumentation Event List', {'class' => 'h5'}) + instrumentationEventListClass.writeHtml(instrumentationEventList) + end + end + end + end + end + end + + # hostId + unless hInstrument[:hostId].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Host ID', {'class' => 'h4'}) + @html.div(: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/simple_html/sections/html_instrumentationEvent.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_instrumentationEvent.rb new file mode 100644 index 00000000..1beb3b24 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/simple_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 Simple_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.div(:class => 'block') do + @html.div do + @html.summary('Citations', {'class' => 'h4'}) + hInstrumentationEvent[:citations].each do |citation| + @html.div(:class => 'block') do + @html.div 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.div(:class => 'block') do + @html.div do + @html.summary('Extent', {'class' => 'h4'}) + @html.div(: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.div(:class => 'block') do + @html.div do + @html.summary('Revision History', {'class' => 'h4'}) + hInstrumentationEvent[:revisionHistories].each do |revision| + @html.div(:class => 'block') do + @html.div 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/simple_html/sections/html_instrumentationEventList.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_instrumentationEventList.rb new file mode 100644 index 00000000..8decfcc7 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/simple_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 Simple_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.div(:class => 'block') do + @html.div do + @html.summary('Citation', {'class' => 'h4'}) + @html.div(: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.div(:class => 'block') do + @html.div do + @html.summary('Locale', {'class' => 'h4'}) + @html.div(:class => 'block') do + localeClass.writeHtml(hInstrumentationEventList[:locale]) + end + end + end + end + + # constraints + unless hInstrumentationEventList[:constraints].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Constraints', {'class' => 'h4'}) + hInstrumentationEventList[:constraints].each do |constraint| + @html.div(:class => 'block') do + @html.div do + @html.summary('Constraint', {'class' => 'h5'}) + constraintClass.writeHtml(constraint) + end + end + end + end + end + end + + # instrumentationEvent + unless hInstrumentationEventList[:instrumentationEvents].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Instrumentation Events', {'class' => 'h4'}) + hInstrumentationEventList[:instrumentationEvents].each do |instrumentationEvent| + @html.div(:class => 'block') do + @html.div 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/simple_html/sections/html_objective.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_objective.rb new file mode 100644 index 00000000..538222a0 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/simple_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 Simple_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.div(:class => 'block') do + @html.div do + @html.summary('Identifiers', {'class' => 'h4'}) + hObjective[:identifiers].each do |identifier| + @html.div(:class => 'block') do + @html.div 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.div(:class => 'block') do + @html.div 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.div(:class => 'block') do + @html.div 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.div(:class => 'block') do + @html.div do + @html.summary('Extents', {'class' => 'h4'}) + hObjective[:extents].each do |extent| + @html.div(:class => 'block') do + @html.div do + @html.summary('Extent', {'class' => 'h5'}) + extentClass.writeHtml(extent) + end + end + end + end + end + end + + # Occurrence + unless hObjective[:occurrences].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Occurrences', {'class' => 'h4'}) + hObjective[:occurrences].each do |occurrence| + @html.div(:class => 'block') do + @html.div do + @html.summary('Occurrence', {'class' => 'h5'}) + eventClass.writeHtml(occurrence) + end + end + end + end + end + end + + # pass + unless hObjective[:passes].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Passes', {'class' => 'h4'}) + hObjective[:passes].each do |pass| + @html.div(:class => 'block') do + @html.div do + @html.summary('Pass', {'class' => 'h5'}) + passClass.writeHtml(pass) + end + end + end + end + end + end + + # sensingInstrument + unless hObjective[:sensingInstruments].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Sensing Instruments', {'class' => 'h4'}) + hObjective[:sensingInstruments].each do |instrument| + @html.div(:class => 'block') do + @html.div 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/simple_html/sections/html_operation.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_operation.rb new file mode 100644 index 00000000..6ea6e7f1 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/simple_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 Simple_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.div(:class => 'block') do + @html.div do + @html.summary('Citation', {'class' => 'h4'}) + @html.div(:class => 'block') do + citationClass.writeHtml(hOperation[:citation]) + end + end + end + end + + # identifier + unless hOperation[:identifier].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Identifier', {'class' => 'h4'}) + @html.div(: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.div(:class => 'block') do + @html.div do + @html.summary('Objectives', {'class' => 'h4'}) + hOperation[:objectives].each do |objective| + @html.div(:class => 'block') do + @html.div do + @html.summary('Objective', {'class' => 'h5'}) + objectiveClass.writeHtml(objective) + end + end + end + end + end + end + + # parentOperation + unless hOperation[:parentOperation].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Parent Operation', {'class' => 'h4'}) + @html.div(:class => 'block') do + operationClass.writeHtml(hOperation[:parentOperation]) + end + end + end + end + + # childOperation + unless hOperation[:childOperations].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Child Operations', {'class' => 'h4'}) + hOperation[:childOperations].each do |operation| + @html.div(:class => 'block') do + @html.div do + @html.summary('Operation', {'class' => 'h5'}) + operationClass.writeHtml(operation) + end + end + end + end + end + end + + # plan + unless hOperation[:plan].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Plan', {'class' => 'h4'}) + @html.div(:class => 'block') do + planClass.writeHtml(hOperation[:plan]) + end + end + end + end + + # platform + unless hOperation[:platforms].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Platforms', {'class' => 'h4'}) + hOperation[:platforms].each do |platform| + @html.div(:class => 'block') do + @html.div do + @html.summary('Platform', {'class' => 'h5'}) + platformClass.writeHtml(platform) + end + end + end + end + end + end + + # significantEvent + unless hOperation[:significantEvents].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Significant Events', {'class' => 'h4'}) + hOperation[:significantEvents].each do |event| + @html.div(:class => 'block') do + @html.div 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/simple_html/sections/html_pass.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_pass.rb new file mode 100644 index 00000000..131f3c42 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/simple_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 Simple_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.div(:class => 'block') do + @html.div do + @html.summary('Identifier', {'class' => 'h4'}) + @html.div(:class => 'block') do + identifierClass.writeHtml(hPass[:identifier]) + end + end + end + end + + # extent + unless hPass[:extent].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Extent', {'class' => 'h4'}) + @html.div(:class => 'block') do + extentClass.writeHtml(hPass[:extent]) + end + end + end + end + + # relatedEvent + unless hPass[:relatedEvents].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Related Events', {'class' => 'h4'}) + hPass[:relatedEvents].each do |event| + @html.div(:class => 'block') do + @html.div 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/simple_html/sections/html_plan.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_plan.rb new file mode 100644 index 00000000..d3ee434c --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/simple_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 Simple_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.div(:class => 'block') do + @html.div do + @html.summary('Citation', {'class' => 'h4'}) + @html.div(:class => 'block') do + citationClass.writeHtml(hPlan[:citation]) + end + end + end + end + + # planOperation + unless hPlan[:planOperations].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Operations', {'class' => 'h4'}) + hPlan[:planOperations].each do |operation| + @html.div(:class => 'block') do + @html.div do + @html.summary('Operation', {'class' => 'h5'}) + operationClass.writeHtml(operation) + end + end + end + end + end + end + + # satisfiedRequirement + unless hPlan[:satisfiedRequirements].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Requirements', {'class' => 'h4'}) + hPlan[:satisfiedRequirements].each do |requirement| + @html.div(:class => 'block') do + @html.div 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/simple_html/sections/html_platform.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_platform.rb new file mode 100644 index 00000000..5162664e --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/simple_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 Simple_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.div(:class => 'block') do + @html.div do + @html.summary('Citation', {'class' => 'h4'}) + @html.div(:class => 'block') do + citationClass.writeHtml(hPlatform[:citation]) + end + end + end + end + + # identifier + unless hPlatform[:identifier].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Identifier', {'class' => 'h4'}) + @html.div(: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.div(:class => 'block') do + @html.div do + @html.summary('Sponsors', {'class' => 'h4'}) + hPlatform[:sponsors].each do |responsibility| + @html.div(:class => 'block') do + @html.div do + @html.summary('Responsibility', {'class' => 'h5'}) + responsibilityClass.writeHtml(responsibility) + end + end + end + end + end + end + + # instrument + unless hPlatform[:instruments].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Instruments', {'class' => 'h4'}) + hPlatform[:instruments].each do |instrument| + @html.div(:class => 'block') do + @html.div do + @html.summary('Instrument', {'class' => 'h5'}) + instrumentClass.writeHtml(instrument) + end + end + end + end + end + end + + # history + unless hPlatform[:history].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('History', {'class' => 'h4'}) + hPlatform[:history].each do |instrumentationEventList| + @html.div(:class => 'block') do + @html.div 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/simple_html/sections/html_requestedDate.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_requestedDate.rb new file mode 100644 index 00000000..73e85058 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_requestedDate.rb @@ -0,0 +1,33 @@ +require_relative 'html_datetime' + +module ADIWG + module Mdtranslator + module Writers + module Simple_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/simple_html/sections/html_requirement.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_requirement.rb new file mode 100644 index 00000000..ac2d0c75 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/simple_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 Simple_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.div(:class => 'block') do + @html.div do + @html.summary('Citation', {'class' => 'h4'}) + @html.div(:class => 'block') do + citationClass.writeHtml(hRequirement[:citation]) + end + end + end + end + + # identifier + unless hRequirement[:identifier].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Identifier ', {'class' => 'h4'}) + @html.div(:class => 'block') do + identifierClass.writeHtml(hRequirement[:identifier]) + end + end + end + end + + # requestor + unless hRequirement[:requestors].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Requestors', {'class' => 'h4'}) + hRequirement[:requestors].each do |requestor| + @html.div(:class => 'block') do + @html.div do + @html.summary('Requestor', {'class' => 'h5'}) + operationClass.writeHtml(requestor) + end + end + end + end + end + end + + # recipient + unless hRequirement[:recipients].empty? + @html.div(:class => 'block') do + @html.div do + @html.summary('Recipients', {'class' => 'h4'}) + hRequirement[:recipients].each do |recipient| + @html.div(:class => 'block') do + @html.div 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.div(:class => 'block') do + @html.div do + @html.summary('Requested Date ', {'class' => 'h4'}) + @html.div(: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.div(:class => 'block') do + @html.div do + @html.summary('Satisfied Plans', {'class' => 'h4'}) + hRequirement[:satisfiedPlans].each do |plan| + @html.div(:class => 'block') do + @html.div 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/simple_html/sections/html_revision.rb b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_revision.rb new file mode 100644 index 00000000..34cf7ff1 --- /dev/null +++ b/lib/adiwg/mdtranslator/writers/simple_html/sections/html_revision.rb @@ -0,0 +1,55 @@ +require_relative 'html_responsibility' +require_relative 'html_date' + +module ADIWG + module Mdtranslator + module Writers + module Simple_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.div(:class => 'block') do + @html.div do + @html.summary('Responsible Party', {'class' => 'h4'}) + @html.div(:class => 'block') do + responsibilityClass.writeHtml(hRevision[:responsibleParty]) + end + end + end + end + + # dateInfo + unless hRevision[:dateInfo].empty? + @html.div(:class => 'block') do + @html.div 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 diff --git a/test/helpers/mdJson_hash_functions.rb b/test/helpers/mdJson_hash_functions.rb index bb1203d0..e34d11a2 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 @@ -474,6 +479,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 773c8d51..b96dc6f1 100644 --- a/test/helpers/mdJson_hash_objects.rb +++ b/test/helpers/mdJson_hash_objects.rb @@ -223,6 +223,458 @@ 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.200-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.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: "CID001" + }] + } + ], + recipient: [ + { + 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: "CID003" + }] + } + ], + priority: "critical", + requestedDate: { + requestedDateOfCollection: "2019-06-10", + latestAcceptableDate: "2019-06-13" + }, + expiryDate: "2019-06-10T15:50:00", + satisfiedPlan: [ + { + planId: "plan ID", + planType: "linear", + status: "accepted", + citation: { + title: "citation title" + }, + planOperation: [], + satisfiedRequirement: [] + } + ] + } + ], + 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: [ + { + 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", + 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 @@ -804,6 +1256,7 @@ def imageDescription # data dictionary ------------------------- def dataDictionary { + dictionaryId: 'dictionary ID', citation: { title: 'dictionary title', date: [ @@ -1379,7 +1832,8 @@ def metadata associatedResource: [], additionalDocumentation: [], funding: [], - dataQuality: [] + dataQuality: [], + acquisition: [] } end diff --git a/test/writers/mdJson/tc_mdjson_metadata.rb b/test/writers/mdJson/tc_mdjson_metadata.rb index 4c0d4fd7..a1a02032 100644 --- a/test/writers/mdJson/tc_mdjson_metadata.rb +++ b/test/writers/mdJson/tc_mdjson_metadata.rb @@ -22,6 +22,11 @@ class TestWriterMdJsonMetadata < TestWriterMdJsonParent mdHash[:metadata][:dataQuality] << TDClass.build_dataQuality mdHash[:metadata][:dataQuality] << TDClass.build_dataQuality + # data quality [] + mdHash[:metadata][:dataQuality] = [] + mdHash[:metadata][:dataQuality] << TDClass.build_dataQuality + mdHash[:metadata][:dataQuality] << TDClass.build_dataQuality + # lineage [] mdHash[:metadata][:resourceLineage] = [] mdHash[:metadata][:resourceLineage] << TDClass.build_lineage @@ -47,6 +52,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