美文网首页
grakn (knowledge graph database)

grakn (knowledge graph database)

作者: GoddyWu | 来源:发表于2019-06-13 13:14 被阅读0次

官方文档: https://dev.grakn.ai/docs/general/quickstart
使用语言:Graql(自制)

产品

名称 是否开源 功能 下载地址
core 服务端(包含console客户端) https://grakn.ai/download#core
kgms 企业级的管理方案 云部署方案:目前Grakn KGMS提供google cloud(成本很高)和Amazon AWS两种云部署的方案
workbase 图形化查询页面 https://github.com/graknlabs/workbase/releases

kgms额外服务:

  • 分布式弹性存储
  • 弹性吞吐
  • 集群管理
  • 性能检测

核心概念

  • keyspace
    • 数据容器,对应rdb的database的概念
    • 官方称可以建立无数多的keyspace
  • schema: 知识蓝图,用于描述数据及其结构。
    • types: 类别分为实体(entity)关系(relationship)属性(attributes),三种类型都可以继承单一一个同类别的父类。
    • types' behaviours:
      • has [attribute type]: 存在情况有entity-[has]->attributesrelationship-[has]->attributes
      • plays [role]: 扮演,可以理解为声明式。例如,人类的entity可以play学生。
      • relates [role] (only relation): 关系和什么role相关,可以理解为声明式。如定义一类relationship为师生关系,它就和学生、老师的role相关,并不关心谁可以扮演学生或老师。(这块设计的真是炒鸡复杂)
    • roles:角色,在特定关系中存在。比如对于师生关系,小红是学生的角色(relates),对于三班这个团体,他扮演着班长的角色(plays)。
    • rules: 通过代码的方式定义的复杂规则,强化推断能力

安装

https://grakn.ai/download

$ cd grakn-core-all-mac-1.5.4
$ ./grakn server start
$ ./grakn server status

连接

连接grakn客户端有三种方式:

  • console(控制台)
    $ ./grakn console
    
  • workbase(GUI)
  • grakn clients

云部署(Grakn KGMS)

缺点

  • 单个keyspace不支持多session
  • google cloud部署过于昂贵,aws貌似还可以

查询语句对比

和Neo4j的cypher对比
  • 查询一类node
    match (n:media) return n limit 2
    
    $ match $x isa media; get; offset 0; limit 2;
    {$x id V245952 isa video;}
    {$x id V258240 isa video;}
    
  • 查询关系
    match (p:employer)-[r]->(q:employee) return p, q, r limit 2
    
    $ match $emp (employer: $x, employee: $y) isa employment; get; limit 2;
    {$x id V40972304 isa organisation; $emp id V139264 (employer: id       V40972304, employee: id V69696, offered-position: id V41128) isa employment; $y id V69696 isa person;}
    {$x id V40972304 isa organisation; $emp id V143360 (employer: id V40972304, employee: id V45224, offered-position: id V69872) isa employment; $y id V45224 isa person;}
    
和关系型数据库的sql对比

//todo:补一些Graql语法介绍,复杂查询

相关文章

网友评论

      本文标题:grakn (knowledge graph database)

      本文链接:https://www.haomeiwen.com/subject/adrjfctx.html