- Neo4j Community Server Edition 3.4.x installed and started (https://neo4j.com/download-center/#community)
- APOC-Awesome Procedures for Neo4j 3.4.x installed (https://github.com/neo4j-contrib/neo4j-apoc-procedures)
- JDK 8 installed.
ACORD.xml
- ACORD Data Model 2.6
load_xml00.txt
- deletes any existing nodes and loads ACORD from xml.
The XML file contains a lot of information but we only want to extract business concepts. In this example we only work with small subset and these nodes will be named POC1Type.
customStoredProcedures.txt
- creates necessary stored procedures
logical01.txt
- creates logical model. Creating logical model consists of series of steps, depending on what we wish to include.
physical02.txt
-create physical model. We can now iter-
ate, create, and recreate physical model based on the logical model.
transform03.txt
- applies model transformations(e.g. splitting, merging, versioning etc) aka roll up and roll down
Java program using Object Graph Mapper library to manage domain objects with Neo4j. Output is annotated schema file used by Amplify/Prisma in order to generate GrapQL API.
In <NEO4J_HOME>/conf/neo4j.conf
add following properties
dbms.security.procedures.unrestricted=apoc.*
apoc.export.file.enabled=true
apoc.import.file.enabled=true
dbms.directories.plugins=plugins
All you need to do to load XML files into the database is to call APOC procedure and provide url to the file call apoc.xml.import('file:///tmp/ACORD.xml');
Most convenient and performant way is to exectue these commands from cypher-shell as scripts. In this first step execute load_xml00.txt
.
./cypher-shell -u neo4j -p <password> --format plain < /edh-model/scripts/load_xml00.txt
./cypher-shell -u neo4j -p <password> --format plain < /edh-model/scripts/customStoredProcedures.txt
Now let's execute logical01.txt
./cypher-shell -u neo4j -p <password> --format plain < /edh-model/scripts/logical01.txt
Execute physical02.txt
./cypher-shell -u neo4j -p <password> --format plain < /edh-model/scripts/physical02.txt
Let's apply transformations to the physicla model.
./cypher-shell -u neo4j -p <password> --format plain < /edh-model/scripts/transform03.txt
Data model can now be accessed through Neo4j browser.
gqlschema.jar accepts command line arguments:
Option (* = required) Description
--------------------- -----------
* --config Path to the config file
Run java program generating schema file.
java -jar gqlschema.jar --config conf/conf.yaml
You can read more about GQLSCHEMA here
- conf - Configuration
- images - Images
- src - Java code
- graph - Graph traversals and application logic
- node - OGM classes
- util - utility code
Config contains following parameters
- server_uri - Uri of the Neo4j server.
- server_username - username
- server_password - password
- schema - type of schema to be generated. "PRISMA" and "APPSYNC" are the valid options.
Example of a conf.yaml file
server_uri: "bolt://localhost:7687"
server_username: "neo4j"
server_password: "password123"
schema: "PRISMA"