![Page 1: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/1.jpg)
AI/ES(Artificial Intelligence / Expert System)
Visual Prolog: Part 1
2012. Fall.SME., Pukyong Nat’l Univ.
Kim, Minsoo
![Page 2: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/2.jpg)
Contents• Brief History• The IDE - Overview• Message Windows
![Page 3: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/3.jpg)
Brief History• Logic Programming Language: Prolog
– 1984, Alain Colmerauer– Declarative Programming Language
• Turbo Prolog for PC– Borland corp.
• Visual Prolog– PDC: the Prolog Development Company– Object-Oriented, Strongly Typed, GUI and
IDE
![Page 4: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/4.jpg)
The IDE - Overview• VIP v7.3 PE
– Task Window, Task Menu– Message Window
![Page 5: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/5.jpg)
The IDE - Overview• Sample Project
– New Project• Project Name: ch01p01
![Page 6: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/6.jpg)
The IDE - Overview• Project Tree
– TaskWindow, main.manifest, main.pack
![Page 7: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/7.jpg)
The IDE - Overview• Build Empty Project
– Build Build
![Page 8: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/8.jpg)
The IDE - Overview• Generated Files
– main.cl, main.pro
![Page 9: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/9.jpg)
The IDE - Overview• Run Empty Project
– Build Execute
![Page 10: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/10.jpg)
The IDE - Overview• Create a Form
– Project Tree: highlight root ‘ch01p01’– File New in Existing Package…
![Page 11: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/11.jpg)
The IDE - Overview• Form Edit Window
– With Controls, Layout, Properties window
![Page 12: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/12.jpg)
The IDE - Overview• Form Files
– *.cl, *.frm, *.i, *.pro
![Page 13: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/13.jpg)
The IDE - Overview• Enable the Task Menu Option
– TaskWindow TaskMenu.mnu
![Page 14: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/14.jpg)
The IDE - Overview• Save / Build Project Again / Add All
![Page 15: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/15.jpg)
The IDE - Overview• Run Project Again
– [File New] is enabled– Do nothing menu option
![Page 16: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/16.jpg)
The IDE - Overview• Add Event Listener to menu option
– TaskWindow.win Open
![Page 17: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/17.jpg)
The IDE - Overview• Check the codes
– addMenuItemListener / onFileNew
![Page 18: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/18.jpg)
The IDE - Overview• Change the code for onFileNew
– Remove underscore from ‘_Source’– Remember ending period!
• Rebuild / Execute Project– File New
![Page 19: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/19.jpg)
The IDE - Overview• Add Mouse Listener to Form
– sampleForm.frm Open Properties/Event
![Page 20: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/20.jpg)
The IDE - Overview• Change the code for onMouseDown
– Remove underscore from ‘_Source’, ‘_Point’
– Case Sensitive!
• Save, Rebuild and Run
![Page 21: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/21.jpg)
Message Windows• vpiCommonDialogs class
– note/1, note/2– error/1, error/2– messageBox/6– ask/2, ask/3– getString/3– listSelect/5– getFileName/6
![Page 22: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/22.jpg)
Message Windows• Add new MenuItem to Task Window
– TaskMenu.mnu Messages/WriteNote1
![Page 23: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/23.jpg)
Message Windows• Add Event Listener to menu option
– TaskWindow.win id_messages
![Page 24: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/24.jpg)
Message Windows• Check the codes
– onMessagesWritenote1
![Page 25: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/25.jpg)
Message Windows• Change code
(onMessagesWritenote1)
• Save, Build and Run
![Page 26: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/26.jpg)
Message Windows• Try note/2
– TaskMenu.mnu Messages/WriteNote2– TaskWindow.win
onMessagesWritenote2– Change code Save/Build/Execute
![Page 27: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/27.jpg)
Message Windows• Including class library
– TaskWindow.pro Open
![Page 28: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/28.jpg)
Message Windows• Include vpiCommonDialogs class
library
• Change codes
![Page 29: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/29.jpg)
Message Windows• Try error/1, error/2
– TaskMenu.mnu Messages/WriteError1,2– TaskWindow.win
onMessagesWriteError1,2– Change code Save/Build/Execute
![Page 30: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/30.jpg)
Message Windows• Try messageBox/6
– Title String, Message, Icon(0~3), Buttons(0~5), Default Button(0~2), Suspending(0,1)
– Change code Save/Build/Execute
![Page 31: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/31.jpg)
Message Windows• Try ask/2, ask/3
– (Title String), Question Line, Answer List– Max 3 answers (0~2)
![Page 32: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/32.jpg)
Message Windows• Try getString/3
– Title String, Question, Preset Answer• Try listSelect/5
– Title String, Choice List, Selected Index (0~), Selected String, Selected Index
![Page 33: AI/ES (Artificial Intelligence / Expert System) Visual Prolog: Part 1 2012. Fall. SME., Pukyong Nat ’ l Univ. Kim, Minsoo](https://reader030.vdocuments.mx/reader030/viewer/2022032605/56649e725503460f94b70863/html5/thumbnails/33.jpg)
Message Windows• Try getFileName/6
– Preset File Extension, List of File Filters (Pairs), Title String, Special Windows Properties List, Open Folder, Selected Files List