英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论