Categorygithub.com/cloudprivacylabs/lsa-neo4j
repositorypackage
1.0.0
Repository: https://github.com/cloudprivacylabs/lsa-neo4j.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

GoDoc Go Report Card

Neo4J Storage Driver for Layered Schemas

This Go package contains the Neo4J graph database driver to store graphs generated by layered schemas. It also has a command line tool that can be paired with layers command line tool to ingest data and store in a Neo4J database.

Graph Mapping

The data ingested using layered schemas is represented as a labeled property graph. There are some minor differences between the Neo4J graph representation and a more generic labeled property graph used by labeled schemas, so a mapping is necessary. This section describes how that mapping is done.

  • Every node of a data graph is stored as a Neo4J node.

    • The data graph node id is stored as the string property neo4j_id
    • All node properties of the data graph are stored as Neo4j node properties, with string or []string values
    • The types associated with a data graph node are stored as Neo4j node labels.
  • Every edge of a data graph is stored as a Neo4J edge.

    • The graph node edge label is stored as the Neo4J edge label
    • All edge properties of the graph node are stored as string or []string property values

As an example:

Data Graph:
+----------------------------+                                  +---------------------------+
|  @id = node_1              |                                  |  @id = node_2             |
+----------------------------+                                  +---------------------------+
|  @type = [ type1, type2 ]  |-------- edgeLabel      --------->|  @type = [ type3, type4 ] |
|  property = value          |         edgeProperty = value     |  property2 = value2       +
+----------------------------+                                  +---------------------------+


Neo4J:
+---------------------+                                      +---------------------------+
|  :type1 :type2      |                                      |     :type3 :type4         |
+-------------------- +                                      +---------------------------+
|  neo4j_id = node_1  |----------- :edgeLabel -------------->|   neo4j_id = node_2       |
|                     |             edgeProperty = value     |   property2 = value2      |
|  property = value   |                                      +---------------------------+
+---------------------+

Command Line Tool

To build the command line tool, use the Go build system:

cd lsaneo
go mod tidy
go build

That should build the lsaneo binary for your platform

You can pair lsaneo with the layers tool to ingest data and store graphs:

layers ingest csv --schema myschema.json inputdata.csv | lsaneo create --user userName --pwd password --uri dburi

You can also store saved graph files (in JSON-LD flattened format):

lsaneo create --user userName --pwd password --uri dbUri <fileName>