-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* implement atag.chains.update * configuration and docs
- Loading branch information
1 parent
3ea2ad5
commit e935cf6
Showing
5 changed files
with
404 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package atag.util; | ||
|
||
import org.neo4j.graphdb.Entity; | ||
import org.neo4j.graphdb.Node; | ||
import org.neo4j.graphdb.Path; | ||
import org.neo4j.graphdb.Relationship; | ||
import org.neo4j.internal.helpers.collection.Iterables; | ||
|
||
import java.util.Iterator; | ||
|
||
public class EmptyPath implements Path { | ||
@Override | ||
public Node startNode() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Node endNode() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Relationship lastRelationship() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Iterable<Relationship> relationships() { | ||
return Iterables.empty(); | ||
} | ||
|
||
@Override | ||
public Iterable<Relationship> reverseRelationships() { | ||
return Iterables.empty(); | ||
} | ||
|
||
@Override | ||
public Iterable<Node> nodes() { | ||
return Iterables.empty(); | ||
} | ||
|
||
@Override | ||
public Iterable<Node> reverseNodes() { | ||
return Iterables.empty(); | ||
} | ||
|
||
@Override | ||
public int length() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public Iterator<Entity> iterator() { | ||
return Iterables.<Entity>empty().iterator(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# `atag.chains.tokenChain` | ||
|
||
## Description | ||
|
||
Partially updates a chain of tokens or characters | ||
|
||
## Parameters | ||
|
||
| name | type | description | default value | | ||
|--------------|---------------|---------------------------------------------------------------------------------|---------------| | ||
| uuidStart | String | uuid of the node located before the changeset | | | ||
| uuidEnd | String | uuid of the node located after the changeset | | | ||
| replacement | array of maps | a list of nodes described by their properties.<br/>each map must contain a uuid | | | ||
| config | map | configuration settings, see table below for details | `{}` | | ||
| return value | Path | a path representing the changeset, excluding uuidStart and uuidEnd nodes | | | ||
|
||
## Configuration Settings | ||
|
||
| name | description | default value | | ||
|------------------|----------------------------------------------------------|------------------| | ||
| textLabel | label to be used for entry point nodes, aka `Text` nodes | `Text` | | ||
| elementLabel | label to be used for chain element nodes | `Character` | | ||
| relationshipType | relationship type interconnection the element nodes | `NEXT_CHARACTER` | | ||
|
||
## Examples | ||
|
||
Assume this sample graph: | ||
|
||
```cypher | ||
CREATE (t:Text{uuid:$uuidText}) | ||
CREATE (s:Token{uuid:$uuidStart}) | ||
CREATE (m1:Token{uuid:$uuidMiddle1, tagName:'a'}) | ||
CREATE (m2:Token{uuid:$uuidMiddle2, tagName:'b'}) | ||
CREATE (e:Token{uuid:$uuidEnd}) | ||
CREATE (t)-[:NEXT_TOKEN]->(s) | ||
CREATE (s)-[:NEXT_TOKEN]->(m1) | ||
CREATE (m1)-[:NEXT_TOKEN]->(m2) | ||
CREATE (m2)-[:NEXT_TOKEN]->(e) | ||
``` | ||
|
||
```cypher | ||
CALL atag.chains.update($uuidText, $uuidStart, $uuidEnd, [ | ||
{ | ||
uuid: $uuidMiddle1, | ||
tagName: 'a' | ||
}, | ||
{ | ||
uuid: $uuidMiddle2, | ||
tagName: 'c' | ||
} | ||
], { | ||
textLabel: "Text", | ||
elementLabel: "Token", | ||
relationshipType: "NEXT_TOKEN" | ||
}) YIELD path RETURN path | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.