Element

class
Superclass
Object

Frame elements of a FrameNet::Frame

References: - framenet.icsi.berkeley.edu/fndrupal/glossary#frame-element

Constants

XPATH

The xpath of the FEs of a frame

Attributes

abbrev[RW]

The Element's abbreviation

background_color[RW]

The Element's background color when displayed in a visual medium

bgColor[RW]

The Element's background color when displayed in a visual medium

bgColor=[RW]

The Element's background color when displayed in a visual medium

cDate[RW]

The Element's creation time as a Time object

cDate=[RW]

The Element's creation time as a Time object

coreType[RW]

The Element's core type

core_type[RW]

The Element's core type

creation_time[RW]

The Element's creation time as a Time object

definition[RW]

The FrameNet::Definition associated with this Element (if one exists)

fgColor[RW]

The Element's foreground color when displayed in a visual medium

fgColor=[RW]

The Element's foreground color when displayed in a visual medium

foreground_color[RW]

The Element's foreground color when displayed in a visual medium

id[RW]

The Element's id

name[RW]

The Element's name

semantic_type[RW]

The FrameNet::SemanticType associated with this Element (if one exists)

Public Class Methods

anchor
from_fe_node( node )

Construct an Element from the given node (a LibXML::XML::Node).

# File lib/frame_net/frame/element.rb, line 25
def self::from_fe_node( node )
        return new do |elem|
                elem.id               = Integer( node['ID'] )
                elem.name             = node['name'].to_sym
                elem.core_type        = node['coreType']
                elem.abbrev           = node['abbrev']
                elem.creation_time    = FrameNet.parse_time( node['cDate'] )
                elem.foreground_color = node['fgColor']
                elem.background_color = node['bgColor']

                if def_node = node.find_first( './fn:definition' )
                        elem.definition = FrameNet::Definition.from_node( def_node )
                end

                if st_node = node.find_first( './fn:semType' )
                        elem.semantic_type = FrameNet::SemanticType.from_node( st_node )
                end
        end
end
anchor
from_frame_data( doc )

Construct one or more Elements from the FEs of the specified doc (a LibXML::XML::Document parsed from the XML for a frame)

# File lib/frame_net/frame/element.rb, line 19
def self::from_frame_data( doc )
        return doc.find( XPATH ).map {|node| self.from_fe_node(node) }
end
anchor
new() { |self| ... }

Create a new frame Element. If a block is given, yield the new object to it so its attributes can be set.

# File lib/frame_net/frame/element.rb, line 48
def initialize # :yields: self
        @id               = id
        @name             = name
        @core_type        = core_type

        @abbrev           = nil
        @creation_time    = nil
        @foreground_color = nil
        @background_color = nil

        @definition       = nil
        @semantic_type    = nil

        yield( self ) if block_given?
end

Public Instance Methods

anchor
inspect()

Return the Element as a human-readable string suitable for debugging.

# File lib/frame_net/frame/element.rb, line 114
def inspect
        return %Q{#<%p:%#016x %s%s(%s) [%d] "%s">} % [
                self.class,
                self.object_id * 2,
                self.name || "(Unnamed)",
                self.semantic_type ? ":#{self.semantic_type.name}" : '',
                self.core_type,
                self.id || 0,
                self.definition ? self.definition.stripped_content : '',
        ]
end