Skip to content

Commit e4f3aac

Browse files
authored
Merge pull request #1 from K-Jo/renaming-relation
Renaming relation to relationship
2 parents 817b95d + 05bd5f7 commit e4f3aac

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ A Redis server with the [RedisGraph](https://github.com/RedisLabsModules/RedisGr
1111
https://oss.redislabs.com/redisgraph/
1212

1313
## Usage
14-
bulk_insert.py [OPTIONS] GRAPHNAME
14+
bulk_insert.py GRAPHNAME [OPTIONS]
1515

1616
| Flags | Extended flags | Parameter |
1717
|---------|-----------------------|----------------------------------------------|
@@ -20,15 +20,15 @@ bulk_insert.py [OPTIONS] GRAPHNAME
2020
| -P | --password TEXT | Redis server password |
2121
| -s | --ssl TEXT | Server is SSL-enabled |
2222
| -n | --nodes TEXT | path to node csv file [required] |
23-
| -r | --relations TEXT | path to relation csv file |
23+
| -r | --relationships TEXT | path to relationship csv file |
2424

2525
The only required arguments are the name to give the newly-created graph (which can appear anywhere) and at least one node CSV file.
26-
The nodes and relations flags should be specified once per input file.
26+
The nodes and relationship flags should be specified once per input file.
2727

2828
```
29-
python bulk_insert.py GRAPH_DEMO -n demo/person.csv -n demo/country.csv -r demo/knows.csv -r demo/visited.csv
29+
python bulk_insert.py GRAPH_DEMO -n example/Person.csv -n example/Country.csv -r example/KNOWS.csv -r example/VISITED.csv
3030
```
31-
The label (for nodes) or relation type (for relations) is derived from the base name of the input CSV file. In this query, we'll construct two node labels, `person` and `country`, and two relation types - `knows` and `visited`.
31+
The label (for nodes) or relationship type (for relationships) is derived from the base name of the input CSV file. In this query, we'll construct two sets of nodes, labeled `Person` and `Country`, and two types of relationships - `KNOWS` and `VISITED`.
3232

3333
## Input constraints
3434
### Node files
@@ -38,22 +38,22 @@ The label (for nodes) or relation type (for relations) is derived from the base
3838
- Value types do not need to be provided. Properties are not required to be exclusively composed of numeric or string types.
3939
- There is no uniqueness constraint on nodes.
4040

41-
### Relation files
42-
- Relation inputs have no headers.
41+
### Relationship files
42+
- Relationship inputs have no headers.
4343
- Each row should specify a source and destination node ID.
44-
- Described relations are always considered to be directed (source->destination).
45-
- The bulk insert script does not yet support adding properties to relations (though this can be done after the fact with RedisGraph queries).
46-
- _NOTE_ Relation processing does not yet include node lookups. The entries in a relation file should all be integers corresponding to node IDs.
44+
- Described relationships are always considered to be directed (source->destination).
45+
- The bulk insert script does not yet support adding properties to relationships (though this can be done after the fact with RedisGraph queries).
46+
- _NOTE_ Relationship processing does not yet include node lookups. The entries in a relationship file should all be integers corresponding to node IDs.
4747

4848

4949
### Determining Node IDs
50-
Node IDs are assigned in order of insertion. Node files are processed in the order specified by the user on the command line (though all label files are processed before relation files).
50+
Node IDs are assigned in order of insertion. Node files are processed in the order specified by the user on the command line (though all Node files are processed before Relationship files).
5151

52-
The first node in the first label file will have an ID of 0, and subsequent nodes across all files are ordered consecutively.
52+
The first node in the first node file will have an ID of 0, and subsequent nodes across all files are ordered consecutively.
5353

54-
If a relation file has the line:
54+
If a relationship file has the line:
5555
```
5656
0,11
5757
```
58-
This indicates that there is an edge from the first node in the first label file to the 12th node to be inserted, regardless of which file it may appear in.
58+
This indicates that there is a relationship from the first node in the first node file to the 12th node to be inserted, regardless of which file it may appear in.
5959

bulk_insert.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,11 @@ def help():
241241
@click.option('--ssl', '-s', default=False, help='Server is SSL-enabled')
242242
# CSV file paths
243243
@click.option('--nodes', '-n', required=True, multiple=True, help='path to node csv file')
244-
@click.option('--relations', '-r', multiple=True, help='path to relation csv file')
244+
@click.option('--relationships', '-r', multiple=True, help='path to relation csv file')
245245
# Debug options
246246
@click.option('--max_buffer_size', '-m', default=1024*1024, help='(DEBUG ONLY) - max token count per Redis query')
247247

248-
def bulk_insert(graph, host, port, password, ssl, nodes, relations, max_buffer_size):
248+
def bulk_insert(graph, host, port, password, ssl, nodes, relationships, max_buffer_size):
249249
global graphname
250250
global redis_client
251251
global max_tokens
@@ -260,8 +260,8 @@ def bulk_insert(graph, host, port, password, ssl, nodes, relations, max_buffer_s
260260
print("Building label descriptors...")
261261
label_descriptors = build_descriptors(nodes, "NODES")
262262
relation_count = 0
263-
if relations:
264-
relation_descriptors = build_descriptors(relations, "RELATIONS")
263+
if relationships:
264+
relation_descriptors = build_descriptors(relationships, "RELATIONS")
265265
relation_count = relation_descriptors.total_entities
266266

267267
# Send prefix tokens to RedisGraph
@@ -272,7 +272,7 @@ def bulk_insert(graph, host, port, password, ssl, nodes, relations, max_buffer_s
272272
# Process input CSVs and commit their contents to RedisGraph
273273
# Possibly make this a method on Argument
274274
label_descriptors.batch_insert_descriptors()
275-
if relations:
275+
if relationships:
276276
relation_descriptors.batch_insert_descriptors()
277277
finalize_graph()
278278

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
name,population
22
Israel,7000000
3-
Japan,127000000
3+
Japan,127000000

demo/knows.csv renamed to example/KNOWS.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626
5,2
2727
5,3
2828
5,4
29-
6,0
29+
6,0

demo/person.csv renamed to example/Person.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ Noam,Nativ
99
Hila,Rahamani
1010
Lucy,Fital
1111
Jane,Velger
12-
Shelly,Laslo
12+
Shelly,Laslo
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
0,11
22
0,12
3-
1,12
3+
1,12

0 commit comments

Comments
 (0)