Class: InterMine::PathQuery::LoopConstraint
- Inherits:
-
Object
- Object
- InterMine::PathQuery::LoopConstraint
- Includes:
- Coded, PathFeature
- Defined in:
- lib/intermine/query.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#loopPath ⇒ Object
Returns the value of attribute loopPath.
Attributes included from Coded
Attributes included from PathFeature
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#loopPath ⇒ Object
Returns the value of attribute loopPath.
1157 1158 1159 |
# File 'lib/intermine/query.rb', line 1157 def loopPath @loopPath end |
Class Method Details
.valid_ops ⇒ Object
1159 1160 1161 |
# File 'lib/intermine/query.rb', line 1159 def self.valid_ops return ["IS", "IS NOT"] end |
.xml_ops ⇒ Object
1163 1164 1165 |
# File 'lib/intermine/query.rb', line 1163 def self.xml_ops return { "IS" => "=", "IS NOT" => "!=" } end |
Instance Method Details
#to_elem ⇒ Object
1167 1168 1169 1170 1171 1172 |
# File 'lib/intermine/query.rb', line 1167 def to_elem elem = super elem.add_attribute("op", LoopConstraint.xml_ops[@op]) elem.add_attribute("loopPath", @loopPath) return elem end |
#validate ⇒ Object
1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 |
# File 'lib/intermine/query.rb', line 1174 def validate if @path.elements.last.is_a?(InterMine::Metadata::AttributeDescriptor) raise ArgumentError, "#{self.class.name}s must be on objects or references to objects" end if @loopPath.elements.last.is_a?(InterMine::Metadata::AttributeDescriptor) raise ArgumentError, "loopPaths on #{self.class.name}s must be on objects or references to objects" end model = @path.model cdA = model.get_cd(@path.end_type) cdB = model.get_cd(@loopPath.end_type) if !(cdA == cdB) && !cdA.subclass_of?(cdB) && !cdB.subclass_of?(cdA) raise ArgumentError, "Incompatible types in #{self.class.name}: #{@path} -> #{cdA} and #{@loopPath} -> #{cdB}" end end |