web application maker: a declarative web database tool miguel calejo, mário araújo, sónia mota...
TRANSCRIPT
Web Application Maker:a declarative web database tool
Miguel Calejo, Mário Araújo, Sónia Mota Araújo, Nuno Soares, Rui MaranteDeclarativa, Portugal
http://www.declarativa.com
DM-UA, 24-10-2003 Copyright Declarativa 2003 2
http://www.declarativa.com
Declarativa, 24-Oct-2003
• 31/2 years, 5 engineers, tools
• Two areas of declarative development– InterProlog: Java JFC/Swing + Prolog
– WAM: browser+Active Server Pages+SQL Server
• Contracts with XSB Inc./DoD (USA); ME, CVRVV, CRAT, Servisoft (Portugal)
DM-UA, 24-10-2003 Copyright Declarativa 2003 3
http://www.declarativa.com
More about Declarativa
• Microsoft Certified Partner...– ...with a grain of salt
• Incubated at Servisoft– Early Web Information System adopter
– Administrative support
– Internet
– Building
DM-UA, 24-10-2003 Copyright Declarativa 2003 4
http://www.declarativa.com
WAM projects: DoD/XSB, Inc.
DM-UA, 24-10-2003 Copyright Declarativa 2003 7
http://www.declarativa.com
Spaghetti code in the internet era
Developer
DBMSCGIBrowserUser
… (HTML)… (JScript at client)… (JScript at server)… (SQL)
…<form … action='…'>Customer <input … name='name'>Phone #<input … name='phone'></form>…
…<script>if (isNaN(phone)) alert('Not a number');</script>…
…<%while (! results.EOF) …%>…
SELECT name, phoneFROM customer
customer
name varchar(50)phone int
DM-UA, 24-10-2003 Copyright Declarativa 2003 8
http://www.declarativa.com
More declarative scenario
… WAM Objects
Developer
DBMS CGI Browser User
customer name varchar(50) phone int
… r = new WAMRow(customer); …
"Phone #", "Customer",…
DM-UA, 24-10-2003 Copyright Declarativa 2003 9
http://www.declarativa.com
Enter: declarative web development
• Web Application Maker (WAM)– Model-driven, based on SQL Server– Given a DB schema with triggers, constraints, etc...– ...get web interface with user profiles, etc.– Flexible: GUI generators exposed to the developer
• Follow any software engineering method, .... – ...and use the resulting database
• Part of Declarativa’s Web Information Systems Toolkit
DM-UA, 24-10-2003 Copyright Declarativa 2003 10
http://www.declarativa.com
The WAM pictureServers
Customcode
ApplicationDB
WAMmodel
WAM“interpreter”
SQL ServerIIS (ASP engine)
Workstation
BrowserMyApplication
DM-UA, 24-10-2003 Copyright Declarativa 2003 11
http://www.declarativa.com
WAM “Equations”
• Web interface = WAM(DB Meta Information + WAMmodel) + CustomASP pages using WAM objects+ other pages
• Default web interface =WAM(DB Meta Inf. + Default WAMmodel)
• An acceptable interface working sooner is better than a fancy one later!
DM-UA, 24-10-2003 Copyright Declarativa 2003 12
http://www.declarativa.com
WAMmodel
• Information added to the database schema to allow reasonable GUI generation– WAM_PRESENTATION
– WAM_LIST, WAM_LIST_COLUMN
– WAM_LOOKUP_COLUMN
– WAM_PROCEDURE_CALL
• 10 tables total
DM-UA, 24-10-2003 Copyright Declarativa 2003 13
http://www.declarativa.com
WAM: a web GUI fragment factory
• Entry page
• (Regular) Lists, List columns
• Detail lists– Stand-alone
– Embbeded
• Search Criteria
• Rows, Row fields, Lookup fields
• Context path, procedure callers, error reporting
DM-UA, 24-10-2003 Copyright Declarativa 2003 14
http://www.declarativa.com
Fragment example: lookups
Pick from master list
See master row direct lookup
inverse lookup
DM-UA, 24-10-2003 Copyright Declarativa 2003 15
http://www.declarativa.com
Demo – “Northwind” database
DM-UA, 24-10-2003 Copyright Declarativa 2003 16
http://www.declarativa.com
Entry page
A default entry page, with all lists plus direct navigation to “interesting” tables
Uses WAM_TABLE_GROUP
DM-UA, 24-10-2003 Copyright Declarativa 2003 17
http://www.declarativa.com
A user-configurable list
Automatic joins, both detail master and master detail
DM-UA, 24-10-2003 Copyright Declarativa 2003 18
http://www.declarativa.com
Row with embedded list and 3 LKs
DM-UA, 24-10-2003 Copyright Declarativa 2003 19
http://www.declarativa.com
Relational navigation extreme
DM-UA, 24-10-2003 Copyright Declarativa 2003 20
http://www.declarativa.com
Editing the WAMmodel
• SQL client tools, or...
• WAMAdmin– A WAM application – Standard lists and rows for all WAMmodel tables
– Some utilities
– Complemented by runtime “edition mode”, adequate for administrators/power users
– Try it at http://showroom.declarativa.com
DM-UA, 24-10-2003 Copyright Declarativa 2003 22
http://www.declarativa.com
Editing the WAMmodel for a row
DM-UA, 24-10-2003 Copyright Declarativa 2003 24
http://www.declarativa.com
Back to the WAM equations
• So far we’ve seen...
• Web interface = WAM(DB Meta Information + WAMmodel)
+ Custom ASP pages using WAM objects+ other pages
• Default web interface =WAM(DB Meta Inf. + Default WAMmodel)
DM-UA, 24-10-2003 Copyright Declarativa 2003 26
http://www.declarativa.com
An ASP invoked from a WAM list
DM-UA, 24-10-2003 Copyright Declarativa 2003 27
http://www.declarativa.com
Beyond WAM – WIS Toolkit
• Making Web Information Systems real • The WIS Tookit contains WAM plus...
– “Calibrated” HTML printing
– Automatic email/fax communications
– Template-based document generator
– Automatic URL validation
– Extraction of structured data from (HTML) organizational knowledge documents
DM-UA, 24-10-2003 Copyright Declarativa 2003 28
http://www.declarativa.com
Web Information Systems Toolkit
DM-UA, 24-10-2003 Copyright Declarativa 2003 29
http://www.declarativa.com
WAM - Near Future
• Upcoming features– External documents/workflow
• Glean link structure, extended navigation
– PocketPC (with WAM’s WAP interface)– Full historical data, with interface– More data type-dependent formatting
• FLUX – “FleXible Logical Updates” project– “establish a flexible declarative language for the
specification of dynamic knowledge, and to apply it to realistic application domains”
– Universidade Nova de Lisboa + Declarativa– WAMmodel manipulation in Prolog
DM-UA, 24-10-2003 Copyright Declarativa 2003 30
http://www.declarativa.com
Initial FLUX experiments(1)
• WAMmodel export/import utility (SQL/XSBProlog)– WAMmodel tables & views Prolog relations
• “Embedding detail lists that belong to aggregations”:- foreignKey(FK,Detail,Master,DColumns,MColumns),
table(Detail,_,BT), tableIndex(BT,PKcols,primaryKey), columnSubset(DColumns,PKcols), !, retractall(lookupColumn(FK,FK,_,_,_,_,_)).
columnSubset([],_) :- !.columnSubset([FKC-_|FKcols],PKcols) :- member(FKC-_,PKcols), columnSubset(FKcols,PKcols).
DM-UA, 24-10-2003 Copyright Declarativa 2003 31
http://www.declarativa.com
Initial FLUX experiments(2)
• “Disable interface for columns changed by server code”:- uses(Type,_,table,Table,Column,update),
(Type=procedure;Type=trigger), assert(rowColumn(Table,Column,0,1,0)), fail.
• “Creating stored procedure calls”:- procedure(P,Args), not uses(_,_,procedure,P,_), table(T,Columns,BT), tableIndex(BT,PKcols,primary),
compatibleArgs(Args,PKcols,Columns), assert(procedureCall(T, row, P, 1, 0)), fail.
compatibleArgs(...) .- ...
DM-UA, 24-10-2003 Copyright Declarativa 2003 32
http://www.declarativa.com
Conclusion
• How to reproduce the Demo• Pushing focus to the database layer
– The Declarativa project distortion field • Statistics
– Simple effort metrics
• Prospects for academic R&D– Make your models run
• How to build a tool in the “real world”– On adult supervision, genes and memes