gpt4 book ai didi

vaticle-typeql - 格拉克 : Can I load a schema or data from a GRAQL file via the Java API?

转载 作者:行者123 更新时间:2023-12-04 16:06:45 24 4
gpt4 key购买 nike

是否可以通过 Java API 从 GRAQL 文件加载/导入模式或数据,例如在内存图中?

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

网站上有 creating a schema 的示例通过 tx.putEntityType 等或 parsing queries但是否也可以简单地导入一个 gql 文件?

最佳答案

有可能,您可以将整个文件读入一个字符串,然后执行以下操作:

String readInFile = readWholeFile(....);
tx.graql().parse(readInFile).execute();

关于vaticle-typeql - 格拉克 : Can I load a schema or data from a GRAQL file via the Java API?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48417611/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com