簡體   English   中英

Gremlin忽略了商店的價值

[英]Gremlin ignoring store value

我是gremlin的新手,正在嘗試查詢,但是我觀察到存儲值始終被忽略

我也嘗試過storeaggregateas但是所有人都給了我錯誤的值。

gV().has('__typeName','avro_schema').where(local(out('__avro_record.fields').as('xm').local(out('classifiedAs').has('__typeName', 'DataClassification').count().is(eq(1))).count().is(eq(select('xm').size()))))

這使'xm'大小始終為0

我希望大小'xm'的值等於每個avro_schema的出站邊緣數,且邊緣標簽為'__avro_record.fields'

如前所述,將查詢更改為:

gV().has('__typeName','avro_schema').where(local(out('__avro_record.fields').local(out('classifiedAs').has('__typeName', 'DataClassification').count().is(eq(1))).count().is(count(local))))

現在得到空結果。

編輯:

我也懷疑與將動態值打印為副作用有關

gV().has('__typeName','avro_schema').where(local(out('__avro_record.fields').local(out('classifiedAs').has('__typeName', 'DataClassification').count().is(eq(1))).count().sideEffect{ println count(local) }.is(count(local))))

輸出:

[CountLocalStep]

我期望count(local)的實際值在哪里。調試gremlin查詢的最佳實踐是什么?

有一些事情在您的遍歷中不起作用。 首先, .size()不是Gremlin步驟,您可能正在尋找.count(local) 接下來, eq()不接受動態值,它僅適用於常量值。 閱讀文檔,了解where()步驟,以了解如何與動態值進行比較。

更新

要比較兩個count()值,您可以執行以下操作:

g.V().has('__typeName','avro_schema').filter(
    out('__avro_record.fields').fold().as('x').
    map(unfold().
        out('classifiedAs').has('__typeName', 'DataClassification').fold()).as('y').
    where('x', eq('y')).
      by(count(local)))

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM