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

posted @ 2019-04-23 15:38  大数据下的小人物  阅读(1995)  评论(0编辑  收藏  举报