Towards Exploiting Meta-Programming for Web Services Gottfried Vossen University of Münster, Germany. Overview. Background: PL and DB getting back together again Ways to integrate data and programs (to “meta-program” databases) “Service-SQL”: SQL at your (web) service. Background.
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Treat procedural data as data (not as text); give up the separation of data and programs!
Done already in data dictionaries, OR databases, active databases, web logs, …
Joint work with Jan Van den Bussche, Frank Neven, Stijn Vansummeren
select director, avg(rating) as avgrat from Movies group by director
<query> <select> <sel-item> <column>director</column> </sel-item> <sel-item> <aggregate><avg/> <column-ref><column>rating</column></column-ref> </aggregate> <alias>avgrat</alias> </sel-item> </select> <from> <table-ref> <table>Movies</table> </table-ref> </from> <group-by> <column-ref> <column>director</column> </column-ref> </group-by></query>
Foundation: Date‘s BNF grammar for SQL, turned into a DTD
“Which queries (stored in ‘Views’) do the most joins?“assumptions: Views (name: string, def: xml)
#joins = #table names
function count_tables returns numberbegin<xsl:template match="/"> <xsl:value-of select="count(//table)“/></xsl:template>endselect name from Views where count_tables(def) = (select max(count_tables(def)) from Views)
“Which views become invalid after removal of the tables listed in `Removed´?”
function mentions_tableparam tname stringreturns stringbegin <xsl:param name="tname"/> <xsl:template match="/"> <xsl:if test="//table[string(.)=$tname]"> true </xsl:if> </xsl:template>endselect name from Views, Removedwhere mentions_table(def, Removed.name) = \'true\'
“Find all pairs (v,t) s.t. v is is a view name and t is a table name occurring in the definition of v“
function string_value returns string
select v.name, string_value(x)
from Views v,x in v.def[//table]
returns the string value of a table subelement
Stored queries in column Q of table Log;goal is to find “hot spots,” i.e., subqueries occurring in at least 10 different queries:
from Log l, s in l.Q[//query]
group by s
having count(l.Q) >= 10
“On table Customer (custid: string, query: xml), (where each query returns a table with columns item, price, …) find the max price of items requested by each customer:”
EVAL returns a table
select custid, max(t.price)
from Customer c, EVAL(c.query) t
group by custid
t is a standard SQL range var
UEVAL available for cases where output schema unknown
Joint work with Stephan Hagemann
output: sendbill, deliver, unavailable rejectpay, alreadypaid, rebill
service is called as soon as the corresponding input relation is filled.
needs to be executed atomically! transactional aspects
the “rebill” functionality