A relation between two Frames in FrameNet.
The IDs of the Frames in this relation with the owning Frame.
The type of the relation (e.g., “Inherits from”, “Is Inherited by”)
Load one or more instances from the specified doc
(a LibXML::XML::Document parsed from
a FrameNet frame).
# File lib/frame_net/frame/relation.rb, line 20
def self::from_frame_data( doc )
return doc.find( '//fn:frameRelation' ).map do |node|
new do |relation|
relation.type = node['type']
relation.frame_ids = node.find( './fn:relatedFrame' ).map {|node| node['ID']}
end
end
end
Create a new instance and yield it to the block if one is given.
# File lib/frame_net/frame/relation.rb, line 31
def initialize
@type = nil
@frame_ids = []
yield( self ) if block_given?
end
Returns true
if there are no frames with this relation.
# File lib/frame_net/frame/relation.rb, line 59
def empty?
return self.frame_ids.empty?
end
Look up and return the related FrameNet::Frames for this Relation.
# File lib/frame_net/frame/relation.rb, line 53
def frames
return self.frame_ids.map {|id| FrameNet::Frame.load_by_id(id) }
end