Tinkerpop (1) Graph Database Console Research

Source: Internet
Author: User

This text connection: http://blog.csdn.net/freewebsys/article/details/46348975 reprint Please specify the source!

1, about the graph database

Tinkerpop is a project under the Apache incubator.
The open source graph database engine, the graph database uses most is neo4j, but has the copyright restriction, if uses the Community edition can only be, the single machine runs.

http://tinkerpop.incubator.apache.org/

Documentation Reference:
http://tinkerpop.incubator.apache.org/docs/3.0.0.M9-incubating/

2. Start Console
wget https://dist.apache.org/repos/dist/release/incubator/tinkerpop/3.0.0.M9-incubating/apache-gremlin-console-3.0.0.M9-incubating-bin.zipunzip apache-gremlin-console-3.0.0.M9-incubating-bin.zipmv apache-gremlin-console-3.0.0.M9-incubating console

Start console: (can be started separately) can try the command, test the data, but the data is stored in memory, the shutdown is lost.

CD Console# sh bin/gremlin.sh         \,,,/(o)-----oooo-(3)-oooo-----Plugin Activated:tinkerpop.serverplugin Activated:tinkerpop.utilitiesplugin Activated:tinkerpop.sugarplugin Activated:tinkerpop.tinkergraph#打开连接gremlin> g = Tinkergraph.open () ==>tinkergraph[vertices:0 edges:0]#创建张三数据gremlin> Zhangsan = G.addvertex ("name", "Zhangsan") ==>v[0]#创建李四数据gremlin> lisi = G.addvertex ("name", "Lisi") ==>v[2]#创建王五数据gremlin> Wangwu = G.addvertex ("name", "Wangwu") ==>v[4]#设置李四和王五朋友关系, Friend is the name of the connection and can be taken at will. Gremlin> Lisi.addedge ("friend", Zhangsan) ==>e[6][2-friend->0]#设置王五和李四朋友关系Gremlin> Wangwu.addedge ("friend", Lisi) ==>e[7][4-friend->2]#查询全部数据Gremlin> g.vertices () ==>v[0]==>v[2]==>v[4]#查询关系Gremlin> g.edges () ==>e[6][2-friend->0]==>e[7][4-friend->2]gremlin> Zhangsan==>v[0]#删除张三数据Gremlin> Zhangsan.remove () ==>null#删除后全部数据Gremlin> g.vertices () ==>v[2]==>v[4]#删除后关系数据Gremlin> g.edges () ==>e[7][4-friend->2]

Turn on the OLTP variable engine

#开启变量引擎gtgremlin> GT = g. Traversal(Standard ()) ==>graphtraversalsource[tinkergraph[vertices:2Edges1], standard]gremlin>#查看数据Gremlin> GT. V() ==>v[2]==>v[4]#查询名字叫lisi的用户Gremlin> GT. V(). has("Name","Lisi") ==>v[2]#查询李四的朋友, because the Zhang San has just been removed. All no data. Gremlin> GT. V(). has("Name","Lisi"). out("Friend"). Values("Name")#查询王五的朋友, the relationship is one-way. Gremlin> GT. V(). has("Name","Wangwu"). out("Friend"). Values("Name") ==>lisi

Use the official examples to illustrate:

#初始化数据gremlin> g = Tinkerfactory.createmodern () ==>tinkergraph[vertices:6Edges6]#初始化遍历引擎gremlin> GT = G.traversal (Standard ()) ==>graphtraversalsource[tinkergraph[vertices:6Edges6], Standard]#查询marko knows people.Gremlin> GT. V (). has (' name ',' Marko '). Out (' knows '). VALUES (' name ') ==>vadas==>josh#查询marko created people.Gremlin> GT. V (). has (' name ',' Marko '). Out (' created '). VALUES (' name ') ==>lopThe people who #查询marko knows, and those who created.Gremlin> GT. V (). has (' name ',' Marko '). Out (' knows '). Out (' created '). VALUES (' name ') ==>ripple==>lop#查询josh created people.Gremlin> GT. V (). has (' name ',' Josh '). Out (' created '). VALUES (' name ') ==>ripple==>lop

Diagram of the database to give people intuitive insertion, query, very convenient.
For more information, see the website: http://tinkerpop.incubator.apache.org/docs/3.0.0.M9-incubating/

3, Summary

This text connection: http://blog.csdn.net/freewebsys/article/details/46348975 reprint Please specify the source!

Diagram database is very convenient, console is a single-machine memory version, can be tested, query.
The deployment of the production environment requires the use of the server version. Continue to study.

Tinkerpop (1) Graph Database Console Research

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.