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.



1087
1088
1089
# File 'lib/intermine/query.rb', line 1087

def value
  @value
end

Class Method Details

.valid_opsObject



1099
1100
1101
# File 'lib/intermine/query.rb', line 1099

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

Instance Method Details

#to_elemObject



1103
1104
1105
1106
1107
1108
# File 'lib/intermine/query.rb', line 1103

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

#validateObject



1110
1111
1112
1113
1114
1115
# File 'lib/intermine/query.rb', line 1110

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