Customizing EDG Using Server-side Scripting

Introducing Active Data Shapes (ADS) Scripting

TBD

Editor Panels for Working with ADS Scripts

Script Editor Panel

This panel offers a full-blown JavaScript editor with syntax highlighting and auto-completion. It lets you work with the automatically generated APIs.

Keyword focusNode lets you work with the APIs for the selected resource. Use the Execute (“Play”) button to run the script, which may in the beginning only consist of the word focusNode. When you run that “script”, the Script Results panel will show the currently selected asset.

TopBraid EDG Script Results Panel

TopBraid EDG Script Results Panel

Another common starting place for a script is to use graph object and its associated APIs as shown below.

TopBraid EDG Script Graph Object

TopBraid EDG Script Graph Object

More generally, the Script Editor can evaluate whatever JavaScript expression you have entered. If you have multiple lines of JavaScript, it will simply return the value of the last expression.

Stop button to the right of the Execute lets you stop currently running script.

There is also a button that lets you Upload a file for use by the script. And a button to Refresh the generated API. This button is used after ontology changes are made, including changes in the ontology structure and changes made in the Shapes Scripts panel.

Settings menu has an option to let the script modify data.

Script Results Panel

This panel shows results of script execution. In the header, it will display the time it took to execute a script.

Shape Scripts Panel

This panel lets you create source code that will be injected into the generated API. It is available only in ontologies.

To use it, navigate to a class you want to add code to. Enter the source code as shown below. Don’t forget to press Save Changes button.

TopBraid EDG Shape Scripts Panel

TopBraid EDG Shape Scripts Panel

Script API Viewer Panel

This panel lists all APIs available in the current asset collection. It has a button to Refresh the generated API. This button is used after ontology changes are made, including changes in the ontology structure and changes made in the Shapes Scripts panel.