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.



1175
1176
1177
# File 'lib/intermine/query.rb', line 1175

def value
  @value
end

Class Method Details

.valid_opsObject



1187
1188
1189
# File 'lib/intermine/query.rb', line 1187

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

Instance Method Details

#to_elemObject



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

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

#validateObject



1198
1199
1200
1201
1202
1203
# File 'lib/intermine/query.rb', line 1198

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