AIAI Presentation

Download Report

Transcript AIAI Presentation

Using DCGs for Large Tasks
Web Site Synthesis
Logic Programming
School of Informatics, University of Edinburgh
1
Conventional Site Management
Editor
CISA
Web site
Logic Programming
School of Informatics, University of Edinburgh
2
Synthesis-based Site Management
Research institute
ontology
Web site
generator
CISA
Web site
CISA knowledge base
Editor
Logic Programming
School of Informatics, University of Edinburgh
3
Economics of Content Management
Time to benefit (3 months for CISA site)
Conventional editing
Effort
Automated synthesis
Time
Logic Programming
School of Informatics, University of Edinburgh
4
CISA Knowledge Base
Contains facts and DCG rules like this:
person('David Robertson',
'http://www.dai.ed.ac.uk/groups/ssp/members/dave.htm',
[staff]).
research_group('Software Systems and Processes',
'http://www.dai.ed.ac.uk/groups/ssp').
postal_address -->
[ref('http://www.informatics.ed.ac.uk','Division of Informatics'), \\,
ref('http://www.ed.ac.uk','University of Edinburgh'),\\,
‘Appleton Tower', \\,
'Edinburgh', \\,
'UK', \\].
Logic Programming
School of Informatics, University of Edinburgh
5
Site Generator
gen_site :phrase(group_site, Pages),
gen_pages(Pages).
gen_pages([Page|T]) :gen_page(Page),
gen_pages(T).
gen_pages([]).
gen_page(page(File, Terms)) :html2terms(Chars, Terms),
tell(File),
put_string(Chars),
told.
Connects to
DCG
Generates
HTML string
Opens file
Writes string to output
Closes file
Logic Programming
School of Informatics, University of Edinburgh
6
Top-level DCG for site
group_site -->
{…Goals defining main page IDs and a navigator structure…},
main_pages(Main, NavTerm),
{…Goals generating lists of events...}.
event_pages(EventLists, NavTerm),
{…Goals generating list of seminar talks…},
abstract_pages(TalksList).
Logic Programming
School of Informatics, University of Edinburgh
7
Generating Main Site Pages
main_pages([(Type,File)|T], Navigator) -->
{Page =.. [Type,Navigator,Contents,[]],
call(Page)},
[page(File, Contents)],
main_pages(T, Navigator).
main_pages([], _) --> [].
Logic Programming
School of Informatics, University of Edinburgh
8
Home Page
index(Navigator) -->
{start_page(Start, []),
phrase(home_body(Navigator), Body),
style_sheet(Style, []),
page_background(BGr)},
[Start,
head([title('CISA Home Page'), Style]),
body(BGr, Body),
end].
home_body(Navigator) -->
standard_heading(Navigator),
group_focus,
standard_foot('<hr>').
Logic Programming
School of Informatics, University of Edinburgh
9
…Down to Definitions Close to HTML
standard_heading(Navigator) -->
[
'<table width = 100%>
<tr>
<td>
<center>
<h1>Centre for Intelligent Systems and their Applications</h1>
</center>
</td>
<td valign=top><a href="http://www.ed.ac.uk"><img
src="img/logo/uoe-mono-100x100.gif" border=0 alt="UoE" name="UoE"
align=right hspace=10 width=100 height=100></a>
</td>
</tr>
</table>
<p>',
Navigator, \\, \\, \\].
Logic Programming
School of Informatics, University of Edinburgh
10