class Mexico::FileSystem::Layer
A layer (or tier) in an transcription or annotation document.
Attributes
document[RW]
Public Class Methods
new(args={})
click to toggle source
data type content structure
# File lib/mexico/file_system/layer.rb, line 47 def initialize(args={}) args.each do |k,v| if self.respond_to?("#{k}=") send("#{k}=", v) end @properties = Mexico::FileSystem::PropertyMap.new end if properties.nil? properties = ::Mexico::FileSystem::PropertyMap.new(key: 'layerProperties') end end
Public Instance Methods
add_property(prop)
click to toggle source
# File lib/mexico/file_system/layer.rb, line 102 def add_property(prop) properties.properties << prop end
after_parse()
click to toggle source
overrides method in ROXML callback after xml parsing process, to store this element in the document cache.
# File lib/mexico/file_system/layer.rb, line 69 def after_parse ::Mexico::FileSystem::FiestaDocument.store(self.identifier, self) end
identifier=(new_id)
click to toggle source
# File lib/mexico/file_system/layer.rb, line 26 def identifier=(new_id) @identifier = Mexico::Util::to_xml_id(new_id) end
items()
click to toggle source
# File lib/mexico/file_system/layer.rb, line 62 def items @document.items.select{|i| i.layers.include?(self) } end
items_form_a_forest?()
click to toggle source
# File lib/mexico/file_system/layer.rb, line 85 def items_form_a_forest? # I need precise semantics what kinds of item links # are supposed to model an actual parent-child-relationship. self.items.each do |item| puts "sources size for items %s: %i" % [item.identifier, item.sources.size] return false if item.sources.size > 1 end return true end
items_form_an_edgeless_graph?()
click to toggle source
# File lib/mexico/file_system/layer.rb, line 96 def items_form_an_edgeless_graph? self.items.each do |item| return false if item.item_links.size > 1 end end
predecessor_layers()
click to toggle source
returns all layers that are linked to this layer such that this layer is the target, and the result layer is the source.
# File lib/mexico/file_system/layer.rb, line 75 def predecessor_layers document.layer_connectors.select{|c| c.target==self}.collect{|c| [c.source, c.role]} end
successor_layers()
click to toggle source
returns all layers that are linked to this layer such that this layer is the source, and the result layer is the target.
# File lib/mexico/file_system/layer.rb, line 81 def successor_layers document.layer_connectors.select{|c| c.source==self}.collect{|c| [c.target, c.role]} end