To jest stara wersja strony!


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 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).

arp. write ARD model in Prolog, can be used arp(File),

     the file can be subsequently consulted to recreate the model,

sprawdz rezultatu!!!!

Projekt

Oryginalny system (tematprosty_system_ekspertowy)

Wersja 1

Predykat tworzący dialog, za pomocą, którego pobieramy informacje od użytkownika
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). 
Predykat tworzący dialog, który wyświetla informacje o uszkodzeniach
show_explain_dialog(Tekst) :-
		jpl_call('javax.swing.JOptionPane', 'showMessageDialog', [@('null'),Tekst],_).
Predykat ask_question

Przed zmianami:

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.

Po zmianach (korzysta z Java):

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).
Predykat explain

Przed zmianami:

explain(wrong_gear) :-
   nl,
   write('Check that the gearshift is set to Park or Neutral.'),nl,
   write('Try jiggling the gearshift lever.'),nl.

Po zmianach:

explain(wrong_gear) :-
	show_explain_dialog('Check that the gearshift is set to Park or Neutral.Try jiggling the gearshift lever.').
Predykat user_says:

Przed:

user_says(Q,A) :- \+ stored_answer(Q,_),
                  ask_question(Q),
                  get_yes_or_no(Response),
                  asserta(stored_answer(Q,Response)),
                  Response = A.

Po:

user_says(Q,A) :- \+ stored_answer(Q,_),
                  ask_question(Q,Response),
		  asserta(stored_answer(Q,Response)),
                  Response = A.

V: Interfejs w Javie

Funkcja wywolujaca prologa
private void startDiagnose(){
	Query queryConsult = new Query("consult", new Atom("pl/carJPL.pl"));
	queryConsult.query();
 
	Query start = new Query("start");
	start.query();
}

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

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);
	}
}

Predykat show_yes_no_dialog :

show_yes_no_dialog(Tekst,Response) :- 
		jpl_call('dialog.MessageDialogs', 'showYesNoDialog', [Tekst], Response).

Źródła projektu

Sprawozdanie

Materiały

pl/miw/miw08_ruleruntimeg_2.1208252690.txt.gz · ostatnio zmienione: 2019/06/27 15:58 (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