gremlin

Gremlin remove all Vertex

≯℡__Kan透↙ 提交于 2019-12-29 03:57:22
问题 I know how to remove a vertex by id, but I need to delete multiple vertices (clean the db). Deleting 1 v is like this: ver = g.v(1) g.removeVertex(ver) 回答1: you can try g.V.each{g.removeVertex(it)} g.commit() 回答2: In more recent terms as of Gremlin 2.3.0, removal of all vertices would be best accomplished with: g.V.remove() UPDATE: For version Gremlin 3.x you would use drop(): gremlin> graph = TinkerFactory.createModern() ==>tinkergraph[vertices:6 edges:6] gremlin> g = graph.traversal() ==

Learning Blueprints, should I move directly to Tinkerpop 3? [closed]

笑着哭i 提交于 2019-12-25 14:48:30
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 years ago . I need to learn Gremlin etc. and possibly use it within a public facing production-ready system I'm working on. As any release of my system is, at a minimum, 6 months away (say end Q1 2015), should I switch directly to the new, still pre-release, Tinkerpop 3 implementation,

Import package in gremlin

浪子不回头ぞ 提交于 2019-12-25 08:32:09
问题 I am trying to import "https://github.com/thinkaurelius/titan/blob/1.0.0/titan-core/src/main/java/com/thinkaurelius/titan/graphdb/tinkerpop/io/graphson/TitanGraphSONModule.java" in gremlin by using command as import https://github.com/thinkaurelius/titan/blob/1.0.0/titan-core/src/main/java/com/thinkaurelius/titan/graphdb/tinkerpop/io/graphson/TitanGraphSONModule.java; But getting error like this: Invalid import definition: 'https://github.com/thinkaurelius/titan/blob/1.0.0/titan-core/src/main

How do I write a sub-query?

两盒软妹~` 提交于 2019-12-25 06:54:16
问题 I want to retrieve all vertexes and for each one I want to count the number of 'Like' edges pointing at it. How do I write this kind of query in Gremlin? In SQL it could be something like.... SELECT *, (SELECT Count(*) FROM tbl_like l WHERE l.id = b.id) AS LikeCount FROM tbl_blah b 回答1: E.g. use sideEffect to put the counts in a map ( m ) m=[:];g.V.sideEffect{m[it]=it.inE.has('label','like').count()} An alternative which omits vertices with 0 likes: m=[:];g.V.inE('like').groupCount(m){it.inV

Measure GPS distance between two points without using almost any math? (accuracy is not needed at all)

岁酱吖の 提交于 2019-12-25 01:46:58
问题 I'm programming an application where I save GPS location (lat and long) into each user info. I need to search the nearest users, I can only search using a between() function provided by my database, this function only checks if a number is between a range min and max, it's a very limited tool. Can I use this to find near users? This is a pseudo-code example of what I could do, this example finds users that their lat and long values are not more or less than 2 comparing with the target user:

Gremlin use case - Int properties and coalesce()

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 23:16:42
问题 Can vertex properties stored as integers be incremented and decremented? If so, how? For a fixed dataset, does coalesce() always return the same item? Is it possible to randomise it or any other way to do it? For instance of all the incoming vertices, choose a random one every time even if the dataset itself is not changed. 回答1: Can vertex properties stored as integers be incremented and decremented? You can use sack() : gremlin> g = TinkerFactory.createModern().traversal() ==

Gremlin.Net System.InvalidOperationException: 'Deserializer for “janusgraph:RelationIdentifier” not found' exception

北慕城南 提交于 2019-12-24 17:12:54
问题 I am new in janusgraph and tinkerpop. I am using Gremlin.Net 3.2.7 to connect to janusgraph and all the request that return vertexes work fine for me but when I run any operation that return edges like "g.V(61464).outE('father').toList()" an exception in the library: System.InvalidOperationException: 'Deserializer for "janusgraph:RelationIdentifier" not found' the server didn't throw any exception, the serializes configuration are the default: serializers: - { className: org.apache.tinkerpop

neo4j - Issue converting gremlin query to cypher

一个人想着一个人 提交于 2019-12-24 13:26:39
问题 I've been using NEO4j database for a recent project at work. Recently, we noticed that Cypher queries run faster than Gremlin so we decided to convert our queries. We are running the queries using the .Net graph client. There is one Gremlin query that I'm having trouble converting to Cypher. ----Gremlin(this works and produces a result of Node(CustomerNode)....should be brackets around CustomerNode but the editor won't take it) var results2 = graphClient.RootNode .Out<ApplicationNode>(

Neo4j Spatial: can't run spatial

↘锁芯ラ 提交于 2019-12-24 13:22:04
问题 I have been trying to work with Neo4j Spatial for my project, but I can't make it work. With limited documentation and examples I figured out how to load OSM map to the database. But to check if it is loaded, I am trying to execute a spatial query. While trying to run my code I get this error: import.java:69: error: cannot access GremlinGroovyPipeline .startIntersectSearch(layer, bbox) ^ class file for com.tinkerpop.gremlin.groovy.GremlinGroovyPipeline not found I understand what's wrong (it

Gremlin query like SQL IN operator?

怎甘沉沦 提交于 2019-12-24 12:20:04
问题 Im stuck with gremlin. I have emails like array and I need to make query to find all user with those emails. In SQL I have SELECT email(s) FROM user WHERE email IN (xxx, yyy...) How can I do this in Gremlin query language? 回答1: What you wanna do here is: g.V().has('anyProperty', within('possibleValue1', 'possibleValue2')) 回答2: If it is acceptable for you to do a linear scan of all vertices, then you could do something like: gremlin> g = TinkerGraphFactory.createTinkerGraph() ==>tinkergraph