Relation

class
Superclass
Object
Extended With
Loggability

A relation between two Frames in FrameNet.

Attributes

frame_ids[RW]

The IDs of the Frames in this relation with the owning Frame.

type[RW]

The type of the relation (e.g., “Inherits from”, “Is Inherited by”)

Public Class Methods

anchor
from_frame_data( doc )

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
anchor
new() { |self| ... }

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

Public Instance Methods

anchor
empty?()

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
anchor
frames()

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