graph-databases

Gremlin - select a vertex, create new vertices and edges in single query

陌路散爱 提交于 2019-12-13 02:48:23
问题 I have a user vertex already created. g.V().has('user','username','vipul').as('user') I want to create a new 'group' vertex with some properties and also a new 'options' vertex with some other properties. g.addV(label,'group','group_name','DC11').as('group') g.addV(label,'options','command_line_arguments','-D -n').as('options') Now I want to create an edge from user to group and another edge from group to options. user ---> group, group ---> options Can these queries be combined, selecting a

Taxi sharing scheduling in neo4j

喜夏-厌秋 提交于 2019-12-13 01:05:49
问题 I would like to ask you some suggestions and ideas for my java application to compute a taxi scheduling with sharing ride. Let's suppose that i have a taxi with two users (passengers). The users are going to share the trip, but both passengers are located in different places and are going to be picked up/dropped off at different times. The user model with its pick up and drop off locations, is: (Grid1)<-[:PICK_UP {time:'10:30'}]-(user1)-[:DROP_OFF {time:'11:00'}]->(Grid9) (Grid4)<-[:PICK_UP

How to add infinity, NaN, or null values to a double[] property on a node in Cypher/Neo4j

独自空忆成欢 提交于 2019-12-13 00:41:55
问题 I have some nodes in my neo4j graph that are a combination of multiple entities. On these nodes I have a property named "p_value" that has a type of double[]. I'm merging new entities into existing nodes and with my merge command I'm using on match to push the new p_values onto the end of this double[] array. The issues is that for some of my entities I don't have p_values, so I need to push something like -infinity/infinity, NaN, or NULL into my double[] p_value array. Here is an example

Can graph db solve my graph problems?

纵饮孤独 提交于 2019-12-13 00:04:54
问题 I have transactions data (pastebin.com/ZswbyVHM) like this: {"accountId":3,"recordedAt":"2013-12-01T00:00:00.000Z","region":"South","status":"H"} {"accountId":3,"recordedAt":"2014-01-01T00:00:00.000Z","region":"South","status":"A"} {"accountId":3,"recordedAt":"2014-02-01T00:00:00.000Z","region":"South","status":"B"} {"accountId":3,"recordedAt":"2014-03-01T00:00:00.000Z","region":"South","status":"E"} {"accountId":3,"recordedAt":"2014-04-01T00:00:00.000Z","region":"South","status":"C"} when

How do you create self-referential nodes?

邮差的信 提交于 2019-12-12 21:11:48
问题 ... or is it possible at all to create a node in Neo4j which has a relationship with itself (a simple loop-node)? If so, what would be the corresponding Cypher query? 回答1: The following query creates Peter who voted for himself. MERGE (peter:User { name: "Peter" }) MERGE (peter)<-[:VOTED_FOR]-(peter) RETURN peter 来源: https://stackoverflow.com/questions/22185212/how-do-you-create-self-referential-nodes

Finding Specific Path in Neo4j Quickly

冷暖自知 提交于 2019-12-12 19:16:15
问题 I've recently asked about how to find all paths between two types os nodes in a way where all the edges in the path had the same attribute (like the same ID). This would be something like: MATCH (a {type: 'cin1'})-[rels:Next*1.. {value: 1}]->(b {type: 'cancer'}) RETURN (a), (b) where instead of having value: 1 I would have value: same for all edges . I found a way to solve this by using something like this (as answered in my other question): MATCH (a:Label {type: 'cin1'}) MATCH (b:Label {type

Neo4j Unmanaged Extension and GuardTimeoutException

百般思念 提交于 2019-12-12 14:27:37
问题 I am in great need of some advice regarding an issue I'm running into with a Neo4j unmanaged extension that I'm building in Java. I have created a very simple code sample that highlights my issue. The basic premise is that I'd like to set the org.neo4j.server.webserver.limit.executiontime for the neo4j server to a reasonable amount of time for user queries (lets say 2 minutes) which are coming in through Cypher, other endpoints, etc. But I also have some batch jobs that I need to run through

Matching elasticsearch data indexed by Titan

落爺英雄遲暮 提交于 2019-12-12 06:12:22
问题 I have indexed titan data in elasticsearch, it worked fine and indexed but when i see the data in elasticsearch using REST API. the column/property name looks different than from Titan. For example i have indexed age while inserting data to Titan final PropertyKey age = mgmt.makePropertyKey("age").dataType(Integer.class).make(); mgmt.buildIndex("vertices",Vertex.class).addKey(age).buildMixedIndex(INDEX_NAME); and if i see same in elasticsearch { "_index" : "titan", "_type" : "vertices", "_id"

Cypher: Matching nodes at arbitrary depth via a strictly alternating set of relations

十年热恋 提交于 2019-12-12 05:08:52
问题 I'm quite new to Cypher but struggling to find how to do this. I want to generalise the following so that it will match at an arbitrary depth. MATCH (:start)-[:a]-()-[:b]-(:end) //Depth1 MATCH (:start)-[:a]-()-[:b]-()-[:a]-()-[:b]-(:end) //Depth2 MATCH (:start)-[:a]-()-[:b]-()-[:a]-()-[:b]-()-[:a]-()-[:b]-(:end) //Depth3 MATCH (:start)-[:a]-()-[:b]-()-[:a]-()-[:b]-()-[:a]-()-[:b]-()-[:a]-()-[:b]-(:end) //Depth4 In other words, the path needs to pass through any number of a-node-b in strict

Exception in Executing Cypher Queries of Neo4j in Java Application

孤街醉人 提交于 2019-12-12 05:06:53
问题 I am new to Neo4j Graph Database and I want to create CyperQueries from java Application . I am using the above neo4j manual http://docs.neo4j.org/chunked/milestone/query-create.html I am creating nodes from java APplication as follow public class CreateQuery { public static final String DBPATH="D:/Neo4j/CQL"; public static void main(String args[]) { GraphDatabaseService path=new EmbeddedGraphDatabase(DBPATH); Transaction tx=path.beginTx(); try { Map<String, Object> props = new HashMap<String