Skip to content

innoq/code-your-model-example

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

code-your-model-example

This is an example project for the code-your-model library.

The meta model is located under src/main/groovy

The model files are located under src/model/groovy

usage

To build this project run

./gradlew build

To start a local neo4j database run

./scripts/run-local-neo4j.sh

The ImportModel.groovy script (located in src/main/groovy/ in package com.innoq.codeyourmodel.example) imports all model files into the neo4j database. It can be executed via gradle task

./gradlew importModel

To view the model in neo4j open the neo4j browser and execute the following cypher query

MATCH (n) RETURN n

You can use the model directly within the neo4j DB (by executing cypher queries)

e.g. to select (and return) all DomainEvent nodes execute

MATCH (n:DomainEvent) RETURN n 

or to select all Service nodes that emit or consume a particular DomainEvent

MATCH (s:Service) -- (e:DomainEvent{name:"Order accepted"}) RETURN s, e    

Alternatively, you can write a groovy script that uses the ModelRepository to retrieve the required data and for example render it to the console. The UseModel.groovy script (located in src/main/groovy/ in package com.innoq.codeyourmodel.example) gives a simple example. It can be executed via gradle task

./gradlew useModel

To stop the local neo4j docker container lookup its container id and execute

docker stop <container id>

If you run the import-model.sh|.groovy script, all existing nodes and relationships within the neo4j DB are deleted before the model is imported. If you want to clean up the existing data indipendent from the import execute the following cypher query

MATCH (n) DETACH DELETE n

About

example project for the code-your-model library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published