Ask Your Question
0

How troubleshoot ERROR: toplevel: Undefined procedure ?!

asked 2013-02-03 09:21:38 -0600

آمال gravatar image

updated 2013-02-17 11:41:36 -0600

Hello, I Follow: Knowledge Processing For Autonomous Robot

I write a simple knowledge base as a test.pl in prolog file, in my package then I try to query it

prolog -f test.pl

and I get a top level error !

?- cup(cup0).
ERROR: toplevel: Undefined procedure: cup/1 (DWIM could not correct goal)

Edit

amal@amal-HP-G62-Notebook-PC:~$ prolog -f test.pl
Welcome to SWI-Prolog (Multi-threaded, 32 bits, Version 5.10.4)
Copyright (c) 1990-2011 University of Amsterdam, VU Amsterdam
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.

For help, use ?- help(Topic). or ?- apropos(Word).

?- cup(cup0).
ERROR: toplevel: Undefined procedure: cup/1 (DWIM could not correct goal)
?-

and that is what in test.pl

cup(cup0).
dairyProduct(milk1).
meatProduct(ham2).
cupboard(cupboard3).
refrigerator(fridge4).
perishable(Prod)            :- dairyProduct(Prod), meatProduct(Prod).
storagePlaceFor(Loc, Item)  :- refrigerator(Loc), perishable(Item).
storagePlaceFor(Loc, Item)  :- cupboard(Loc), cup(Item).
searchForIn(Item,Loc)       :- storagePlaceFor(Loc, Item).

any suggestion ?!

Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2013-02-03 19:39:17 -0600

moritz gravatar image

updated 2013-02-17 18:47:10 -0600

This is not related to KnowRob but a problem with Prolog or your test files. You'll need to check if test.pl contains the correct predicate definitions, no syntax errors (did you get any error messages when starting Prolog?) and if the lines with definitions of e.g. cup(cup0) start with :-

EDIT When I just copy/paste your file and try it, it works for me. System configuration seems to be the same, maybe you need to check why the first output line seems to be missing in your case (..compiled...)

tenorth@lapradig6:~$ prolog -f test.pl 
% [...]/test.pl compiled 0.00 sec, 4,112 bytes
Welcome to SWI-Prolog (Multi-threaded, 32 bits, Version 5.10.4)
Copyright (c) 1990-2011 University of Amsterdam, VU Amsterdam
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.

For help, use ?- help(Topic). or ?- apropos(Word).

?- cup(cup0).
true.
edit flag offensive delete link more

Comments

I edit my Q

آمال gravatar imageآمال ( 2013-02-17 11:42:01 -0600 )edit

I am still do not get what I have to do now ! Thanks

آمال gravatar imageآمال ( 2013-02-18 15:40:33 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-02-03 09:21:38 -0600

Seen: 5,271 times

Last updated: Feb 17 '13