Class: ConceptQL::Nodes::TemporalNode

Inherits:
BinaryOperatorNode show all
Defined in:
lib/conceptql/nodes/temporal_node.rb

Overview

Base class for all temporal nodes

Subclasses must implement the where_clause method which should probably return a proc that can be executed as a Sequel “virtual row” e.g. Proc.new { l.end_date < r.start_date }

Direct Known Subclasses

After, Before, During, StartedBy

Constant Summary

Constants inherited from Node

Node::KNOWN_TYPES

Instance Attribute Summary

Attributes inherited from Node

#values

Instance Method Summary collapse

Methods inherited from BinaryOperatorNode

#children, #display_name, #graph_it

Methods inherited from Node

#arguments, #children, #columns, #date_columns, #evaluate, #initialize, #select_it, #stream, #types

Constructor Details

This class inherits a constructor from ConceptQL::Nodes::Node

Instance Method Details

#inclusive?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/conceptql/nodes/temporal_node.rb', line 18

def inclusive?
  options[:inclusive]
end

#query(db) ⇒ Object



11
12
13
14
15
16
# File 'lib/conceptql/nodes/temporal_node.rb', line 11

def query(db)
  db.from(db.from(Sequel.expr(left.evaluate(db)).as(:l))
            .join(Sequel.expr(right.evaluate(db)).as(:r), [:person_id])
            .where(where_clause)
            .select_all(:l))
end