
Uniform configuration facade for Neo4j import tools: user-friendly JSON/YAML import specs with JSON Schema, Java model, pipeline API, and extensible plugins for sources, targets, actions, and validators.
This library provides a uniform configuration facade for tools running imports to Neo4j. In particular, it offers:
org.neo4j.importer.v1.ImportSpecification
org.neo4j.importer.v1.pipeline.ImportPipeline
The import specification also offers various extension points, such as:
SourceProvider Service Provider Interface)EntityTargetExtensionProvider Service Provider Interface)ActionProvider Service Provider Interface and built-in plugins)SpecificationValidator Service Provider Interface and built-in plugins)The library does NOT:
First, implement and register a source provider for BigQuery.
Then, save the following import specification into spec.json:
{
"version": "1",
"config": {
"key": "value"
},
"sources": [
{
"name": "my-bigquery-source",
"type": "bigquery",
"query": "SELECT id, name FROM my.table"
}
],
"targets": {
"queries": [
{
"name": "my-query",
"source": "my-bigquery-source",
"query": "UNWIND $rows AS row CREATE (n:ANode) SET n = row"
}
]
},
"actions": [
{
"name": "my-cypher-action",
"type": "cypher",
"stage": "start",
"query": "CREATE CONSTRAINT a_node_id FOR (n:ANode) REQUIRE n.id IS UNIQUE"
}
]
}You can then deserialize it and run your import logic accordingly:
import org.neo4j.importer.v1.ImportSpecificationDeserializer;
import org.neo4j.importer.v1.targets.Targets;
import java.io.Reader;
class GettingStarted {
public static void main(String... args) {
try (var reader = new InputStreamReader(createReaderFor("/import/spec.yaml"))) {
var pipeline = ImportPipeline.of(ImportSpecificationDeserializer.deserialize(reader));
pipeline.forEach(step -> {
switch (step) {
case SourceStep source -> handleSource(source);
case ActionStep action -> handleAction(action);
case TargetStep target -> handleTarget(target);
}
});
}
}
}This library provides a uniform configuration facade for tools running imports to Neo4j. In particular, it offers:
org.neo4j.importer.v1.ImportSpecification
org.neo4j.importer.v1.pipeline.ImportPipeline
The import specification also offers various extension points, such as:
SourceProvider Service Provider Interface)EntityTargetExtensionProvider Service Provider Interface)ActionProvider Service Provider Interface and built-in plugins)SpecificationValidator Service Provider Interface and built-in plugins)The library does NOT:
First, implement and register a source provider for BigQuery.
Then, save the following import specification into spec.json:
{
"version": "1",
"config": {
"key": "value"
},
"sources": [
{
"name": "my-bigquery-source",
"type": "bigquery",
"query": "SELECT id, name FROM my.table"
}
],
"targets": {
"queries": [
{
"name": "my-query",
"source": "my-bigquery-source",
"query": "UNWIND $rows AS row CREATE (n:ANode) SET n = row"
}
]
},
"actions": [
{
"name": "my-cypher-action",
"type": "cypher",
"stage": "start",
"query": "CREATE CONSTRAINT a_node_id FOR (n:ANode) REQUIRE n.id IS UNIQUE"
}
]
}You can then deserialize it and run your import logic accordingly:
import org.neo4j.importer.v1.ImportSpecificationDeserializer;
import org.neo4j.importer.v1.targets.Targets;
import java.io.Reader;
class GettingStarted {
public static void main(String... args) {
try (var reader = new InputStreamReader(createReaderFor("/import/spec.yaml"))) {
var pipeline = ImportPipeline.of(ImportSpecificationDeserializer.deserialize(reader));
pipeline.forEach(step -> {
switch (step) {
case SourceStep source -> handleSource(source);
case ActionStep action -> handleAction(action);
case TargetStep target -> handleTarget(target);
}
});
}
}
}