Siren Platform User Guide

Importing Neo4j data

Neo4j is a graph database management system, which uses graph structures with nodes, relations, and properties to represent and store data. Siren can now ingest and reflect (periodically update) Neo4j data. The Neo4j Import Wizard (beta feature) makes this an easy process.

  • Nodes represent entities that are to be tracked, and correspond to a record in a relational database.

  • Relations are lines that connect nodes to other nodes, representing the relationship between them. Relations are the key concept in graph databases because they represent an abstraction that is not directly implemented in a conventional relational database.Properties describe information relevant to nodes.

  • Properties describe information relevant to nodes.

The following diagram shows two nodes with five relations between them. One of the nodes also has a relation with itself (node properties are not shown here).

neo4j_model.png
Using the Neo4j Import Wizard (beta)

The Neo4j Import Wizard (beta feature) makes it easy to import Neo4j data from a datasource and then configure and view the data model.

  1. Go to ManagementDatasources.

  2. In the New Datasource Type dropdown, click JDBC.

  3. Specify the details for the Neo4j as the datasource, then click Save.

  4. Go to Data Reflections and click Reflection Jobs; add a new job.

  5. Select the Neo4j as the datasource; you then get an option to use the Neo4J Importer.

    neo4j_importer.png
  6. Click Use Neo4j Importer. The Neo4j Wizard screen opens.

  7. Select the required nodes from the Select Nodes dropdown, and click Next.

    neo4j_step1.png

    All data reflection jobs for nodes and relations are displayed. Note that relations are also listed under Node Name; this is because Neo4j relations contain data, and Siren Investigate runs a reflection job for each relation, just like a node.

    neo4j_step2a.png

    Note

    Ensure that an appropriate primary key is selected. The use of stable unique identifiers as primary keys in your Neo4J data model is recommended.

  8. Click Confirm.

    Wait for the data to start reflecting, which means that all jobs have indexed at least one document, indicating that the fields are mapping successfully. The Continue button becomes enabled at this point.

    neo4j_reflect.png

    While a job is indexing, its status is shown as running; when a job completes, the status changes to successful.

    Tip

    You can see the document count and other information by hovering over the status.

    neo4j_tip.png

    You can leave the wizard at this point (by clicking ../ on top left of the wizard, or anywhere else in the application). This may be necessary if reflection jobs are failing and you have to go back to fix them.

  9. You can continue where you left off by following the notification in the Datasource Reflection Jobs page. Click Pending Jobs.

    neo4j_pending_jobs.png
  10. Click Continue Neo4J Job.

    neo4j_continue_job.png

    Note

    Pending jobs are stored in server cache, which will be wiped out if the Investigate server is restarted or shut down. Its behaviour is unpredictable when multiple Investigate instances are running behind a Load Balancer.

  11. On the Configure Saved Searches screen, you can modify the search name, and specify a color for the nodes and relations:

    neo4j_copy.png

    Click Next.

  12. On the Configure Relations screen, you can modify the Relation Label and the Inverse Relation Label for each relation:

    neo4j_relations.png
  13. Click Create Ontology.

  14. You can now go to the Data Model page to view the Neo4j data model:

    neo4j_end.png
Node behavior

You should note the following aspects of node behavior:

  • If a node has labels Location and Residence, then it will be reflected onto both indices.

  • A field node_labels is added to every document to denote all its labels.

  • Extra fields are added to all nodes, including node_id (containing the value of the primary key). Relation nodes have a few additional fields: start_node_id, end_node_id, relation_type.

  • In the case of relation-based reflection jobs, relation documents are only included for added nodes.

Other considerations
  • The same field mappings should not conflict for a single node.

  • All id()s are unique. Note that the use of stable unique identifiers in your Neo4J data model as primary keys is recommended.

    Neo4j does provide a unique id for each node and relationship, but they are not persistent. The id can be accessed by returning id(node) or id(relationship). While this id is unique, it can change if the database store is compacted.