Class: InterMine::PathQuery::SingleValueConstraint

Inherits:
Object
  • Object
show all
Includes:
AttributeConstraint, Coded, PathFeature
Defined in:
lib/intermine/query.rb

Constant Summary collapse

CANONICAL_OPS =
{
    "EQ" => "=",
    "==" => "=",
    "NE" => "!=",
    "LT" => "<",
    "GT" => ">",
    "LE" => "<=",
    "GE" => ">="
}

Instance Attribute Summary collapse

Attributes included from Coded

#code, #op

Attributes included from PathFeature

#path

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AttributeConstraint

#coerce_value, #validate_value

Instance Attribute Details

#valueObject

Returns the value of attribute value.



1179
1180
1181
# File 'lib/intermine/query.rb', line 1179

def value
  @value
end

Class Method Details

.valid_opsObject



1191
1192
1193
# File 'lib/intermine/query.rb', line 1191

def self.valid_ops 
    return %w{= == > < >= <= != CONTAINS LIKE EQ NE GT LT LE GE}
end

Instance Method Details

#to_elemObject



1195
1196
1197
1198
1199
1200
# File 'lib/intermine/query.rb', line 1195

def to_elem
    elem = super
    attributes = {"value" => @value}
    elem.add_attributes(attributes)
    return elem
end

#validateObject



1202
1203
1204
1205
1206
1207
# File 'lib/intermine/query.rb', line 1202

def validate 
    super
    @op = SingleValueConstraint::CANONICAL_OPS[@op] || @op
    @value = coerce_value(@value)
    validate_value(@value)
end