Class: ConceptQL::Nodes::Complement
- Defined in:
- lib/conceptql/nodes/complement.rb
Constant Summary
Constants inherited from Node
Instance Attribute Summary
Attributes inherited from Node
Instance Method Summary collapse
Methods inherited from PassThru
Methods inherited from Node
#arguments, #children, #columns, #evaluate, #initialize, #select_it, #sql, #stream, #types
Constructor Details
This class inherits a constructor from ConceptQL::Nodes::Node
Instance Method Details
#query(db) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/conceptql/nodes/complement.rb', line 6 def query(db) child = children.first child.types.map do |type| positive_query = db.from(child.evaluate(db)) .select(:criterion_id) .exclude(:criterion_id => nil) .where(:criterion_type => type.to_s) query = db.from(make_table_name(type)) .exclude(make_type_id(type) => positive_query) db.from(select_it(query, type)) end.inject do |union_query, q| union_query.union(q, all: true) end end |