Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 XML-KSI, 2004 XML- : an extendible framework for manipulating XML data Jaroslav Pokorny Charles University Praha.

Similar presentations


Presentation on theme: "1 XML-KSI, 2004 XML- : an extendible framework for manipulating XML data Jaroslav Pokorny Charles University Praha."— Presentation transcript:

1 1 XML-KSI, 2004 XML- : an extendible framework for manipulating XML data Jaroslav Pokorny Charles University Praha

2 2 XML-KSI, 2004 Two approaches to XML logical or physical Idea: XML as a database –DB of XML documents –„mix“ of (relational) DB and XML data –XML views (over non-XML and/or XML data) Advantages: –independence on original platforms and models on processed data –more flexible for design, manipulation (integration, updates, querying)

3 3 XML-KSI, 2004 Two approaches to XML implications –implementations: XML DBs (native, via relational, OO, OR), –special demands on query languages how do them powerful how to describe their semantics how implement them –new types of software: wrappers, mediators (personal) goal: to develop a powerful formal approach appropriate for manipulating both XML and non-XML data

4 4 XML-KSI, 2004 Outline n XML - shortly n XML – functional data model n functional typing XML (and non-XML data) n LT language n XML-schema, XML-database n XML- framework n Conclusions

5 5 XML-KSI, 2004 XML – an example <!DOCTYPE biblio [ <!ELEMENT title (#PCDATA) ]>

6 6 XML-KSI, 2004 XML – an example Fundamentals of DBS Ramez Elmasri Arlington 76019 Shamkant Navathe

7 7 XML-KSI, 2004 XML model n Usually: tree- or graph-oriented Here: inspiration by functional approach to conceptual modelling DEPARTMENT MEMBER* PROJECT* For example, the HIT data model from 80s.

8 8 XML-KSI, 2004 Synopsis of the approach n Typing XML data Background: –a functional type system (base of primitive types + functions, tuples, and unions) Extensions to: –typing XML regular expressions, –typing XML elements. n Querying XML elements –a general typed -calculus (functional variables and constants, tuples, applications of functions, -abstractions) XML-database schema as a set of variables of types, XML-database as any valuation of these variables –XML- - a syntactic variant of the typed -calculus over XML- data

9 9 XML-KSI, 2004 Typing XML data - informally E … a set of abstract elements. The content of an abstract element will be either a string from PCDATA, in the easiest example, or a sequence of abstract subelements (or groups), or empty. Ex: 781 7090. It is an instance of a phone element object. For an e  E, phone(e) returns e.g. the phone number ‘781 7090‘. phone element object will be conceived as a (partial) function from E into PCDATA.

10 10 XML-KSI, 2004 Typing XML data - informally Ex: is conceived a set of functions from E  E  E The current name element object, i.e. the one stored in a given XML database, is a function assigning to each abstract element e  E at most a couple of abstract elements. Hierarchy of notions: element type, element object, element

11 11 XML-KSI, 2004 Functional typing B … a set of symbols (the base) T ::= S primitive type  (T 1  T 2 ) functional type  (T 1,...,T n ) tuple type  (T 1 + T 2 ) union type where S  B Remark: relations are ((T 1,...,T n )  BOOL)-objects!

12 12 XML-KSI, 2004 Functional typing Interpretation: Members of B … mutually disjoint non-empty sets, (T 1  T 2 )... the set of all (total or partial) functions from T 1 into T 2, (T 1,...,T n ) … T 1 ...  T n, (T 1 +…+T n ) …  T i Exs: n arithmetic operations: +, -, *, / are ((NUMBER, NUMBER)  NUMBER)-objects. n logic: –and/((BOOL, BOOL)  BOOL), –universal R-quantifier  R, and existential R-quantifiers  R are ( (R  BOOL)  BOOL) - objects. –R-identity = R is ((R,R)  BOOL)-object. n aggregation functions: COUNT R /((R  BOOL)  NUMBER)

13 13 XML-KSI, 2004 Typing XML regular expressions Let B = {PCDATA, BOOL, NAME}. The type system T reg over B is recursively defined as follows. T ::= tag: PCDATA  tag: where tag  NAME. elementary regular expression  T* zero or more  T+ one or more  T?zero or one where T is an alternative or elementary regular expression.  (T 1  T 2 ) alternative

14 14 XML-KSI, 2004 Typing XML regular expressions Interpretation: Ex.: (T 1  T 2 ) … a set of objects of type T 1  T 2. T* … (T  BOOL) /partially ordered model/ T* … ((T, NUMBER)  BOOL) /ordered model/ –Consider a function f of this type. For a couple (t, i), f(t, i) = TRUE iff t is i th object in an (ordered) set of T-objects.

15 15 XML-KSI, 2004 Typing XML elements and attributes T reg over B, E. The type system T E induced by T reg (or T E if T reg is understood) containing the regular element expressions given by the following rules: E ::= TAG:T  TAG: elementary element types where tag:T and tag: are elementary regular expressions over B  E*  E+  E?  (E 1  E 2 )  TAG:(E 1,..., E n ) where tag  NAME. Elementary element types and regular element expressions TAG:(E 1,...,E n ) are called element types.

16 16 XML-KSI, 2004 Typing XML elements and attributes Semantics of element types: TAG:PCDATA … the set of all (partial functions) from E to tag:PCDATA … etc Attributes are also functions. Ex.: year (of monograph) is a function assigning to each monograph its year (of issue). Notation: E  MONOGRAPH  CDATA

17 17 XML-KSI, 2004 Example: BIBLIO element types TITLE:PCDATA FIRSTNAME:PCDATA SURNAME:PCDATA LOCALITY:PCDATA ZIP:PCDATA ADDRESS:(LOCALITY, ZIP) BOOK:(TITLE, AUTHOR*) NAME:(FIRSTNAME, SURNAME) MONOGRAPH:(TITLE, AUTHOR, EDITOR) YEAR/(MONOGRAPH  CDATA) EDITOR:MONOGRAPH* AUTHOR:(NAME, ADDRESS?) BIBLIO: (BOOK  MONOGRAPH)*

18 18 XML-KSI, 2004 LT language (Language of Terms) Func... constants, each of a fixed type, variables for each type from T. Let types T, T 1,..., T n (n  1) are members of T. Typed constants and variables are terms.  M(M 1,...,M n ) application  x 1,...,x n (M) -abstraction where x 1,...,x n are distinct variables  (M 1,...,M n )tuple  M i projections for a term M  (M 1,...,M n )  K:M tagged term where K/NAME. If M/T, then K:M/(E  T).

19 19 XML-KSI, 2004 Schema and DB n XML-database schema, S XML, is a set of variables of types from T E. n Given a database schema S XML, an XML- database is any valuation of these variables. Ex.: SURNAME, AUTHOR

20 20 XML-KSI, 2004 XML- framework What is it? XML- framework is a subset of LT + syntactic sugar Features: n queries are expressed by terms n Ex.: AUTHOR (1) RESULT: AUTHOR…. more „XML-like“) Typically:.. (.. …(expression)…), where expression/BOOL x (AUTHOR(x)) does the same as (1) n paths as compositions of functions Ex.: SURNAME(NAME(AUTHOR(m))) where m is a monograph abstract element object Notation: m.AUTHOR.NAME.SURNAME

21 21 XML-KSI, 2004 XML- framework n applications of logic, arithmetic, … functions  e (b.AUTHOR(e) and e.NAME.SURNAME = ‘Smith’) where b is a book abstract element object  b  e (b.AUTHOR(e) and e.NAME.SURNAME = ‘Smith’) is a YES/NO query.

22 22 XML-KSI, 2004 XML- framework n restructuring name:x.NAME ( title:y (.BOOK.(AUTHOR(x) and TITLE = y)) ) title:y ( name:x.NAME (.BOOK.(AUTHOR(x) and TITLE = y)) ) Notation: tagged variables, content of abstract elements by y, x n aggregations + nesting D. For each book, find the number of its authors. x, n (.BOOK..(TITLE = x and COUNT(AUTHOR) = n)) Notation: dots.. for omitting parts of paths and prefixes possibility to embed any user defined function

23 23 XML-KSI, 2004 XML- framework D(XQuery): FOR $x IN distinct(document(“biblio1.xml”)//book) LET $n := count($x/author) RETURN $x/title/text() $n

24 24 XML-KSI, 2004 Integration of heterogeneous information sources relational schemes, DTDs, ADTs, classes in OO user query answer typed objects

25 25 XML-KSI, 2004 Conclusions Issues: n finding appropriate restrictions of XML- for querying n implementation is in progress The forthcoming paper: n cleaning the model (ordered and unordered) n formal semantics of types, n extensions to tagged variables Future: n XML- with tag variables n semantics of XQuery in XML- framework


Download ppt "1 XML-KSI, 2004 XML- : an extendible framework for manipulating XML data Jaroslav Pokorny Charles University Praha."

Similar presentations


Ads by Google