Skip to content

Commit 2961780

Browse files
committed
docs: complete Javadoc of ImportPipeline iterable API
1 parent b1acc59 commit 2961780

File tree

1 file changed

+36
-9
lines changed

1 file changed

+36
-9
lines changed

core/src/main/java/org/neo4j/importer/v1/pipeline/ImportPipeline.java

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,21 @@
4747
import org.neo4j.importer.v1.targets.Targets;
4848

4949
/**
50-
* {@link ImportPipeline} exposes a topologically-ordered set of {@link ImportStep},
50+
* {@link ImportPipeline} exposes a topologically-ordered set of active {@link ImportStep},
5151
* based on the provided {@link ImportSpecification}, usually created with
5252
* {@link org.neo4j.importer.v1.ImportSpecificationDeserializer#deserialize(Reader)} or its variants.
53+
* <br>
54+
* The existing types of the provided {@link ImportSpecification} are converted to their Step equivalent: {@link Source}
55+
* gets translated to {@link SourceStep}, {@link NodeTarget} to {@link NodeTargetStep} etc...<br>
56+
* Inactive {@link Target}s (see {@link Target#isActive}) are skipped and therefore not translated to their
57+
* corresponding step type.
5358
* <br><br>
59+
* In particular, {@link RelationshipTargetStep}s directly reference their start and end {@link NodeTargetStep}, whereas
60+
* {@link RelationshipTarget}s simply reference the start and end node target name. This reduces the amount of required
61+
* lookup logic. If the corresponding start and/or end {@link org.neo4j.importer.v1.targets.NodeReference} define
62+
* key mapping overrides, the resulting {@link NodeTargetStep} get their property mappings accordingly updated.
63+
* <br><br>
64+
* Here is an example usage of {@link ImportPipeline} made possible by its {@link Iterable} implementation:
5465
* <pre>
5566
* var specification = org.neo4j.importer.v1.ImportSpecificationDeserializer.deserialize(aReader);
5667
* var pipeline = @link ImportPipeline.of(specification);
@@ -66,14 +77,30 @@
6677
* }
6778
* });
6879
* </pre>
69-
* <br><br>
70-
* Since an {@link ImportStep} may have dependencies, which are either:<br><br>
71-
* - implicit like a {@link TargetStep} depending on a {@link SourceStep},
72-
* a {@link RelationshipTargetStep} depending on start/end {@link NodeTargetStep}s<br>
73-
* - and/or explicit (via {@link ImportStep#dependencies()}<br><br>
74-
* ... the pipeline guarantees that dependencies are *always* returned after their dependents.<br>
75-
* In particular, the dependencies of each {@link ActionStep} are resolved at pipeline construction, based on the
76-
* provided import specification and the corresponding {@link Action}'s {@link ActionStage}.
80+
* The iteration returns every step in order.
81+
* Each step is guaranteed to be processed after all its implicit and explicit dependencies.
82+
* <br>
83+
* Implicit dependencies are:<br><br>
84+
* - {@link TargetStep} depending on a {@link SourceStep}<br>
85+
* - {@link RelationshipTargetStep} depending on start/end {@link NodeTargetStep}s<br>
86+
* - {@link RelationshipTargetStep} sharing common start/end nodes with other {@link RelationshipTargetStep}<br/>
87+
* - {@link ActionStep} must define an {@link ActionStage}, which gets translated to a set of concrete dependencies<br>
88+
* <br>
89+
* Relationships sharing common nodes must not be imported in parallel as this would likely cause
90+
* deadlock issues. Such relationships are defined with an explicit dependency between them.<br>
91+
*<br>
92+
* {@link Action}s with {@link ActionStage#POST_QUERIES} are translated to
93+
* instance of {@link ActionStep}s with dependencies on all the {@link CustomQueryTargetStep} defined in the pipeline.
94+
* {@link ActionStep}s with {@link ActionStage#PRE_NODES} result in making all the {@link NodeTargetStep} in
95+
* the pipeline to depend on these actions.
96+
* Finally, {@link ActionStep}s with {@link ActionStage#END} get the following dependencies:<br><br>
97+
* - all declared {@link SourceStep}<br>
98+
* - all declared {@link TargetStep}<br>
99+
* - all declared {@link ActionStep} with an {@link ActionStage} different from {@link ActionStage#END}<br>
100+
* <br>
101+
* Dependencies can also be explicit:<br><br>
102+
* - {@link TargetStep} can define dependencies to other {@link TargetStep}<br>
103+
* <br>
77104
*/
78105
public class ImportPipeline implements Iterable<ImportStep>, Serializable {
79106

0 commit comments

Comments
 (0)