redisgraph-bulk-loader icon indicating copy to clipboard operation
redisgraph-bulk-loader copied to clipboard

Multiple labels (Question)

Open YaphetKG opened this issue 3 years ago • 6 comments

is there a way for the bulk loader to add multiple labels on a node?

YaphetKG avatar Jun 10 '22 18:06 YaphetKG

I believe you can use the following:

redisgraph-bulk-insert <graph_name> -N <Label_0>:<Label_1>:<Label_i> nodes.csv

To load specify multiple labels to each entity in a CSV file. @AviAvni can you please make sure we update redisgraph-bulk-loader documentation such that this is clear and easy to find, consider also adding an example.

Thanks!

swilly22 avatar Jun 11 '22 13:06 swilly22

Thanks for the suggestion @swilly22 , I played around with this a little bit , we have node types like

biolink:SmallMolecule biolink:MolecularEntity biolink:ChemicalEntity biolink:NamedThing biolink:Entity biolink:PhysicalEssence ...

This becomes a problem with how labels would be split by : character.... I am wondering if there is a way to seperate them in another way ....

YaphetKG avatar Jun 24 '22 15:06 YaphetKG

Hi @swilly22 is there any work around to support labels that have : in them ?

YaphetKG avatar Oct 28 '22 16:10 YaphetKG

to be able to do queries as

MATCH (c:`biolink:SmallMolecule`:`biolink:ChemicalEntity`) return c 

If we create the node with cypher create call i believe it would work , but we are not able to create the nodes with multiple labels using the bulk loader. Maybe having an option to override the separator would make sense (?)

YaphetKG avatar Oct 28 '22 16:10 YaphetKG

Hi @YaphetKG,

I've looked into the Bulk-Loder source and I'm reluctant to make any change in the command line arguments at the moment, Let me suggest the following:

Use a placeholder label during bulk loading, once the data is loaded issue a query to update this place holder, See following example on how to update node label, note this will require the latest version of RedisGraph 2.10

127.0.0.1:6379> GRAPH.QUERY g "MATCH (a:A) SET a:`C:D`"
1) 1) "Labels added: 1"
   2) "Cached execution: 0"
   3) "Query internal execution time: 6.551250 milliseconds"

127.0.0.1:6379> GRAPH.QUERY g "MATCH (a) REMOVE a:A RETURN a"
1) 1) "a"
2) 1) 1) 1) 1) "id"
            2) (integer) 0
         2) 1) "labels"
            2) 1) "C:D"
         3) 1) "properties"
            2) (empty array)
3) 1) "Labels removed: 1"
   2) "Cached execution: 0"
   3) "Query internal execution time: 6.202083 milliseconds"

swilly22 avatar Nov 02 '22 08:11 swilly22

Thanks @swilly22

YaphetKG avatar Nov 07 '22 13:11 YaphetKG