I’ve been working a lot with Sparx Enterprise Architect and ArchiMate over the past few years, and although I am a big fan of formalized modelling using ArchiMate I’ve found myself frustrated with some of the limitations of the Sparx EA tool.
Over a small series of posts I’m intending to share a few of the tricks I’ve developed over time to address these frustrations. These posts are fairly technical in nature, and address the usage of Sparx EA as an architecture tool, as opposed to the practice of defining the architecture itself. The other posts in this series are below;
- Sparx EA: Matrix Viewpoints Across Multiple Relationships
- Sparx EA: Embedding Diagrams within an Enterprise Wiki
- Sparx EA: Displaying Tagged Values on Diagrams
- Sparx EA: Preview Panel for Element Rollovers in HTML Exports
- Sparx EA: Using PowerShell to script queries against the model
- Sparx EA: Bulk Updates using PowerShell
Saving Time with Scripted Updates
In my last post I walked through how I’ve been connecting to the Sparx EA repository using PowerShell and executing queries to retrieve model elements. In this post I’ll be building on that with an example of using the same technique to make bulk updates more efficient.
There are a number of ways I’ve found this useful as an efficiency tool in my day-to-day use of Sparx EA;
- Quickly creating a set of new elements from a spreadsheet
- Quick check that all elements of a specific stereotype have all mandatory tagged values and add any that are missing
- Facilitating Import / Export Methods for element catalogs managed within the architecture model
For this example, I’m going to concentrate on adding a missing tagged value for a set of elements. I use this frequently, so as to ensure that all elements have the minimum set of attributes required for our organisation standards.
I should not here that while I do use the term ‘bulk updates’, this is still performing row-level operations – however since we can leverage SQL statements to quickly identify the set of elements to update this technique is much more efficient than iterating through elements in the repository.
Selecting Elements to Update
Using with the technique discussed in my previous post to use pre-select and filter a set of elements from the Sparx EA model, we can quickly identify all elements of a specific type where the tagged value is missing.
Saving the Tagged Value
Using the object model to add a new tagged value is straight forward, as shown below.
With these functions defined, it becomes possible to build an ad-hoc script that can be run when necessary to make sure all the expected tagged values have been setup across the model.