• Aucun résultat trouvé

Temporal Data Mining Query Language

Dans le document The DART-Europe E-theses Portal (Page 106-109)

In this section, we introduce our domain specific query language for formalizing temporal data analysis tool chains.

We choose an algebraic syntax to formalize our query language. An algebraic syntax offers an abstract and flexible representation of the tool chain that makes it independent from the compu-tational model.

In principle, the tool chain is represented by an expression like:

op1p

1 op2p

2(hC1,D1i), op3p

3(hC2,D2i)

(5.1) whereop1p1,op2p2andop3p3are elementary operators with parameters (p1,p2andp3) andhC1,D1i represents a dataset of sequences. Each operator also returns a dataset of sequences. The dataset of sequences is represented by a pair. Dis the dataset itself representing andC is called the context.

The later is an abstract representation of the dataset formalism. An operator processes one or more datasets of sequences and generates (at most) another dataset of sequences.

In the following, we formalize the different elements of a query starting by the model of a dataset of sequences.

In principle, an element of the dataset, so calledindividual, is described by two aspects:

. a tuple of sequence valueshc1, . . . cnithat are not timestamped (for instance, the sex or the birthday of a patient),

. a temporal sequence of complex events: each event is represented by a tuple of values h[t, t+], v1, . . . , vni where [t, t+] is a temporal interval and v1, . . . , vn are typed values.

Intuitively, the event values (except timestamp) are described in a relational model.

Remark 9 (Interval vs punctual events). In this model the temporal events are associated to interval time span. Punctual events are temporal event that have a singleton interval, i.e., a temporal interval [t, t].

2This section presents results that are not yet published.

In addition, the dataset of sequences is equipped with a context which is a pair of abstract models of sequences values (constants for the patient) and event values (with timestamps). In short, the abstract model is a collection of attribute definitions which specify the type, the domain and the name of each attribute.

Definition 33 (Attribute definition). An attributea=hν, τ, δiis defined by:

. a nameν, i.e. a literal that identifies the attribute.

. a type τ among the common types (boolean, integer, float, string) and types for enumerates or taxonomies. Enumerate and taxonomy values enable to represent a finite collection of elements.

. (optionally) a domainδ. The domain is mandatory for type enumerate or taxonomy.

Definition 34 (Dataset context). A context is a tuple hC,R1, . . . ,Rri where R1, . . . ,Rr and C are sets of attribute definitions representing respectively the sequences attributes and the events attributes.

In a set of attributes, two different attributes can not hold the same name.

Intuitively, the dataset context give the schema of a sequence: C is the relation schema for sequence attributes and R1, . . . ,Rr are relational schema that can be used to describe different types of events. We denote<the set of sequence attributes schema, andris the number of relation schema. Each relation schemaR ∈ <represents events of typeR.

Remark 10 (Data model vs FOL representation of temporal sequences). This representation of temporal events has connections with the example of the manuscript introduction, and that we used in the case study of Section D in Chapter 4. The listing below is an example of information that we want to represent with our data model.

1sex(p1, 1) .

2 b i r t h Y e a r(p1, 1 9 7 9 ) .

3 e v e n t(p1, 0 , 0 , d r u g D e l i v e r y( 3 4 3 0 1 2 6 , 1) ) .

4 e v e n t(p1, 3 , 5 , p r o c e d u r e(E C G H 0 1 1) ) .

5 e v e n t(p1, 12 , 12 , d r u g D e l i v e r y( 4 9 9 1 4 0 1 , 1) ) .

6 e v e n t(p1, 23 , 23 , d r u g D e l i v e r y( 3 5 8 8 7 5 5 , 2) ) .

7 e v e n t(p1, 38 , 38 , p r o c e d u r e(Y Y Y Y 6 0 0) ) .

8 e v e n t(p1, 45 , 45 , d r u g D e l i v e r y( 3 7 2 3 0 9 3 , 1) ) .

9 e v e n t(p1, 62 , 66 , p r o c e d u r e(G A Q E 0 0 1) ) .

In this case, predicates sex/2andbirthYears/2encodes the sequences values, whileevent/4 predicate encodes temporal sequences of complex events.

In the FOL syntax, the context correspond to the set of predicates.

Definition 35 (Attributed events in contexthC,<i). Let R={r1, . . . , rm} ∈ < be the set of m event attribute definitions, then anattributed eventof typeRis a tuple of values([t, t+], v1, . . . vm) such that:

. t, t+∈R are timestamps such thatt≤t+,

. vi is a value of type τi in the domain δi for alli∈[m], whereri=hνi, τi, δiiis the attribute definitions of thei-th attribute.

For sake of conciseness, we denote by~vthe tuple of values.

Definition 36 (Attributed sequence in contextC =hC,<i). Let C={c1, . . . , cn} be the set of n sequence attribute definitions, then anattributed sequence is a pair id, ~v,s1, . . . ,sr

such that:

. id∈Nis an identifier of the individual,

. ~v is a tuple of values such thatvi is a value of typeτi in the domain δi for alli∈[n], where ci=hνi, τi, δiiis the attribute definitions of thei-th attribute,

. si=hsi1 . . . sikiiis a sequence of attributed events of type Ri, i.e. si is an attributed event in contextRi.

The identifier of the individualidrepresents the individual from which the sequence originates.

It is not an identifier of the sequence. More especially, this value is not necessarily unique in the dataset of sequences.

Our model of time for temporal events is based on intervals. This enables to represent both events with duration (t+> t) and punctual events (t+=t). One can note that we do not take into account the problem of multi-temporal granularity in the data [Euzenat and Montanari,2005].

The timestamps are represented by real values. It can be seconds, minutes, days or whatever but the domain of time is unique for all sequences in a dataset of sequences.

Definition 37 (Dataset of sequences in context C). Let C = h{c1, . . . , cn},{r11, . . . , rm11}, . . . , {rr1, . . . , rrmr}i be a context, a dataset of sequences with contextC denoted DC or (C, D), is a set of sequences in contextC.

Example 26(Care pathways). In this example, we propose to represent care pathways from data of the SNDS. An individual is a patient which has three attributes: its sex, its birth year and its local-ization code (zip code). Then we haveC={hsex, enum,{F, M}i,hby, Integer,[1900,2100]i,hzipcode, Integer,N+i}.

The care pathway of a patient is made of drugs deliveries, medical procedure and hospitalization.

The attributes of a drug delivery event are the ATC code, and the quantity of drug boxes. The attribute of a medical procedure event is the CCAM code. The attributes of an hospitalization event is the CIM 10 code (entrance principal diagnosis).

The Rdrug = {hcode, enum, AT Ci,hquantity, Integer,N+i}, Ract = {hcode, enum, CCAMi}

andRhosp={hcode, enum, CIM10i}.

We can now illustrate two instances of a sequence in the context C ={C,Rdrugs,Ract,Rhosp}:

1. (1,[M,1980,35700],sdrugs=h([0,0],[C01DA02,1]) ([10,10],[R01AD52,3]) ([31,31],[C07AA07,1])i, sacts=h([8,8],[HN CA006])i,shosps=h([35,39],[K35.0])i)

2. (2,[F,1945,27300],sdrugs=h([0,0],[A01BB04,4]) ([0,0],[R01AD52,1]) ([30,30],[R01AD52,3])

([31,31],[A01BA07,1]) ([90,90],[R01AD52,1])i,sacts=hi,shosps=h([32,34],[K35.0])([95,99],[K35.0])i) Let us now present the abstract notion of operator. Intuitively, an operator processes a collection

input datasets to output one dataset of sequences. Then, this an atomic operation on a dataset of sequences.

Definition 38(Operator). Anoperatoropof arityn∈Nis denotedop[p11,...,pmm](hC1,D1i, . . . , hCn,Dni)where:

. p1, . . . , pmare the parameters of the operator andρ1, . . . , ρmare parameters values or literals.

For anyi∈[m], ifρi is a literal, then it represents possible alternative configurations for the operator. The value of the parameter will be given at the execution.

. hC1,D1i, . . . ,hCn,Dniis an ordered list of datasets of sequences. This list can be empty.

We denote bylit(op)the list of the literals (or variables) used in the parameters of the operator opandar(op)the arity of the operatorop.

If the operator in a notterminal, then the operatoropyields a new datasethC,Di. Aterminal operator does not yield any dataset. A terminal operator can not be of arity 0.

Some remarks and precision about the definition of an operator:

. An operator of arity 0 (empty list of dataset) corresponds to a data source: it yields a dataset of sequences from not any other dataset.

. The parameters of an operator are typed. Their types are among the common types (string, int,float,boolean).

. A terminal operator can not be used as an argument for another operator. The terminal operator may have side effect: it can be used to output some results in files or to print results.

Now that operators have been defined, a workflow or a tool chain is simply a composition of operators. Instead of proposing an algebraic definition of a workflow, as illustrated in Eq. 5.1, we propose a definition based on a graph.

Definition 39(Processing chain/workflow graph). A workflow is a directed graph of noperators h{op1, op2, . . . , opn}, e: [n]×[n]7→Niwhere{op1, op2, . . . , opn}are operators (vertices of the graph) andeare the directed edges between operators, and such that:

. each terminal operator has an outdegree3 equals to 0,

3The outdegree of a vertex is the number of edges pointing from it.

op1[p=X]

op2[p=2]

op3[] hC,Di C 1

C 1

2

Figure 5.2: Graph of the workflow in Example27: hC,Di=op3[](C, op2[p=2](C=op1[p=X]())).

. each operator vertex has an indegree4 equals to the arity of the operator.

Letoando0 be two operators, thene(o, o0)>0iffois a parameter of theo0 operator. The edge direction indicates the data flow from the producer to the consumer. The value e(o, o0) indicates the position of oin the list the parameters of o0.

The workflow does not constraint the outdegree of non terminal operators. This means that the output of an operator can be used by several operators. In this case, the outdegree. In the algebraic representation of a workflow, we use renaming of output dataset to represent its multiple usage (see Example 27). In addition, a non terminal operator without outedge is an output of the workflow. Thus, the workflow may have several outputs.

We will see that operators may have some requirements for their operands (for example, having an attribute with a specific name). These requirements are integrity constraints that are specified by each operator. We do not represent these constraints in our formalization of a workflow. Indeed, we relegate these constraint to the workflow execution process. The operator is executed iff the constraints are satisfied. Otherwise, there is no output.

Example 27 (Algebraic and graph representation of a workflow). Let op1, op2 and op3 be three operators of arity 0, 1 and 2 (respectively) and let hC,Di = op3[](C, op2[p=2](C =op1[p=X]())) be a workflow. In this workflow, op1[p=X] is a data source (null indegree). The value of parameter pis given by a literal (X). A value is assigned toX at the execution of the workflow. The value of the parameter p in operator op2 is 2. The syntax C = op1[p=X]() denotes the renaming of the output of op1: once in op1 and once inop3. It illustrates the multiple usage of the output of the operator op1. The Figure5.2illustrates the graph representation of this algebraic expression.

Definition 40 (Query). Aquery is a triple(G,O,X)where:

. G is a workflow involving operators {op1, op2, . . . , opn},

. O ⊆ {op1, op2, . . . , opn} is a set of output operators for which we would like the dataset, . X is an assignment of parameters literals ofS

i∈[n]lit(opi).

The assignment of parameter literals is global. This means that the same value replaces all use of a parameter literalX in the workflow.

At the time, there is no query pre-checking mechanism in our tools. Some operators have requirements (for instance a number of input dataset, or event requirement on the context of the input dataset). Then, the requirements are checked while running the workflow. It would be interesting to induce the context without running operators to have static pre-checking of the workflow, and avoid running workflow with prototyping errors.

Dans le document The DART-Europe E-theses Portal (Page 106-109)