neo4j

Counting primitives in Neo4j

北城余情 提交于 2019-12-18 16:57:38
问题 I have been reading through the documentation for neo4j and it's components and have yet to come across functionality that lets me query the total number of primitives (nodes, relationships, and properties) in the graph. Does this functionality exist somewhere or am I going to have to write code that traverses the entire graph counting as it goes? 回答1: Thanks for the question! I'm on the Neo4j team, and we currently have commercial tools which report this kind of information. However, an

Neo4j: how do I delete all duplicate relationships in the database through cypher?

别等时光非礼了梦想. 提交于 2019-12-18 16:54:33
问题 I have a huge database with a ton of nodes (10mil+). There is only one type of relationship in the whole database. However, there are a ton of nodes that have duplicated relationships between them. What i have currently is this cypher script that finds all the pairs with duplicates, and then a python script that runs through and cleans up each one (leaving just one unique relationship between those nodes). match (a)-[r]->(b) with a,b, count(*) as c where c>1 return a.pageid, b.pageid, c LIMIT

(六)图数据neo4j之cypher(一)

孤街醉人 提交于 2019-12-18 13:44:39
1.Cypher概述 cypher是一种声明式的图数据库查询语言,能高效的查询和更新图数据库,是依赖于模式的。所谓模式(Patterns)是就是众多节点和关系的任意复杂想法。 (1)节点语法 cypher使用()来表示一个节点,以下几种常见的 节点表示方法。 () 匿名节点 (n) 变量为n的节点 (:Movie)匿名属于Movie标签的节点 (n:Movie)变量为n ,属于Movie的节点 (n:Movie{name:"zhangsan"}) 变量为n,属于Movie节点,且还有name属性,属性值为zhangsan. (2) 关系 语法 Cypher中使用一对短横线(--)表示一个无方向关系,有方向关系使用-->和<--来表示。方括号[....]可用于添加详情。里面包含变量、属性或者类型信息。常见 的表达式如下: --> 有方向关系 -[role]-> 变量名为role的有向关系 -[:ACTED_IN]-> 名称为ACTED_IN的关系. -[role:ACTED_IN]-> 名称为ACTED_IN关系,且变量名为role -[role:ACTED_IN{roles:["NEO"]}]-> 关系名ACTED_IN,变量为role,属性为名称为roles,属性值为:NEO。 关系的类型类似于节点的标签,关系的属性等同于节点的属性。属性的值可以为数值。 实例说明

Find all events between 2 dates

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-18 13:38:01
问题 Trying to figure out the following scenario. Setup: Used the suggestions in this post to create a Time Tree http://www.markhneedham.com/blog/2014/04/19/neo4j-cypher-creating-a-time-tree-down-to-the-day/ Extended it to go to the Hour and Minutes (for the sake of simplicity, using 0,15,30,45 Connected the Minutes with :NEXT (similar to what's done on days, but on minutes) Created several events attached to the minutes with "STARTS_AT" and "ENDS_AT" Goals Find all events occurring between two

Create neo4j databse from backup inside neo4j docker

喜欢而已 提交于 2019-12-18 12:37:49
问题 Neo4j is new to me. I have a backup of neo4j database and I would like to build a docker container by creating a database by using that backup. I know I can use neo4j-admin restore --from=<backup-directory> [--database=<name>] [--force[=<true|false>]] command but am looking for something which a docker container would be able to use to recreate database when the container is created. The documentation of the neo4j docker image uses an exiting database database inside container. But I need to

Neo4j Cypher: How do you unpack nodes from a path to allow for further matching?

社会主义新天地 提交于 2019-12-18 12:32:08
问题 This question is a follow on to the question here I have a graph that has a circular linked list. (see here for an example) Each node in the linked list points to a User. When querying the list I have to use a path statement as the list is circular and I do not want to retrieve nodes beginning from the u:USER node. In order to get the nodes of interest my query looks like this: MATCH path=(nl:NODELINK { linkId:'cc' })-[:LINK*]->(u:USER) RETURN nodes(path) Once I have retrieved the path I

Neo4j - Cypher vs Gremlin query language

情到浓时终转凉″ 提交于 2019-12-18 09:54:36
问题 I'm starting to develop with Neo4j using the REST API. I saw that there are two options for performing complex queries - Cypher (Neo4j's query language) and Gremlin (the general purpose graph query/traversal language). Here's what I want to know - is there any query or operation that can be done by using Gremlin and can't be done with Cypher? or vice versa? Cypher seems much more clear to me than Gremlin, and in general it seems that the guys in Neo4j are going with Cypher. But - if Cypher is

Neo4J: N/A: WebSocket connection failure.

扶醉桌前 提交于 2019-12-18 09:43:15
问题 G'day. Installed neo4j (v3.0.5 according to the browser) on AWS (ubuntu). No matter what i try, when i connect to the db i get this error: "WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver. Please use your browsers development console to determine the root cause of the failure. Common reasons include the database being unavailable, using the wrong connection URL or temporary network problems. If you

Neo4j: Lucene phrase matching using Cypher (fuzzy)

耗尽温柔 提交于 2019-12-18 09:12:23
问题 In Lucene, a Phrase is a group of words surrounded by double quotes such as "hello dolly". I would like to be able to do the CYPHER equivalent of this Lucene fuzzy query: "hello dolly"~0.1 This finds my "hello dolly" node: START n=node:node_auto_index("name:\"hello dolly\"~0.1") RETURN n This doesn't: START n=node:node_auto_index("name:\"hella dolly\"~0.1") RETURN n Splitting the search phrase by whitespace into Single Terms does work: START n=node:node_auto_index("name:hella~0.1 AND name

what does transaction mean in reference with neo4j database

不羁的心 提交于 2019-12-18 08:24:34
问题 I got a bit confuse with term transaction. Suppose in transaction A we have two commands C1 and C2 and same in transaction B. Now both transaction come at same time then Are these observations correct? All commands of transaction A C1 and C2 will be done first (assuming A enter first) , then only commands of transaction B will be executed. Any command of transaction A or B can be executed but with assurance that If any of the command fails of any of the transaction then that transaction will