Dragon1 API - Action Script

Dragon1 API - Action Script (dragon1.js) is a fast, small, and feature-rich JavaScript library for generating enterprise architecture visualizations and real-time views, using AI and Machine Learning technologies.

If you are new to Dragon1, we suggest you check out the Get Started.

Action Script methods

The following Dragon1 API (v7.4) - Action Script methods are available:

  • dragon1 toggleobjects example toggleObjects([class,] attribute, value)Hide and show the objects that match the attribute value. Optionally a class can be specified.
    Details Example
  • Description

    class: Type: string. Optional. The name of the class to find.
    attribute: Type: string. The name of the attribute to find.
    value: Type: string. The name of the value to match.

    Example 1
    Toggle visibility of all applications that have an attribute tags with value outdated. toggleObjects(application,tags,outdated);

    Example 2
    Toggle visibility of all objects that have an attribute tags with value outdated. toggleObjects(tags,outdated);
  • dragon1 showobjects example showObjects([class,] attribute, value)objects that match the attribute value are shown on the canvas. Objects with tags value hidden are not shown. Check help page on default attributes for all possible default attributes.
    Details Example
  • Description

    class: Type: string. Optional. The name of the class to find.
    attribute: Type: string. The name of the attribute to find.
    value: Type: string. The name of the value to match.

    Example 1
    Show all objects that have an attribute tags with value outdated. showObjects(application,tags,outdated);

    Example 2
    Show all objects that have an attribute tags with value outdated. showObjects(tags,outdated);
  • dragon1 hideObjects example hideObjects([class,] attribute, value)objects that match the attribute value are hidden on the canvas. Objects with tags value fixed, are not hidden. Check help page on default attributes for all possible default attributes.
    Details Example
  • Description

    class: Type: string. Optional. The name of the class to find.
    attribute: Type: string. The name of the attribute to find.
    value: Type: string. The name of the value to match.

    Example 1
    Hide all objects that have an attribute tags with value outdated. hideObjects(application,tags,outdated);

    Example 2
    Hide all objects that have an attribute tags with value outdated. HideObjects(tags,outdated);
  • dragon1 showOnlyObjects example showOnlyObjects(attribute, value)enforce only objects that match the attribute value to be shown on the canvas and hide all others. Check help page on default attributes for all possible default attributes.
    Details Example
  • Description

    attribute: Type: string. The name of the attribute to find.
    value: Type: string. The name of the value to match.

    Example 1
    Show only objects that match the attribute tags with value outdated. showOnlyObjects(tags,outdated);

    Example 2
    Show only objects that have an attribute tags with value outdated. showOnlyObjects(tags,outdated);
  • dragon1 toggleobjects example showArea(area name)show the area with the corresponding name and all objects in it.
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example showOnlyArea(area name)show only the area and all objects in it.
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example hideArea(area name)hide the area and all objects in it.
    Details Example
  • Description

    Example 1

    Example 2

    Example

  • dragon1 toggleobjects example showName()enforce a name to be shown on the canvas of the visualization.
    Details Example
  • Description

    Example 1

    Example 2

    Example

  • dragon1 toggleobjects example showTitle(New Title)enforce the title entry to be shown on the canvas of the visualization.
    Details Example
  • Description

    Example 1

    Example 2

    Example

  • dragon1 toggleobjects example showSubtitle(New Subtitle)enforce the title entry to be shown on the canvas of the visualization.
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example showOnlyClass(Application)enforce only this class, Application in this case, to be shown on the canvas and hide all others. Check the list below for all possible entity classes.
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example showClass(Interface)enforce this class to be shown on the canvas. Check the list below for all possible entity classes.
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example hideClass(Interface)enforce this class to be hidden on the canvas. Check the list below for all possible entity classes.
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example showLanguageButton(Translate)generates a button on the visualization to switch between the name and title value of all shapes on the visualization.
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example showRACIMatrix()to have a raci matrix generated on a BPMN diagram.
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example showRACIButton(RACI)to have a dialog that shows RACI of a BPMN diagram.
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example showLearnButton(Learn)to have a dialog that shows statements on the current diagram.
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example showTestButton(Test)to have a dialog that shows questions on the current diagram.
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 showattributeaslabel exampleshowAttributeAsLabel(attributename, fill, stroke, color, position, margin) generates a label, showing an the attribute name and value for a shape.
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example generateLegend()to have a dialog that shows the used shapes, icons and colors and their meaning.
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example showIconSwitchButton(Switch)generates a button on the visualization to switch between the default icon and configured image of all shapes on the visualization.
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example showRelatedObjects(Location, New York) - show only the objects on the visualization that are related to the location New York.
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example hideRelatedObjects(Location, New York) - hide the objects on the visualization that are related to the location New York.
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example hideRelationships()hides by default all the relationships on a visualization.
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example showTags(Customer)- show only the entities that have tag value including the term Customer.
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example hideTags(Sales)- hide the entities that have tag value including the term Sales.
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example colorizeObjects(name,mywebapp, yellow) - give all the shapes that have namevalue webapp a yellow fill color
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example colorizeTags(webapp, green) - give all the shapes that have tag value webapp a green fill color
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example addDotObjects(type, modern,green) - give all the shapes that have value modern for attribute type a green dot at the right top
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example addDotTags(outdated, red) - give all the shapes that have tag value outdated a red dot at the right top
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example generateLegend() generates a legend of used shapes for entityclasses on the diagram
    Details Example
  • Description

    Example 1

    Example 2
  • dragon1 toggleobjects example showButton(showRelatedObjects, Location, New York, top right) shows a button at the top right of the diagram that shows and hides related data objects with location New York.
  • dragon1 toggleobjects example showButtonbar(Roadmap, 3, 2021, 2022, 2023, showHideValue, start date, bottom left) shows a button bar at the bottom left of the diagram with 3 clickable buttons that shows or hides entity classes that have a start date from that year. You can change the label, the number of buttons (between 1 and 10), attribute and position of the button bar (bottom right, top left, top right).
  • dragon1 toggleobjects example hideButtons()hides the buttons on the diagram.
  • dragon1 toggleobjects example addImageBefore(attribute, value, image label)places an image in front of a shape if it has a matching attribute value. Popular labels are: Danger, Bulb, StopSign and Bomb.
  • dragon1 toggleobjects example generateLegend(columns, rows) generates a legend on the diagram of the used types and or classes on the diagram. The default generateLegend() is 2 x 5 items.
  • dragon1 toggleobjects example addLegendItem(image label,fillcolor,text)adds a row to the legend with the specified vector image, with a certain and text.

The Dragon1 API Action Script methods can be used on the Dragon1 platform, by placing it in action scripts fields of Entities (Data Objects) .

The following words are reserved words for values:

  • empty - if you use empty as attribute or tag value, Dragon1 will look for empty attributes or tags.
  • nonempty - if you use nonempty as attribute or tag value, Dragon1 will look for nonempty attributes or tags.
  • dragon1 toggleobjects example storeObjects( jsonobjectarray, attribute, value)add a jsonobjectarray to the rawdata section in the repository and set an tagging attribute value for all the objects in the array and the array as object itself.
  • Description

    Example

  • dragon1 toggleobjects example learnObjectAttributes( jsonobjectarray, dragon1classobject, match percentage)learn to recognize a set of jsonobjects with attributes as a certain class or object with certain attribute values. A bit like memorizing and filing patterns.
  • Example

  • dragon1 toggleobjects example learnObjectMethods( jsonobjectarray, dragon1classobject, match percentage)learn to recognize a set of jsonobjects with methods as a certain class or object with certain attribute values. A bit like memorizing and filing patterns.
  • Example

  • dragon1 toggleobjects example learnObjectsRelationships( jsonobjectarray, dragon1classobject, match percentage)learn to recognize relationships of jsonobjects with other jsonobjects.
  • Example

  • dragon1 toggleobjects example prepareObjects( query,attribute,value) update or add the attribute with a value for the objects that match the query. See below for example queries.
  • Example

  • dragon1 toggleobjects example markObjects( query,attribute,value, match percentage)mark the objects that match the query with a value for the attribute. See below for example queries.
  • Example

  • dragon1 toggleobjects example tagObjects(attribute1, value1,attribute2,value2)tag the objects that match attribute 1 and value1 with a value2 for attribute2.
  • Example

  • dragon1 toggleobjects example validateObjects(query,attribute,value, match percentage)vailidate if the objects that match the query, correctly match the query. See below for example queries.
  • Example

  • dragon1 toggleobjects example reportObjects(query,jsonobjectarray, match percentage, attribute,value) report in json a list of objects that match the query, josn objectarray, and or attribute values.
  • Example

  • dragon1 toggleobjects example queryObjects(query,actions)query can be a statement to identify a type of object or to identify relationships of two related types of object. Example: queryObjects(source.object.version=3,fill:cyan); This will color every shape cyan if the value for version is 3. actions can be fill:, stroke:, color:, hide, show. Example 2: queryObjects(source.object.version=3 AND target.object.application=SalesForce,stroke:cyan); This will color any relationship between the two identified types of objects cyan.
  • Example

Example

Suppose, we want to recognize data sharing opportunities in a hospital.

The method storeObjects we use to store health care related databases, data objects, applications, departments, processes and tasks, in the repository. For instance: the tasks Monitoring Physical Changes of Patient, Bathing Patient and Assess Patient’s Health Improvements and the departments Nursing, Dietary and Rehabilitation. And the data objects Patient, Guest and Client.

The method learnObjects we use to label objects in the repository that match for a certain percentage the provided object attributes. For instance, labeling patient, guest and client as patient objects and as medical records.

The following color names are supported:

  • red
  • green
  • orange
  • blue
  • yellow
  • purple
  • pink
  • cyan
  • black
  • purple
  • darkblue
  • darkred
  • fuchsia

For instance the action script field of a visualization or view.

The methods can be used in a chain separated with a ;

The Dragon1 API Action Script methods can also be used in any web application via a reference to dragon1.js.

The method can have various contexts:

  • the whole repository - we prefix a class with r.
  • a single cabinet - we prefix a class with c[name]. or c[id]. for a specific cabinet or c. for all cabinets.
  • a single model - we prefix a class with m[name]. or m[id]. for a specific model or m. for all models.
  • a single atlas - we prefix a class with a. for the current atlas
  • a single visualization - we prefix a class with v. for the current visualization.

If you use the method without context indication the current visualization is used.

Example of using the context of a repository:
repository.prepareObjects( *.owner= unknown, tag, incomplete); or r.prepareObjects( *.owner= unknown, tag, incomplete);

This means that all objects without an owner will be tagged as incomplete.

List of Entity Classes

Check here for full list of Entity Classes

Configure Action Script in the Repository

To enter the action script:

  • Go to the Data Dashboard of the Collaboration Application
  • Select Visualizations or Views or Principles
  • Select a Visualization, View or Principle
  • Click Edit
  • Enter the action script in the Action Script filed
  • Click Save.
  • Go to the Viewer and check the Visualization.

Add Button with Actions

Use showButton or showButtonbar to link the actionscript to buttons.

Configure Action Script in the Viewer

  • In the Viewer, click on the Edit button after a view.
  • Change the Name, Text and Action Script.
  • Click OK.

Query examples

Here are examples queries of applications, processes and applications that are used by processes:

  • query example 1: r.process.owner = unknown - this query collects all processes from the repository without a value for the owner attribute
  • query example 2: a.application.platform = microsoft - this query collects all applications in the current atlas that have Microsoft as value for the platform attribute
  • query example 3: application.tag = duplicate - this query collects all applications in the current visualization that have duplicate as value for the tag attribute
  • query example 4: externalsources[0] = 'https://www.dragon1.com/downloads/docmgt_export.json'; externalsources[0].process.id = r.process.id and externalsources[0].process.documentlink = unknown - this query collects all processes present in the repository that in an external system seem to have no link to a document
  • query example 5: externalsources[0] = 'https://www.dragon1.com/downloads/crm_export.json'; externalsources[0].contract.expirydata > today and externalsources[0].contract.applicationname = r.application.name - this query collects all applications present in the repository that in an external system seem to have an expired contract.
  • query example 1: relationship.sourceclass = process,application and relationship.targetclass = application, process and relationship.type = association, flow