3d_xml a three-dimensional xml-based model
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 PresentationTRANSCRIPT
1
3D_XML A three-Dimensional XML-based Model
Khadija Ali, Jaroslav PokornýCzech Technical University
Prague - Czech Republic
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.
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).
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.
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“
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.
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
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]
9
3D_XML Model
Valid/Efficacy Times Relationship1. (vtStart < etStart), or (vtEnd > etEnd)
Valid data stops to be applicable
10
3D_XML Model
2. (vtStart > etStart), or (vtEnd < etEnd)
Data is applicable although it is not valid
11
3D_XML Model
3. (vtStart = etStart), and (vtEnd = etEnd)
The normal case
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
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>
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>
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“ />
16
Data Modeling
Time dimensions Constraints
1. Conjunction Constraints2. Disjunction Constraints
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
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
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.
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)};
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()};
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 ()
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) };
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“.
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 ()
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.
27
Future Work
Add more temporal constructs. Updates will be a real area of future
investigation. Improve the performance of our system.