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.

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

  • 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.
  • 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.
  • 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.
  • learnObjectsRelationships( jsonobjectarray, dragon1classobject, match percentage)learn to recognize relationships of jsonobjects with other jsonobjects.
  • prepareObjects( query,attribute,value) update or add the attribute with a value for the objects that match the query. See below for example queries.
  • markObjects( query,attribute,value, match percentage)mark the objects that match the query with a value for the attribute. See below for example queries.
  • tagObjects(attribute1, value1,attribute2,value2)tag the objects that match attribute 1 and value1 with a value2 for attribute2.
  • validateObjects(query,attribute,value, match percentage)vailidate if the objects that match the query, correctly match the query. See below for example queries.
  • 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

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.

  • 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.
  • showArea(area name)show the area with the corresponding name and all objects in it.
  • showOnlyArea(area name)show only the area and all objects in it.
  • hideArea(area name)hide the area and all objects in it.
  • hideOnlyArea(area name)show only the area and all objects in it.
  • showName()enforce a name to be shown on the canvas of the visualization.
  • showTitle(New Title)enforce the title entry to be shown on the canvas of the visualization.
  • showSubtitle(New Subtitle)enforce the title entry to be shown on the canvas of the visualization.
  • 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.
  • showClass(Interface)enforce this class to be shown on the canvas. Check the list below for all possible entity classes.
  • hideClass(Interface)enforce this class to be hidden on the canvas. Check the list below for all possible entity classes.
  • showLanguageButton(Translate)generates a button on the visualization to switch between the name and title value of all shapes on the visualization.
  • showRACIMatrix()to have a raci matrix generated on a BPMN diagram.
  • showRACIButton(RACI)to have a dialog that shows RACI of a BPMN diagram.
  • showLearnButton(Learn)to have a dialog that shows statements on the current diagram.
  • showTestButton(Test)to have a dialog that shows questions on the current diagram.
  • showLegendButton(Legend)to have a dialog that shows the used shapes, icons and colors and their meaning.
  • showIconSwitchButton(Switch)generates a button on the visualization to switch between the default icon and configured image of all shapes on the visualization.
  • showRelatedObjects(Location, New York) - show only the objects on the visualization that are related to the location New York.
  • hideRelatedObjects(Location, New York) - hide the objects on the visualization that are related to the location New York.
  • hideRelationships()hides by default all the relationships on a visualization.
  • showTags(Customer)shows only the entities that have tag value including the term Customer.
  • hideTags(Sales)hides the entities that have tag value including the term Sales.
  • colorizeObjects(name,mywebapp, yellow)give alle the shapes that have namevalue webapp a yellow fill color
  • colorizeTags(webapp, green)give alle the shapes that have tag value webapp a green fill color
  • 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.
  • 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).
  • hideButtons()hides the buttons on the diagram.
  • 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.
  • 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.
  • 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) .

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

The methods can be used in a chain seperated 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