Home | Trees | Indices | Help |
|
---|
|
Python interface to XSB Prolog (http://xsb.sf.net)
|
|||
|
|||
|
|||
|
|||
|
|
Constructor method Usage: xsb( path, args ) path - path to XSB executable (default: 'xsb') args - command line arguments (default: '--nobanner --quietload') self.engine becomes pexpect spawn instance of XSB Prolog shell Raises: XSBExecutableNotFound |
Loads module into self.engine Usage: instance.load( path ) path - path to module file Raises: XSBCompileError |
Queries current engine state Usage: instance.query( query ) query - usual XSB Prolog query (example: 'likes( X, Y )') Returns: True - if yes/no query and answer is yes False - if yes/no query and answer is no List of dictionaries - if normal query. Dictionary keys are returned variable names. Example: >>> instance.query( 'likes( Person, Food )' ) [{'Person': 'john', 'Food': 'curry'}, {'Person': 'sandy', 'Food': 'mushrooms'}] Raises: XSBQueryError |
Private method for constructing a result printing query. Usage: instance._printer( lvars, query ) lvars - list of logical variables to print query - query containing the variables to be printed Returns: string of the form 'query, writeln( res( 'VarName1', VarName1 ) ) ... writeln( res( 'VarNameN', VarNameN ) ),nl,fail.' |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Aug 1 18:44:56 2012 | http://epydoc.sourceforge.net |