Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure 查找连接到所有当前顶点的顶点_Azure_Gremlin_Tinkerpop_Azure Cosmosdb Gremlinapi - Fatal编程技术网

Azure 查找连接到所有当前顶点的顶点

Azure 查找连接到所有当前顶点的顶点,azure,gremlin,tinkerpop,azure-cosmosdb-gremlinapi,Azure,Gremlin,Tinkerpop,Azure Cosmosdb Gremlinapi,我是graph db和gremlin的新手,我遇到了与其他人类似的问题,请看,我正在尝试获取满足所选项目所有标准的资源垂直度。下面的图表是这样的 项目1应返回资源1和资源2 项目2应仅返回资源2 下面是创建示例数据的脚本: g.addV("Resource").property("name", "Resource1") g.addV("Resource").property("name", "Resource2") g.addV("Criteria").property("name",

我是graph db和gremlin的新手,我遇到了与其他人类似的问题,请看,我正在尝试获取满足所选项目所有标准的资源垂直度。下面的图表是这样的

  • 项目1应返回资源1和资源2
  • 项目2应仅返回资源2
下面是创建示例数据的脚本:

g.addV("Resource").property("name", "Resource1")
g.addV("Resource").property("name", "Resource2")

g.addV("Criteria").property("name", "Criteria1")
g.addV("Criteria").property("name", "Criteria2")

g.addV("Item").property("name", "Item1")
g.addV("Item").property("name", "Item2")


g.V().has("Resource", "name", "Resource1").addE("isOf").to(g.V().has("Criteria", "name", "Criteria1"))
g.V().has("Resource", "name", "Resource2").addE("isOf").to(g.V().has("Criteria", "name", "Criteria1"))
g.V().has("Resource", "name", "Resource2").addE("isOf").to(g.V().has("Criteria", "name", "Criteria2"))

g.V().has("Item", "name", "Item1").addE("needs").to(g.V().has("Criteria", "name", "Criteria1"))
g.V().has("Item", "name", "Item2").addE("needs").to(g.V().has("Criteria", "name", "Criteria1"))
g.V().has("Item", "name", "Item2").addE("needs").to(g.V().has("Criteria", "name", "Criteria2"))
当我尝试以下操作时,我得到了资源1和资源2,因为它正在查看与这两个条件相关的所有资源,而我只需要与这两个条件匹配的资源(资源2)

因此,如果我尝试以下方法,正如参考问题所示

g.V()
    .hasLabel('Item')
    .has('name', 'Item2')
    .outE('needs')
    .inV()
    .aggregate("x")
    .inE('isOf')
    .outV()
    .dedup()
    .filter(
        out("isOf")
        .where(within("x"))
        .count()
        .where(eq("x"))
        .by()
        .by(count(local)))
        .valueMap()
我得到以下异常,因为为另一个问题提供的答案在Azure CosmosDB图形数据库中不起作用

提交查询失败:g.V().hasLabel('Item').has('name','Item2').outE('needs').inV().aggregate('x').inE('isOf').outV().Duplicate().filter(out('isOf').where(in('x')).where(等式('x').by().by('count(local)).valueMap():脚本评估错误:\r\n\nActivityId:d2eccb49-9ca5-4ac6-bfd7-b851d63662c9\nExceptionType:GraphCompileException\nExceptionMessage:\r\n\tGremlin查询编译错误:在第1行第113列找不到任何方法“筛选器”。\r\n\t1错误\nSource:Microsoft.Azure.Cosmos.Gremlin.Core\n\tGremlinRequestId:d2eccb49-9ca5-4ac6-bfd7-b851d63662c9\n\t上下文:graphcompute\n\t作用域:graphparse translate csharpexpressionbinding\n\tGraphInterOpStatusCode:QuerySyntaxError\n\t结果:0x80131500\r\n“


我很想知道微软在Azure CosmosDB()中提供的gremlin步骤是否有办法解决我的问题。

只需将
过滤器
替换为
where

查询的工作原理相同。

只需将
过滤器
替换为
where
。 查询的工作方式相同

g.V()
    .hasLabel('Item')
    .has('name', 'Item2')
    .outE('needs')
    .inV()
    .aggregate("x")
    .inE('isOf')
    .outV()
    .dedup()
    .filter(
        out("isOf")
        .where(within("x"))
        .count()
        .where(eq("x"))
        .by()
        .by(count(local)))
        .valueMap()