Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple labels (Question) #92

Open
YaphetKG opened this issue Jun 10, 2022 · 6 comments
Open

Multiple labels (Question) #92

YaphetKG opened this issue Jun 10, 2022 · 6 comments
Labels
question Further information is requested

Comments

@YaphetKG
Copy link
Contributor

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

@swilly22
Copy link
Contributor

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 swilly22 added the question Further information is requested label Jun 11, 2022
@YaphetKG
Copy link
Contributor Author

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
Copy link
Contributor Author

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

@YaphetKG
Copy link
Contributor Author

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 (?)

@swilly22
Copy link
Contributor

swilly22 commented Nov 2, 2022

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"

@YaphetKG
Copy link
Contributor Author

YaphetKG commented Nov 7, 2022

Thanks @swilly22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants