ffi - true - false response of query from prolog in C# -
i using swi- prolog c# front end. want to display whether the query executed or not in mmessagebox. need answer in 'true' or 'false' comes in prolog console. here code:
static void main(string[] args) { environment.setenvironmentvariable("swi_home_dir", @"c:\program files\swipl"); environment.setenvironmentvariable("path", @"c:\program files\swipl"); environment.setenvironmentvariable("path", @"c:\program files\swipl\bin"); string p1 = @"c:\program files\swipl\try9.pl"; string[] p = { "-q", "-f", p1 }; plengine.initialize(p); try { plquery q = new plquery("get(sam,age(26))."); // here need responce of prolog engine of above query whether true or false . console.readline(); } catch (plexception ex) { console.writeline("exception handeled" + ex.message); } }
let me state first of have never used swi-prolog, may not you're looking for. able read documentation , samples... :)
i found page: http://www.lesta.de/prolog/swiplcs/generated/html/m_sbssw_swiplcs_plquery__ctor.htm
and sounds might want following. or @ least maybe helps started?
try { using (var q = new plquery("get(sam,age(26)).")) { if (q.solutions == null) // not sure if possible? { console.writeline("query did not run successfully."); } else { console.writeline("query returned {0} items.", q.solutions.count()); } } } catch (plexception ex) { console.writeline("exception handled: " + ex.message); } console.readline();
Comments
Post a Comment