path | title |
---|---|
/learnings/graph_databases |
Learnings: Graph Databases |
- Learning Graph Database : Gremlin / Tinkerpop >
- Learning Graph Database: Gremlin-Scala >
- Learning Graph Databases: Gremlin Server >
- Learning Graph Databases: Gremlin Console >
gremlin> g.V().has("name", "saturn") // queries for verticies that have name "saturn"
gremlin> g.V().has("name", "saturn").outE() // gets edge coming out
- IBM CloudDocs creating / traversing a Graph using Gremlin console
- Gremlin Graph Guide PDF <--- TinkerPop, Gremlin, and Janus Graph!!!
Graph Structure API (org.apache.tinkerpop.gremlin.structure.Graph) <<Learning_GraphDatabase_Gremlin_Tinkerpop_APIS_Structure>>
Gremlin Guide, section 4.5.1:
It is strongly recommended that the traversal source object g be used when adding, NOTE updating or deleting vertices and edges. Using the graph object directly is not viewed as a TinkerPop best practice.
- source ????????
Traversal API (org.apachae.tinkerpop.gremlin.process.dsl.graph.GraphTraversal) <<Learning_GraphDatabase_Gremlin_Tinkerpop_APIS_Traversal>>
NOTE: Need to always call .next()
or .iterate()
to save data to the graph. Source
ALSO: https://tinkerpop.apache.org/docs/current/reference/#graph-traversal-steps
- MUST(??) use Websockets mode for server instead of HTTP mode for Gremlin / Tinkerpop communications
Tinkerpop when given address will create ws:// URL instead of http:// line
-
Can ONLY run Websocket Mode OR HTTP mode - can not run both Stackoverflow answer
-
Remote connections are done via (Remote) Traversal API
val graph = JanusGraphFactory.open("inmemory")
val g : GraphTraversalSource = graph.traversal().withRemote( conf )
Q: Why not EmptyGraph()
, like the examples say?
A: EmptyGraph doesn't seem to support transactions, add edges, etc etc. (???). See also stackoverflow answer on JanusGraphFactory inmemory ... because it doesn't have the JanusGraph goodness baked in (EmptyGraph is a Tinkerpop thing!)
.profile
<-- outputs time / traverse info about your traversal
??? Need to be careful about what is and is not supported with gremlin server ie: + , -----, operators may not use the Traversal API (see: Learning_GraphDatabase_Gremlin_Tinkerpop_APIS_Traversal ) and may not support certain operations (????)
Can only use one mode: HTTP or WebSockets mode. Sources:
NOTE: configuration only valid for server. If you try to connect via Gremlin with this configuration it will barf (only partially related to URL schema of ws:// by Tinkerpop)
In config file set: channelizer: org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer
NOTE: HTTP / "REST" mode is not really RESTful
-
Stackoverflow answer for Gremlin Servers behind load balancers
-
Health Check:
http://myhostname:8182/?gremlin=100-1
<-- orws://...
( Stackoverflow answer source )NOTE: in Websocket mode this connection, of course, never closes. In HTTP mode it does not keep alive.
??? graphs: { }
in gremlin-server.yml needs to have same graph name in it as the Gremlin clients are trying to connect to (need to share YAML file, or parts of YAML file somehow??????)
- And using gremlin servers: mpollmeier/gremlin-scala#223 (comment)
gremlin> graph = JanusGraphFactory.open('janusgraph.properties')
Backend shorthand unknown: janusgraph.properties
^^^^^ means that it can not find the properties file you are pointing at. Try using a relative path or just the full path in your string.