• Keine Ergebnisse gefunden

4 PLATFORM INDEPENDENT ANALYSIS AND DESIGN

4.4 Navigation

4.4.1 Metamodel

The basic elements in navigation models are nodes and links. The corresponding modeling elements in the metamodel are Node and Link, which are derived from the UML elements Class and Association, respectively. The backbone of the metamodel for navigation model-ing is shown in Figure 32. The node metaclass is abstract, which means that only further specialized classes may be instantiated. Furthermore a node can be designated to be an en-try point of the application with the isHome attribute. If a node should be reachable from everywhere within the navigation model without explicit links, then the isLandmark attrib-ute has to be set. The Link class is also an abstract class. Links connect a source node with a target node as expressed by the two associations between link and node. With the isAutomatic attribute a link is automatically followed. Additionally, a guard expression can be defined, to specify when a link can be followed, see below. The element Node is further specialized to the concrete node type NavigationClass. Further specialized classes are used for modeling access structures (see below) and for the integration of processes (see 4.5.1).

A navigation class is a navigational view of a content class, represented by the association to a content class. Navigation classes comprise a list of navigation properties which repre-sent properties from the content model, expressed by the attribute contentProperties. An optional derivationExpression can be used to specify how the navigation property is

de-Model Driven Software Engineering for Web Applications

rived from the content properties. A navigation link is used for modeling the navigation between nodes with the usual semantics for hypermedia applications. Navigation links are always uni-directional. In case of bi-directional navigation links two uni-directional navi-gation links have to be used. Inheritance between navinavi-gation classes has the usual object-oriented semantics. In addition, navigation links to a super navigation class represent dy-namic navigation, i.e. depending on the actual type of the target navigation class at run-time, the corresponding navigation class is presented to the user.

NavigationProperty derivationExpression[0..1] : Str ing

Link guar d : String = true

isAutomatic : Boolean = false Node

isHome : Boolean = f alse isLandmar k : Boolean = false

NavigationClass NavigationLink

Association

Property

{ordered, subsets ownedAttribute}

{subsets class}

Class

+/target 1

+/inLinks

* +/source

1

+/outLinks

* +contentClass

1

+navigationClass 1

+navigationProperties

*

+contentProperties

*

Figure 32. Metamodel for navigation modeling (backbone)

For further structuring the navigation model, two additional specialized node types are in-troduced: access primitives and menus, see Figure 33. Access primitives are used to define how collections of nodes should be accessed. Access primitives are further specialized to indices, guided tours and queries. An index represents the direct access to all instances of the target node type by providing the user with a list of all elements to choose from for continuing the navigation. A guided tour represents the sequential access to all elements. A sort expression can be defined with the attribute sortExpression. The query element repre-sents the possibility to search for instances of the target node type where a filtering

expres-99

sion can be defined by the attribute filterExpression. Menus are specialized navigation classes that are used to structure the outgoing links from a navigation class. They have to be associated to a navigation class by a composition.

Index Query

filt erExpression : St ring GuidedTour

sor tExpression : Str ing AccessPrimitive

Node

Menu NavigationClass

Figure 33. Metamodel for navigation modeling (access structures)

Derived Attributes

The attributes source and target of a link are derived from the members of the association super class.

context Link def : source : Node = self.ownedEnd->first().type

context Link def : target : Node = self.ownedEnd->first().opposite.type

The derived attributes outLinks and inLinks of a node are derived from the derived attrib-utes source and target of the corresponding links.

context Node def : outLinks : Set( Link ) = Link.allInstances()->select( l | l.source = self ) context Node def : inLinks : Set( Link ) = Link.allInstances()->select( l | l.target = self )

Constraints

In a specific namespace at most one home node may be defined.

context Namespace inv NamespaceUniqueHomeNode : self.member->select( e | e.oclIsKindOf( Node ) )->

select( n | n.isHome )->size() <= 1

Only navigation classes (and subclasses) can be home or landmark nodes.

context Node inv NodeHomeOrLandmark :

self.isHome or self.isLandmark implies self.oclIsKindOf( NavigationClass )

Model Driven Software Engineering for Web Applications

Each node must be reachable. Therefore it has to be either a home or landmark node or the node (or a super node) must be navigable from some other node. Here, navigable means that some other node owns a corresponding attribute.

context Node inv NodeReachability :

not ( self.isHome or self.isLandmark ) implies

let allNodes : Set( Node ) = self.allParents()->including( self ) in

Node.allInstances()->exists( n | n.ownedAttribute->exists( p | allNodes->includes( p.type ) ) )

Node inheritance is restricted to navigation classes. The content class associated to a navi-gation class has to conform to the corresponding content class of a super navinavi-gation class.

Inheritance among different types of navigation classes is not permitted.

context Node inv NodeInheritance :

if self.oclIsKindOf( NavigationClass ) then

self.parents()->forAll( sn | sn.oclType = self.oclType and self.contentClass.conformsTo( sn.contentClass ) ) else self.parents()->isEmpty() endif

A navigation class contains only navigation properties.

context NavigationClass inv NavigationClassOwnedAttributeType : self.ownedAttribute->forAll( p | p.oclIsKindOf( NavigationProperty ) )

The type of a navigation property has to be either a data type or a (navigation) node type.

context NavigationProperty inv NavigationPropertyType :

self.type.oclIsKindOf( DataType ) or self.type.oclIsKindOf( Node )

Links only connect (navigation) nodes, must be binary and unidirectional.

context Link inv LinkMembers :

self.memberEnd->size() = 2 and self.ownedEnd->size() = 1 and self.memberEnd->forAll( p | p.type.oclIsKindOf( Node ) )

All navigable properties of a node corresponding to the incoming links of an access primi-tive must have multiplicity one.

context AccessPrimitive inv AccessPrimitiveIncoming :

let ps : Set( Property ) = Node.allInstances()->collect( n | n.ownedAttribute )->flatten()->

select( p | p.association.oclIsKindOf( Link ) and p.type = self ) in ps->forAll( p | p.lower = 1 and p.upper = 1 )

An access primitive has exactly one outgoing link.

context AccessPrimitive inv AccessPrimitiveOutgoing : self.outLinks->size() = 1

The one and only outgoing link of an index leads to a navigation class and the correspond-ing navigable property has multiplicity many.

context Index inv IndexOutgoing :

101

self.ownedAttribute->forAll( p | p.association.oclIsKindOf( Link ) implies p.isMultivalued() and p.type.oclIsKindOf( NavigationClass ) )

The one and only outgoing link of a guided tour leads to a navigation class and the corre-sponding navigable property has multiplicity many.

context GuidedTour inv GuidedTourOutgoing :

self.ownedAttribute->forAll( p | p.association.oclIsKindOf( Link ) implies p.isMultivalued() and p.type.oclIsKindOf( NavigationClass ) )

The one and only outgoing link of a query leads to an index and the corresponding naviga-ble property has multiplicity one.

context Query inv QueryOutgoing :

self.ownedAttribute->forAll( p | p.association.oclIsKindOf( Link ) implies p.lower = 1 and p.upper = 1 and p.type.oclIsKindOf( Index ) )

Derivation Expressions

If the derivation of a navigation property from content properties is non trivial, a derivation expression has to be defined as a simple expression of the expression language, see 4.1.3.

The derivation of a navigation property is trivial, if it is derived directly from exactly one content property, for example the derivation expression

self.name

for the derivation of the navigation property name from the content property name of the content class Project. The derivation expression for a trivial derivation may be omitted. A non-trivial derivation expression for a navigation property representing the name of the corresponding validation project would be for example

empty self.validationProject ? “<none>” : self.validationProject.name

Guard Expressions

If the availability of a link should depend on some condition, a guard expression has to be defined as a simple expression of the expression language, see 4.1.3. The context of this expression is the source content class and the expression has to evaluate to a boolean value.

The following guard expression for the link from a user project to the corresponding vali-dation project

not empty self.validationProject

ensures that the link is only available if the validation project exists. Note that this guard condition could be omitted because a link is only shown when the target object exists. The

Model Driven Software Engineering for Web Applications

following guard expression shows the link only if the validation project exists and if it has a name:

empty self.validationProject ? false : not empty self.validationProject.name

Notation

Stereotyped UML class diagrams are used for navigation modeling. For a definition of the corresponding UML profile see A.4.