{ * File: 03-queries.sml.txt * Author: Manfred Jeusfeld, Thomas Kuehne * Created: 2024-02-24/M.Jeusfeld (2024-02-29/M.Jeusfeld) * ------------------------------------------------------ * Constraints as queries for multi-dimensional MLM * * License: Creative Commons license Attribution-NonCommercial 4.0 International http://creativecommons.org/licenses/by-nc/4.0/ http://creativecommons.org/licenses/by-nc/4.0/legalcode * } Cb1_PotencyNotDimension in QueryClass isA Element with constraint potNotDim: $ exists lab/Label n/Integer (this potency/lab n) and not exists dim/Dimension Label(dim,lab) $ end C0a_PotencyNotDecreasingInstanceOf in QueryClass isA Element with computed_attribute c: Element; px: Integer; pc: Integer constraint potencyerror1: $ exists lab/Label (this instanceOf/lab c) and (c potency/lab pc) and (this potency/lab px) and ((px >= pc) or (pc = 0)) $ end C0b_PotencyNotDecreasingSpecialization in QueryClass isA Element with computed_attribute d: Element; pc: Integer; pd: Integer constraint potencyerror2: $ exists lab/Label (this specializationOf/lab d) and (this potency/lab pc) and (d potency/lab pd) and (pd > pc) $ end C1_AmbiguousFeatures in QueryClass isA Element with computed_attribute c1: Element; c2: Element constraint ambiguous: $ exists t1,t2/DataType a1,a2/ElementAttribute lab/Label ((this instanceOf c1) or (this isA c1)) and ((this instanceOf c2) or (this isA c2)) and Pa(a1,c1,lab,t1) and Pa(a2,c2,lab,t2) and (this <> c1) and (this <> c2) and (c1 <> c2) $ end C2a_MultipleNonZeroPotency in QueryClass isA Element with constraint multinonzero: $ exists p1,p2/Integer lab1,lab2/Label (this potency/lab1 p1) and (this potency/lab2 p2) and (lab1 <> lab2) and (p1 > 0) and (p2 > 0) $ end C2b_InstancesInDifferentDimensions in QueryClass isA Element with computed_attribute x1: Element; x2: Element constraint diffdim: $ exists lab1,lab2/Label (x1 instanceOf/lab1 this) and (x2 instanceOf/lab2 this) and (lab1 <> lab2) $ end C2c_MultiDimNonZero in QueryClass isA Element with computed_attribute c: Element; dim: Dimension constraint multidimnonzero: $ exists lab/Label (this specializationOf/lab c) and (this memberOf dim) and not Label(dim,lab) and not (exists p/Integer (this potency/lab p) and (p > 0)) $ end {* variant with computed attributes *} C3a_MultipleClassification_1 in QueryClass isA Element with computed_attribute c1: Element; c2: Element constraint multipleClassifiers: $ exists lab/Label (this instanceOf/lab c1) and (this instanceOf/lab c2) and (c1 <> c2) $ end C3b_MultipleSuperclassesInDim in QueryClass isA Element with computed_attribute c1: Element; c2: Element constraint multisuperclass: $ exists lab/Label (this specializationOf/lab c1) and (this specializationOf/lab c2) and (c1 <> c2) $ end C3c_DisjointDimensions_plain in QueryClass isA DimensionLabel with constraint disjointDim: $ not (exists c/Element (forall x,y/Element (x instanceOf/this y) ==> (x instanceOf_trans/this c))) $ end C3c_DisjointDimensions_x0 in QueryClass isA Element with computed_attribute dim: Dimension constraint disjointDim: $ exists x0/Element lab/Label (x0 instanceOf/lab this) and Label(dim,lab) and not (exists c/Element (forall x,y/Element (x instanceOf/lab y) ==> (x instanceOf_trans/lab c))) $ end {* ER 2023 version of the query *} C3c_DisjointDimensions_er23 in GenericQueryClass isA Element with parameter,computed_attribute dim: Dimension computed_attribute otherTop: Element constraint disjointDim: $ (this in TopInDimension[~dim/dim]) and (~otherTop in TopInDimension[~dim/dim]) and (this <> ~otherTop) $ end {* TopDimension version version *} C3c_DisjointDimensions_topdim in GenericQueryClass isA Element with parameter,computed_attribute dim: Dimension constraint disjointDim: $ exists lab/Label (this in TopInDimension[~dim/dim]) and Label(dim,lab) and exists x0/Element (x0 instanceOf/lab this) and not exists c/Element (forall x,y/Element (x instanceOf/lab y) ==> (x instanceOf_trans/lab c)) $ end C4a_CycleInHierarchy in QueryClass isA Element with constraint hiercycle: $ exists lab/Label (this inIsa_trans/lab this) $ end C4b_InconsistentOrder in QueryClass isA Element with computed_attribute y: Element constraint instanceVsGen: $ exists lab/Label (this specConnected/lab y) and not (this orderNotInconsistent/lab y) $ end C4c_NotLevelRespecting in QueryClass isA Element with computed_attribute c1: Element; c2: Element constraint notLevelRespecting: $ exists lab/Label (this instanceOf/lab c1) and (this instanceOf/lab c2) and not (c1 orderNotInconsistent/lab c2) $ end