Import a Context Graph model into a Neo4j cluster - 23.1

Spectrum Dataflow Designer Guide

Version
23.1
Language
English
Product name
Spectrum Technology Platform
Title
Spectrum Dataflow Designer Guide
First publish date
2007
Last updated
2024-05-09
Published on
2024-05-09T23:01:03.226155

This procedure describes how to use the Import to Model stage in a workflow to upload a model to a Neo4j Graph Database Server cluster.

The Neo4j Database Server cluster must be started and configured to work with Context Graph before you perform this procedure. To install a Neo4j Database Server cluster, see Installing a Cluster for Context Graph in the Spectrum Technology Platform 2023.1 Installation Guide.
  1. In Enterprise Designer, add the Import to Model stage to a workflow, and connect input and output ports to upstream and downstream stages.
    For more information see Input and Output.
  2. Configure stage options.
    Option Description
    Entities tab Settings on this tab configure the entities that will be included in the imported model. For more information, see Entities tab.
    Relationships tab Settings on this tab configure relationships between source and target entities in the imported model. For more information, see Relationships tab.
    Options tab Specify an output directory on a local or shared drive. The Import to Model stage writes batch files into this directory that you run to import the model and data to the Neo4j database. For more information, see Options tab.
  3. Run Import to Model job against the cluster to create the model metadata and import files.
  4. Install a stand-alone Neo4j Database Server on the cluster node where you ran the Import to Model job or on a different server.
  5. Navigate to the path of the output folder that was defined in the Import to Model stage.
    If the stand-alone Neo4j Database Server was installed on a different server, copy the output folder to that server.
  6. On the server that runs the Neo4j stand-alone instance, open the model folder and run the appropriate script file.
    Platform Run
    Windows modelname-timestamp_import.bat
    Linux modelname-timestamp_import.sh
    1. When prompted, enter the path to the Neo4j instance /bin folder.
    Note:

    If your data contains multiple line input fields, add the option --multiline-fields=true to the neo4j-admin import command in the modelname-timestamp_import.bat or or modelname-timestamp_import.sh file.

    Example: call %neopath%/neo4j-admin import --database Artists --multiline-fields=true --verbose

  7. On the server that runs the Neo4j stand-alone instance, open the model folder and run the appropriate dbinit script file.

    Windows

    SSL Certificate Run
    No None modelname-timestamp_dbinit.bat
    Yes Self-signed modelname-timestamp_dbinit_ssc.bat
    Yes Certificate authority modelname-timestamp_dbinit_s.bat

    Linux

    SSL Certificate  
    No None modelname-timestamp_dbinit.sh
    Yes Self-signed modelname-timestamp_dbinit_ssc.sh
    Yes Certificate authority modelname-timestamp_dbinit_s.sh
    1. When prompted, enter the user name and password for Neo4j.
      Press Enter in each case if authentication is not set up for the Neo4j instance.
    2. For the port number, enter the Bolt connector address.
      The default port setting for the Bolt connector address is 7700. This is defined on the Neo4j server in the Neo4j configuration settings file (neo4j.conf).
    3. When prompted, enter the path to the /bin folder for the Neo4j instance.
  8. On the server that runs the Neo4j stand-alone instance, configure the following settings in the Neo4j.conf file:
    dbms.backup.enabled=true
    dbms.backup.listen_address=0.0.0.0:6365
    

Note: Steps that follow are based on seeding a Neo4j cluster based on the Backup and Restore commands. For other methods to seed a Neo4j cluster, see Seed a cluster (Neo4j Operations Manual).
  1. Run the neo4j-admin database backup command to create an online backup of the imported model on the stand-alone instance of Neo4j.

    The following command backs up the artists model database on a stand-alone instance of Neo4j:

    neo4j-admin database backup artists --from=ipAddress/hostname:6365 --to-path=path-to-backup-folder
  2. Confirm that the Neo4j Database Server cluster is started.
  3. Use the model backup from the stand-alone Neo4j instance, and run the neo4j-admin database restore command to restore the model database on one of the core cluster nodes.

    The following command line restores the artists model database.

    neo4j-admin database restore --from-path=path-to-backup-folder/artistsimport-2023-04-14T20-36-13.backup
  4. Use the Neo4j Browser (http://localhost:7475/browser/) to connect to the cluster core node on which you ran the restore command.
  5. Select the system database and run SHOW SERVERS YIELD *.
  6. From the list of nodes, find the ServerId of the core node on which you ran the Restore command, and copy the ServerId.
  7. From the system database run the CREATE DATABASE command to create the model database.

    The following example illustrates the Cypher CREATE DATABASE command to create the artists model database.

    CREATE DATABASE artists options {existingData: 'use', existingDataSeedInstance: 'ServerId'};
    The model database will replicate to the other core nodes in the cluster.
    Note: If the database is of considerable size, the execution of the command can take some time. You can reference the Neo4j logs to check the status.
  8. Verify the model database is online on all members of the cluster.
After you complete this procedure, verify you can open and query a model using Context Graph Visualization.