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.
1135 1136 1137 |
# File 'lib/intermine/query.rb', line 1135 def loopPath @loopPath end |
Class Method Details
.valid_ops ⇒ Object
1137 1138 1139 |
# File 'lib/intermine/query.rb', line 1137 def self.valid_ops return ["IS", "IS NOT"] end |
.xml_ops ⇒ Object
1141 1142 1143 |
# File 'lib/intermine/query.rb', line 1141 def self.xml_ops return { "IS" => "=", "IS NOT" => "!=" } end |
Instance Method Details
#to_elem ⇒ Object
1145 1146 1147 1148 1149 1150 |
# File 'lib/intermine/query.rb', line 1145 def to_elem elem = super elem.add_attribute("op", LoopConstraint.xml_ops[@op]) elem.add_attribute("loopPath", @loopPath) return elem end |
#validate ⇒ Object
1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 |
# File 'lib/intermine/query.rb', line 1152 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 |