• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

pass parameters from java to prolog

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the code below using swi Prolog and I made a interface using jframe in netbeans.

In this jframe I have textbox for answer and another textbox for grade.i want take answer from textbox and pass to start predicate in prolog to process answer. Can anyone tell me how I can do that? The only thing that I know is how to call predicate.

start(Answer,Total_grade):-
Question1 = "Define computer?",
Word_list1 = ["software","operatingsystem"],
Word_list2 = ["hardware","tools"],
Msg = "Write your answers ",
write(Question1),nl,
write(Msg),nl,nl,
read(Answer),
string_lower(Answer,Low_answer),
split_string(Low_answer," ,.()-_"," ,.()-_", Answer_in_list),
find(Answer_in_list,Word_list1,Grade1),
find(Answer_in_list,Word_list2,Grade2),
Total_grade is Grade1 + Grade2,
nl,write("Your grade is : "), write(Total_grade),nl.
 
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know, I'm afraid. Does that Prolog implementation not have documentation on how to interact with Java?

A long time I used https://sourceforge.net/projects/jlogic/, which is written in Java, and thus easy to use within Java code; with that I could probably help.
 
alaa alrehily
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Moores wrote:I don't know, I'm afraid. Does that Prolog implementation not have documentation on how to interact with Java?

A long time I used https://sourceforge.net/projects/jlogic/, which is written in Java, and thus easy to use within Java code; with that I could probably help.



I found documentation to call prolog in java but did not know how to sent answer to prolog.
 
reply
    Bookmark Topic Watch Topic
  • New Topic