3d_xml a three-dimensional xml-based model

27
1 3D_XML A three-Dimensional XML-based Model Khadija Ali, Jaroslav Pokorný Czech Technical University Prague - Czech Republic

Upload: major

Post on 10-Jan-2016

35 views

Category:

Documents


0 download

DESCRIPTION

3D_XML A three-Dimensional XML-based Model. Khadija Ali, Jaroslav Pokorn ý C zech Technical University Prague - Czech Republic. Content of Presentation. Current approaches Motivation 3D_XML Model Time dimensions Time model Data modeling Temporal constructs - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: 3D_XML  A three-Dimensional XML-based  Model

1

3D_XML A three-Dimensional XML-based Model

Khadija Ali, Jaroslav PokornýCzech Technical University

Prague - Czech Republic

Page 2: 3D_XML  A three-Dimensional XML-based  Model

2

Content of Presentation

Current approaches Motivation 3D_XML Model

Time dimensions Time model Data modeling Temporal constructs Temporal Queries with XQuery

Conclusions and Future investigations.

Page 3: 3D_XML  A three-Dimensional XML-based  Model

3

Current Approaches

Much research work has recently focused on adding temporal features to XML.

XBIT- an XML-based bitemporal data model. XML-based model for Versioned Documents. XML-based model for Versioned normative texts. Valid time XPath data model. Key-based model for archiving data. Multidimensional XML Model (MXML).

Page 4: 3D_XML  A three-Dimensional XML-based  Model

4

Motivation

Non-Temporal XML databases– The contents of XML documents change over time.– Past data are overwritten; they are replaced by the new data. – The latest information is recorded as a result.

But, in the real life:

there is a real need to keep past and current data.

Page 5: 3D_XML  A three-Dimensional XML-based  Model

5

Motivation

For instance, at a bank, querying the current state is important, e.g.,

“How much is in my account right now“

But it is also often useful and required to know how

the data has changed over time, e.g., “When has my account been below $4000“

Page 6: 3D_XML  A three-Dimensional XML-based  Model

6

3D_XML Model

The main aim of 3D_XML is to propose a temporal extension of XML by:

representing XML changes; we retain a single representation of all versions of the XML document.

using XQuery to express complex temporal queries on the evolution of the document contents via user-defined functions.

Page 7: 3D_XML  A three-Dimensional XML-based  Model

7

3D_XML Model

Time dimensions1. Valid time2. Transaction time3. Efficacy time (abrogated data continues to be applicable)

Our ExtensionValid data stops to be applicable

Page 8: 3D_XML  A three-Dimensional XML-based  Model

8

3D_XML Model

Time Model The time domain T is linear and discrete. A time constant

t = [a, b], is either a time instant or a time interval. We limit our event measures to dates (granularity = one

day). The valid time constant vt = [vtStart, vtEnd]

The transaction time constant tt = [ttStart, ttEnd]

The efficacy time constant et = [etStart, etEnd]

Page 9: 3D_XML  A three-Dimensional XML-based  Model

9

3D_XML Model

Valid/Efficacy Times Relationship1. (vtStart < etStart), or (vtEnd > etEnd)

Valid data stops to be applicable

Page 10: 3D_XML  A three-Dimensional XML-based  Model

10

3D_XML Model

2. (vtStart > etStart), or (vtEnd < etEnd)

Data is applicable although it is not valid

Page 11: 3D_XML  A three-Dimensional XML-based  Model

11

3D_XML Model

3. (vtStart = etStart), and (vtEnd = etEnd)

The normal case

Page 12: 3D_XML  A three-Dimensional XML-based  Model

12

3D_XML Model

Example 1. Consider a company database. Suppose the manager mgr of Design department is Ali from "2002-01-01" till "2006-01-01". Due to some unexpected circumstances, another person started managing Design department from "2002-09-02".

2002-01-01 2006-01-01 Valid time

2002-09-02 2006-01-01

2002-01-01 2002-09-01 Efficacy time

Page 13: 3D_XML  A three-Dimensional XML-based  Model

13

Data Modeling

A temporal element can be specified in DTD notation as:

(1) <!ELEMENT ele (sub-element+)> <!ELEMENT sub-element Any>

<!ATTLIST sub-element vtStart CDATA #REQUIRED

vtEnd CDATA #REQUIRED

ttStart CDATA #REQUIRED

ttEnd CDATA #REQUIRED

etStart CDATA #REQUIRED

etEnd CDATA #REQUIRED>

Page 14: 3D_XML  A three-Dimensional XML-based  Model

14

Data Modeling

(2) <!ELEMENT ele (sub-element+)> <!ELEMENT sub-element Any>

<!ATTLIST sub-element inherits CDATA #REQUIRED>

Example 2<employee vtStart="2000-01-01" vtEnd="now" ttStart="2000-01-01" ttEnd="now" etStart="2000-01-01" etEnd="now">

<name inherits = ”1”>Anas</name>

<job inherits = ”1”>Sr Engineer</job>

</employee>

Page 15: 3D_XML  A three-Dimensional XML-based  Model

15

Data Modeling

A temporal attribute is represented by: a special empty element temporal_Attribute. the name and value of the temporal attribute are

represented by special attributes name and value. representing time dimensions is similar to time

dimensions in temporal elements.

<temporal_Attribute name="currency" value="crown"

vtStart="2000-08-31" vtEnd="2014-12-31" ttStart="2000-09-01" ttEnd="now" etStart="2000-08-31" etEnd="2014-12-31“ />

Page 16: 3D_XML  A three-Dimensional XML-based  Model

16

Data Modeling

Time dimensions Constraints

1. Conjunction Constraints2. Disjunction Constraints

Page 17: 3D_XML  A three-Dimensional XML-based  Model

17

Data Modeling

Conjunction Constraints<employee vtStart="2000-01-01" vtEnd="now" ttStart="2000-01-01" ttEnd="now" etStart="2000-01-01" etEnd="now">

<salary vtStart="2000-08-31" vtEnd="2005-09-01" ttStart="2000-08-31“ ttEnd="2005-09-30" etStart="2000-08-31" etEnd="2005-09-01"> 60000

<temporal_Attribute name="currency" value="crown" vtStart="2000-08-31" vtEnd="2014-12-31" ttStart="2000-09-01" ttEnd="now" etStart="2000-08-31" etEnd="2014-12-31"/><temporal_Attribute name="currency" value="euro" vtStart= "2015-01-01" vtEnd="now" ttStart="2000-09-01" ttEnd="now" etStart="2015-01-01" etEnd="now"/>

</salary> … </employee>

Cover

Page 18: 3D_XML  A three-Dimensional XML-based  Model

18

Data Modeling

Disjunction Constraints<employee vtStart="2000-01-01" vtEnd="now" ttStart="2000-01-01" ttEnd="now" etStart="2000-01-01" etEnd="now">

<salary vtStart="2000-08-31" vtEnd="2005-09-01" ttStart="2000-08-31“ ttEnd="2005-09-30" etStart="2000-08-31" etEnd="2005-09-01"> 60000

<temporal_Attribute name="currency" value="crown" vtStart="2000-08-31" vtEnd="2014-12-31" ttStart="2000-09-01" ttEnd="now" etStart="2000-08-31" etEnd="2014-12-31"/>

<temporal_Attribute name="currency" value="euro" vtStart= "2015-01-01" vtEnd="now" ttStart="2000-09-01" ttEnd="now" etStart="2015-01-01" etEnd="now"/>

</salary> … </employee>

disjoint

Page 19: 3D_XML  A three-Dimensional XML-based  Model

19

Temporal Constructs

XQuery is natively extensible and Turing-complete:

any extensions needed for temporal queries can be defined in the language .

user-defined functions which are not typical features of query languages can be used to define the temporal constructs.

Page 20: 3D_XML  A three-Dimensional XML-based  Model

20

Temporal Constructs

Get time dimensions

declare function get_vtStart ($s){let $g := string($s/@inherits) return if ($g )then xs:date($s/ancestor::node()[$g]/@vtStart)else xs:date($s/@vtStart)};

Page 21: 3D_XML  A three-Dimensional XML-based  Model

21

Temporal Constructs

Valid/efficacy times relationship constructs

declare function valid-notEfficient($a){if (get_etStart($a) > get_vtStart($a) or get_etEnd($a)< get_vtEnd($a) ) then true() else false()};

Page 22: 3D_XML  A three-Dimensional XML-based  Model

22

Temporal Constructs

Snapshot data construct is used to construct snapshots of 3D-XML documents.declare function dataShot ($e, $v){ if (get_vtStart($e)<= xs:date($v) and get_vtEnd($e) >= xs:date($v) ) then element {name($e)} {$e/text(),$e/@* except $e/@* [string(name(.))="vtStart" or string(name(.))="vtEnd" or string(name(.))="etStart" or string(name(.))="etEnd" or string(name(.))="ttStart" or string(name(.))="ttEnd"], for $c in $e/* return dataShot ($c, $v)} else ()

Page 23: 3D_XML  A three-Dimensional XML-based  Model

23

Temporal Constructs

Interval comparison operators: a small library of interval comparison operators is defined to help users with interval-based queries.Break construct: it checks if valid/efficacy times of a temporal element having breaks or not.

declare function Tbreak($g){ let $c := count($g) - 1 let $o := for $i in (1 to $c) let $j := $i +1 return if (TmeeTs(get_vtEnd($g[$i]), get_vtStart($g[$j]))) then() else ”break” return count ($o) };

Page 24: 3D_XML  A three-Dimensional XML-based  Model

24

Temporal Queries with XQuery

We use XQuery to express complex temporal queries. The queries can be greatly simplified by a suitable library

of built-in temporal functions (temporal constructs).

Query 1 Return employee’s names who have one break in their

employment histories (fired and rehired) and their salaries have been changed for the first time at any time when they are assigned in “Design“ department as “Sr Engineer“.

Page 25: 3D_XML  A three-Dimensional XML-based  Model

25

Temporal Queries with XQuery

for $t in collection ("C1")//employee/job[.= Engineer"]for $dep in

collection("C1")//employee/dept[.="Design"]where $t/../emp_no = $dep/../emp_noreturn if (Tcontains ($dep, $t) and Toverlaps ($dep/../salary[1],$t) and Tbreak ($dep/../job)= 1) then $dep/../name else ()

Page 26: 3D_XML  A three-Dimensional XML-based  Model

26

Conclusions

XML provides a flexible mechanism to represent temporal data.

The most usual temporal representation does not require changes of current XML standards.

An effective temporal information system should provide:– expressive temporal data model.– powerful language for temporal queries and

snapshot queries as well.

Page 27: 3D_XML  A three-Dimensional XML-based  Model

27

Future Work

Add more temporal constructs. Updates will be a real area of future

investigation. Improve the performance of our system.