Modalities for an Allegorical Conceptual Data Model

Allegories are enriched categories generalizing a category of sets and binary relations. In this paper, we extend a new, recently-introduced conceptual data model based on allegories by adding support for modal operators and developing a modal interpretation of the model in any allegory satisfying certain additional (but natural) axioms. The possibility of using different allegories allows us to transparently use alternative logical frameworks, such as fuzzy relations. Mathematically, our work demonstrates how to enrich with modal operators and to give a many world semantics to an abstract algebraic logic framework. We also give some examples of applications of the modal extension.


Introduction
Allegories, introduced by Freyd and Scedrov [1], are enriched categories modeled upon the category of sets and binary relations, R, in such a way that allows for other realizations of allegorical axioms than R, while still preserving many of the useful R properties.This is similar to the way in which toposes generalize the category, Set, of sets.For a logician, allegories can be seen as the generalizations (with some axioms relaxed) of the relation algebra [2].Because of the deep relationship between relational databases and relational algebra and also a lively research program of using category theory for conceptual modeling (see e.g., [3][4][5][6][7][8][9][10]), it is surprising that allegories were hardly ever used for database modeling.The use of allegories for this purpose was suggested in [9], and recently, the new allegorical data model was introduced by the authors in [11]; barring that, the authors were unable to secure more references.
In the majority of works applying category theory to conceptual database modeling, the arrows in a category are interpreted as functional dependencies.While this approach was successfully used, e.g., in tackling the view update problem ( [12,13]) and in the treatment of incomplete data ( [14]), the advantage of using the allegories instead of plain categories is that they furnish interpreting the arrows as arbitrary binary relationships (including non-functional ones), and makes the use of auxiliary constructs, like spans or power sets, unnecessary.
Conceptual database modeling is an important part of the database design process, assisting in creating better database schema and applications and also isolating the designer from the technical details of a particular database technology, which might be relational, object-oriented, XML, etc.One of the rationales for using category theory (and allegories, in particular) for conceptual modeling instead of plain first-order logic or relational algebra is that it allows one to abstract away also some ontological and logical commitments [11]: the data model formulated in terms of an allegory can be interpreted both in the allegory of (sharp) relations, but also in some allegory of fuzzy relations; thus, the database designer can, to some extent, free herself from the dependence on the particular choice of logic.
A desired feature of the conceptual model is the possibility of extending the model to increase its expressivity, when such a need arises.An example of such an extension is adding the modalities and many world interpretations, useful e.g., in the context of temporal or distributed databases.A main contribution of this paper is adding support for modal operators to the allegorical conceptual data model described in [11].Here, we add the many world semantics to the model using only the language of allegories.This means that we are doing it independently of a concrete allegory; we can do it, e.g., for both sharp and fuzzy relations.
For both the allegorical model to be useful and the introduction of many worlds semantics to be possible requires more structure than provided by the plain allegories.A structure we work with here and which we conjecture to be minimal is that of a complete distributive allegory with all relational products (which are just products in the subcategory of maps).Our sentences are equalities between type safe terms formed using language of these categories.In particular, when our model is interpreted in R, this language is sufficient to express any first-order sentence (cf.[2]).The specification of the model resembles the algebraic sketch (see, e.g., [15]), but is a lot more expressive; in fact, limits and colimits in the subcategory of maps (arrows that are like total functions) are definable within our formalism (see [1]).
The many worlds semantics of the allegorical conceptual model is introduced as the family of interpretations of the model in a family of allegories (each corresponding to the "world"), as well as a special allegory providing a kind of common interpretation and within which one can define the modal operators using only the allegorical operators, together with the structure connecting "worlds" with one another and the common interpretation.
The structure of this paper is as follows.In Section 2, we recall some basic facts about category theory and allegories, as well as the definition (slight extension) of the allegorical conceptual model from [11].
In Section 3, we develop our modal extension and its semantics, and finally, in Section 4, we give some examples of modal specifications and queries.

Preliminaries
We recall some basic categorical definitions in order to fix the clean, but somewhat idiosyncratic, notation we use.The bulk of this preliminaries is taken, first by introductory material on allegories, which are not widely known and for which [1] is the basic textbook, and, then, by modified definitions of an allegorical conceptual data model from [11].
The reader might be disturbed by our consequent use of the term "set" where "class" might be more appropriate.We do it consciously, in order not to clutter the presentation with the set-theoretical considerations.The reader should also remember that while we use the ¤; ¤ operator to compose arrows in diagrammatic order, we also denote by f ¥ g the composition in the assignment order (i.e., pf ¥ gqpxq : f pgpxqq), of any two actual maps (that is, procedures that assign values to values) whenever those maps are not used as arrows in a category.

Categories and Graphs
A graph, G, consists of a set of vertices, ObjrGs, a set of arrows, ArrrGs, and a pair of maps Ð Ý p¤q, Ý Ñ p¤q : ArrrGs ÝÑ ObjrGs called source and target, respectively.We denote by Arr G pA, Bq the set of arrows with source A and target B, where A, B ObjrGs.A graph morphism F : G Ñ H from a graph, G, to a graph, H, is a pair of maps: A category, C, is a graph with associative arrow composition f ; g Arr C p Ð Ý f , Ý Ñ g q, defined whenever Ý Ñ f Ð Ý g (note the diagrammatic order), and identity map id : ObjrCs Ñ ArrrCs such that idp Ð Ý f q; f f ; idp Ý Ñ f q f for all f ArrrCs.We write id A : idpAq.When using single letter arrow names, we will often omit the semicolon composition operator abbreviating f g : f ; g.A graph morphism F : C Ñ D between categories is called a functor when it maps identity arrows to identity arrows and respects composition, i.e., F a pid A q id FopAq and F a pf; gq F a pfq; F a pgq.

Allegories
An allegory [1] A is a category enriched with intersection and reciprocation operators, respectively, for all A, B ObjrAs: We require these operators to satisfy the following conditions: Intersections make each hom-set a meet semi-lattice (see, e.g., [16]), where we denote the associated partial order by , i.e., R S : R S R, for all R, S Arr A p Ð Ý R , Ý Ñ R q.In addition, ¤ ¤ and p¤q ¥ are to satisfy: for all R, S, T ArrrAs such that the above formulas are well-defined.
Allegories generalize the allegory, R, of sets (objects) and binary relations (arrows).Because of this, we may refer to arrows in any allegory as "relations".In R, we write aRb iff pa, bq R. The identity in R is id : A Þ Ñ tpa, aq|a Au; intersection is the set intersection, i.e., R S : R S; reciprocation is defined by aR ¥ b : bRa; and the composition of relations R, S ArrrRs such that Ý Ñ R Ð Ý S is defined by: apRSqc : hb Ý Ñ R .aRb bSc (2) We distinguish the following classes of arrows in allegory: • If R is functional and total, it is called a map.A set of all maps in an allegory, A, is denoted by: MaprAs.
For any maps h, h I MaprAs with target A, if h; r i h I ; r i for all i, then h h I .
For any A, B ObjrAs, we denote by t A,B and u A,B the top and bottom elements of Arr A pA, Bq, respectively, if they exist.In R, we have t AB : A ¢ B, u AB : r AB .
Suppose that the top element t AB Arr A pA, Bq exists.An object, C, together with maps π A , π B MaprAs (called projections on components), where the arrow π X Arr A pC, Xq, X A, B, is called a relational product iff: Relational products are products in MaprAs, and they are unique up to an isomorphism.On the other hand, a product in MaprAs is not necessarily a relational product (see, e.g., [17]).Let f, g MaprAs be such that Then, the unique map, h MaprAs, such that f h; π A , g h; π B can be expressed explicitly as: In an allegory, A, there might be a canonical choice of a relational product of each A, B ObjrAs.In such a case, we denote the canonical product object by A B and the projections by π AB A and π AB B .In R, the canonical relational product is the usual Cartesian product.
A distributive allegory is an allegory, A, in which for all hom-sets, Arr A pA, Bq, there exists a bottom element, u AB Arr A pA, Bq, and a binary operation: ¤ ¤ : Arr A pA, Bq ¢ Arr A pA, Bq Ñ Arr A pA, Bq which together with ¤ ¤ makes Arr A pA, Bq a distributive lattice with ¤ ¤ as the infimum and ¤ ¤ as the supremum.In addition, we require that ¤ ¤ and u AB satisfy: for all R, S, T ArrrAs such the above formulae are type-correct.One proves easily that: pu AB q ¥ u BA , pR Sq ¥ R ¥ S ¥ A locally complete distributive allegory is a distributive allegory in which each of the hom-sets is a complete lattice, and moreover, the following infinite distributive laws hold: for any arrow R and a family tS i u i such that the above formulas make sense.As a consequence, each of the hom-sets in a complete distributive allegory, A, is a locale (a complete lattice in which finite meets distribute over any joins) or, equivalently, a complete Heyting algebra.More precisely, the above distributivity condition implies the existence of a binary hom-set operator, Ñ, called implication, defined uniquely by the property: R S T S pR Ñ T q for all R, S and T in the same hom-set.The implication can be expressed explicitly by the formula: We denote for brevity 2R : pR Ñ uÐ Ý R Ý Ñ R q.A hom-set, Arr A pA, Bq, is a Boolean algebra if and only if one of the equivalent conditions below hold for all R Arr A pA, If this is the case, then R Ñ S : 2R S. It is immediate that R is a locally complete distributive allegory with the union defined as a set union, i.e., R S : R S, and in which every hom-set is a Boolean algebra where ap2Rqb : 2aRb.
It is worth noting that a locally complete distributive allegory is a division allegory [1], that is, a distributive allegory with a partial binary operation ¤{¤ (called a right division), defined if and only if both arguments have the same targets, and satisfying for all arrows R, S and T : In a distributive allegory which is locally complete, the (unique) operation satisfying the above axioms is given by R{S : In the present paper, we do not utilize this operation, but it would be easy to extend the language of the conceptual model considered here with the right division operator, in order to increase its expressivity.
The allegorical conceptual data model introduced in [11] requires that the allegories in which the model is interpreted contain canonical relational products of all pairs of objects and top and bottom elements in all hom-sets.Here, because the modal structure imposed on the model in this paper requires the locally complete distributive allegories anyway for the definitions to make sense, we enrich the language of specification to include unions and implications and, thus, require from the allegories in which models are interpreted to be distributive.For an easy reference, we call such allegories PTBDI (product, top, bottom distributive and containing implications) allegories.In particular, R is a locally complete PTBDI allegory.

Allegorical Conceptual Data Model
Before we can recall the definition of the model, we need first the following two auxiliary notions: Definition 1.An extended set of objects Obj E rGs of a graph G is defined as a groupoid (i.e., a set with a binary operation ( [18], Chapter V)) with operation generated by ObjrGs, i.e., if A, B, C ObjrGs, then A B, A A, pA Bq C Obj E rGs, etc. Definition 2. Let G be a graph.A set, T G , of allegorical terms associated to (cf.[11]) G is defined as the smallest set of expressions such that: We omit unnecessary parentheses when writing elements of T G .In the above conditions, we used the functions Ð Ý p¤q, Ý Ñ p¤q : T G ÝÑ Obj E rGs defined in an obvious way using induction on the structure of terms as the extension of source and target functions, i.e., ÝÝÑ t

ÐÝÝ π AB
A A B and so on, for any terms t, t 1 , t 2 .
We are now ready to formulate the definition of our conceptual model.

Definition 3.
An allegorical conceptual data model, pG, Eq, consists of a finite graph, G, and a finite set, E, of equations of the form t 1 t 2 , where t 1 , t 2 T G .
We write the equations of the form t 1 t 2 t 1 as t 1 t 2 .Equations allow us to specify constraints and dependencies between data elements.
Example 1.A conceptual model pG, Eq loosely based on an example HR database of Oracle is depicted in Figure 1 (graph G) and Figure 2 (equations E).Equation (a) states that the arrows in the list are (total) maps; Equation (b) states that maps street, street-no, code, city and country are jointly monic (that is an Address is uniquely determined by the values of these attributes).Equation (c) makes "¤" a linear order and under transitive (it is meant as a transitive closure of the chain of commands) and irreflexive relation.The first two equations in Equation (d) specify that manages ¥ is an injective map (i.e., each department has a manager, and no manager manages two different departments).Then, the last of equations in (d) link relations manages and under by specifying that either an employee is a manager of the department he/she works in or he/she is under the departmental manager.Finally, Equation (e) limits the wages by enforcing that an employee doing a certain job type may not earn less than the minimal wage nor more than the maximal wage associated with the given job type.
The model is intended to be interpreted in some PTBDI allegory.Each interpretation corresponds to some actual realization and state of the database.The choice of allegory determines the kind of database; different interpretations in the same allegory may be interpreted as different states of the same database.Interpretation of the allegorical conceptual model in R is the typical choice.In order to formulate the precise definition of interpretation, we first need the following simple observation:

street-no T T T T T T T T T T T T T i i T T T T T T T T T T T T T
country city j j j j j j j j j j j j j j u u j j j j j j j j j j j j j j

Cities Countries
Figure 2. Equations specifying the properties of relations from Figure 1.
for all R tstreet, street-no, code, city, country, located-at, dept-name, job-name, works-in, min-salary, max-salary, earns, works-as, first-name, last-nameu, id Salaries "¤" p"¤"q ¥ , "¤"; "¤" "¤" under; under under, under id Employees u Employees Employees (c) manages; manages ¥ id Employees , manages ¥ ; manages id Employees , works-in; manages ¥ under id Employees , works-as ¥ ; earns min-salary; "¤", works-as ¥ ; earns max-salary; p"¤"q ¥ (e) Lemma 4. Let G be a graph, and let A be a PTBDI allegory.Let F : G Ñ A be a graph morphism.Then, F o can be extended to a map Fo : Obj E rGs Ñ ObjrAs using induction on the -groupoid structure of Obj E rGs; that is, by defining Fo pA Bq Fo pAq Fo pBq for all A, B Obj E rGs.Similarly, F a can be extended to a map Fa : T G Ñ ArrrAs using induction on the structure of terms in T G ; that is, by defining Fa pid A q id FopAq , Fa pt 1 ; t 2 q Fa pt 1 q; Fa pt 2 q, and so on.
The following remark clarifies the above lemma.Suppose that: R G G contained in a graph G, and that F : G Ñ A is a graph morphism from G into a PTBDI allegory, A, such that F a pTq $ F a pRq; F a pSq.Consequently, by the above definition of the extension Fa : T G Ñ ArrrAs of F a , we have Fa pR; Sq : F a pRq; F a pSq $ Fa pTq, where Fa pTq : F a pTq.Note that even if T is intended to be interpreted as a composition of R and S, this intention cannot be communicated through the structure of the graph, G, and hence, it does not introduce any inconsistency in the extension of F a .
On the other hand, the intended identification of T with the composition of R and S can be declared through equations.In particular, if pR; S T q E, then F cannot be an interpretation of pG, Eq, as defined below.
Definition 5. Let pG, Eq be an allegorical conceptual data model, and let A be a PTBDI allegory.
A graph morphism H : G Ñ A is called an interpretation of pG, Eq in A if Ĥa pt 1 q Ĥa pt 2 q for all equations pt 1 t 2 q E. A set of all interpretations of pG, Eq is denoted by IptrG, Es, and the set of all interpretations in an allegory A is denoted by Ipt A rG, Es.
Reasoning about data is furnished by the following semantic definition of a derived equality: Definition 6.Let pG, Eq be an allegorical conceptual model.We write pG, Eq | ù F t 1 t 2 , where F is an interpretation of pG, Eq if Fa pt 1 q Fa pt 2 q.We write pG, Eq | ù t 1 t 2 (the equality t 1 t 2 holds in pG, Eq) if pG, Eq | ù F t 1 t 2 for any interpretation F of pG, Eq.

Modal Terms and Modal Interpretations
Recall that a modal similarity type pS, ρq consists of a set, S, of symbols and a map ρ : S Ñ N called an arity.A frame pM, Rq with modal similarity type pS, ρq is a set, M, together with a family R : tR S M ρpSq 1 | S Su of relations.
Let G be a graph, and let pS, ρq be a modal similarity type.We extend the set, T G , of allegorical terms associated with G to a set, T S,ρ G , of modal allegorical terms of modal similarity type pS, ρq by introducing new term constructors called modal operators: for each S S, such that ρpSq ¥ 1, and each term t 1 , . . ., t ρpSq T S,ρ ∆ S pt 1 , . . ., t ρpSq q, ∇ S pt 1 , . . ., t ρpSq q T S,ρ G .We also declare: ÐÝÝÝÝÝÝÝÝÝÝÝÝ ∆ S pt 1 , . . ., t ρpSq q Ð Ý t 1 ÐÝÝÝÝÝÝÝÝÝÝÝÝ ∇ S pt 1 , . . ., t ρpSq q ÝÝÝÝÝÝÝÝÝÝÝÝÑ ∆ S pt 1 , . . ., t ρpSq q Ý Ñ t 1 ÝÝÝÝÝÝÝÝÝÝÝÝÑ ∇ S pt 1 , . . ., t ρpSq q (i.e., modal operators associate arrows with arrows from the same hom-set) so that the terms with modal operators can be used as subterms.Arity zero modal operators (that is, modal constants) require special treatment.For all S S such that ρpSq 0, and all pairs of objects A, B ObjrGs, we declare ∆ AB S to be a term in Definition 7. Let pM, Rq be a frame of similarity type pS, ρq; let A be a locally complete PTBDI allegory, and let pG, Eq be an allegorical conceptual data model.A modal interpretation pΦ, Υ, ıq of pG, Eq in A with frame pM, Rq consists of a family of interpretations tΦ m u mM Ipt A rG, Es, a map Υ : Obj E rGs Ñ ObjrAs and a map ı : M ¢ Obj E rGs Ñ ArrrAs, where we denote ı m A : ıpm, Aq, satisfying, for all A, B Obj E rGs and m M: We denote by ModInt M,R A rG, Es the set of all modal interpretations of pG, Eq in A with frame pM, Rq.
The last of the equalities (10) specifies ı m AB to be a unique map which makes a diagram in Figure 3 commute (cf.Equation ( 4)).In fact, Formula (10c) could be taken as a definition of ı Similarly, exchanging A and B, we prove the inequality Observe that a modal interpretation pΦ, Υ, ıq defines a family of maps tΓ m : T G Ñ Au mM given explicitly by: Alternatively, Γ m is determined by the commutativity of the following family of diagrams (for all t T G ):

ΥpAq ΥpBq
Lemma 8. Γ m satisfies the following properties: (1) For all t 1 , t 2 T G , such that Ð Ý ) For all A, B Obj E rGs, the following properties hold: Proof.ad.1: Suppose that Γ m pt 1 q Γ m pt 2 q.Then: ad. 2: Γ m pt 1 t 2 q Γ m pt 1 q Γ m pt 2 q follows immediately from the distributivity of composition over union.The composition does not distribute over the intersection.However, it is well known (see, e.g., [1]) that in any allegory RpS T q RS RT and pS T qR A is functional.The first of Equations (5) implies that Γ m pu AB q u ΥpAqΥpBq .Inequality Γ m pt AB q t ΥpAqΥpBq holds trivially.Then, (cf. Figure 3):

ΥpAq
Note that Γ m does not in general preserve identities, tops, bottoms and relational product projections, and thus, it is not an interpretation.The objects ΥpAq, for A Obj E rGs should be considered a representation of "total domains"-the collections of all possible values (whatever that means in a general allegory).On the other hand, Φ m is an interpretation of the conceptual model of the database in the concrete world (say a moment of time), and in particular objects Φ m o pAq represent actual values stored in the database in the world m.Note also that Γ m does not preserve implications in general.This is obvious, as, in particular, in R, the complement 2Γ m ptq : Γ m ptq Ñ u Υp Ð Ý t qΥp Ý Ñ t q in the arrow-set Arr A pΥp Ð Ý t q, Υp Ý Ñ t qq is much larger than the embedding Γ m p2tq in Arr A pΥp Ð Ý t q, Υp Ý Ñ t qq of the complement of Φm a ptq in Arr A p Φm o p Ð Ý t q, Φm o p Ý Ñ t qq.
However, Lemma 10 alleviates that a bit.First, we need the following general result, interesting on its own.Lemma 9. Let ı 1 and ı 2 be injective maps in some allegory, A, and suppose that the meet semilattice of Consider the following statements (see the diagram below for illustration): ( Statement (1) implies Statements ( 2) and ( 3), and Statement (3) implies Statements ( 1) and ( 2).
Ð Ý and the composition is monotonic, we must also ı 1 and, similarly, R R; ı ¥ 2 ; ı 2 .This finishes the proof of the first set of implications.
Now, we are ready to prove the last implication.Assuming R ı ¥ 1 ; tÐ Ý ı 1 , Ð Ý ı 2 ; ı 2 , itfollows from the just proven result that ı ¥ Proof.Using explicit Formula ( 8) for an implication in a locally complete distributive allegory, and the distributivity law (6), we have: In the second equality, in order to change the subscript, we made use of the fact that It follows immediately, because extending the set of which the supremum is taken increases the supremum value that: It remains to prove that: The above inequality is equivalent to the conjunction of Γ m ptÐ Ý t 1 Ý Ñ t 1 q Γ m pt 1 Ñ t 2 q (which holds by the monotonicity of Γ m ) and Γ m pt 1 q Ñ Γ m pt 2 q ¨ Γ m pt 1 Ñ t 2 q.Using explicit Formula (8) for implication and the fact that decreasing the set for which the supremum is taken decreases the supremum value, we have: The last expression is identical to (**), which is equal (as shown above) to Γ m pt 1 Ñ t 2 q.
The following immediate corollary to Lemma 10 shows that for certain safe expressions, Γ m preserves implications: Corollary 11.For all t 1 , t 2 , t 3 T G with the same source and target and all m M, we have: Ẅe are now ready to define the interpretation of the modal formulas T pS,ρq G in the allegory A using the interpretation pΦ, Υ, ıq.
Definition 12. Let pM, Rq be a frame of similarity type pS, ρq; let A be a locally complete PTBDI allegory, and let pG, Eq be an allegorical conceptual data model.A modal interpretation pΦ, Υ, ıq of pG, Eq in A with frame pM, Rq defines for all m M a map Ξ m pΦ,Υ,ıq : T pS,ρq G Ñ ArrrAs defined by induction on the structure of terms in T S,ρ G as follows (we omit the subscript whenever pΦ, Υ, ıq is clear from the context): • If S S is such that ρpSq ¡ 0 and t 1 , . . ., t ρpSq T S,ρ Remark 1.Note that Ξ m preserves neither top elements, relational projections and identities nor implications (because Γ m does not preserve them either).Note, however, that by definition, ÐÝÝÝ Ξ m ptq Υp Ð Ý t q and ÝÝÝÑ Ξ m ptq Υp Ý Ñ t q for all t T pS,ρq G .
Example 2. Here, we construct an allegorical counterpart of the basic modal logic.Let pM, Rq be a frame of similarity type ptSu, S Þ Ñ 1q.Let pG, Eq be an allegorical conceptual data model and consider a modal interpretation pΦ, Υ, ıq ModInt M,R R rG, Es.We denote customarily ♦R : ∆ S ptq and lR : ∇ S ptq for all t T S,SÞ Ñ1 G .Let a Υp Ð Ý t q, b Υp Ý Ñ t q.Then: a Ξ m p♦tq ¨b hm I M .R S pm, m I q a Ξ m I ptq ¨b a Ξ m pltq ¨b dm I M .R S pm, m I q ñ a Ξ m I ptq ¨b Note that the above formulas are the same as in the definition of satisfaction of modal operators in the (first-order) basic modal logic (see, e.g., [19,20]).
Example 3. In this example, we will consider modal interpretations in the allegory RrLs where L is a locale, of locale-valued relations (see, e.g., [1]).In RrLs, objects are sets, and for any A, B ObjrRrLss, the hom-set Arr RrLs pA, Bq consists of maps R : A ¢ B Ñ L. Locale-valued relations are usually interpreted as fuzzy relations, where the value, Rpa, bq, gives the degree to which the relation, R, between a and b actually holds.Composition for R, S ArrrRrLss such that Ý Ñ R Ð Ý S , is given by: pRSqpa, cq : For all A ObjrRrLss, the identity morphisms are given explicitly by id A pa, bq : t if a b and id A pa, bq : u if a $ b.The intersection, union and reciprocation operators are defined in RrLs by pR Sqpa, bq : Rpa, bq Spa, bq, pR Sqpa, bq : Rpa, bq Spa, bq, R ¥ pa, bq : Rpb, aq.
Let us now consider the formulas defining modal interpretation in the same setting as in Example 2, but with RrLs instead of R. Then: Sometimes, the modal operators associated directly to the frame relations are not enough.For instance (see Example 4), the counterpart of until and since operators from temporal logic cannot be expressed using the formalism described so far.Therefore, we allow one to extend the set of terms, T G , to the set, T Ω G , using an arbitrary set of constructors corresponding to the set of operators, Ω, instead of using only the constructors tied in a canonical way to frame relations and attaching to those operators arbitrary (though defined using frame relations) semantics.
Example 4. Let pM, t¤uq be a frame of similarity type ptSu, S Þ Ñ 1q, such that ¤ is a linear order.Let pG, Eq be an allegorical conceptual data model.We extend T G to T tS,Uu G by adding two new term constructors: For all terms t 1 , t 2 T tS,Uu Let pΦ, Υ, ıq ModInt pM,Rq A rG, Es, and let m M.Then, the semantics of S and U is given by: where we denote m m I m ¤ m I m $ m I .In particular, if A R, then for all a Υp Ð Ý t 1 q and b Υp Ý Ñ t 1 q, those definitions boil down to the classical definition of the since and until temporal modalities: Formal equalities between terms from T S,ρ G can be used to specify the dependencies between data from different "worlds", where the "world" can mean, depending on the application, a time moment or perhaps a database server instance.Here is the precise definition.Definition 13.Let t 1 , t 2 T pS,ρq G ; let pM, Rq be a frame of similarity type pS, ρq, and let the modal interpretation pΦ, Υ, ıq ModInt pM,Rq A rG, Eqs.We say that a formal equality t 1 t 2 is satisfied in modal interpretation pΦ, Υ, ıq at m M if Ξ m pΦ,Υ,ıq pt 1 q Ξ m pΦ,Υ,ıq pt 2 q, which we denote by pΦ, Υ, ıq D m t 1 t 2 .We say that a formal equality t 1 t 2 is satisfied in modal interpretation pΦ, Υ, ıq, which we denote by pΦ, Υ, ıq D t 1 t 2 if pΦ, Υ, ıq D m t 1 t 2 for all m M.

Applications to Database Modeling
In this section, we consider how our formalism can be used to express business rules and queries in the context of temporal and distributed databases.In all the examples, we use the allegorical conceptual model depicted in Figures 1 and 2.

Temporal Databases
Here, we work with frame pT, Rq of similarity type tO, ρu, where we denote O : t"¤", "¥", " ", "¡"u, ρp"¤"q ρp"¥"q ρp" "q ρp"¡"q 1.We abbreviate ¤: R "¤" and similarly for the other symbols.We assume that ¤ is a linear order on T and that , ¡ and ¥ are dependent on ¤ in the usual way.We interpret the set of worlds, T, as the time axis, with ¤ being the linear time ordering.
Example 5. Consider the following business rule concerning the allegorical conceptual model pG, Eq depicted in Figures 1 and 2: "A manager of a department must have worked in the department in the past and not as its manager".For simplicity let us ignore the fact that this rule is impossible to realize for the new departments.We claim that this rule can be expressed as the following formal equality between terms in T pO,ρq G : manages ∆ "¡" works-in 2manages ¨ (15) where we denoted for brevity 2manages : pmanages Ñ u EmployeesDepartmets q.Indeed, let the modal interpretation pΦ, Υ, ıq ModInt pT,Rq Note that in Equation (15), the negation was used in a "safe" way in accordance with Corollary 11.
Example 6. Suppose that we want to create a temporal query (that is, a term in T pO,ρq G ), the evaluation of which at some moment m T will return those employees, whose pay will not decrease in the future.
One may use such a term as a part of a formal equality stating some business rule or as a query in a temporal database.We claim that the query can be expressed as follows: ¡ earns; ∆ " " "¤"; earns ¥ ¨© id Employees Note the unfortunate clash of symbols here: in the above formula, we have the arrow "¤" from the graph, G, and the relation symbol, " " O. Any modal interpretation is bound to represent Term (16) as a coreflexive (that is contained in the identity) arrow.Coreflexive arrows are natural allegorical representations of subobjects (subsets) (see, e.g., [1]).In R, if R is coreflexive, then by definition Ð Ý R Ý Ñ R and for all e, e I Ð Ý R , we have eRe I ñ e e I .One can associate with R the subset te Ð Conversely, with a subset V U , one can associate a coreflexive relation R V id U defined by eRe I e e I e V .
The correctness of the solution (16) of our problem depends on the following reasonable assumption: the object Salaries should be understood not as a collection of salaries really earned by someone, but rather as a (generalized) numerical domain (e.g., NUMBER(6,2)).Accordingly, its interpretation (as well as the interpretation of the linear order, "¤") should be constant, that is, we consider only those modal interpretations pΦ, Υ, ıq of pG, Eq in which for all m T, we have: Salaries id ΥpSalariesq , Φm a p"¤"q ¤ (17) As in the previous example, we consider the query to satisfy the desired semantics if the modal interpretation in R turns out to be the translation into the first-order logic of the problem statement.
Therefore, let us consider any pΦ, Υ, ıq ModInt pT,Rq R rG, Es satisfying Conditions (17).Let T denote Term (16).In this setting, e Ξ m pTq ¨eI can be equivalently written using Definition 12 as: hm I ¡ m .hs, s I ΥpSalariesq .e Ξ m pearnsq ¨s s ¤ s I e I Ξ m pearnsq ¨sI e e I

Replicated Databases
Here, we consider applications of modal interpretations of allegorical conceptual data models to specifying properties of replicated databases.One of the frames a replicated database can be associated with is the frame pDB, t uq of similarity type D : pt" "u, t" " Þ Ñ 1uq.Here, DB is the set of database servers, and d d I means that d pushes data into d I .To avoid problems with circular pushes and consistency, we assume that the graph of is acyclic and that that there exists a unique master, that is a database, d DB, such that there exists no d I DB, such that d I d.Applications can read any database, but only the master is directly modified.What remains is the specification of details of change propagation.
Example 7. We want to specify the following rule: deletions from the relation works-in are propagated within the updating transaction.However insertions are propagated after the end of the transaction.The solution can be easily seen to be as follows: works-in ∇ " " pworks-inq Consider now the frame pT ¢ DB, R t uq of similarity type tO t" "u, ρ I u, where ρ I | O ρ and ρ I p" "q 1.Here, T, R O and ρ are like in Subsection 4.1, and and DB are like above, except that both R and are extended in a natural way as relations on Cartesian product T ¢ DB, e.g., ppm, dq pm I , d I qq : pm m I q and ppm, dq pm I , d I qq : pd d I q.
Example 8. Here, we continue Example 7. Note that one cannot express the requirement that the inserts will be eventually propagated without temporal modalities, that is using the frame that was used in the previous example.One can do it, however, using the frame described above, combining the replicated database frame with the temporal frame from the previous subsection.The reader will easily verify that the appropriate equation is as follows: works-in ∇ " " p∆ " " pworks-inqq

Conclusions
We have presented a modal extension of a new allegorical conceptual data model, which interprets modal operators within an appropriate allegory.Our formalism can be seen as a generalization via the relational algebra of a limited form of a first-order modal logic with variable domains (see, e.g., [19]).We have given a few examples of applications of the modal extensions of our allegorical conceptual data model to specifying properties of temporal or distributed databases.We hope that those examples justify our conviction about the usefulness and expressiveness of our approach.More examples are needed, however, where the data should be naturally interpreted in allegories other than R or RrLs for some locale, L.
It will be also interesting to compare our approach with that of [21], where it is shown how to enrich an arbitrary institution [22] with modalities and many worlds semantics.To make this comparison possible, we are currently working on the institutional formulation of our allegorical data model.

Figure 1 .
Figure 1.An example of an allegorical conceptual model graph.

R
rG, Es, and let m T. Then: pΦ, Υ, ıq D m manages ∆ "¡" works-in 2manages ¨ is equivalent to the statement, that for all elements e ΥpEmployeesq and d ΥpDepartmentsq: e Ξ m pmanagesq d ñ hm I m .e Ξ m I pworks-inq d 2 e Ξ m I pmanagesq d ẅhich is a direct first-order rendering of the desired business rule, where we read aΞ m pRqb, as a is in relation b at the time m.
m AB , because it guarantees by itself that ı m AB is an injective map.Indeed, ı m AB as defined by Equation (10c) is a map because Φm o pAq Φm o pBq : Φm a pπ AB A q and Φm a pπ AB B q are jointly monicu id Φm o pAq Φm o pBq as desired.
The construction of injection for a relational product (note that Φm o pAq Φm o pBq Hence, the result follows from the injectivity of ı m Ð Ý