连接到Azure Cosmos DB Gremlin API的嵌入式代码。

huangapple go评论72阅读模式
英文:

How to connect to Azure Cosmos DB Gremlin API via embedded code

问题

目前我们使用了非常简化且不接近实际情况的方法,即 Azure 官方允许的一种玩法:https://learn.microsoft.com/en-us/azure/cosmos-db/gremlin/quickstart-java。

但我们需要以一种脚本的方式使用 gremlin,就像这样:

g.V().has()...

... 而不是作为提交的字符串脚本查询:

static final String gremlinQueries[] = new String[] {
            "g.addV('person').property('id', 'thomas').as('tom')",
            "g.addV('person').property('id', 'mary').as('may')",
            "g.addE('friends').from('tom').to('may')" };

(...)

for (String query : gremlinQueries) {

   ResultSet results = client.submit(query);
}

for (Result result : resultList) {
   result.toString()
}

我已经尝试使用 Tinkerpop 文档指南:

https://tinkerpop.apache.org/docs/current/reference/#gremlin-java
https://tinkerpop.apache.org/docs/current/reference/#connecting-gremlin

英文:

For now we are using the very simplified and not near reality approach that Azure officially lets one play: https://learn.microsoft.com/en-us/azure/cosmos-db/gremlin/quickstart-java.

But we need to use gremlin in a scriptive manner ... like this:

g.V().has()...

... not as a string script query that is then submited:

static final String gremlinQueries[] = new String[] {
            "g.addV('person').property('id', 'thomas').as('tom'),
            "g.addV('person').property('id', 'mary').as('may'),
            "g.addE('friends').from('tom').to('may')" };

(...)

for (String query : gremlinQueries) {

   ResultSet results = client.submit(query);
}

for (Result result : resultList) {
   result.toString()
}

I already tried to use Tinkerpop Documentation guides:

https://tinkerpop.apache.org/docs/current/reference/#gremlin-java
https://tinkerpop.apache.org/docs/current/reference/#connecting-gremlin

答案1

得分: 0

I believe you are asking how to send Gremlin bytecode queries to CosmosDB, but are finding that you can only send strings-based queries. If that is correct, note that CosmosDB does not currently support bytecode-based requests, so you are in fact limited to strings. CosmosDB has a long open issue about this here.

英文:

I believe you are asking how to send Gremlin bytecode queries to CosmosDB, but are finding that you can only send strings-based queries. If that is correct, note that CosmosDB does not currently support bytecode based requests, so you are in fact limited to strings. CosmosDB has a long open issue about this here.

huangapple
  • 本文由 发表于 2023年5月18日 02:11:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/76275061.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定