Class: ConceptQL::CLI

Inherits:
Thor
  • Object
show all
Includes:
Sequelizer
Defined in:
lib/conceptql/cli.rb

Instance Method Summary collapse

Instance Method Details

#fake_graph(file) ⇒ Object



46
47
48
49
50
51
52
53
54
55
# File 'lib/conceptql/cli.rb', line 46

def fake_graph(file)
  require_relative 'graph'
  require_relative 'tree'
  require_relative 'graph_nodifier'
  ConceptQL::Graph.new(criteria_from_file(file),
     dangler: true,
     tree: ConceptQL::Tree.new(nodifier: ConceptQL::GraphNodifier.new)
  ).graph_it('/tmp/graph')
  system('open /tmp/graph.pdf')
end

#run_statement(statement_file) ⇒ Object



38
39
40
41
42
43
# File 'lib/conceptql/cli.rb', line 38

def run_statement(statement_file)
  q = ConceptQL::Query.new(db(options), criteria_from_file(statement_file))
  puts q.query.sql
  puts q.statement.to_yaml
  pp q.execute
end

#show_and_tell_db(conceptql_id) ⇒ Object



70
71
72
73
74
# File 'lib/conceptql/cli.rb', line 70

def show_and_tell_db(conceptql_id)
  result = fetch_conceptql(conceptql_id, options)
  puts "Concept: #{result[:label]}"
  show_and_tell(result[:statement].to_hash, options, result[:label])
end

#show_and_tell_file(file) ⇒ Object



64
65
66
# File 'lib/conceptql/cli.rb', line 64

def show_and_tell_file(file)
  show_and_tell(criteria_from_file(file), options)
end

#show_db_graph(conceptql_id) ⇒ Object



77
78
79
80
# File 'lib/conceptql/cli.rb', line 77

def show_db_graph(conceptql_id)
  result = fetch_conceptql(conceptql_id, options)
  graph_it(result[:statement].to_hash, db, result[:label])
end

#show_graph(file) ⇒ Object



58
59
60
# File 'lib/conceptql/cli.rb', line 58

def show_graph(file)
  graph_it(criteria_from_file(file))
end