janusgraph-遍歷圖的語言


精確查詢

語句含義

測試語句

執行時間

查詢頂點標簽為FALV的頂點數量

g.V().hasLabel('FALV').count()

2400s

查詢頂點屬性中id為19012201

clockWithResult(1) {g.V().has('id','19012201') }

0.18540099999999998s

查詢頂點屬性中id為19012201

clockWithResult(1) {g.V().has('id','19012201').valueMap().next()}

1.309877s

查詢頂點屬性中id為19012201

clockWithResult(1) {g.V().has('KUAN','id','19012201') }

0.114287ms

查詢頂點屬性中id為19012201

clockWithResult(1) {g.V().has('KUAN','id','19012201').valueMap().next()}

1.752052ms

查詢出頂點屬性中內容為。。。的頂點

g.V().has('neirong','<p>   本法所稱農業機械化,是指運用先進適用的農業機械裝備農業,改善農業生產經營條件,不斷提高農業的生產技術水平和經濟效益、生態效益的過程。</p>').values()

0. 228ms

查詢頂點屬性中id為'403116'

g.V().has('id','403116').profile()

60.364ms

查詢頂點屬性中效力級別為2的頂點

g.V().has('xiaolijibie','2').limit(10).valueMap()

只查詢出一條數據

查詢包含屬性值xiaolijibie的頂點

g.V().has('xiaolijibie')

不使用索引

查詢屬性vlabel為法律的

g.V().has('vlabel','FALV').valueMap()

遍歷所有的頂點進行輸出

2. 模糊查詢

語句語義

測試語句

執行時間

查詢出頂點屬性中包含’建設’

g.V().where(properties().hasValue(textContainsFuzzy("建設"))).limit(20).valueMap()

0.253718ms

查詢出頂點為FALV屬性中包含’建設’前20

g.V().hasLabel('FALV').where(properties().hasValue(textContainsFuzzy("建設"))).limit(20)

2400s

查詢出頂點屬性包含’建設’的頂點數

clockWithResult(1) {g.V().where(properties().hasValue(textContainsFuzzy("建設"))).count().next()}

會遍歷所有的頂點

查詢出頂點屬性包含’建設’的頂點數,限制為兩個

g.V().where(properties().hasValue(textContainsFuzzy("建設"))).limit(2).profile()

162.023ms

 

clockWithResult(1) {g.V().where(properties().hasValue(textContainsFuzzy("北京市"))).has('id','19240800').valueMap().next()}

 

模糊匹配共和國

clockWithResult(1){g.V().where(properties().hasValue(textContainsFuzzy("共和國"))).valueMap().next()}

250127.85826799998ms

查詢法律中有中國的頂點

g.V().where(properties().hasValue(textContainsFuzzy("中國"))).has('vlabel','FALV')

遍歷所有的頂點

模糊匹配北京和建設兩個關鍵字

clockWithResult(1) {g.V().where(properties().hasValue(textContainsFuzzy("北京市"))).where(properties().hasValue(textContainsFuzzy("建設"))).valueMap().next()}

49961.617301ms

3. 謂詞查詢

語句含義

測試語句

執行時間

查詢所有定點數量

g.V().count()

97s

查詢所有的邊數量

g.E().count()

2400s

查詢法律標簽有out關系的頂點

g.V().hasLabel('FALV').out().limit(10)

 

查詢一個頂點具有out方向的鄰接點

clockWithResult(1){g.V().has('id','332734').out('FALVFATIAO').count().next()}

3.349717ms

分組查看

g.V().groupCount().by(label)

 

 

4. 探索查詢

語句語義

測試語句

執行時間

查詢某個實體的向外關系

clockWithResult(1) {g.V().has('id','19013190').out().next()};

1.353237ms

查詢某個實體的向內關系

clockWithResult(1) {g.V().has('id','19013104').in().next()};

1.7450409999999998ms

多關系查詢

 

 

 

輸入實體類型+屬性約束,返回一個實體及其所有一級關系

 

clockWithResult(1) {g.V().has('id', '19012335').outE().inV().path().by(valueMap(true)).next()}

2.051107ms

查詢與頂點id為332734有直接關聯的頂點以及邊的關系

g.V().has('id','332734').bothE().otherV().path().profile()

 

查詢與頂點id為332734有直接關聯的頂點

g.V().has('FALVFAGUI','id','332734').both().path().profile()

4.840

兩點之間是否有路徑存在

g.V('983044208').repeat(out()).until(hasId('983044200')).path().profile

18ms

路徑為三的探索

v=g.V().has('id','332733').out('FALVFATIAO').out('FATIAOKUAN').out('KUANXIANG').valueMap()

1822.820ms

該頂點所有的向外邊為款的結果全部輸出

g.V(v).repeat(out('KUANXIANG')).emit().valueMap()

1ms


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM