AbutionGraph is a time-series knowledge graph database for real-time OLAP。
AbutionGraph是一款端到端的流式数据实时分析的图谱数据库,实时(流式写入实时、高QPS决策分析实时、流式预处理实时)表现在:
AbutionGraph具有多种数据库的特性,除传统图谱数据存储模型外,Abution的目标是以足够低的延迟(亚秒级)来服务大规模图谱数据(达BP级)的实时决策分析。 AbutionGraph特别适用于业务指标系统建设、实时交互式数据分析、可视化大屏展现、IOT流式数据监测、拓扑数据动态行为计算、相同点边id的数据根据标签分类管理等等。 AbutionGraph使用Java/C++开发,支持Aremlin、Gremlin、GraphQL查询语法,并支持与Java进行混合编程开发和Python API。
AbutionGraph特性:
分布式企业级图数据库,提供图数据的实时-存储、查询和OLAP分析能力,主要面向对局部数据的海量并发查询和全量数据的实时在线计算/更新/监控。
用于大数据量高吞吐率和低延迟的同时,实时反馈数据态势变化(异常)情况,保障决策分析业务7*24小时在线运行。
支持功能 | AbutionGraph | Neo4j | TigerGraph |
---|---|---|---|
分布式 | √ | X | √ |
RDF图模型 | √ | X | X |
属性图模型 | √ | √ | √ |
实时增删查改 | √ | √ | √ |
TB级大容量 | √ | √ | √ |
高性能批量导入 | √ | √ | √ |
点边检索、全文检索 | √ | √ | √ |
千万顶点/秒的高吞吐率 | √ | √ | √ |
对接流式数据源、关系型数据源 | √ | √ | √ |
图分析算法 | √ | √ | √ |
高可用性支持 | √ | √ | √ |
图谱可视化工具 | √ | √ | √ |
读写任务内高效并行存储) | √ | √ | √ |
在线/离线、全量/增量的备份恢复 | √ | √ | √ |
多图(大图与多个子图) | √ | √ | √ |
丰富的离线图算法 | √ | √ | √ |
- | - | - | |
单独删除点边(支持独立点/边存储) | √ | X | X |
动态新增/隐藏字段 | √ | X | X |
时间窗口计算(流式数据库的标志特性) | √ | X | X |
实时大数据流式图 存储/计算/更新 | √ | X | X |
多重/多维图关系(每对点间都允许多种不同标签的边共存) | √ | X | X |
多重/多维图实体(每个点上都允许多种不同标签的点共存) | √ | X | X |
动图-时序关系聚合(根据年月日等时间窗口-自动合并边属性) | √ | X | X |
动图-时序实体聚合(根据年月日等时间窗口-自动合并点属性) | √ | X | X |
导出图数据到大数据平台继续计算(Spark/Flink/Hadoop等。 对接AI算法作为特征工程库,实时更新模型指标,实时取用) |
√ | X | X |
子图隔离(原子级用户权限管理) | √ | X | X |
分布式图实例 | √ | X | X |
节点模糊查询 | √ | X | X |
自定义节点类型 | √ | X | X |
图数据库专家支持服务 | √ | X | X |
AbutionGraph适用:
及一切希望在亚秒实现关联数据分析的场景 - 执行查询即所得、数据写入即见变化,类似于Kafka、Flink、Kylin等系统,不过Abuion旨在关联计算上弥补缺陷,所以它更擅长处理关联分析问题,且比传统图数据库更节省计算资源和响应时间。 视频介绍
Abution的TmpGraph实例使用临时缓存持久化数据,无需安装部署即可体验大部分功能,程序执行完毕则释放空间,本意是方便开发者本地调试编写的程序。 TmpGraph推荐使用jdk8/11进行开发。此外,abution-jshell是系统封装的一个REPL启动命令,可以直接输入业务代码并查看其执行结果。
1)图谱建模
AbutionGraph的Schema由entity和edge组成,缺少任一项也是允许的。其中,维度标签都由Dimension类定义,label第二个参数为标签描述,可缺省;property的字段可以指定为任意类型,只要写入数据类型一致即可。
Schema schema = Schema
.entity(
Dimension.label("V|Titan", "太阳神").property("age", Integer.class).build(),
Dimension.label("V|God", "上帝").property("age", Integer.class).build(),
Dimension.label("V|Demigod", "小神").property("age", Integer.class).build(),
Dimension.label("V|Human", "人类").property("age", Integer.class).build(),
Dimension.label("V|Monster", "怪物").build(),
Dimension.label("V|Location", "场景").build()
).edge(
Dimension.label("E|Father", "父亲").build(),
Dimension.label("E|Brother", "兄弟").build(),
Dimension.label("E|Mother", "母亲").build(),
Dimension.label("E|Battled", "战争")
.property("time", Integer.class)
.property("place", Geoshape.class)
.build(),
Dimension.label("E|Pet", "宠物").build(),
Dimension.label("E|Lives", "生活").property("reason", String.class).build()
).build();
2)创建图谱 应用schema新建一个名叫"Gods"的图谱。
Graph g = G.TmpGraph("Gods", schema);
3)手动构建图谱数据
Entity saturn = Knowledge.dimV("V|Titan").vertex("saturn").property("age", 10000).build();
Entity sky = Knowledge.dimV("V|Location").vertex("sky").build();
Entity jupiter = Knowledge.dimV("V|God").vertex("jupiter").property("age", 5000).build();
Entity neptune = Knowledge.dimV("V|God").vertex("neptune").property("age", 4500).build();
Entity hercules = Knowledge.dimV("V|Demigod").vertex("hercules").property("age", 30).build();
...
// jupiter relation
Edge eg = Knowledge.dimE("E|Father").edge("jupiter", "saturn", true).build();
Edge eg1 = Knowledge.dimE("E|Lives").edge("jupiter", "sky", true).property("reason", "loves fresh breezes").build();
Edge eg2 = Knowledge.dimE("E|Brother").edge("jupiter", "neptune", true).build();
//hercules relation
Edge eg7 = Knowledge.dimE("E|Father").edge("hercules", "jupiter", true).build();
Edge eg8 = Knowledge.dimE("E|Mother").edge("hercules", "alcmene", true).build();
Edge eg9 = Knowledge.dimE("E|Battled").edge("hercules", "nemean", true).property("time", 1).property("place", Geoshape.point(38.1, 23.7)).build();
Edge eg10 = Knowledge.dimE("E|Battled").edge("hercules", "hydra", true).property("time", 2).property("place", Geoshape.point(37.7, 23.9)).build();
...
List<Edge> edges = Lists.newArrayList(eg, eg1, eg2, eg3, eg4, eg5, ...);
Ps:可见,实体和关系可以0属性,这是RDF图谱的特性。此外,实体和关系也无需完全对应,允许孤立点和孤立边数据的导入。
4)导入数据
g.addKnow(saturn, sky, sea, jupiter, neptune, hercules, ...).exec();
g.addKnow(edges).exec();
Ps:因为Entity和Edge都属于Knowledge类,因此实体与关系数据无需分开,可以混合导入,数据库会自动区分。
5)图谱查询
Aremlin语法规则:pipline大写字母开头的为功能函数,后接小写开头的都为该功能函数的参数,直到下一个大写开头的功能函数出现。
Iterable<? extends Knowledge> scan1 = g.V("saturn").dims().exec();
System.out.println(Lists.newArrayList(scan1));
// [Entity[vertex=saturn,dimension=Titan,properties=Properties[age=<java.lang.Integer>10000]]]
Iterable<? extends Object> scan2 = g.V("saturn").In().dim("E|Father").In().dim("E|Father").exec();
System.out.println(Lists.newArrayList(scan2));
// ["hercules"]
Iterable<? extends Entity> scan3 = g.V().dim("V|Human").has("age").by(P.LessThan(50)).exec();
System.out.println(JsonSerialiser.serialise(scan3));
DimsCounter counter = g.V("saturn").OutV().dims().CountDims().exec();
System.out.println(Lists.newArrayList(counter));
//[DimsCounter[entityDims={Titan=1},edgeDims={},limitHit=false]]
System.out.println(Lists.newArrayList( g.V().ToEntityIds().exec() ));
// [EntityKey[vertex=hercules], EntityKey[vertex=hydra], EntityKey[vertex=cerberus], ...]
Iterable<Object> scan6 = g.V("jupiter").OutV().dims().Map(F.ItFunc(x-> ((Knowledge)x).getDimension())).exec();
System.out.println(JsonSerialiser.serialise(scan6));
// ["god","Titan","god","location"]
时序动态图谱实际是一种预计算技术,其核心思想是提前计算和存储某些计算结果,以便在需要时能够更快地获取结果,用于提高应用程序的响应时间。
静态图谱:只需要指定字段及类型;
动态图谱:需要指定字段类型、聚合函数、序列化函数(可选)、.groupBy()聚合窗口;
Ps:静态图谱和动态图谱可以节点不同维度的形式异构存储。
1)构建图谱
可见property多了一些聚合配置(除默认功能外,聚合函数可自定义):
Graph g = G.TmpGraph("Gods", Schema
.entity(
Dimension.label("Vgg|TimeWindow", "")
.property("startDate", Date.class, Agg.Min())
.property("stopDate", Date.class, Agg.Max())
.property("hll", DistinctCountHll.class, Agg.DistinctCountHll(), new DistinctCountHllSerialiser())
.property("freq", FreqMap.class, Agg.FreqMap(), new FreqMapSerialiser())
.property("count", Integer.class, Agg.Sum())
.groupBy("startDate", "stopDate") // 指定聚合窗口; 不指定字段即为全局聚合:.groupBy()
.build())
.edge(
Dimension.label("Egg|Merge", "合并边")
.property("total_duration", Double.class, Agg.Sum())
.groupBy()
.build()
).build());
2)模拟数据
起点(人), 终点(地点), 关系标签, 发生时间, 持续时长
"hercules", "nemean", Battled, 2023-10-08, 20.0
"hercules", "hydra", Battled, 2023-10-08, 10.1
"hercules", "hydra", Battled, 2023-10-09, 10.1
"hercules", "hydra", Battled, 2023-10-09, 11.1
3)导入数据
下面我们将模拟流式数据一条一条的导入并立即查看存储效果。
Entity entt1 = Knowledge.dimV("Vgg|TimeWindow")
.vertex("hercules") //人名作为节点id
.property("startDate", DateUtil.parse("2023-10-08 00:00:00")) //开始时间(窗口开)
.property("stopDate", DateUtil.parse("2023-10-08 23:59:59")) //结束时间(窗口闭)
.property("hll", new DistinctCountHll().update("nemean")) //将尾节点放入基数统计类
.property("freq", new FreqMap().update("nemean")) //将尾节点放入频率估计类
.property("count", 1) //本次自动+1
.build();
Edge edge1 = Knowledge.dimE("Egg|Merge")
.edge("hercules","nemean",true)
.property("total_duration", 20.0d)
.build();
g.addKnow(entt1,edge1).exec();
查看结果:
System.out.println(JsonSerialiser.serialise(
g.V("hercules").dim("Vgg|TimeWindow").exec()
));
[{"class":"Entity","dimension":"Vgg|TimeWindow","vertex":"hercules","properties":
{"freq":{"FreqMap":{"nemean":1}},"count":1,"hll":{"DistinctCountHll":{"cardinality":1.0}},"startDate":{"java.util.Date":1696694400000},"stopDate":{"java.util.Date":1696780799000}}}]
System.out.println(JsonSerialiser.serialise(
g.E("hercules->nemean").dim("Egg|Merge").exec()
));
[{"class":"Edge","dimension":"Egg|Merge","source":"hercules","target":"nemean","directed":true,"properties":{"total_duration":20.0}}]
Entity entt2 = Knowledge.dimV("Vgg|TimeWindow")
.vertex("hercules") //
.property("startDate", DateUtil.parse("2023-10-08 00:00:00")) //开始时间(窗口开)
.property("stopDate", DateUtil.parse("2023-10-08 23:59:59")) //结束时间(窗口闭)
.property("hll", new DistinctCountHll().update("hydra")) //将尾节点放入基数统计类
.property("freq", new FreqMap().update("hydra")) //将尾节点放入频率估计类
.property("count", 1) //本次自动+1
.build();
Edge edge2 = Knowledge.dimE("Egg|Merge")
.edge("hercules","nemean",true)
.property("total_duration", 10.1d)
.build();
g.addKnow(entt2,edge2).exec();
查看结果:
System.out.println(JsonSerialiser.serialise(
g.V("hercules").dim("Vgg|TimeWindow").exec()
));
[{"class":"Entity","dimension":"Vgg|TimeWindow","vertex":"hercules","properties":
{"freq":{"FreqMap":{"hydra":1,"nemean":1}},"count":2,"hll":{"DistinctCountHll":{"cardinality":2.0}},"startDate":{"java.util.Date":1696694400000},"stopDate":{"java.util.Date":1696780799000}}}]
System.out.println(JsonSerialiser.serialise(
g.E("hercules->nemean").dim("Egg|Merge").exec()
));
[{"class":"Edge","dimension":"Egg|Merge","source":"hercules","target":"nemean","directed":true,"properties":{"total_duration":30.1}}]
可见,与schema预设一致,"hercules"的Entity中,count自动累加成2(1+1),hll也由1变成了2(hydra与nemean两个不重复),而时间则都是2023-10-08(开始和结束点是该天的窗口界限);Edge中,total_duration变成了新老数据只和。
Entity entt3 = Knowledge.dimV("Vgg|TimeWindow")
.vertex("hercules")
.property("startDate", DateUtil.parse("2023-10-09 00:00:00"))
.property("stopDate", DateUtil.parse("2023-10-09 23:59:59"))
.property("hll", new DistinctCountHll().update("hydra").update("hydra"))
.property("freq", new FreqMap().update("hydra").update("hydra"))
.property("count", 2) //本次自动+2:篇幅影响,两条数据手动合并录入了
.build();
Edge edge3 = Knowledge.dimE("Egg|Merge")
.edge("hercules","nemean",true)
.property("total_duration", 10.1d+11.1d)
.build();
g.addKnow(entt3,edge3).exec();
// 打印结果:
System.out.println(JsonSerialiser.serialise(
g.V("hercules").dim("Vgg|TimeWindow").exec()
));
System.out.println(JsonSerialiser.serialise(
g.E("hercules->nemean").dim("Egg|Merge").exec()
));
结果打印效果:
[{"class":"Entity","dimension":"Vgg|TimeWindow","vertex":"hercules","properties":{"freq":{"FreqMap":{"hydra":2}},"count":2,"hll":{"DistinctCountHll":{"cardinality":1.0}},"startDate":{"java.util.Date":1696780800000},"stopDate":{"java.util.Date":1696867199000}}},
{"class":"Entity","dimension":"Vgg|TimeWindow","vertex":"hercules","properties":{"freq":{"FreqMap":{"hydra":1,"nemean":1}},"count":2,"hll":{"DistinctCountHll":{"cardinality":2.0}},"startDate":{"java.util.Date":1696694400000},"stopDate":{"java.util.Date":1696780799000}}},
{"class":"Edge","dimension":"Egg|Merge","source":"hercules","target":"nemean","directed":true,"properties":{"total_duration":51.3}}]
可见,节点"hercules"的Entity有两条已经完成所有属性聚合的数据(不同时间窗口的两天);而"hercules to nemean"的Edge是全局聚合,所以始终会聚合属性并合并成一条边。
AbutionGraph - 更多文档请看其他部分
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。