130 likes | 145 Views
EJBs +XML + Integrity Constraints. Data-Object Modeling and Optimization (DOMO) June 2003 Rajesh Bordawekar, Michael Burke, Mukund Raghavachari , Vivek Sarkar, Oded Shmueli. A Changing Application Environment.
E N D
EJBs +XML + Integrity Constraints Data-Object Modeling and Optimization (DOMO) June 2003 Rajesh Bordawekar, Michael Burke, Mukund Raghavachari, Vivek Sarkar, Oded Shmueli
A 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.
Setting 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
EJBs + 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).
XML 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”).
Plans • Examine data binding formalisms. • Examine XML schema constraints. • Analyze their interplay at the application level: • Support static analysis of programs to determine constraint violations.
Example: Updating a “Record" • EJB Field SAL is updated in an employee record. • SAL is associated with min=10K, max=200K. • Two salary ranges: [10,45], [65,200]. • May check application code to determine possible violations.
Record XML Schema Complex type <complexType name=“employee”/> <attribute name=“empName” type=“eid”/> <attribute name=“deptNum” type=“dnum”/> <attribute name=“salary” type=“empSal””/> </ complexType > Union type <simpleType name=“empSal”> <union memberType=“lowhigh”/> <\simpleType> Restriction <simpleType name=“low”> <restriction base=:integer”> <minInclusive value=“10”/> <maxInclusive value=“45”/> </restriction> </simpleType> <simpleType name=“high”> <restriction base=:integer”> <minInclusive value=“65”/> <maxInclusive value=“200”/> </restriction> </simpleType>
Use 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
Using 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.
XAOS: 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 Xpath-specific Automaton supports streaming XPath processing for forward and backward axes XML Parser XPath Expression Parsing Events Specialized XPath Processor Xpath-specific Automaton XML Fragments
XAOS Example XPATH expression //y[u]//w[ancestor::z/v] XDAG: Root Root Root(0) Root(0) descendant descendant Y Y Z Z X (1) child descendant descendant child Y(2) Y(2) Y(10) U U W W V V Z(4) U(9) W(3) Z(4) U(9) Z(11) U(13) XML Document V(5) V(5) V(6) V(6) W(7) W(7) W(7) W(7) V(5) V(6) W(7) W(12) Parser + Specialized XPath Processor Xpath-specific Automaton W(8) W(8) W(8) W(8) XPath Matchings in XML Document
XAOS Scalability: Parsing + XPath Execution times Experiments run on 550 MHz Pentium III, w/ 256MB RAM & Linux 2.2