Class: DatagroutConduit::LogicNamespace
- Inherits:
-
Object
- Object
- DatagroutConduit::LogicNamespace
- Defined in:
- lib/datagrout_conduit/namespaces/logic.rb
Instance Method Summary collapse
- #constrain(rule:, tag: nil) ⇒ Object
- #export_cell(params = {}) ⇒ Object
- #forget(handles: nil, pattern: nil) ⇒ Object
- #hydrate(params = {}) ⇒ Object
- #import_cell(params = {}) ⇒ Object
-
#initialize(client) ⇒ LogicNamespace
constructor
A new instance of LogicNamespace.
- #query(question: nil, patterns: nil, limit: nil) ⇒ Object
- #reflect(entity: nil, summary_only: false) ⇒ Object
- #remember(statement: nil, facts: nil, tag: nil) ⇒ Object
- #tabulate(params = {}) ⇒ Object
- #worlds(params = {}) ⇒ Object
Constructor Details
#initialize(client) ⇒ LogicNamespace
Returns a new instance of LogicNamespace.
5 6 7 |
# File 'lib/datagrout_conduit/namespaces/logic.rb', line 5 def initialize(client) @client = client end |
Instance Method Details
#constrain(rule:, tag: nil) ⇒ Object
38 39 40 41 42 |
# File 'lib/datagrout_conduit/namespaces/logic.rb', line 38 def constrain(rule:, tag: nil) params = { "rule" => rule } params["tag"] = tag if tag dg_call("logic.constrain", params) end |
#export_cell(params = {}) ⇒ Object
54 55 56 |
# File 'lib/datagrout_conduit/namespaces/logic.rb', line 54 def export_cell(params = {}) dg_call("logic.export", params) end |
#forget(handles: nil, pattern: nil) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/datagrout_conduit/namespaces/logic.rb', line 29 def forget(handles: nil, pattern: nil) raise ArgumentError, "must provide handles or pattern" unless handles || pattern params = {} params["handles"] = handles if handles params["pattern"] = pattern if pattern dg_call("logic.forget", params) end |
#hydrate(params = {}) ⇒ Object
50 51 52 |
# File 'lib/datagrout_conduit/namespaces/logic.rb', line 50 def hydrate(params = {}) dg_call("logic.hydrate", params) end |
#import_cell(params = {}) ⇒ Object
58 59 60 |
# File 'lib/datagrout_conduit/namespaces/logic.rb', line 58 def import_cell(params = {}) dg_call("logic.import", params) end |
#query(question: nil, patterns: nil, limit: nil) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/datagrout_conduit/namespaces/logic.rb', line 19 def query(question: nil, patterns: nil, limit: nil) raise ArgumentError, "must provide question or patterns" unless question || patterns params = {} params["question"] = question if question params["patterns"] = patterns if patterns params["limit"] = limit if limit dg_call("logic.query", params) end |
#reflect(entity: nil, summary_only: false) ⇒ Object
44 45 46 47 48 |
# File 'lib/datagrout_conduit/namespaces/logic.rb', line 44 def reflect(entity: nil, summary_only: false) params = { "summary_only" => summary_only } params["entity"] = entity if entity dg_call("logic.reflect", params) end |
#remember(statement: nil, facts: nil, tag: nil) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/datagrout_conduit/namespaces/logic.rb', line 9 def remember(statement: nil, facts: nil, tag: nil) raise ArgumentError, "must provide statement or facts" unless statement || facts params = {} params["statement"] = statement if statement params["facts"] = facts if facts params["tag"] = tag if tag dg_call("logic.remember", params) end |
#tabulate(params = {}) ⇒ Object
62 63 64 |
# File 'lib/datagrout_conduit/namespaces/logic.rb', line 62 def tabulate(params = {}) dg_call("logic.tabulate", params) end |
#worlds(params = {}) ⇒ Object
66 67 68 |
# File 'lib/datagrout_conduit/namespaces/logic.rb', line 66 def worlds(params = {}) dg_call("logic.worlds", params) end |