Property allows for typed and referenced properties from external resources to be attached to 'Phylogeny', 'Clade', and 'Annotation'. The value of a property is its mixed (free text) content. Attribute 'datatype' indicates the type of a property and is limited to xsd-datatypes (e.g. 'xsd:string', 'xsd:boolean', 'xsd:integer', 'xsd:decimal', 'xsd:float', 'xsd:double', 'xsd:date', 'xsd:anyURI'). Attribute 'applies_to' indicates the item to which a property applies to (e.g. 'node' for the parent node of a clade, 'parent_branch' for the parent branch of a clade). Attribute 'id_ref' allows to attached a property specifically to one element (on the xml-level). Optional attribute 'unit' is used to indicate the unit of the property. An example: <property datatype="xsd:integer" ref="NOAA:depth" applies_to="clade" unit="METRIC:m"> 200 </property>
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 948 def applies_to=(str) unless ['phylogeny','clade','node','annotation','parent_branch','other'].include?(str) puts "Warning: #{str} is not in the list of allowed values." end @applies_to = str end
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 933 def datatype=(str) #@todo add unit test or maybe remove, if assume that xml is valid. unless ['xsd:string','xsd:boolean','xsd:decimal','xsd:float','xsd:double', 'xsd:duration','xsd:dateTime','xsd:time','xsd:date','xsd:gYearMonth', 'xsd:gYear','xsd:gMonthDay','xsd:gDay','xsd:gMonth','xsd:hexBinary', 'xsd:base64Binary','xsd:anyURI','xsd:normalizedString','xsd:token', 'xsd:integer','xsd:nonPositiveInteger','xsd:negativeInteger', 'xsd:long','xsd:int','xsd:short','xsd:byte','xsd:nonNegativeInteger', 'xsd:unsignedLong','xsd:unsignedInt','xsd:unsignedShort', 'xsd:unsignedByte','xsd:positiveInteger'].include?(str) raise "Warning: #{str} is not in the list of allowed values." end @datatype = str end
Converts elements to xml representation. Called by PhyloXML::Writer class.
# File lib/bio/db/phyloxml/phyloxml_elements.rb, line 956 def to_xml #@todo write unit test for this raise "ref is an required element of property" if @ref.nil? raise "datatype is an required element of property" if @datatype.nil? raise "applies_to is an required element of property" if @applies_to.nil? property = LibXML::XML::Node.new('property') Writer.generate_xml(property, self, [ [:attr, 'ref'], [:attr, 'unit'], [:attr, 'datatype'], [:attr, 'applies_to'], [:attr, 'id_ref']]) property << @value if @value != nil return property end
Generated with the Darkfish Rdoc Generator 2.