Class: ConceptQL::Nodes::Recall

Inherits:
Node
  • Object
show all
Defined in:
lib/conceptql/nodes/recall.rb

Overview

Mimics using a variable that has been set via “define” node

The idea is that a concept might be very complex and it helps to break that complex concept into a set of sub-concepts to better understand it.

This node will look for a sub-concept that has been created through the “define” node and will fetch the results cached in the corresponding table

Constant Summary

Constants inherited from Node

Node::COLUMNS

Instance Attribute Summary

Attributes inherited from Node

#values

Instance Method Summary collapse

Methods inherited from Node

#arguments, #children, #evaluate, #initialize, #select_it, #sql, #stream

Constructor Details

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

Instance Method Details

#columns(query, local_type) ⇒ Object



31
32
33
# File 'lib/conceptql/nodes/recall.rb', line 31

def columns(query, local_type)
  COLUMNS
end

#query(db) ⇒ Object

Behind the scenes we simply fetch all rows from the temp table that corresponds to the name fed to “recall”

We also set the @types variable by pulling the type information out of the hash piggybacking on the database connection.

TODO: This might be an issue since we might need the type information before we call #query. Probably time to reevaluate how we’re caching the type information.



22
23
24
25
26
27
28
29
# File 'lib/conceptql/nodes/recall.rb', line 22

def query(db)
  # We're going to call evaluate on definition to ensure the definition
  # has been created.  We were running into odd timing issues when
  # drawing graphs where the recall node was being drawn before definition
  # was drawn.
  definition.evaluate(db)
  db.from(table_name)
end

#typesObject



35
36
37
# File 'lib/conceptql/nodes/recall.rb', line 35

def types
  definition.types
end