Python API¶
The core of the IDP-Z3 software is a Python component available on Pypi. The following code illustrates how to invoke it.
from idp_engine import IDP, model_expand
kb = IDP.parse("path/to/file.idp")
T, S = kb.get_blocks("T, S")
for model in model_expand(T,S):
print(model)
Besides the methods and class available in the main block, idp_engine
exposes the IDP class
, described below.
IDP class¶
The IDP
class exposes the following methods:
- parse(file_or_string)
This class method parses the IDP source file in the file or string.
- get_blocks(names)
This instance method returns the list of blocks whose names are given in a comma-separated string.
- execute()
This instance methods executes the main() procedure block in the IDP source file.