class ADIWG::Mdtranslator::Writers::Iso19110::Multiplicity
Public Class Methods
new(xml, responseObj)
click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19110/classes/class_multiplicity.rb, line 32 def initialize(xml, responseObj) @xml = xml @hResponseObj = responseObj end
Public Instance Methods
writeXML(hAttribute)
click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19110/classes/class_multiplicity.rb, line 37 def writeXML(hAttribute) # xml for iso classes Multiplicity and MultiplicityRange # in 19110 cardinality is expressed as multiplicity, a min/max range # Multiplicity is not defined in the documentation, only inferred from the XSD # max cardinality ----------------- # ISO 19110-2 rule # ... "If this is an attribute or operation, the default cardinality is 1" # there is no hint if this refers to min or max of the range, I chose max # I assume this means the attribute can occur only once in the entity # I set the internal object mustBeUnique = true as default # I assume false would describe something like a repeating tag in an XML file # min cardinality ----------------- # mdJson allows setting flag to allow nulls as attribute values # I set this into minimum cardinality # issue --------------------------- # min cardinality refers to the attribute values # max cardinality refers to the attribute instantiation # perhaps one of these should not be carried in ISO19110 minCard = 1 maxCard = 9 if hAttribute[:allowNull] minCard = 0 end if hAttribute[:mustBeUnique] maxCard = 1 end # xml for iso classes Multiplicity and MultiplicityRange @xml.tag!('gco:Multiplicity') do @xml.tag!('gco:range') do @xml.tag!('gco:MultiplicityRange') do @xml.tag!('gco:lower') do @xml.tag!('gco:Integer', minCard) end @xml.tag!('gco:upper') do if maxCard == 1 @xml.tag!('gco:UnlimitedInteger', 1) else @xml.tag!('gco:UnlimitedInteger', {'isInfinite'=>'true'}, 9) end end end end end # gco:Multiplicity tag end