neo4j

Modify or change relationship properties in py2neo

只愿长相守 提交于 2019-12-23 02:36:30
问题 Is there a way to change a relationship property once it has been set using py2neo or cypher? I'm creating an inventory tracker and once an item is "CHECKED_OUT" a property called "status" in the relationship is set to "True". Ideally, once the item is returned or checked in, I'd like to change the "status" property to "False". This way I can keep track of the item and prevent it from being checked out twice. Here is my code for creating the relationship for a checkout transaction: def check

Is it possible to determine if a Cypher MERGE results in a create or a match?

自古美人都是妖i 提交于 2019-12-23 02:35:03
问题 Consider the Neo4J 2.0 Cypher query MERGE (u:User {id_str:"123"}) ON CREATE SET u.name="Bob", ON MATCH SET u.phone_num="555-4152" RETURN u It's a silly query - don't worry about the intent here. The question is, how do I understand whether this query created or simply found a node? UPDATE Perhaps I should further motivate why I want this behavior. Here's why: If the node already exists, then don't have to go to a remote server (Twitter API in my case) and download all of the user's metadata.

BFS traversal using cypher

穿精又带淫゛_ 提交于 2019-12-23 02:26:32
问题 I need to traverse a directed acyclic graph (DAG) using BFS. I am using neo4j via REST API, so my main way of commuication with neo4j is using Cypher. With Cypher I can retrieve a set of all the paths from a starting node, and from them derive a BFS traversal. I was wondering if there's a simpler way of getting a BFS traversal using Cypher. What I expect as output would be an array of sets of nodes. 回答1: Couldn't you then just order resulting paths after length, maybe take the last node from

Unable to switch neo4j database

冷暖自知 提交于 2019-12-23 01:54:35
问题 I am new in neo4j and i am using " neo4j-community-3.0.1 " . I want to switch database and retrieve nodes .After google i found how to switch database . But there is no file with name conf/neo4j-server.properties There are two files neo4j.conf and neo4j-wrapper.conf . But there is not any configuration such org.neo4j.server.database.location=data/graph.db Can any one help me how to switch database and i am able to see node using browser 回答1: As of Neo4J 3.0, all the configuration files have

How do I provide multiple queries in Neo4j Cypher?

十年热恋 提交于 2019-12-23 01:52:50
问题 I want to use the results from the first query in the second query. I am not sure how to do this in Cypher? Current code, START user1=node:USER_INDEX(USER_INDEX = "userA") MATCH user1-[r1:ACCESSED]->docid1<-[r2:ACCESSED]-user2, user2-[r3:ACCESSED]->docid2 WHERE r2.Topic=r3.Topic RETURN distinct docid2.Label; I want to have different conditions checked in the WHERE clause for the same docid2 set of nodes and accumulate the results and perform order by based on a date field. I am not able to

Time/date based searches in neo4j

99封情书 提交于 2019-12-23 01:27:09
问题 while playing around with neo4j a couple of questions arisen. At present time there are 2 of them: How can I limit the relationships/edges while searching for a specific path from node X to node Y (RegEx?/Wildcard?)? For instance all edges have 2 time attributes, "begin" and "end". I would like to find a path between nodes which occured between 2 am and 3 am in the morning.? How can track a time path? Lets say a car drove from 'A' to 'B'. The route took one hour, namely from 5 am to 6 am. The

Setting up NEO4j in Symfony2

↘锁芯ラ 提交于 2019-12-23 01:20:07
问题 I am new to Symfony and have started reading and toying about. I was able to install Symfony2 and a NEO4j database. I was also able to include bootstrap into my Symfony project and display a basic homepage. I would now like to connect my project to the database. I would like to start with basic functionallity such as registration and user system. I am currently using following (installed via composer): "everyman/neo4jphp": "dev-master", "hirevoice/neo4jphp-ogm": "dev-master", "klaussilveira

【贪心学院】python学习笔记

流过昼夜 提交于 2019-12-23 00:11:15
预习课第二章 知识点 作业 first_num = input ( "请输入第一个数字:" ) operation = input ( "请输入运算符:" ) second_num = input ( "请输入第二个数字:" ) #判断输入数字为整型或浮点型 if '.' in first_num : first_num = float ( first_num ) else : first_num = int ( first_num ) if '.' in second_num : second_num = float ( second_num ) else : second_num = int ( second_num ) #基本运算符 if operation == '+' : result = first_num + second_num elif operation == '-' : result = first_num - second_num elif operation == '*' : result = first_num * second_num elif operation == '/' : result = first_num / second_num #算数运算符 elif operation == '**' : #幂运算 result = first

Graph Database Newbie Q- How to decide on the direction of a relation between 2 nodes

跟風遠走 提交于 2019-12-22 18:32:43
问题 How do you decide the verb-direction of a relation ? E.g I have a Country falling under a Sub REgion which in turn is under a Region. Which one would be better and are there any thumb rules on deciding the direction. (Region)-[HAS]->(Sub Region)-[HAS]->(Country) or (Region)<-[BELONGS_TO]-(Sub Region)<-[BELONGS_TO]-(Country) Regards San 回答1: I agree with @InverFalcon that directionality is mostly a subjective decision. However, there may be (at least) one situation in which you might want to

Graph Database Newbie Q- How to decide on the direction of a relation between 2 nodes

社会主义新天地 提交于 2019-12-22 18:32:31
问题 How do you decide the verb-direction of a relation ? E.g I have a Country falling under a Sub REgion which in turn is under a Region. Which one would be better and are there any thumb rules on deciding the direction. (Region)-[HAS]->(Sub Region)-[HAS]->(Country) or (Region)<-[BELONGS_TO]-(Sub Region)<-[BELONGS_TO]-(Country) Regards San 回答1: I agree with @InverFalcon that directionality is mostly a subjective decision. However, there may be (at least) one situation in which you might want to