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.



1065
1066
1067
# File 'lib/intermine/query.rb', line 1065

def value
  @value
end

Class Method Details

.valid_opsObject



1077
1078
1079
# File 'lib/intermine/query.rb', line 1077

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

Instance Method Details

#to_elemObject



1081
1082
1083
1084
1085
1086
# File 'lib/intermine/query.rb', line 1081

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

#validateObject



1088
1089
1090
1091
1092
1093
# File 'lib/intermine/query.rb', line 1088

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