Title: EJBs%20 XML%20 %20Integrity%20Constraints
1EJBs XML Integrity Constraints
- Data-Object Modeling and Optimization (DOMO)
- June 2003
- Rajesh Bordawekar, Michael Burke, Mukund
Raghavachari, Vivek Sarkar, Oded Shmueli
2A Changing Application Environment
- Frameworks such as Container-Managed Persistence
simplify integration of application logic with
databases. - Programmer specifies mapping between Java classes
and schema declaratively. - Relational databases have integrity constraints.
- XML schemas have integrity constraints.
- Application logic may have its own integrity
constraints. - There is no mechanism for reasoning about
constraints on data given a mapping between
language types and relational schema. - Applications may fail when seemingly correct
updates are rejected by the database. - Domain constraints and referential integrity
constraints. - Need to reason about such constraints.
3Setting
Mapping associates db.X. t and ejb.X.t
Mapping
db.X. t
ejb.X.t
XML data
T
? What can be deduced about db originated values
based on the schema?
Relational data
4EJBs XML
- Current J2EE implementations provide little
support for XML data sources. - Goals
- Understand integration of XML and EJBs.
- Efficient algorithms for instantiating EJBs from
XML data sources. - E.g., Streaming algorithms.
- Focus Mechanisms for ensuring that XML (and
relational) integrity constraints are maintained
in application logic. - Past Work
- Streaming algorithms for XPath (ICDE 2003).
5XML Data Bindings
- XML data is imported into the application
environment. - Often, the data conforms to an XML schema or a
DTD. - XML schemas support constraints domain,
uniqueness, key. - These should be related to relational database
and application constraints. - Data travels in both directions (export).
6Plans
- Examine data binding formalisms.
- Examine XML schema constraints.
- Analyze their interplay at the application level
- Support static analysis of programs to determine
constraint violations.
7Example Updating a Record"
- EJB Field SAL is updated in an employee record.
- SAL is associated with min10K, max200K.
- Two salary ranges 10,45, 65,200.
- May check application code to determine possible
violations. -
8Record XML Schema
- Complex type
- ltcomplexType nameemployee/gt
- ltattribute nameempName typeeid/gt
- ltattribute namedeptNum typednum/gt
- ltattribute namesalary typeempSal/gt
- lt/ complexType gt
- Union type
- ltsimpleType nameempSalgt
- ltunion memberTypelow high/gt
- lt\simpleTypegt
- Restriction
- ltsimpleType namelowgt
- ltrestriction baseintegergt
- ltminInclusive value10/gt
- ltmaxInclusive value45/gt
- lt/restrictiongt
- lt/simpleTypegt
9Use Cases
- Reading a database record
- Writing/Updating a database record
- Reading an XML element/attribute
- Writing/Updating an XML element/attribute
- Assisting CMP/BMP
- Assisting CMR
10Using Constraint/Type Information
- Constraints for the same application may
originate in a relational DB, an XML schema, a
DTD or other sources. - We therefore need to reason about and manipulate
constraints originating in various formalisms. - Analyze program statically and dynamically to
verify that constraints are met. - Failure of a check implies update will fail in
DB. Success usually provides no definite
information. - Much related Dist. DB literature on the subject.
11XAOS XPath Analysis and Optimization for
Streaming
- Motivation
- XPath lookup is next major bottleneck in XML
processing (after parsing) - Streaming access is most efficient mode for
memory hierarchies and large documents
XML Document
XML Parser
XPath Expression
Parsing Events
Specialized XPath Processor
Xpath-specific Automaton
XML Fragments
- Xpath-specific Automaton supports streaming
XPath processing for forward and backward axes
12XAOS Example
XPATH expression //yu//wancestorz/v
XDAG
Root
Root
Root(0)
Root(0)
descendant
descendant
Y
Z
Y
Z
X (1)
child
descendant
descendant
child
Y(10)
Y(2)
Y(2)
U
W
V
U
V
W
Z(4)
U(9)
Z(11)
Z(4)
U(9)
W(3)
U(13)
XML Document
V(5)
V(5)
V(6)
V(6)
W(7)
W(7)
W(7)
W(7)
W(12)
V(5)
V(6)
W(7)
Parser Specialized XPath Processor
Xpath-specific Automaton
W(8)
W(8)
W(8)
W(8)
XPath Matchings in XML Document
13XAOS Scalability Parsing XPath Execution times
- Experiments run on
- 550 MHz Pentium III,
- w/ 256MB RAM Linux 2.2