Method: InterMine::PathQuery::LoopConstraint#validate

Defined in:
lib/intermine/query.rb

#validateObject



1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
# File 'lib/intermine/query.rb', line 1266

def validate
    if @path.elements.last.is_a?(InterMine::::AttributeDescriptor)
        raise ArgumentError, "#{self.class.name}s must be on objects or references to objects"
    end
    if @loopPath.elements.last.is_a?(InterMine::::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