Menu of Frameworks, Methods, Tools & Modeling (by Eero Hosiaisluoma)
Menu of Frameworks, Methods, Tools & Modeling (by Eero Hosiaisluoma)

ArchiMate Model Transfer from Archi to Neo4j Graph Database

From Models to Data Visualization

..and back. It is possible to transfer Enterprise Architecture (EA) models to database, from which the EA data can be enriched or used as a raw data for more advanced data visualization. Data visualization can be performed by diverse tools and techniques, as there are plenty of them available. Data visualization is makes it possible to make organization data available for all the stakeholders with modern, user-friendly and attractive way. EA data is a category of organization data, that is meaningful and valuable for decision makers, management, business representatives and all the roles that are involved in development or operations…

Graph Databases such as Neo4j can be used for extended visualization and analysis purposes of EA-models. As EA-models consist of concepts and relations between them, they match perfectly to Graph Databases: a Graph Database model consists of objects and relations between those objects. They are called “Nodes” and “Relationships” as shown in the figure below.

Graph model: : Nodes, Relationships and Properties.

Why to transfer an EA-model to a Graph Database? Even though ArchiMate-models contain lots of exact information of the enterprise, ArchiMate-models are difficult to understand for many audiences. E.g. business stakeholders often see ArchiMate-models too complicated and hard to catch up. No doubt there is a quite tough learning curve in ArchiMate – though the basics are simple.

So there is a need for simplified visualizations of EA-models that can be easier to understand. Graph model visualizations are simple enough and intuitively understandable: just lines and circles. That is an easy way for most of us to understand concepts their relations to each other.  Graph data models are simple, and they can adapt to continuously changing requirements and conditions. Predefined database schema is not required. That is where the agility comes from! The data model evolves according to changing requirements without any schema modifications.

Graph database can be queried, and more user-friendly visualizations and analysis can be provided. This can be done either with many of those available specialized visualization tools (such as Tableau or BI/A tools like MS Power BI, Leaflet), or with custom applications that utilize modern Javascript-frameworks (e.g. D3.js, Chart.js, Leaflet, Sigma.js and Angular, Node.js, React.js etc.). This makes it possible to create whole lot a new genre of EA-visualization & analysis tools. Or, all those existing data visualization tools can be utilized.

Graph data and a graph database can be used for simpler and easier visualizations of EA-data. Also, graph data provides wide range of ways for different kinds of analysis such as impact analysis.

How to transfer an EA-model to a Graph database? There is available an excellent Archi database plugin (link). With that plugin ArchiMate-models can be exported and imported to relational database, and to Neo4j Graph database. Data can be imported into Neo4j with number of other mechanisms too (e.g. from CSV-files).

I have tested ArchiMate Model transfer from Archi (v.4 Beta) to Neo4j Graph Database (v. 3.1.0 Beta) and back with the plugin. It works fine! I exported an ArchiMate diagram (Figure below) from Archi-tool to Neo4j. The target graph in Neo4j contains all the ArchiMate elements, relations and properties.

EA-model transfer from Archi-tool to Neo4j graph database in practice

Source ArchiMate model

Source ArchiMate (3) model illustrated in the diagram below.

ArchiMate model.

Target graph model in Neo4j

Target graph model in Neo4j shown below. This graph is created based on the source ArchiMate model. Now the ArchiMate model can be further used for more advanced visualization techniques, e.g. by utilizing modern web-based technologies such as javascript frameworks. Also, by this way the original ArchiMate data can be enriched with other data within graph database.

Neo4j graph.

Neo4j database can be queried by the graph query language named Cypher. E.g. the graph shown above is queried with the following Cypher statement:

MATCH (n:archimateelement) RETURN n

The Cypher query language is very powerful and it provides lots of functions etc. for advanced analytical use cases. Cypher is analogous to SQL (Structured Query Language), that is de facto standard when accessing relational databases (RDBMS).

Transfer process

The transfer process goes as follows:

1. Create model with Archi-tool
2. Export model from Archi to Neo4j
3. Visualize & analyze graph model with Neo4j
From Archi to Neo4j -process.

1. Create model with Archi-tool

An ArchiMate model created with Archi-tool (figure below).

Archi-tool.

2. Export model from Archi to Neo4j

Archi database plugin view to define export from Archi to Neo4j (figure below).

From Archi to Neoj4 – DB-plugin.

Export done (figure below).

Export done from Archi to Neo4j.

3. Visualize & analyze graph model with Neo4j

Result graph model in Neo4j (figure below).

Graph model in Neo4j.
Query language

Now the graph model can be queried with the Cypher language. Queries can be done within Neo4j browser-based user interface (figure 8), or alternatively Neo4j database can be accessed e.g. from customized Javascript web-applications.  Cypher queries can be sent from custom application to Neo4j database e.g. by using e.g. REST or Neo4j Bolt -protocol.

Connection to the Neo4j database can be performed with the Neo4j Driver and Session context, as shown in the Java example below:

Driver driver = GraphDatabase.driver( "bolt://localhost", AuthTokens.basic( "neo4j", "password" ) );

Session session = driver.session();

StatementResult result = null;

try { 
 result = session.run( "MATCH (n:archimateelement) RETURN n.id, n.name, n.type, n.documentation order by n.type, n.name asc" ); 
 
 // Handle result...
 while ( result.hasNext() ) { 
 Record record = result.next();
 System.out.println ("Name: " + record.get( "n.name" ).asString() + 
   " Id: " + record.get( "n.id" ).asString() + 
   " Type: " + record.get("n.type").asString() + 
   " Documentation: " + record.get("n.documentation").asString() ); 
 } 
} 
catch (Exception e) {
 // Handle Exception...
}
finally {
 session.close();
 driver.close(); 
}

Summary

Custom data visualization (web)applications have all the data visualization options available. This makes it possible to visualize and analyze the EA-data as any other data for decision making in an organization. Graph model in graph database opens new possibilities for more advanced visualization and analysis of the enterprise data.

Challenge in using Graph databases for EA-models is that there is new concept of “relationships between relationships” in ArchiMate 3…