Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

Both sides previous revision Poprzednia wersja
Nowa wersja
Poprzednia wersja
pl:miw:miw08_ruleruntimeg_2 [2008/04/22 10:16]
gjn
pl:miw:miw08_ruleruntimeg_2 [2008/07/01 20:17]
gjn
Linia 1: Linia 1:
-====== Opis ====== ​ 
-Damian Janicki <​janicki.damian@gmail.com>​ 
- 
-Investigate runtime integration aspects, mainly semi-automatical building of a GUI for Prolog programs possibilities XPCE, Static QT/Gtk, Gtk-Server, Java (Swing), Eclipse (SWT) 
- 
-    * input: XPCE, QT, GTK, GtkServer, Java etc., SWI Prolog documentation 
- 
-    * output: Java/JPL, Feasibility study, a prototype. 
- 
-    * integration options for Java: JPL (SWI),​Logtalk (OO Prolog), architecture:​ MVC 
-    * approach: 2 -3 app. cases, M prolog, V in Java, C -> JPL/​Logtalk,​ e.g. ready M in Prolog, build V in Java: Car ES, opposite: ready MV i Java, build M in Prolog, make it work with the V 
- 
-====== Spotkania ====== ​ 
-===== 08.03.04 ===== 
-  * **MISSED** prototyp dla car, tj. ask_question 
- 
-===== 080311 ===== 
-  * problems, problems 
- 
- 
-===== 080318 ===== 
-  * przerobienie car na wywołanie V w Javie 
-  * jpl pod linuxem na wiki do czwartku 
- 
- 
- 
-===== 080401 ===== 
- ​MISSED 
- 
- 
- 
- 
- 
-===== 080415 ===== 
-  * model z [[hekate:​varda]],​ view w java, funkcjonalność z ''​varda_model.pl''​ (ew. innych) ma być udostępniania przez  jako model, do tego jest view w javie 
- 
-funkcje (proste reqestery, radiobox): 
- ​split,​ -> na ile, ktore, jakie nowe czesci 
-finalize -> na ile att, ktore property 
-(new att) 
- ​sar. ​ show the ARD diagram, can be used sar(File), 
- ​shi. ​ show the ARD history (TPH), can be used shi(File), 
- ​sha. ​ show the TPH and ARD combined, with can be used sha(File), 
- 
-setof([A,​B],​ard_depend(A,​B),​L). 
-<​code>​ 
- ​arp. ​ write ARD model in Prolog, can be used arp(File), 
-       the file can be subsequently consulted to recreate the model, 
-</​code>​ 
-sprawdz rezultatu!!!! 
- 
-===== 080429 ===== 
-  * varda 
- 
-====== Projekt ====== 
-Oryginalny system ([[pl:​prolog:​prolog_lab:​prolog_lab_2#​tematprosty_system_ekspertowy]]) 
- 
-=== Wersja 1 === 
- 
-== Predykat tworzący dialog, za pomocą, którego pobieramy informacje od użytkownika == 
-<code prolog> 
-show_yes_no_dialog(Tekst,​Response) :- 
- jpl_new(array(class([java,​lang],​['​String'​])),​['​yes','​no'​],​ ArrayRef), 
- jpl_get(ArrayRef,​0,​ArrayPosRef),​ 
- jpl_get('​javax.swing.JOptionPane',​ '​YES_NO_OPTION',​ YesNoRef), 
- jpl_get('​javax.swing.JOptionPane',​ '​QUESTION_MESSAGE',​ QuestionRef),​ 
- jpl_call('​javax.swing.JOptionPane',​ '​showOptionDialog',​ [@(null), 
-        ​Tekst, ​ 
-        '​Question',​ 
-        ​YesNoRef,​ 
-        ​QuestionRef,​ 
-        ​@(null), ​ 
-        ​ArrayRef, ​ 
-        ​ArrayPosRef], ​ 
-        ​RetVal),​ 
- interpret(RetVal,​Response). 
- 
-interpret(1,​no). ​ 
-interpret(0,​yes). ​ 
-</​code>​ 
- 
-== Predykat tworzący dialog, który wyświetla informacje o uszkodzeniach == 
-<code prolog> 
-show_explain_dialog(Tekst) :- 
- jpl_call('​javax.swing.JOptionPane',​ '​showMessageDialog',​ [@('​null'​),​Tekst],​_). 
-</​code>​ 
- 
- 
-== Predykat ask_question == 
-Przed zmianami: 
-<code prolog> 
-ask_question(starter_was_ok) :- 
-   ​write('​When you first started trying to start the car,'​),​nl,​ 
-   ​write('​did the starter crank the engine normally? '),nl. 
-</​code>​ 
- 
-Po zmianach (korzysta z Java): 
-<code prolog> 
-ask_question(starter_was_ok,​Res) :- 
- show_yes_no_dialog('​When you first started trying to start the car did the starter crank the engine normally?',​Res). 
-</​code>​ 
- 
-== Predykat explain ​ == 
-Przed zmianami: 
-<code prolog> 
-explain(wrong_gear) :- 
-   nl, 
-   ​write('​Check that the gearshift is set to Park or Neutral.'​),​nl,​ 
-   ​write('​Try jiggling the gearshift lever.'​),​nl. 
-</​code>​ 
- 
-Po zmianach: 
-<code prolog> 
-explain(wrong_gear) :- 
- show_explain_dialog('​Check that the gearshift is set to Park or Neutral.Try jiggling the gearshift lever.'​). 
-</​code>​ 
- 
-== Predykat user_says: == 
-Przed: 
-<code prolog> 
-user_says(Q,​A) :- \+ stored_answer(Q,​_),​ 
-                  ask_question(Q),​ 
-                  get_yes_or_no(Response),​ 
-                  asserta(stored_answer(Q,​Response)),​ 
-                  Response = A. 
-</​code>​ 
-Po: 
-<code prolog> 
-user_says(Q,​A) :- \+ stored_answer(Q,​_),​ 
-                  ask_question(Q,​Response),​ 
-   asserta(stored_answer(Q,​Response)),​ 
-                  Response = A. 
-</​code>​ 
- 
-V: Interfejs w Javie 
-== Funkcja wywolujaca prologa == 
-<code java> 
-private void startDiagnose(){ 
- Query queryConsult = new Query("​consult",​ new Atom("​pl/​carJPL.pl"​));​ 
- queryConsult.query();​ 
-  
- Query start = new Query("​start"​);​ 
- start.query();​ 
-} 
-</​code>​ 
- 
-=== Wersja 2 === 
-W stosunku do wersji pierwszej deklaracje dialogów z pytaniem do użytkownika znajduja się w klasie MessageDialogs. Dzieki temu poziomu prologu wołana jest tylko jedna funkcja: 
- 
-Klasa MessageDialogs 
-<code java> 
-import javax.swing.JOptionPane;​ 
- 
-public class MessageDialogs { 
-  
- public static String showYesNoDialog(String A_strMessage) 
- { 
- String strRetVal = new String(""​);​ 
- Object[] options = {"​Yes",​ "​No"​};​ 
- int nRetVal = JOptionPane.showOptionDialog( null,​ 
- A_strMessage,​ 
- "​Question",​ 
- JOptionPane.YES_NO_OPTION,​ 
- JOptionPane.QUESTION_MESSAGE,​ 
- null, 
- options,​ 
- options[0]);​ 
-  
- if(nRetVal == 1) 
- strRetVal = "​yes";​ 
- else if (nRetVal == 0) 
- strRetVal = "​no";​ 
-  
- return strRetVal; 
- } 
-  
- public static void showInformation(String A_strMessage){ 
- JOptionPane.showMessageDialog(null,​ A_strMessage);​ 
- } 
-} 
-</​code>​ 
- 
-Predykat show_yes_no_dialog : 
-<code prolog> 
-show_yes_no_dialog(Tekst,​Response) :-  
- jpl_call('​dialog.MessageDialogs',​ '​showYesNoDialog',​ [Tekst], Response). 
-</​code>​ 
- 
- 
-[[pl:​miw:​miw08_ruleruntimeg_2:​pliki|Źródła projektu]] 
- 
-====== Sprawozdanie ====== 
- 
- 
-====== Materiały ====== 
- 
- 
-[[http://​www.swi-prolog.org/​packages/​jpl/​|JPL - Prolog/Java interface]] 
- 
- 
- 
- 
- 
  
pl/miw/miw08_ruleruntimeg_2.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0