Graph Nodes and Connectors Asymmetric Directed Each model

  • Slides: 14
Download presentation

Graph: Nodes and Connectors (Asymmetric, Directed) Each model has its own requirements! 1. .

Graph: Nodes and Connectors (Asymmetric, Directed) Each model has its own requirements! 1. . * or 0. . * can be narrowed using target-specific OCL. For instance, imagine a centipede-like bug with an unbound number of legs (*), which has to be even: Context Centipede inv Even. Legs: Legs->size() modulo 2 == 0 1 to 3: email sent to multiple recipients 2 to 1: blending pathways (roads, rivers…)

Graph: Symmetry vs. Asymmetry Friendship is a symmetric (undirected) binary association. Network relation: all

Graph: Symmetry vs. Asymmetry Friendship is a symmetric (undirected) binary association. Network relation: all computers are networked.

OPM Metamodel : 1 פתרון Constraints: : בקשרים מבניים קשר שלם וחלקיו בו המשתתפים

OPM Metamodel : 1 פתרון Constraints: : בקשרים מבניים קשר שלם וחלקיו בו המשתתפים צריכים להיות . ( מאותו סוג )עצם או תהליך קשר הורשה בו המשתתפים צריכים להיות מאותו . סוג context Composition inv same. Type: (source->for. All(t: Thing|t. is. Ocl. Type. Of(Object)) and destination->for. All(t: Thing|t. is. Ocl. Type. Of(Process))) or (destination->for. All(t: Thing|t. is. Ocl. Type. Of(Object)) and source->for. All(t: Thing|t. is. Ocl. Type. Of(Process))) : ( בקשרים תהליכיים )פרוצדורליים בכל הקשרים הללו משתתף אחד צריך . להיות עצם והשני תהליך Context Procedural. Link inv diff. Type: destination. is. Ocl. Type. Of(Object) implies source. is. Ocl. Type. Of(Process) //and vice-versa 7

DFD Metamodel : 2 דוגמא : DFD לפניכם דוגמא של תרשים Function Data Store

DFD Metamodel : 2 דוגמא : DFD לפניכם דוגמא של תרשים Function Data Store External entity Data Flow . DFD עבור תרשימי metamodel בנו 8

DFD Metamodel : 2 פתרון Constraints The data flow should be between two different

DFD Metamodel : 2 פתרון Constraints The data flow should be between two different elements: context Dataflow inv: source<>target For each Entity one Data flow which should either enter or leave: context Entity inv: out->not. Empty() or in-> not. Empty () For each Function one Data flow which should either enter or leave: context Function inv: out->not. Empty () or in->not. Empty () For each Datastore at least one Data flow should enter and at least one Data flow should leave: context Datastore inv: out->not. Empty () and in->not. Empty () 9

XML Metamodel : 3 דוגמא <root> <element [attr 1 = value] …. > <sub-element

XML Metamodel : 3 דוגמא <root> <element [attr 1 = value] …. > <sub-element [attr 1 = value]…> content </sub-element> </element> </root> : xml לפניכם דוגמא של קובץ : לפי הכללים הבאים xml עבור metamodel בנו It contains a root element. All other elements are descendants of the root element. All elements are correctly paired. The element name in a start-tag and an end-tag are exactly the same. Attribute names are used only once within the same element. Nodes Root Element Node represents a document root. Element Node represents a XML element, with element name property. Text Node represents a text element in the XML document and provides name property Attribute Node represents an attribute of XML element and provides name and value property. 10

 Constraints: XML Metamodel : 3 פתרון It contains exactly one root element: context

Constraints: XML Metamodel : 3 פתרון It contains exactly one root element: context Root. Node inv: all. Instances size () = 1 A Root. Node doesn’t have a parent node: context Root. Node inv: parent is. Empty() A Root. Node doesn’t have a text node: context Root. Node inv: includes. Text. Node->size() = 0 All other nodes have parents: context XMLNode inv: XMLNode. all. Instances->for. All(node: XMLNode| not node. is. Ocl. Type. Of(Root. Node) implies node. parents ->size() == 1) Attribute names are used only once within the same element context Element. Node inv: child select(node: XMLNode| node. is. Ocl. Type. Of(Attribute. Node)) is. Unique(Name) 11

XML Metamodel : 3 פתרון Question: How can we ensure cycle avoidance, in respect

XML Metamodel : 3 פתרון Question: How can we ensure cycle avoidance, in respect to parents and children? 12

XML Metamodel : 3 פתרון Possible Solution: Add nesting. Level attribute to XMLNode to

XML Metamodel : 3 פתרון Possible Solution: Add nesting. Level attribute to XMLNode to ensure proper nesting. context XMLNode inv: If self. parent->size() = 0 then self. nesting. Level = 0 else self. nesting. Level = self. parent. nesting. Level + 1 0 2 1 13