SelectorExpression

niklauslee edited this page Jan 4, 2015 · 1 revision

Selector Expression

Selector expression is an query to select elements in a model file (.mdj).

var repo = app.getModule("core/Repository");
...
var elems1 = repo.select("Package1::@UMLClass.attributes[type=String]");
var elems2 = repo.select("Package1::Model1::@UMLInterface.operations[isAbstract=false]");

Selectors

Name Selector (N)

Select elements which has name specified by N. (equivalent to value selector [name=N])

Examples

  • Class1 : "Class1" elements (all element named by "Class1").
  • Class1::Attribute1 : all elements named by "Attribute1" only in children of "Class1" element(s).

Children Selector (P::)

Select all child elements of an element P.

Examples

  • Package1:: : all children of "Package1" element(s).
  • Package1::@UMLClass : all elements of type "UMLClass" only in children of "Package1" element(s).

Type Selector (@T)

Select all elements of type T.

Examples

  • @UMLInterface : all elements of type "UMLInterface".
  • @UMLClassifier : all elements of type "UMLClassifier". (includes all descendants types: e.g. UMLClass, UMLInterface, UMLEnumeration, ...)
  • Package1::@UMLClass : all elements of type "UMLClass" only in children of "Package1" element(s).

Field Selector (.F)

Select all elements contained in field F.

Examples

  • Class1.attributes : all attribute elements contained in attributes field of "Class1" element(s).
  • Package1.ownedElements : all elements contained in ownedElements field of "Package1" element(s).
  • @UMLClass.operations : all operation elements contained in operations field for all elements of type "UMLClass".

Value Selector ([F=V])

Select all elements whose field F has value V.

Examples

  • Class1.operations[isAbstract=false] : All non-abstract (isAbstract=false) operations of "Class1" element(s).
  • Class1.attributes[isDerived=true] : All derived attribute (isDerived=true) elements of "Class1" element(s).
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.