Overview of Prometheus Mediator Snehal Thakkar CSCI 548 - - PowerPoint PPT Presentation
Overview of Prometheus Mediator Snehal Thakkar CSCI 548 - - PowerPoint PPT Presentation
Overview of Prometheus Mediator Snehal Thakkar CSCI 548 Information Integration On the Web Outline Prometheus mediator Brief Introduction Understanding data sources Installation Global-As-View Local-As-View Using
Outline
Prometheus mediator
Brief Introduction Understanding data sources Installation Global-As-View Local-As-View Using from another Java program Frequently asked questions
Introduction
Mediator system that supports
Global-As-View Local-As-View
Using Inverse Rules
Plan optimization using heuristics Efficient execution using Theseus
Inputs
A domain file A query file Optional source file
Understanding Data Sources
Sources can be
Databases, wrappers, web services,
Theseus plans
Have
A schema
Attribute names, types, binding restrictions
Access method
url for the wrapper, pointer to the database
Installation
Download a zip file from the URL given
in the homework
Unzip the file in one directory To run any example
Go to the examples\databases (or other
example) directory
Type runlocal.bat test1q.txt -o Press enter
Mediator Parameters
Look through the runlocal.bat
We pass –d domainfile(hardcoded as test.txt in
the batch file, but u can change it if you like)
- q queryfile
Optional –s sourcefile (needed for LAV) Optional –o (optimize the generated plans)
You will almost always want to run it with –o
Optional –debug
Use it to see debugging info such as the theseus plan
Optional –g
Use it to get dotty representation of the graph
Global-As-View
Using Prometheus to do GAV
integration
Create wrappers (or databases, or theseus
plans) for your sources
Specify a file containing domain description Specify a query file Run the mediator!!
Domain File
Three sections
SourceSchemas
Information about attributes of the sources Example: source1(attr1:attr1type:b, attr2:attrtype2:f…)
SourceTypes
Information about sources (wrappers, databases, etc) Example: source1(wrapper, src1, “http://....”)
Rules
Datalog rules Relationships between domain concepts and sources Domainrel1(x, y, z) :- source1(x ,y)^ source2(y, z)
Query File
Only one section
Queries : Datalog predicates Conjunctions and disjunctions are allowed Multiple queries in file are allowed Example
Q1(x, y , z) :- domainrel1(x, y) ^
domainrel2(y, z) ^ (z = “15”)
Examples
Database
SourceSchemas:
s1(emp:string:f, dept:string:f, sal:string:f) SourceTypes: s1(database, test, "jdbc:odbc:Driver= { MicroSoft Access Driver (* .mdb)} ;DBQ= test.mdb!u!p") Rules: employee(name, dept, sal) :- s1(name, dept, sal)
Table Name Database Name Domain Predicate Attribute Names
Examples (Cont’d)
Query
q1(n, d, s) :- employee(n, d, s)
Output
< result> < q1>
- < row>
- < n type= "string"> pat< /n>
- < d type= "string"> sales< /d>
- < s type= "string"> 30< /s>
- < /row>
........ < /q1>
Example of using a wrapper
SourceSchemas: wrapper1(Address:string:b, Parcel:string:f,
Owner:string:f, Addr:string:f, Desc:string:f)
Example of using a wrapper
SourceSchemas: wrapper1(Address:string:b, Parcel:string:f,
Owner:string:f, Addr:string:f, Desc:string:f)
SourceTypes: wrapper1(wrapper, Summit,
"http://oceanus.isi.edu:8080/agent/runner?plan= wra pper1%2Fplans%2Fproduction")
Rules: ….
Example GAV Application
Let’s see the Prometheus mediator in
action
In the GAV mode To run the example go the
examples\databases directory and type
runlocal.bat test1q.txt –o
You should see whole bunch of xml
Repeat the same in the wrapper directory
Local-As-View
No Different then using GAV except
You have to write the source descriptions Pass the sourcefile Remember from earlier part
Write sources as views over domain relations
s1(x, y, z, cr) :- seaports(x, y, z, cr)^ (cr < “7”)
Example
Domain file Database
SourceSchemas:
s1(emp:string:f, dept:string:f, sal:string:f) SourceTypes: s1(database, test, "jdbc:odbc:Driver= { MicroSoft Access Driver (* .mdb)} ;DBQ= test.mdb!u!p") Rules:
Example
Source file s1(name, dept, sal) :-
employee(name, dept, sal)
Source Name Domain Predicate
Calling Mediator from Java
Its actually pretty simple Hardest part is to make sure that you have Theseus
and mediator jar files in your class path to compile and run your java class
Edit runlocal.bat
For GAV
String domainFile = "webl_empl.txt"; String queryStr = "q1(person, args, number) :- person(person, args, number)^ (person= \"ABC\") "; String xmlresults = Mediator.doQuery(domainFile, queryStr); System.out.println(xmlresults);
Calling Mediator from Java
For LAV
String domainFile = "webl_empl.txt"; String domainStr = { read the domain file into string} ; String srcFile = "webl_empl_src.txt"; String srcStr = { read the source file into string} ; String queryStr = "q1(person, args, number) :- person(person, args, number)^ (person= \"ABC\") "; String xmlresults = Mediator.doQueryFromString(domainstr, queryStr, srcStr, “”); System.out.println(xmlresults);
FAQ on the Mediator
1) Do I need write Theseus plans for my sources?
- Not really. The mediator will generate them for you ☺
2) I get syntax error when I run the mediator with my files?
- Check syntax of your files, usually its because
- Missing quote
- You used some editor that uses specialized quotes instead of double quotes
- You are missing ) or ^
3) The mediator seems to sit and do nothing or returns no data?
- If you specified source plans, check and make sure that your source
plans work
- If mediator is generating source plans use -no_plan_delete with the
mediator and see that plans generated by the mediator are ok (most
- ften problem is due to xquery for wrapper being slightly incorrect)
- Plans are in the C:\Documents and Settings\< user> \Local Settings\Temp
directory
FAQ on the Mediator (Cont’d)
4) I see ugly java exception that says something about parser error
- Check your domain model, you probably have a single
quote instead of double quote or forgot to close double quote (Hopefully you will never really see this one)
5) I get empty result
- Turn on the debug mode and see the plans