Extracting Schema From Data • The difference between schemas for semistructured data and traditional schemas is that a given semistructured data can have more than one schema . • Given a semistructured data, compute automatically some schema for it, given several possible answers, we want the schema that best describes the structure of that particular data.This is called Schema Extraction.
26
Embed
Extracting Schema From Data The difference between schemas for semistructured data and traditional schemas is that a given semistructured data can have.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Extracting Schema From Data
• The difference between schemas for semistructured data and traditional schemas is that a given semistructured data can have more than one schema .
• Given a semistructured data, compute automatically some schema for it, given several possible answers, we want the schema that best describes the structure of that particular data.This is called Schema Extraction.
•Schema Extraction for schema graphs
•Schema Extraction for Datalog Typings
Data Guides
Our goal is to construct a new OEM graph that is a finite description of the list of paths. This is called Data Guide. The two properties to be fulfilled:
•Accurate : Every path in the data occurs in the data guide, and every path in the data guide occurs in the data.
•Concise : Every path occurs exactly once.
&r
&p1 &p2 &p3 &p6 &p7 &p7&p4 &p5
&c
employee
employee
employee
company
worksfor worksfor
worksfor
name
namename name
namename name
name
name
“Widget Trenton”
managesmanages
manages manages manages
Managedby
Managedby
Managedby Managedby
Managedbyposition
positionpositionposition
phone
“Jones” “6666”“Smith”
“Joe”“Marketing” “Dupont”
“Gaston”“Salse” “Gonnet” “Jack” “IT”
“IT”
“Fred”
Figure7.13 An Example of OEM data
We proceed as follows: The Data Guide will have a root node, call it Root. Next we examine one by one each path in the list and add new nodes to the data guide, as needed:
•employee
•employee.name
•employee.manages
•employee.manages.managedby
•employee.manages.managedby.manages
•employee.manages.managedby.manages.managedby
•company
Root&r
Employees&p1,&p2,&p3,&p4&p5,&p6,&p7,&p8
Boss&p1,&p4,&p6
Regular&p2,&p3,&p5
&p7,&p8
Company&c
employee
company
worksfor
managedby
manages
name
name
name
nameworksfor
worksfor
manages
managedby
phone
phone
position
position
A Data Guide
Root
Emp
Comp
employee
company
name
name
worksfor
phoneposition
managedby
manages
Schema graph
Simulation between a data graph and a data guide
Node in data graph Node in data guide&r Root&p1, &p2, &p3, &p4, &p5, Employee&p6, &p7, &p8 &p1, &p4, &p6 Boss&p2, &p3, &p5, &p7, &p8 Regular&c Company
Simulation from the data guide to the schema graph
Node in data guide Node in schema graphRoot RootEmployee EmpBoss EmpRegular EmpCompany Comp
This construction of the data guide resembles the technique to transform a nondeterministic finite state automaton into a deterministic one .
The data guide is the most specific schema graph for that data with the following features:
•The data guide is a deterministic schema graph.
•Any other deterministic schema graph to which our data conforms subsumes the data guide.
Root&r
Regular &p2,&p3,&p5 &p7,&p8
Boss &p1,
&p4,&p6
manages
employee
managedby
employee
name
Comp &c
company
worksfor
namephone
worksfor
A nondeterministic schema
Extracting Datalog rules from data
We have a semistructured data instance and want to extract automatically the most specific typing given by a set of Datalog rules.
We create one predicate for each complex value object in the data. We create the following predicates:
•For any publication p, the set p.auth is a subset of the set author. Similarly, for any author a, the set a.pub is a subset of publication.
Inverse relationships:
•For any publication p, and for any author a in p.auth, p is a member of a.pub .
•For any author a, and for any publication p in a.pub, a is a member of p.auth .
publication publication authorauthor
auth auth auth
pubpubpub
title title datedate name name addressaddress
... ... ... ... ... ... ... ...
r
Illustration of path constraints on semistructured data
In semistructured data
•inclusion constraint is expressed as follows p (a (author(r,a) pub(a,p)) -> publication(r,p))
The general form of an inclusion constraint is x ((r,x)) -> (r,x))
• inverse relationship is p ( publication(r,p) -> a(auth(p,a) -> pub(a,p)))
The general form of this constraint is x ((r,x)) -> y((x,y)-> (y,x)))
Constraints are also important in Query Optimization. Here is an example:
Select row: P2from r.publication P1, r.publication P2, P1.auth Awhere “Database Systems” in P1.title and A in P2.auth
Select row: P’from r.publication P, P.auth A, A.pub P’where “Database Systems” in P.title
The query plan implicit in the first one requires two iterations over publication - with P1,P2 - whereas the second requests only one iteration - with P .