Is it possible to load/import a schema or data from a GRAQL file via the Java API, e.g. in an in-memory graph?
import ai.grakn.Grakn
import ai.grakn.GraknTxType
fun main(args: Array<String>) {
val session = Grakn.session(Grakn.IN_MEMORY, "db")
val tx = session.open(GraknTxType.WRITE)
// load a schema / import data from a gql file
tx.close()
session.close()
}
There are examples on the web site for creating a schema via tx.putEntityType
etc. or parsing queries but is it also possible to simply import a gql file?
It is possible, you can read the whole file into a string and then do the following:
String readInFile = readWholeFile(....);
tx.graql().parse(readInFile).execute();