Class: CiaoWorker

CiaoWorker(ciao_root_URL)

new CiaoWorker(ciao_root_URL)

Class for the Ciao Worker, able to run the Ciao queries, like use_bundle, use_module_from_string and run queries.

Parameters:
Name Type Description
ciao_root_URL string
Source:

Methods

async_() → {CiaoPromiseProxy}

In charge of communications with Worker by messages. It sends the function and its arguments to be executed by the Ciao Worker.

Source:
Returns:

Ciao promise with the result of the call.

Type
CiaoPromiseProxy

bootInfo() → {CiaoPromiseProxy}

Show boot information in a JS console (this forces boot).

Source:
Returns:
  • Result of the call to the worker.
Type
CiaoPromiseProxy

ensure_boot()

Ensure boot.

Source:

ensure_loadEng()

Ensure the engine is loaded correctly.

Source:

get_ciao_root() → {CiaoPromiseProxy}

Get the Ciao root path.

Source:
Returns:
  • Result of the call to the worker.
Type
CiaoPromiseProxy

get_stats() → {CiaoPromiseProxy}

Get the stats of the latest call.

Source:
Returns:
  • Result of the call to the worker.
Type
CiaoPromiseProxy

query(template, goal) → {CiaoPromiseProxy}

Run the query passed as a parameter and obtain all solutions.

Parameters:
Name Type Description
template string

Template term for solutions (null if same as goal).

goal string

Query to be executed.

Source:
Returns:
  • Result of the call to the worker.
Type
CiaoPromiseProxy

query_end() → {CiaoPromiseProxy}

End the query process stopping its decision tree.

Source:
Returns:
  • Result of the call to the worker.
Type
CiaoPromiseProxy

query_ok() → {CiaoPromiseProxy}

Tells whether the query has started correctly and has more solutions or not.

Source:
Returns:
  • Result of the call to the worker.
Type
CiaoPromiseProxy

query_one_begin(template, goal) → {CiaoPromiseProxy}

Begins the query passed as parameter and obtains one solution. The decision tree stays awake and waits for user's input.

Parameters:
Name Type Description
template string

Template term for solutions (null if same as goal).

goal string

Query to be launched.

Source:
Returns:
  • Result of the call to the worker.
Type
CiaoPromiseProxy

query_one_next() → {CiaoPromiseProxy}

Obtain the next solution for the query previously launched.

Source:
Returns:
  • Result of the call to the worker.
Type
CiaoPromiseProxy

readFile(path) → {CiaoPromiseProxy}

Read file specified in path parameter.

Parameters:
Name Type Description
path string

Path of the file to read.

Source:
Returns:
  • Result of the call to the worker.
Type
CiaoPromiseProxy

readStderr() → {CiaoPromiseProxy}

Capture the standard error of the most recent query/ies.

Source:
Returns:
  • Result of the call to the worker.
Type
CiaoPromiseProxy

readStdout() → {CiaoPromiseProxy}

Capture the output of the most recent query/ies.

Source:
Returns:
  • Result of the call to the worker.
Type
CiaoPromiseProxy

terminate()

Terminate the worker w. It does not finish its operations; it is stopped at once.

Source:
Returns:

undefined

use_bundle(name) → {CiaoPromiseProxy}

Use the bundle passed as a parameter, loading the engine if needed.

Parameters:
Name Type Description
name string

Name of the bundle.

Source:
Returns:
  • Result of the call to the worker.
Type
CiaoPromiseProxy

use_module_from_string(path, contents) → {CiaoPromiseProxy}

Use the module defined by the string passed a parameter, saving it into a file. This allows for modules written by the user to be used in a Ciao playground.

Parameters:
Name Type Description
path string

Path to save the contents.

contents string

Contents of the module.

Source:
Returns:
  • Result of the call to the worker.
Type
CiaoPromiseProxy

writeFile(path, contents) → {CiaoPromiseProxy}

Write a string in a file.

Parameters:
Name Type Description
path string

Path of the file to write.

contents string

String of the contents to write in the file.

Source:
Returns:
  • Result of the call to the worker.
Type
CiaoPromiseProxy