Temporal Query Languages - PowerPoint PPT Presentation

About This Presentation
Title:

Temporal Query Languages

Description:

Introduction to temporal databases. Temporal databases overview. Properties of query languages ... Eschew Temporal DB Glossary of Jensen, et al, in Tansel book, ... – PowerPoint PPT presentation

Number of Views:248
Avg rating:3.0/5.0
Slides: 48
Provided by: barry69
Learn more at: https://infolab.usc.edu
Category:

less

Transcript and Presenter's Notes

Title: Temporal Query Languages


1
Temporal Query Languages
  • a Survey
  • by Jan Chomicki, January 24, 1995
  • Computing and Information Sciences
  • Kansas State University
  • Presented by Barry Klein, USC, October 3, 2000

2
Contents
  1. Introduction to temporal databases
  2. Temporal databases overview
  3. Properties of query languages
  4. Abstract query languages
  5. Concrete query languages
  6. Incomplete temporal information
  7. Related work in artificial intelligence

3
Introduction to temporal databases
  • Key concepts Temporal Domain, Abstract and
    Concrete representations/Query langs, Incomplete
    Temporal Information. Interpreted db domain.
  • Examples financial/personnel/medical/legal
    records network monitoring, process control
  • Framework integrate temporal research with
    research in db theory, logic and AI.
  • Eschew Temporal DB Glossary of Jensen, et al, in
    Tansel book, to comply with accepted db terms.

4
Intro to temporal databases (contd)
  • ANSI/SPARC architecture 3 levels
  • Physical External Conceptual abstract vs.
    concrete
  • Abstract formal meaning representation-independ
    t
  • Concrete specific, finite rep of a certain data
    model
  • Abstract languages
  • 1st-order and temporal logic, relational algebra,
    deductive languages
  • Concrete languages
  • TSQL2 others in 107, 108, 110

5
2. Temporal databases
  • Major issues
  • Choice of temporal domains (only flat types
    considered in this survey)
  • Points vs. intervals
  • Linear vs. branching
  • Dense vs. discrete
  • Bounded vs. unbounded time
  • Query Language issues
  • formal semantics, expressiveness, implementation

6
2.1 Temporal domains
  • Temporal ontology 2 distinctions from AI and
    logic
  • Points, or instants (at particular times)
  • Intervals (during ranges of time)
  • Point view dominant in database work intervals
    defined as pairs of endpoints, making it easy to
    move between the 2 views in first-order case

7
2.1 Temporal domains (contd)
  • Mathematical structure on points
  • Partial order
  • Total (linear) order
  • Ex cyclic time modeled with linear transitive
    order, reflexive symmetric, or with ultimately
    periodic sets
  • Branching time modeled with partial order
    satisfying left-linearity (no branch to left)

8
2.1 Temporal domains (contd)
  • Temporal domain first-order structure with a
    given Signature (set of Constant, Function and
    Relation symbols)
  • Typical elements of signatures
  • lt binary-order relation
  • 0 origin or std ref pt of a temporal domain
  • s denotes succession of time points
  • , - relative distance of time points
  • ?k periodicity congruence modulo k

9
2.1 Temporal domains (contd)
  • Standard temporal domains (in this 1st-order
    structure
  • N natural numbers
  • Z integers
  • Q rationals
  • R real numbers
  • Equality not necessarily available in domains
    like TSQL2
  • Temp domains may have finite universes, or
    bounded subsets of standard domains

10
2.1 Temporal domains (contd)
  • Common assumption Time is discrete and
    isomorphic to natural numbers vs. AI view that
    time is usually dense.
  • Continuous time is becoming valuable in math,
    physics and hybrid systems.
  • Constraint formula allows finite representation
    of dense sets in computer storage
  • Higher level, or multiple-time granularities
    (hours vs. weeks), require multiple, interrelated
    temporal domains (not included in this survey)

11
2.2 Abstract temporal databases
  • Model-theoretic view is most basic view
  • Treats ATD as a 1st-order structure
  • Snapshot view treats ATD as a function mapping
    each instant as a tuple
  • Timestamp view maps a set of instants with each
    tuple

12
2.2 Abstract temporal dbs (contd)
  • Assumptions
  • Single temporal dimension and domain T
  • Single data domain U containing standard db
    constants (these two will be expanded)
  • Context relational data model, then generalized
    to other 1st-order data models
  • Fixed db schema with a fixed set of relations

13
2.2 Abstract temporal dbs (contd)
  • Model-theoretic view
  • Abstract temporal relation
  • (a1,-,an,t) ? P iff P(a1,-,an) holds at t where
    (a1,-,an) ? U
  • where P is a relation of arity n, P of arity
    n1, U is a single data domain, and t is a
    particular instant.
  • Formally, an ATD (a finite temporal structure D)
    (U,T,P1,,Pk) for the 2-sorted 1st-order
    language LD containing a new relation symbol for
    each A.T. relation Pi and constant symbol for all
    ? U, and also 0 ? T.
  • The final element of Pi is temporal the others
    are data.
  • No assumptions are made about temporal domain T
  • D is finite if it consists of finite relations

14
2.2 Abstract temporal dbs (contd)
Model-Theoretic View
15
2.2 Abstract temporal dbs (contd)
  • Snapshot view a set of functions s/t
  • f Pi(t) (a1,,an) Pi(a1,,an) holds at t
  • where each such relation is binary in which the
    values of the 2nd attribute are sets of tuples
    i.e., non-1NF.
  • Timestamp view a set of functions s/t
  • f Pi( a1,,an) t Pi(a1,,an) holds at t
  • Here the db consists of a timestamp relation for
    each relation symbol, and each relation (non-1NF)
    data attributes corresponding to the relation
    symbol, a timestamp attribute, which is a set
    of instants.

16
2.2 Abstract temporal dbs (contd)
Snapshot View
17
2.2 Abstract temporal dbs (contd)
Timestamp View
18
2.2 Abstract temporal dbs (contd)
  • Multiple temporal dimensions
  • Necessary to model intervals (pairs of pts)
  • Multiple kinds of time
  • Valid vs. transaction ref. time vs. event time
  • Assumption single temporal domain
  • Interpretations of MDTD captured by adding axioms
    as integrity contstraints
  • An intervals start must precede its end.
  • Adding dimensions increases complexity

19
2.2 Abstract temporal dbs (contd)
  • Example properties of ATDs
  • In Valid-time TDs, a model is point-based if
    facts are associated with single instants
  • Interval-based if events are associated with
    intervals (represented as pairs of instants)
  • The semantics of many query languages and
    integrity constraints can be defined directly,
    regardless of representation method.

20
2.3 Concrete temporal databases
  • Any model-specific db just a rep of a ATD
  • 2 CTDs are equiv if they rep the same ATD
  • An ATD may be infinite, but only finite objects
    can be explicitly represented in storage.
  • Many TDB models incompatible unless specific
    representations of ATDs.

21
2.3 Concrete temporal dbs (contd)
  • Two important properties of CTD classes
  • Data expressiveness
  • How many ATDs can be represented within it (gives
    a metric to expressiveness)
  • Succinctness how much space is needed to
    express a given ATD (also good metric).

22
2.3 Concrete temporal dbs (contd)
  • Concrete Timestamp Databases
  • Timestamp view ? most useful for CTD
  • Infinite set implicitly represented with
    timestamp formulae 1st-order formulae with one
    free variable in the language of the temporal
    domain.
  • Example 0 lt t lt 5 V t gt 10
  • See next slide for an example CTS DB

23
2.3 Concrete temporal dbs (contd)
Timestamp View with Timestamp Formulae
24
2.3 Concrete temporal dbs (contd)
  • Timestamp formulae
  • For temporal domain (N, lt) timestamps must be
    finite or co-finite subsets of N.
  • Presurger arithmetic (N, 0, , lt) timestamps all
    ultimately periodic subsets of N.
  • Ex natural numbers beginning with 0, period 7
  • ?y, t y y y y y y y
  • Equivalently, as congruence formula t ? 7 0
  • where ? k means congruent modulo k.

25
2.3 Concrete temporal dbs (contd)
  • These as timestamps allow infinite ultimately
    periodic ATD to be represented finitely.
  • Ultimately periodic means that, if some natural
    number is added to the time coordinate, a given
    set of relationships in the ATD still holds true.
  • Calendars can be defined with inf. periodic sets.
  • Finite periodic sets may be represented well as
    infinite sets constraints for finiteness.
  • Ex all Sundays in a year

26
2.3 Concrete temporal dbs (contd)
  • Quantifier Elimination main tool in theory of
    timestamp dbs.
  • A theory admits Q.E. if every formula in the
    theorys language can ? an equiv formula free of
    quantifiers.
  • These must satisfy tests, for example, that a
    specific instant belongs to a timestamp.

27
2.3 Concrete temporal dbs (contd)
  • Features of timestamp formulae
  • Constraints are atomic TSFs
  • A TSF is termed separable if it is a conjunction
    of the forms t c, t lt c or t gt c, and c is in T
  • To admit gt 1 dimension or rep an interval
    requires timestamp formula to have at least 2
    free variables
  • Timestamps may be associated either with tuples
    or with attribute values
  • Assumption timestamps are finite or bounded
    sets, unless TSF used to rep inf sets implicitly

28
2.3 Concrete temporal dbs (contd)
  • Finite Temporal DBs
  • For snapshot dbs or temporal structures to be
    used as CDBs requires they be finite and describe
    a finite subset of time domain
  • These 2 forms usually waste too much space

29
2.3 Concrete temporal dbs (contd)
  • Features of Logic Programs
  • To represent an (infinite) ATD as finite, LPs
    consist of deductive (Horn) rules a finite db
  • The ATD corresponding to such a program is called
    its least Herbrand model
  • Ex to rep Sundays sunday(0),
  • sunday(s7(T)) - sunday(T).
  • Notation (N, 0, s) used for LP syntax where s is
    a unary successor, in only 1 argument of a
    relation

30
2.4 Interoperability
  • If two temporal data models, ?1 and ?2, use the
    same temporal domains, then the meaning of ?1
    (resp ?2) is defined as a total mapping h1 (resp
    h2) from CTDs defd under ?1 (resp ?2) to ATDs.
  • The inverse mappings h-11 and h-12 may be only
    partial (some ATDs may not be repable in the
    given data model)
  • Let rep function composition then d1 h-11
    h2(d2) represents the CDB under ?1 corresp to a
    CDB d2 under ?2. Then d1 can be queried the same
    as ?1.
  • This provides the access for d2.

31
3 Properties of Query Languages
  • A semantics is declarative if it assigns meaning
    to a query without ref to evaluation method
  • Query evaluation can be in closed form if the
    query result can be expressed in the dbs
    language
  • Repl independence a query answer s/b the same
    for any 2 CDBs representing the same ATD
  • Query expressiveness 2 queries equivalent if
    they return the same answer for every db.
  • Data complexity the computational complexity of
    the set of finite dbs where a fixed query true

32
4 Abstract Query Languages
  • 4.1 Relational Calculus
  • Domain relational calculus the 1st-ord logic of
    an ATD (model theoretic view) can be used as a
    QL.
  • Semantics Tarskian, which is declarative the
    answer to a 1st-order query is valuations that
    make the query formula true in the given db
  • 1st-order logic can be used as a concrete query
    language

33
4.1 Relational Calculus (continued)
  • Example query list all countries that lost and
    regained independence. (the example was done in
    2nd-order relational calculus)
  • 2 ways to implement query evaluation in CTS DBs
  • Translate the query to relational algebra, use
    generalized versions of RA operations.
  • Directly eval the query in closed form (resulting
    in a timestamp relation) using quantifier-eliminat
    ion procedures for the temporal and data domains.

34
4.2 Relational Algebra
  • RA semantics are defined as set theory for
    possibly infinite relations, so it fits the
    model-theoretic view of ATDs
  • In snapshot view, RA operations can be used only
    on snapshots corresponding to the same time
    instants in different relations (pointwise).

35
4.3 Temporal Logic
  • Use a temporal extension of 1st-order LD tl(LD)
  • Contains the binary connectives since until
  • ?A sometime in the past true since A
  • ?A (sometime in the future A) true until A
  • These connectives may become invalid when the
    dimension is gt 1

36
4.4 Inductive Query Languages
  • Natural queries may be inductive or 2nd-order
  • Ex find all who are at risk (infected
    previously or been in contact with an at-risk
    person)
  • Logic programming languages extend Datalog
    (language of function-free logic programs)
  • Datalogltz with integer order constraints
  • DatalogltQ with rational order constraints
  • Datalog1S a unary successor symbol in 1 arg
  • unary successor symbol linear arith constraints

37
5 Concrete Query Languages
  • 5.1 TQuel
  • Supports single temporal domain discrete,
    finite, multi-level (can refer to specific day or
    hour)
  • 2 temporal dimensions valid and transaction time
  • Data model a timestamp is an interval
  • Intervals must be maximal so the timestamps of
    identical facts coalesce for overlapped intervals
  • An insertion may trigger a coalesce operation

38
5.1 TQuel (continued)
  • TQuel can simulate temporal logic queries
  • 1st-order language cant express inductive
    temporal queries
  • Data complexity polynomial
  • Timestamp max req ? a given abstract temporal rel
    is uniquely repd as a TQuel rel
  • No support for gt 2 temporal dimensions

39
5.2 TSQL2
  • SQL2 with time component
  • Linearly ordered
  • No test for equality of time constraints (can
    give diff answers for discrete dense temp
    domains)
  • Point-, not interval-based
  • Facts are timestamped with finite unions of maxl
    intervals (one timestamp/fact)
  • No semantics or formal properties established ?
    use of interval rels insufficient for unions of
    intervals

40
5.3 Hist. Relational Data Model
  • HRDM supports single, discrete and infinite
    temporal domain single time dimension
  • Relations are finite
  • Non-uniform rel attributes some are parts of key
  • Non-key attributes can be functions? limited
    non-1NF relations
  • No specs for which subsets of the temporal
    domain can serve as function domains difficulty
    assessing expressiveness of the model or comp
    complexity of queries.

41
5.3 HRDM (continued)
  • Redefines most operators of RA
  • Semantics defined with set theory
  • Cant express queries relating snapshots at
    different instants
  • 1st-order algebra cant express inductive
    temporal queries
  • SQL extension not representation-independent

42
5.4 Backlog Relations
  • Supports single, discrete, infinite temporal
    domain valid- and transaction-time dimensions
  • These 2 dimensions are not independent here
  • Backlog rels store not data, but change requests
  • Only transaction-time instants are stored
  • Valid time requires a scan that a tuple was
    inserted but not later deleted
  • BRs rep only finite abstract temporal relations

43
5.4 Backlog Relations (continued)
  • Example - 5 attributes consec of updates
    op-name transaction time country capital.

44
6 Incomplete Temporal info
  • Example partial ordering of events
  • Various solutions proposed
  • Non-linear, based on events
  • Generalize the temporal db paradigm
  • Marked nulls stand for some value in domain
  • Same null value may be in diff columns or rows
  • Each row has quantifier-free local condition with
    some nulls of this row

45
6 Incomplete Temporal info (contd)
  • Entire table has a quantifier-free global
    condition relating nulls in different rows
  • Indefinite timestamp formulae define indefinite
    timestamps which are sets of timestamps
  • An indefinite timestamp table is a finite set of
    tuples with indef ts formulae a global
    condition
  • Semantics of an indef temporal table sem(T)
  • rep(T) is ts rels ? substing domain vals for
    nulls satisfying the global condition of T

46
6 Incomplete Temporal info (contd)
  • In van der Meydens framework, only single vals,
    which may be null, can constitute timestamps
  • Only finite ATDs can then be represented
  • Nulls can be related via global conjunctive cond
  • May be arbitrary of temporal dims, but the
    complexity of evaluating queries relies on the
    num.
  • Data complexity for certain answers to FO
    queries
  • In PTIME for one-dimensional time
  • co-NP-complete for greater of dimensions

47
7 Related Work in AI
  • Most AI approaches restricted to the
    propositional (non-temporal) case
  • Often take an interval view of time originating
    in the work of J.F. Allen, where each prop is
    assoc with an interval where it holds true.
  • 2 intervals could relate via a rels
    representing a disjunction? allows rep of much
    disjunctive info
  • 1st-order queries re quantifiers are not
    supported
  • Queries evald via constraint-satisfactn
    algorithms
Write a Comment
User Comments (0)
About PowerShow.com