class InterMine::PathQuery::LoopConstraint
Attributes
loopPath[RW]
Public Class Methods
valid_ops()
click to toggle source
# File lib/intermine/query.rb 1251 def self.valid_ops 1252 return ["IS", "IS NOT"] 1253 end
xml_ops()
click to toggle source
# File lib/intermine/query.rb 1255 def self.xml_ops 1256 return { "IS" => "=", "IS NOT" => "!=" } 1257 end
Public Instance Methods
to_elem()
click to toggle source
Calls superclass method
InterMine::PathQuery::Coded#to_elem
# File lib/intermine/query.rb 1259 def to_elem 1260 elem = super 1261 elem.add_attribute("op", LoopConstraint.xml_ops[@op]) 1262 elem.add_attribute("loopPath", @loopPath) 1263 return elem 1264 end
validate()
click to toggle source
# File lib/intermine/query.rb 1266 def validate 1267 if @path.elements.last.is_a?(InterMine::Metadata::AttributeDescriptor) 1268 raise ArgumentError, "#{self.class.name}s must be on objects or references to objects" 1269 end 1270 if @loopPath.elements.last.is_a?(InterMine::Metadata::AttributeDescriptor) 1271 raise ArgumentError, "loopPaths on #{self.class.name}s must be on objects or references to objects" 1272 end 1273 model = @path.model 1274 cdA = model.get_cd(@path.end_type) 1275 cdB = model.get_cd(@loopPath.end_type) 1276 if !(cdA == cdB) && !cdA.subclass_of?(cdB) && !cdB.subclass_of?(cdA) 1277 raise ArgumentError, "Incompatible types in #{self.class.name}: #{@path} -> #{cdA} and #{@loopPath} -> #{cdB}" 1278 end 1279 end