目录

图存储比较
<https://blog.csdn.net/wzwdcld/article/details/81283559#%E5%9B%BE%E5%AD%98%E5%82%A8%E6%AF%94%E8%BE%83>

社区 <https://blog.csdn.net/wzwdcld/article/details/81283559#%E7%A4%BE%E5%8C%BA>

Install and Start gremlin.sh
<https://blog.csdn.net/wzwdcld/article/details/81283559#Install%20and%20Start%20gremlin.sh>

 

图存储比较

* titan 停止更新, janus 还未发布。
* neo4j 单机性能超高,分布式瓶颈大。
*  
中文入门资料

图数据库JanusGraph介绍及使用(一):简介 
https://blog.csdn.net/gobitan/article/details/80939224
<https://blog.csdn.net/gobitan/article/details/80939224>

图数据库JanusGraph介绍及使用(二):架构 
https://blog.csdn.net/gobitan/article/details/80939276
<https://blog.csdn.net/gobitan/article/details/80939276>

图数据库JanusGraph介绍及使用(三):安装与初步使用:
https://blog.csdn.net/gobitan/article/details/81068459
<https://blog.csdn.net/gobitan/article/details/81068459>

JanusGraph的schema及数据建模 <https://www.cnblogs.com/jiyuqi/p/7127178.html>

JanusGraph <https://www.cnblogs.com/jiyuqi/p/7127178.html>查询和数据类型. 
https://docs.janusgraph.org/latest/search-predicates.html
<https://docs.janusgraph.org/latest/search-predicates.html>

 

社区

 

* https://groups.google.com/forum/#!forum/janusgraph-users Goole论坛
*
Chat: join us on Gitter <https://gitter.im/JanusGraph/janusgraph>

*
Stack Overflow: see the janusgraph
<https://stackoverflow.com/questions/tagged/janusgraph> tag

*
Twitter: follow @JanusGraph <https://twitter.com/JanusGraph> for news and
updates

*
Mailing lists:

*
janusgraph-users (at) googlegroups.com (archives
<https://groups.google.com/group/janusgraph-users>) for questions about using
JanusGraph, installation, configuration, integrations

To join with a Google account, use the web UI
<https://groups.google.com/forum/#!forum/janusgraph-users/join>; to
subscribe/unsubscribe with an arbitrary email address, send an email to:

* janusgraph-users+subscribe (at) googlegroups.com
* janusgraph-users+unsubscribe (at) googlegroups.com
*
janusgraph-dev (at) googlegroups.com (archives
<https://groups.google.com/group/janusgraph-dev>) for internal implementation
of JanusGraph itself

To join with a Google account, use the web UI
<https://groups.google.com/forum/#!forum/janusgraph-dev/join>; to
subscribe/unsubscribe with an arbitrary email address, send an email to:

* janusgraph-dev+subscribe (at) googlegroups.com
* janusgraph-dev+unsubscribe (at) googlegroups.com
Architecture

一般来说,应用程序可以通过如下两种方式与JanusGraph交互:

*
嵌入式JanusGraph:它与执行Gremlin查询语言的应用程序运行在同一个JVM中。查询执行,JanusGraph图缓存和事务处理都发生在同一个JVM中,但后端的数据存储可以是本地也可以在远程。
* JanusGraph服务器:通过提交Gremlin语言到JanusGraph服务器来交互。
 

下面是JanusGraph的架构图

 

 

 

Gremlin是Apache TinkerPop的一个模块。

 

实战笔记

* JanusGraph的EdgeLabel和PropertyKey的name不能相同。
 

 

 

About JanusGraph as RDF Store or Sparql Supporting

*  Simple Conclusion
* JanusGraph provides native support for the property graph data model
exposed by Apache TinkerPop and uses Gremlin as its query language. It does not
have native support for RDF or SPARQL. That being said, you could write custom
scripts to ingest RDF and transform it into a property graph model. Daniel
Kuppitz started work on transforming SPARQL queries into Gremlin, and that
effort continues on at 
https://github.com/LITMUS-Benchmark-Suite/sparql-to-gremlin
<https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FLITMUS-Benchmark-Suite%2Fsparql-to-gremlin&sa=D&sntz=1&usg=AFQjCNGuD93Gef39qCdxhzTGcwjf6bEHWQ>
 (32 stars,4 forks, It is based on the Apache Jena
<https://jena.apache.org/index.html> SPARQL processor ARQ
<https://jena.apache.org/documentation/query/index.html>)
* 来源:https://groups.google.com/d/msg/janusgraph-users/I4rW_KhcgFE/WTxIx2ocCwAJ
<https://groups.google.com/d/msg/janusgraph-users/I4rW_KhcgFE/WTxIx2ocCwAJ>.
2017年3月
* load rdf file to GREMLIN
*
https://groups.google.com/forum/#!topic/gremlin-users/nIE6uaSck8g
<https://groups.google.com/forum/#!topic/gremlin-users/nIE6uaSck8g>

*
import org.openrdf.sail.memory.MemoryStore;  

g = new SailGraph(new MemoryStore())

g.loadRDF('./test2.rdf', 'rdf-xml'))

*
Invalid import definition: 'org.openrdf.sail.memory.MemoryStore'; reason:
startup failed:
script1532930094647133709938.groovy: 1: unable to resolve class
org.openrdf.sail.memory.MemoryStore
 @ line 1, column 1.
   import org.openrdf.sail.memory.MemoryStore;
   ^

1 error

*
I cant understand SailGraph well, it need me to read the Tinkpop Documention

*
 

File Format SupportedJanusGraph supports 3 file formats that are provided via
Apache TinkerPop -- Gryo, GraphML, and GraphSON.

* http://tinkerpop.apache.org/docs/current/reference/#_gremlin_i_o
<http://tinkerpop.apache.org/docs/current/reference/#_gremlin_i_o>

You can load it like this:
 
gremlin> graph = JanusGraphFactory.open("conf/janusgraph-hbase.properties")
==>standardjanusgraph[hbase:[127.0.0.1]]
gremlin> graph.io(gryo()).readGraph("data/tinkerpop-modern.kryo")
gremlin> graph.io(graphml()).readGraph("data/tinkerpop-modern.xml")
gremlin> graph.io(graphson()).readGraph("data/tinkerpop-modern.json")

If you have some other format file, you'll need to write code to read it in
the data file, and then construct the graph elements
<https://github.com/JanusGraph/janusgraph/issues/428> based on the data.
*  
 

 

 

Install and Start gremlin.sh

* 解压JanusGraph 0.1.1
* 安装hadoop和elasticsearch.
* 在下面这张众神图上做练习


 

visual symbol meaning

bold key

a graph indexed key


bold key with star

a graph indexed key that must have a unique value


underlined key

a vertex-centric indexed key


hollow-head edge

a functional/unique edge (no duplicates)


tail-crossed edge

a unidirectional edge (can only traverse in one direction)

* JanusGraph 0.1.1无需改动即可顺利运行以下命令。
* #Start gremlin.sh
* sudo ./gremlin.sh
* graph = JanusGraphFactory.build().set('storage.backend',
'inmemory').set('index.search.backend', 'elasticsearch').open()
* graph = JanusGraphFactory.build().set('storage.backend', 'inmemory').open()
#不使用索引
* GraphOfTheGodsFactory.load(graph)
* Unknown external index backend: search
Type ':help' or ':h' for help.
* 貌似是必须要有set('index.search.backend', 'elasticsearch'),否则打不开。
* g = graph.traversal()
* saturn = g.V().has('name', 'saturn').next()
* 写入数据
* 同一个顶点同样的属性key写多次测试
*  
JanusGraph·Java写数据.  http://www.k6k4.com/chapter/show/aafiizxav1531746415578
<http://www.k6k4.com/chapter/show/aafiizxav1531746415578>

 

graph = JanusGraphFactory.build().set('storage.backend', 'inmemory').open()

 

Vertex v1 = graph.addVertex("USER")

v1.property("uid", "100")

v1.property("uid").value()

==>100
v1.property("uid", "1001") #属性的修改

v1.property("uid").value()

==>1001

 

mgmt = graph.openManagement()

//创建了一个名字为name的属性,并设置值类型为String,且可以保存可以重复的多个值

nameKey =
mgmt.makePropertyKey('name').dataType(String.class).cardinality(Cardinality.LIST).make()

mgmt.commit()

//存储并查询values为list类型的键值对

gremlin> v1.property("name","name1")
==>vp[name->name1]
gremlin> v1.property("name","name2")
==>vp[name->name2]

gremlin> v1.properties("name")
==>vp[name->name1]
==>vp[name->name2]
 

 

 

v1.property("age", 23);

 

Vertex v2 = graph.addVertex("PHONE");

v2.property("phone", "13811111111");

 

//创建边

Edge e12 = v1.addEdge("USER_PHONE", v2);

e12.property("create_time", "2018-08-08");

 

graph.tx().commit();

 

graph.close();

 

 

 

Load/Import Data

* Ways
* https://docs.janusgraph.org/latest/hadoop-tp3.html
<https://docs.janusgraph.org/latest/hadoop-tp3.html>
* gremlin-importer <https://github.com/vsantosu/gremlin-importer>
* search 'titan bulk load csv'  /spark bulkload
*  
* Installation Guide
https://github.com/vsantosu/gremlin-importer
<https://github.com/vsantosu/gremlin-importer>

* CSV Import guide
* https://github.com/vsantosu/gremlin-importer/wiki/CSV-import-guide
<https://github.com/vsantosu/gremlin-importer/wiki/CSV-import-guide>
*
https://github.com/vsantosu/gremlin-importer/wiki/CSV-import-guide#csv-format-information-and-limitations

<https://github.com/vsantosu/gremlin-importer/wiki/CSV-import-guide#csv-format-information-and-limitations>
* Always quote everything in the CSV(I know, I did not in my examples) but
you should. 
* node.csv
* node.csv example:
category, id, name, born_place, salary, siblings, rank, first_battle label,
numeric, string, string, numeric, numeric, numeric, date hero, 1,3-D Man,
Dmitriyevka,8.46,1,7,12/17/1995 villain, 2,A-Bomb (HAS), Roma,7.6,5,5,4/3/02004

* To our dataset, the first three lines will be:
category, id, srcUri

label, numeric, string

source,1,<http://dbpedia.org/ontology/description>

* edge.csv
* Each edge is represented as a combination of 3
rows. Source row, target row, and edge row. For example:
id, numeric, 1428 id, numeric, 1 out,worked,hours, numeric, 1,date, date,
8/1/1984

* a ***label*** with value "worked"
*  a numeric field named ***hours*** with value 1, and a date field named
***date*** with value "8/1/1984"
*  
 

 

 

 

 

 

 

 

 

友情链接
KaDraw流程图
API参考文档
OK工具箱
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:637538335
关注微信