Download presentation
Presentation is loading. Please wait.
1
1 View Theory Dan Suciu Computer Science Department University of Washington
2
2 Query v.s. View A query returns a subset of the data Examples of query languages: –SQL –XPath –SparQL, RQL A view constructs new data Examples of view languages: –SQL –XQuery –SpartQL (?), RVL, StruQL
3
3 Examples from [Magkanaraki] VIEW DBCourse(Y),Author(X),creates(X,Y),name(X,W) FROM {Y;ns1:Course}createdBy{X}.ns1:name{W}, {Y}ns1:subject{Z} WHERE Z like "Database Management"; VIEW DBCourse(Y),Author(X),creates(X,Y),name(X,W) FROM {Y;ns1:Course}createdBy{X}.ns1:name{W}, {Y}ns1:subject{Z} WHERE Z like "Database Management"; SELECT X, Y, Z FROM {Y;ns1:Course}createdBy{X}.ns1:name{W}, {Y}ns1:subject{Z} WHERE Z like "Database Management"; SELECT X, Y, Z FROM {Y;ns1:Course}createdBy{X}.ns1:name{W}, {Y}ns1:subject{Z} WHERE Z like "Database Management"; RQL RVL
4
4 VIEW DBCourse(Y),Author(X),creates(X,Y),name(X,W) FROM {Y;ns1:Course}createdBy{X}.ns1:name{W}, {Y}ns1:subject{Z} WHERE Z like "Database Management"; VIEW DBCourse(Y),Author(X),creates(X,Y),name(X,W) FROM {Y;ns1:Course}createdBy{X}.ns1:name{W}, {Y}ns1:subject{Z} WHERE Z like "Database Management"; Course Y X W Z “Data management” createdBy subject name DBCourse Author W X Y createsname Note: this is almost identical to StruQL
5
5 Problem 0: View Language Design My benchmarks: Can you copy the graph ? With renaming ? Can you copy/modify a part of the graph ? Need traversal w. regular expressions. Can you construct the cartesian product of two graphs ?
6
6 Problem 1: Query/View Composition Given a query over the view, rewrite it into a query over the original data Example: –View: FMA Subset –Query over Subset... –... Rewritten into query over FMA
7
7 Problem 1: Query/View Composition Course Y X W Z “Data management” createdBy subject name DBCourse Author W X Y createsname SELECT N FROM {M}myview:creates{N}, {M}myview:name{P} WHERE P = "Jim" SELECT N FROM {M}myview:creates{N}, {M}myview:name{P} WHERE P = "Jim" SELECT N FROM {N;ns1:Course}createdBy {M}.ns1:name{P}, WHERE P like “Jim”; SELECT N FROM {N;ns1:Course}createdBy {M}.ns1:name{P}, WHERE P like “Jim”;
8
8 Problem 1: Query/View Composition Remarks: In SQL (more correctly: conjunctive queries) the problem is trivial –Done by every RDBMS In StruQL (hence RVL) it is not always possible (!!!) because of regular expressions In Xquery: we studied it in the SilkRoute project
9
9 Problem 1: Query/View Composition Important Application: Source data is SQL database The view defines an RDF ontology Then query/view composition gives us a “free” translation of RDF queries into SQL
10
10 Problem 2: Query Rewriting Using Views Given a query over the data, rewrite it into a query over the view WHY WOULD ANYONE WANT TO DO THIS ???
11
11 Problem 2: Query Rewriting Using Views ? ? ? ? ? Query …. View
12
12 Problem 2: Query Rewriting Using Views FMA User 1 User 2 Query …. Composed query Rewritten query
13
13 Problem 2: Query Rewriting Using Views Remarks: Difficult, and intensively studied problem for conjunctive queries (fragments of SQL) Fewer results on Xquery, and even fewer on StruQL We probably need to do this too in the grant
14
14 Problem 3: Mappings Two data sets exists already, they don’t align Define a “mapping” between the two
15
15 Problem 3: Mappings
16
16 Problem 3: Mappings What is known: Query rewriting understood to some extent –In general you can’t do too much –One way to define a mapping is to define two views and state they are included; then query rewriting is related to query rewriting using views Composition often doesn’t exists –“Second order mappings” solve this Should we do this in the grant ??
17
17 Plan Student: Marianne Shaw Definite language: –Currently: RVL = RQL + view defs –We want: NewVL = SparQL + view defs = SparQL + (RVL - RQL) Will explore/implement query/view composition Will use this to store on a relational DB In other words: SilkRoute on RDF
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.