Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to write insert GRAQL statements in a .gql file and process it either in GRAKN console or in Workbase?

There is an option to start a GRAKN console with a file:

". /grakn console - k [keyspace name] - f [your file path to gpl file]"

But in our case, the schema is common for multiple keyspaces/projects but the data for each is different, so we wanted to factor it out and not duplicate. And now we have two .gql files: one with schema and the other one with insert queries.

How can I apply the schema and upload the data into a keyspace using GRAKN console or Workbase?

Should I use Client API for that case or just starting a console twice (with schema file and with insert statements) will do the job?

like image 987
Alexander Reshytko Avatar asked Aug 21 '20 21:08

Alexander Reshytko


1 Answers

I've found creating separate scripts that hold common operations is a good workflow for me. For example, if you have a common schema shared between different keyspaces and different data for those make a schema.gql file and your multiple data.gql files. They can then be glued together with a shell script if typing that in gets tedious.

grakn console -k keyspace_name_ONE -f schema.gql
grakn console -k keyspace_name_ONE -f data_ONE.gql

grakn console -k keyspace_name_TWO -f schema.gql
grakn console -k keyspace_name_TWO -f data_TWO.gql

The workbase is a great visualizer and query debugger. It has limited support for other operations so I treat it as a viewer mostly.

like image 134
vj1 Avatar answered Nov 03 '22 13:11

vj1