src.ergoai package

Submodules

src.ergoai.ergoai module

ErgoAI module interface – contains convenience functions.

json_to_ergo

Converts a JSON file to an ERGO file.

query_ergoai

Queries an ERGO knowledge base/graph using ErgoAI.

src.ergoai.ergoai.json_to_ergo(json_file, output_file=None)[source]

Converts a JSON file to an ERGO file.

Note

  • If a JSON file needs to be converted to an ERGO file, this function MUST be called first before calling query_ergoai().

  • If a KnowledgeBase or KnowledgeGraph object is passed, then the object is updated with the ERGO file path.

Danger

  • This function can only be called/used once per python session. If you need to convert multiple JSON files to ERGO files, you must start a new session each time, otherwise subsequent calls to json_to_ergo() will cause the current python session to crash.

Usage example:
>>> from src.ergoai.ergoai import json_to_ergo
>>> ergo_file = json_to_ergo(json_file="cse_courses.json")
>>> print(ergo_file)
cse_courses.ergo
Parameters:
Return type:

str

Returns:

Path to the output ERGO file.

src.ergoai.ergoai.query_ergoai(knowledge, query)[source]

Queries an ERGO knowledge base/graph using ErgoAI.

Warning

  • This function is still a work in progress.

Parameters:
Return type:

Union[str, Any]

Returns:

Results of the query.

Module contents