Giter VIP home page Giter VIP logo

neo4j's Introduction

Neo4j: Graphs for Everyone

Neo4j is the world’s leading Graph Database. It is a high performance graph store with all the features expected of a mature and robust database, like a friendly query language and ACID transactions. The programmer works with a flexible network structure of nodes and relationships rather than static tables — yet enjoys all the benefits of enterprise-quality database. For many applications, Neo4j offers orders of magnitude performance benefits compared to relational DBs.

Learn more on the Neo4j website.

Discord

Discourse users

Using Neo4j

Neo4j is available both as a standalone server, or an embeddable component. You can download or try online.

Extending Neo4j

We encourage experimentation with Neo4j. You can build extensions to Neo4j, develop library or drivers atop the product, or make contributions directly to the product core. You’ll need to sign a Contributor License Agreement in order for us to accept your patches.

Dependencies

Neo4j is built using Apache Maven version 3.8.2 and a recent version of supported VM. Bash and Make are also required. Note that maven needs more memory than the standard configuration, this can be achieved with export MAVEN_OPTS="-Xmx2048m".

macOS users need to have Homebrew installed.

With brew on macOS

brew install maven

Please note that we do not support building Debian packages on macOS.

With apt-get on Ubuntu

sudo apt install maven openjdk-17-jdk

Be sure that the JAVA_HOME environment variable points to /usr/lib/jvm/java-17-openjdk-amd64 (you may have various java versions installed).

Building Neo4j

Before you start running the unit and integration tests in the Neo4j Maven project on a Linux-like system, you should ensure your limit on open files is set to a reasonable value. You can test it with ulimit -n. We recommend you have a limit of at least 40K.

  • A plain mvn clean install -T1C will only build the individual jar files.

  • Test execution is, of course, part of the build.

  • In case you just want the jars, without running tests, this is for you: mvn clean install -DskipTests -T1C.

  • You may need to increase the memory available to Maven: export MAVEN_OPTS="-Xmx2048m" (try this first if you get build errors).

  • You may run into problems resolving org.neo4j.build:build-resources due to a bug in maven. To resolve this simply invoke mvn clean install -pl build-resources.

Running Neo4j

After running a mvn clean install, cd into packaging/standalone/target and extract the version you want, then:

bin/neo4j-admin server start

in the extracted folder to start Neo4j on localhost:7474. On Windows you want to run:

bin\neo4j-admin server start

instead.

Neo4j Desktop

Neo4j Desktop is a convenient way for developers to work with local Neo4j databases.

To install Neo4j Desktop, go to Neo4j Download Center and follow the instructions.

Licensing

Neo4j Community Edition is an open source product licensed under GPLv3.

Neo4j Enterprise Edition includes additional closed-source components not available in this repository and requires a commercial license from Neo4j or one of its affiliates.

Trademark

Neo4j’s trademark policy is available at our trademark policy page.

neo4j's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neo4j's Issues

Reintroduce OSGi metadata in the manifests

@ractive: 'The newly introduced GraphDatabaseFactory allows the OSGi friendly configuration of a GraphDatabaseService without using the Java Service Loader (that does not play well within an OSGi environment). This now allows to reintroduce the OSGi manifest headers that were present until the 1.4 release, because the single jars can now be treated as independent bundles again.

Peter Neubauer described how to use Neo4j embedded with OSGi in the manual stating:

"Just make the necessary jars available as wrapped library bundles"

The test case that Peter created only works, because pax-exam automatically wraps all dependencies in a (super-)bundle when running the pax-exam tests. Wrapping the jars in one "super bundle" (as we did in this project) is not necessary anymore, when the neo4j jars would contain the OSGi Import- and Export-Package headers. Maintaining such a super-bundle in a separate project is error-prone and tedious.

Interestingly enough, the jar files of the 1.8 RC1 release contain OSGi blueprints service config files in the OSGI-INF directory. Those of course also only make sense with proper OSGi headers.'

Provide lucene-like faceted search capabilities

@chillenious: 'See some discussion here: https://groups.google.com/forum/?fromgroups=#!topic/neo4j/FI0IwV626k8

The problem is that for some cases - in my case because I want to calculate facets - it can be useful to have direct access to index documents. Opening up a (read only) index directly on the FS isn't an option as it may take a while before neo4j flushes (so stuff will be out of date, and might not even have a readable cache yet).

I have a work around that uses nodes and properties, but the overhead is unfortunately unacceptable for this case. I'd love to create a better solution, but need to somehow - doesn't have to be neat or generic - to be able to access index documents directly when I do a search. Currently, this is pretty much impossible due to the visibility of most of the involved classes.'

Server should respond to queries with a progress report

@vlad: 'When serving a query, the server should respond with progress ‘reporters’. It would be great if they were human readable (so the user can see what’s going on) and machine parseable (so that a client library could pass it on to the application using the library, or choose to ignore this information.)

The report could be a simple dot every 5 seconds, or more information like the number of nodes processed during the last interval (or since start), etc.

http://visionmedia.github.com/mocha/#reporters shows a few interesting reporters that can be configured for a javascript testing framework called mocha (though of course they are mostly not-relevant in this case.)'

Circular relationship "Jake likes Jake"

@gokcemutlu: 'Hi,

I have a simple model:

START root=node(0) CREATE UNIQUE root-[:PEOPLE]->(jake {Name:'Jake'}), root-[:PEOPLE]->(jill {Name:'Jill'}), jake-[:LIKE]->jill, jill-[:LIKE]->jake, jake-[:LIKE]->jake;

In this model

  • Jake likes Jill,
  • Jill likes Jake
  • Jake likes Jake

I want to find out Jake likes who.

START r = node(0) MATCH r-[:PEOPLE]->jake, path=(jake-[:LIKE]->person-[:LIKE]->jake) where jake.Name = 'Jake' RETURN person;

This query returns only Jill and this is wrong.

Please let me know.

Regards,
Gokce'

Webadmin regression: console doesn't respect initial URL

@aseemk: 'Simpler than it sounds:

  1. Open up the wedadmin.
  2. Click on the console tab.
  3. Change to a different console, e.g. Gremlin or HTTP.

See how the URL says #/console/gremlin or #/console/http? That's good -- the URL reflects the state of the webadmin.

Now reload, or copy/paste the URL into a new tab. Note how the correct console isn't loaded by default. That's the bug.

But it's a bit worse: clicking the shell you want to load it also won't work if it's the same as the URL. You have to first manually switch to a different shell in order to be able to switch to the shell you want.'

NodeRecord[...] not in use error when issuing concurrent Cypher queries including a DELETE query

@blevine: 'This is expands on the issue I originally raised here: https://groups.google.com/d/topic/neo4j/-Ml0NDjKDQA/discussion

Environment:

  • Neo4j Community 1.8RC1
  • Ubuntu 12.04
  • Oracle JDK 1.6.0_32

I've come up with a relatively easy way to reproduce this issue without requiring you to replicate my Node.js environment.

I was able to reproduce the problem fairly easily by running an Apache Benchmark (ab) script that issued a "delete all nodes" Cypher query repeatedly and concurrently:

ab -c 10 -n 10000 -v3 -T "application/json" -p delete.json http://localhost:747
4/db/data/cypher

The delete .json file looks like:

{
"query" : "start n = node(*) DELETE n"
}

Instructions for reproducing the problem:

  1. Bring up the neo4j console in a browser and navigate to the Data Browser tab. Be ready to start clicking the "+ Node" button to create new Nodes.
  2. Start the ab script and immediately start clicking the "+Node" button repeatedly while the ab script is working to delete all nodes.

Eventually, the ab script will start reporting errors of the form shown below. You can of course, increase the run time of the ab script if the problem doesn't appear right away. For me, it appeared after about 2 seconds. After that point, the "delete all nodes" query will continue to return this error.

I also noticed some additional interesting behavior after this error occurred:

  1. The console said that there were 24 nodes, but 'start n = node(*) return count(n)' returned 26.
  2. The query 'start n = node(*) return n' produced an error: "Node[214] not found. This can be because someone else deleted ..." (note that Node 214 also appears in the original error below)

Error produced:

{
"message" : "NodeRecord[214] not in use",
"exception" : "InvalidRecordException",
"stacktrace" : [ "org.neo4j.kernel.impl.nioneo.store.NodeStore.getRecord(NodeStore.java:199)", "org.neo4j.kernel.impl.nioneo.store.NodeStore.getRecord(NodeStore.java:79)", "org.neo4j.kernel.impl.nioneo.xa.WriteTransaction.nodeDelete(WriteTransaction.java:661)", "org.neo4j.kernel.impl.persistence.PersistenceManager.nodeDelete(PersistenceManager.java:134)", "org.neo4j.kernel.impl.core.NodeManager.deleteNode(NodeManager.java:922)", "org.neo4j.kernel.impl.core.NodeImpl.delete(NodeImpl.java:282)", "org.neo4j.kernel.impl.core.NodeProxy.delete(NodeProxy.java:67)", "org.neo4j.cypher.internal.mutation.DeleteEntityAction.org$neo4j$cypher$internal$mutation$DeleteEntityAction$$delete(DeleteEntityAction.scala:50)", "org.neo4j.cypher.internal.mutation.DeleteEntityAction.exec(DeleteEntityAction.scala:34)", "org.neo4j.cypher.internal.mutation.DeleteEntityAction.exec(DeleteEntityAction.scala:30)", "org.neo4j.cypher.internal.pipes.ExecuteUpdateCommandsPipe.org$neo4j$cypher$internal$pipes$ExecuteUpdateCommandsPipe$$exec(ExecuteUpdateCommandsPipe.scala:52)", "org.neo4j.cypher.internal.pipes.ExecuteUpdateCommandsPipe$$anonfun$org$neo4j$cypher$internal$pipes$ExecuteUpdateCommandsPipe$$executeMutationCommands$1$$anonfun$apply$1.apply(ExecuteUpdateCommandsPipe.scala:43)", "org.neo4j.cypher.internal.pipes.ExecuteUpdateCommandsPipe$$anonfun$org$neo4j$cypher$internal$pipes$ExecuteUpdateCommandsPipe$$executeMutationCommands$1$$anonfun$apply$1.apply(ExecuteUpdateCommandsPipe.scala:43)", "scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:200)", "scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:200)", "scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)", "scala.collection.immutable.List.foreach(List.scala:45
....

'

Cypher head(tail(head(...))) fails on aggregated data, works on fixed data

@jexp: '

start n=node(1) 
where has(n.name) 
with id(n) as id, n.name as name, count(*) as cnt 
with id, collect([name,cnt]) as data 
return filter(x in data : head(x)="Neo") as cnt
+-------------+
| cnt         |
+-------------+
| [["Neo",1]] |
+-------------+
1 row
0 ms


start n=node(1) 
where has(n.name) 
with id(n) as id, n.name as name, count(*) as cnt 
with id, collect([name,cnt]) as data 
return head(filter(x in data : head(x)="Neo")) as cnt
+-----------+
| cnt       |
+-----------+
| ["Neo",1] |
+-----------+
1 row
0 ms


start n=node(1) 
where has(n.name) 
with id(n) as id, n.name as name, count(*) as cnt 
with id, collect([name,cnt]) as data 
return tail(head(filter(x in data : head(x)="Neo"))) as cnt
+-----+
| cnt |
+-----+
| [1] |
+-----+
1 row
0 ms


start n=node(1) 
where has(n.name) 
with id(n) as id, n.name as name, count(*) as cnt 
with id, collect([name,cnt]) as data 
return head(tail(head(filter(x in data : head(x)="Neo")))) as cnt
Error: `tail(head(filter(x in data : head(x) == Neo)))` expected to be a Collection but it is a Scalar

this works:

start n=node(0) 
return head(tail(head(filter(x in [["foo",1]] : head(x)="foo")))) as cnt
+-----+
| cnt |
+-----+
| 1   |
+-----+
1 row
0 ms

http://console.neo4j.org/r/zguxf6'

web-admin remote connection

@eikal: 'Until today i develop on my laptop and use the web-admin. But when i install it in remote server, i can't enter the web-admin. (its work only from localhost?) how can i see the web-admin of prod env?

thanks'

Webadmin: shell doesn't relay exceptions without messages

@aseemk: 'Some inputs seem to give exceptions without messages. In those cases, the shell currently (1.8 GA) doesn't give any form of feedback. It should still show something like "[unknown error]", etc.

I'm guessing this'd be a one-line fix in the webadmin code, but I realize I may be simplifying. =)

Example:

neo4j-sh (0)$ START n=node(0) RETURN ABS(null);
neo4j-sh (0)$ 

But the HTTP response does properly convey it's an error:

http> POST /db/data/cypher {"query":"START n=node(0) RETURN ABS(null)"}
==> 400 Bad Request
==> {
==>   "exception" : "BadInputException",
==>   "stacktrace" : [ "org.neo4j.server.rest.repr.RepresentationExceptionHandlingIterable.exceptionOnHasNext(RepresentationExceptionHandlingIterable.java:51)", "org.neo4j.helpers.collection.ExceptionHandlingIterable$1.hasNext(ExceptionHandlingIterable.java:61)", "org.neo4j.helpers.collection.IteratorWrapper.hasNext(IteratorWrapper.java:42)", "org.neo4j.server.rest.repr.ListRepresentation.serialize(ListRepresentation.java:58)", "org.neo4j.server.rest.repr.Serializer.serialize(Serializer.java:75)", "org.neo4j.server.rest.repr.MappingSerializer.putList(MappingSerializer.java:61)", "org.neo4j.server.rest.repr.CypherResultRepresentation.serialize(CypherResultRepresentation.java:50)", "org.neo4j.server.rest.repr.MappingRepresentation.serialize(MappingRepresentation.java:42)", "org.neo4j.server.rest.repr.OutputFormat.format(OutputFormat.java:170)", "org.neo4j.server.rest.repr.OutputFormat.formatRepresentation(OutputFormat.java:120)", "org.neo4j.server.rest.repr.OutputFormat.response(OutputFormat.java:107)", "org.neo4j.server.rest.repr.OutputFormat.ok(OutputFormat.java:55)", "org.neo4j.server.rest.web.CypherService.cypher(CypherService.java:80)", "java.lang.reflect.Method.invoke(Method.java:597)" ]
==> }
```'

'Node concurrently deleted while loading its relationships' error when issuing concurrent 'delete all' Cypher query

@blevine: 'Environment:
Neo4j Communit 1.8GA
Ubuntu 12.04
Oracle JDK 1.6.0_32-b05
Node.js/node-neo4j driver

This problem is most likely related to issue #872. After running a similar test for a while, I see the following error:

"Node[1877] concurrently deleted while loading its relationships?"

as a result of the following 'delete all' query:

start n = node(*) match n-[r?]-() delete r,n

At this point all attempts to execute that query (both programmatically and from the Data Browser) result in the same error. Nothing appears in the log related to this error.

I then went to the Data Browser and was able to view Node 1877 although all of its properties had been deleted. I then restarted the server after which Node 1877 disappeared (according to the Data Browser). I was then able to issue the 'delete all' query successfully.'

Cypher: StartPipe overflows with ~40 variables

@wfreeman: 'This is interesting. It happens even without the CREATE portion of the request. Memory is blowing up just by having the 40 start nodes/node collections. I was able to reproduce by inserting 400 nodes without properties, and then running:

 Start 
      x0=node(100), 
      y0=node(101,220,226,238,256,293,341), 
      x1=node(120),
      y1=node(237,237,242,254,267,268,280,282,321,332,342),
      x2=node(121),
      y2=node(270,270,281,284,296,305,309),
      x3=node(122),
      y3=node(221,221,261,285,295,324,333,334,335),
      x4=node(123),
      y4=node(223,223,229,241,253,262,303,306),
      x5=node(124),
      y5=node(225,225,227,235,287,296,312,337,339),
      x6=node(125),
      y6=node(274,274,278,283,285,307,339),
      x7=node(126),
      y7=node(236,236,240,265,269,283,298,308,324,325),
      x8=node(127),
      y8=node(219,219,227,277,286,292,297,321,328),
      x9=node(128),
      y9=node(225,225,247,255,279,301,310,315,325,334,343),
      x10=node(129),
      y10=node(242,242,263,265,266,275,286,293,337),
      x11=node(130),
      y11=node(249,249,260,277,284,298,304),
      x12=node(131),
      y12=node(252,252,297,299,315,323),
      x13=node(132),
      y13=node(221,221,239,268,273,276,284,296),
      x14=node(133),
      y14=node(235,235,237,257,280,289,296,313,339),
      x15=node(134),
      y15=node(231,231,237,244,246,249,306,318,339),
      x16=node(135),
      y16=node(223,223,225,235,243,266,277,282,289,301,323),
      x17=node(136),
      y17=node(241,241,271,276,287,292,313,318,322,341),
      x18=node(137),
      y18=node(238,238,265,270,281,300,304,318,319,339,340),
      x19=node(138),
      y19=node(223,223,239,272,300,315,325,330) 
return x0;

If I run it in console it hits the Error: java.lang.RuntimeException: org.neo4j.kernel.guard.GuardOperationsCountException: max ops (ops=100001). (which is weird, I think, considering it's not even doing any matching).

Happens in 1.8 and 1.9 (my local build which is close to M01).

Locally, I get:

GC overhead limit exceeded</pre></p><h3>Caused by:</h3><pre>java.lang.OutOfMemoryError: GC overhead limit exceeded
    at scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:48)
    at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:128)
    at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:42)
    at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:200)
    at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:200)
    at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
    at scala.collection.immutable.List.foreach(List.scala:45)
    at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:200)
    at scala.collection.immutable.List.flatMap(List.scala:45)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
    at org.neo4j.cypher.internal.pipes.StartPipe.createResults(StartPipe.scala:34)
```'

Logger writes to stdout when log level is not enabled

@blevine: 'Neo4j 1.8GA

From issue originally raised in this thread:

https://groups.google.com/d/topic/neo4j/gDSjRe8f4xY/discussion

It appears that there's a Logger wrapper in org.neo4j.server.logging.Logger.java that will send log messages to stdout if the requested log level is not enabled due to this code:

public void log( Level level, String message, Object... parameters )
{
    final String logMessage = String.format( message, parameters );
    if ( logger != null && logger.isLoggable( level ) )
    {
        logger.log( level, logMessage );
    }
    else
    {
        System.out.println(
            String.format( "Logger not configured, logging to std out instead: [%s] %s", level.getName(), logMessage ) );
    }
}

For example, Jetty6WebServer is doing this:

log.debug( "Adding JAXRS packages %s at [%s]", packageNames, mountPoint );

However, the default log level for the org.neo4j.server package is set to INFO. So you see this message sent to stdout. I'm not sure what the intent was here, but it doesn't seem like a very good idea since even the log messages you wanted to suppress will just end up being sent to stdout.'

neo4j-shell in read-only mode does not update graph

@treaves: 'I am using the shell to connect to a SDG app I'm working on. As the app is still running, I connect in read-only mode. When a new node is created in the SDG app, it is not reflected in the shell. I must exit & restart the shell to see the new node.

This is with 1.8.RC1.'

'Relationship[nnn] in use error' when issuing concurrent Cypher DELETE queries when cache is enabled

@blevine: 'Environment:
Neo4j 1.8GA (also repro on 1.9 M01)
Ubuntu 12.04
Java:
java version "1.6.0_32"
Java(TM) SE Runtime Environment (build 1.6.0_32-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.7-b02, mixed mode)
Hardware:
Quad core home-brew, 8 G memory

I have a test that is designed to test out a retry strategy for dealing with deadlock exceptions. The test creates 50 nodes and multiple relationships between one node and the next node. It then issues 50 DELETE queries against each of these nodes. The specific DELETE query is:

START n = node({neoId}) MATCH n-[r?]-() DELETE r, n

Some of these queries produce the error: "Relationship[nnn] not in use"

Once this error is seen, any Cypher query that would encounter that relationship returns the error:

"Relationship[nnn] not found. This can be because someone else deleted this entity while we were trying to read properties from it, or because of concurrent modification of other properties on this entity. The problem should be temporary."

For example, the query:

START r = rel(*) return r 

will return this error. Also note that the query

START r = rel(*) return count(*) 

will return a non-zero value even though all of the relationships should have been deleted.

This condition persists until the database is restarted.

This appears to be a caching issue. When the node cache is disabled by setting cache_type=none, this problem does not occur.

I have a test (requires Node.js) that reproduces this problem at https://github.com/blevine/neo4j-concurrent-delete-test. The conc directory contains a full Node.js project. You should be able to cd into conc and run npm test. Or if you don't have npm installed, cd into conc and run node index.js'

Cypher: Add "unwind" capability--the opposite of "collect"

@wfreeman: 'If you have a property that's an array, it is sometimes useful to break that array up and return a cartesian product of the array and the rest of its record (for all result records).

I think this would be handy, especially used with group by and collect, to massage results.

The name unwind comes from MongoDB's aggregation framework function, but we don't have to call it the same thing:
http://docs.mongodb.org/manual/reference/aggregation/#_S_unwind

Partly inspired by: https://groups.google.com/d/topic/neo4j/DLpcOvvnpFA/discussion

I'll post some example use cases later. Any comments?'

Cypher: CREATE & CREATE UNIQUE - bidirectional edge

@bfhappy: 'As far as I understand, there is no way to create a bidirectional edge today?
I would think that having:

START n1=node(x), n2=node(y)
CREATE UNIQUE n1-[r:TYPE]-n2
RETURN r;

would create, but no... it only creates an edge going from n1->n2.
Would make more sense to have these patterns imo:

CREATE UNIQUE n1-[r:TYPE]->n2 -- Direction: OUT (from originating node n1 to n2)
CREATE UNIQUE n1<-[r:TYPE]-n2 -- Direction: IN (from node n2 to n1)
CREATE UNIQUE n1-[r:TYPE]-n2 -- Direction: BOTH (a bidirectional edge)

Is there another way to create a bidi edge? If not, could you maybe implement this? Today, I have to do two create unique calls...

Thanks'

Broken Neo4j 1.7-1.7.2 graph database, cannot recover from errors

@ceefour: '```
$ sudo service neo4j-service start
WARNING: Detected a limit of 1024 for maximum open files, while a minimum value of 40000 is recommended.
WARNING: Problems with the operation of the server may occur. Please refer to the Neo4j manual regarding lifting this limitation.
Starting Neo4j Server... process [12153]... waiting for server to be ready.. BAD.
Neo4j Server may have failed to start, please check the logs.


The logs :

Oct 3, 2012 2:03:43 PM org.neo4j.server.logging.Logger log
INFO: Starting Neo Server on port [7474] with [80] threads available
Oct 3, 2012 2:03:43 PM org.neo4j.server.logging.Logger log
INFO: Enabling HTTPS on port [7473]
Oct 3, 2012 2:03:44 PM org.mortbay.log.Slf4jLog info
INFO: Logging to org.slf4j.impl.JDK14LoggerAdapter(org.mortbay.log) via org.mortbay.log.Slf4jLog
Oct 3, 2012 2:03:44 PM org.neo4j.server.logging.Logger log
INFO: Using database at /var/lib/neo4j/graph.db
Oct 3, 2012 2:03:44 PM org.neo4j.server.logging.Logger log
SEVERE:
org.neo4j.kernel.lifecycle.LifecycleException: Failed to transition org.neo4j.kernel.AbstractGraphDatabase$DefaultKernelExtensionLoader@6ab30913 from NONE to STOPPED
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:388)
at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:82)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:116)
at org.neo4j.kernel.AbstractGraphDatabase.run(AbstractGraphDatabase.java:224)
at org.neo4j.kernel.EmbeddedGraphDatabase.(EmbeddedGraphDatabase.java:79)
at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:70)
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:195)
at org.neo4j.server.NeoServerBootstrapper$1.createDatabase(NeoServerBootstrapper.java:63)
at org.neo4j.server.database.Database.createDatabase(Database.java:81)
at org.neo4j.server.database.Database.(Database.java:64)
at org.neo4j.server.NeoServerWithEmbeddedWebServer.startDatabase(NeoServerWithEmbeddedWebServer.java:175)
at org.neo4j.server.NeoServerWithEmbeddedWebServer.start(NeoServerWithEmbeddedWebServer.java:93)
at org.neo4j.server.Bootstrapper.start(Bootstrapper.java:87)
at org.neo4j.server.Bootstrapper.main(Bootstrapper.java:52)
Caused by: org.neo4j.graphdb.NotFoundException: Target file[lucene.log.v67] already exists
at org.neo4j.kernel.impl.util.FileUtils.renameFile(FileUtils.java:190)
at org.neo4j.kernel.DefaultFileSystemAbstraction.renameFile(DefaultFileSystemAbstraction.java:77)
at org.neo4j.kernel.impl.transaction.xaframework.XaLogicalLog.renameLogFileToRightVersion(XaLogicalLog.java:700)
at org.neo4j.kernel.impl.transaction.xaframework.XaLogicalLog.renameIfExists(XaLogicalLog.java:219)
at org.neo4j.kernel.impl.transaction.xaframework.XaLogicalLog.open(XaLogicalLog.java:171)
at org.neo4j.kernel.impl.transaction.xaframework.XaContainer.openLogicalLog(XaContainer.java:64)
at org.neo4j.index.impl.lucene.LuceneDataSource.(LuceneDataSource.java:230)
at org.neo4j.index.lucene.LuceneIndexProvider.load(LuceneIndexProvider.java:70)
at org.neo4j.kernel.AbstractGraphDatabase$DefaultKernelExtensionLoader.loadIndexImplementations(AbstractGraphDatabase.java:1180)
at org.neo4j.kernel.AbstractGraphDatabase$DefaultKernelExtensionLoader.init(AbstractGraphDatabase.java:1152)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:382)
... 13 more
Oct 3, 2012 2:03:44 PM org.neo4j.server.logging.Logger log
SEVERE: Failed to start Neo Server on port [7474]


Environment:

Neo4j version 1.7 Linux x64

$ uname -a
Linux annafi.dev 3.2.0-31-generic #50-Ubuntu SMP Fri Sep 7 16:16:45 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.4) (6b24-1.11.4-1ubuntu0.12.04.1)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)


I can provide the graph database file and complete logs (via private channel) (total ~200 KB bzipped)'

Neo4j won't install. Doesn't see Java RE

@BobZ123BobZ: 'C:\Neo4j\neo4j-community-1.8.RC1\bin>Neo4j.bat
Unable to locate jvm. Could not find HKLM\SOFTWARE\JavaSoft\Java Runtime Environ
ment/CurrentVersion entry in windows registry.

When I run the Java Download, it comes back and says:

You have the recommended Java installed (Version 7 Update 7).
'

Consider to support extraction of REGEXP groups from statements

@peterneubauer: 'It would be very practical to use regexp in conjunction with WITH to extract groups from regexp on properties for further processing, just like any other function. Something like

START n = node(1)
WITH EXTRACT(n.name, '(N.*) (Matrix)', 1) as neo
CREATE n-[:NAME_CONTAINS]-{name:neo}

where EXTRACT(n.name, '(N.*) (Matrix)', 1) as neo specifies the string expression, the REGEXP and the group(s) from the regexp to extract. '

Cypher's ExecutionResult is traversable only once, but it is an Iterable - document this

@wujek-srujek: 'I am using the ExecutionEngine / ExecutionResult classes form the 'javacompat' package. The following code:

        ExecutionResult res = new ExecutionEngine(graphDb).execute('start from = node({from}) match from-[:IS_PART_OF]->t return t', [from: node])
        println '> first traversal start'
        for (def o : res) {
            println o['t']
        }
        println '> first traversal end'
        println '> second traversal start'
        for (def o : res) {
            println o['t']
        }
        println '> second traversal end'

results in:

first traversal start
Node[3]
first traversal end
second traversal start
second traversal end

The second traversal (calling iterator() for the second time) yields an Scala iterator whose toString() method says 'empty iterator'.
On the other hand, when people see an Iterable, they most likely expect it to be traversable more than once. If some API, like this one, doesn't implement this, it must be documented.

I know this can be too late, but how about changing the result types to Iterator? This will mean it can be traversed only once and be clearly documented by the API itself.'

Create method in GraphDatabaseService that retrieves a ReadOnlyGraphDatabase

@NicholasAStuart: 'I would like to be able to get a read only graph database object out of an already existing GraphDatabaseService. I know there is a property set for the DB that allows the creation of a InternalAbstractGraphDatabaseService that has the mutating methods throwing not supported exceptions, but there is no way of casting into this Class.

I need this because I'm creating a Web Service that takes in Gremlin and runs it, and I need to guarantee that this specific operation does not mutate the GraphDb, while I have other web services that will mutate the graph. The primary reason for wanting the ability to get a Read/Write and ReadOnly out of 1 DB object is the cache that i stored in the DB Object.

Is this something that is feasible?'

Cypher: Map handling

@systay: 'Cypher has been able to work nicely with collections. It would be nice to have better support for maps. To do this, I think we need to support tuples for some of the existing functions.

Create maps

Given a node or a relationship, we should be able to create a map from it. This would allow us to write something like:

START a=node(...), b=node(...)
SET a = map(b)

Filter on keys and/or values

Given a map, we should be able to filter on key-value-pairs, something like:

RETURN filter( k,v in myNode : k =~ "IS*." )

Return count of key-value-pairs on map

Allows us to count the number of properties on nodes and relationships

RETURN length(myNode)

Allow extract on maps

This would allow us to change map keys and map values, with something that is similar to the functional map. Very uncertain about the tuple syntax. Using Scala's just to use something.

RETURN extract( k,v in myNode : (foo+"k" -> v*2) )'

Index corruption in case of node ID recycling

@cheadp: 'On node deletion, related indexes entries will be removed only when the next query on those indexes occurs and should return the deleted node.
As indexes work with internal node id, and as they can be recycled, not removing indexes entries when a node is deleted can lead to index corruption (and happened in one of our pre-production database)

As it was told, indexing will be refactored in a futur milestone.
But I think a good thing to do now is to add a warning in the manual about this issue, and advice users to always think about removing indexes entries'

Lists not indexable via the REST API

@ZackGC: 'While using the REST API and the batch methods, indexing via an array causes errors, i.e.
"Unknown property type on: [104e08f3a15c49f1809dfbef2a4f5ec8], class java.util.ArrayList"

Michael Hunger and Peter Neubauer have advised me on the simple fix to this problem. I'm taking a shot at fixing this now.
-Zack '

Support "repeatable read" within a single cypher statement

NOTE: This description has been updated, the original description is at the bottom

While Neo4j primitives are read committed, Cypher composes these primitives together in ways that can lead to errors - notably cypher may read an entity that is subsequently deleted, and will then fail to perform some operation on it.

While this could be construed as a cypher issue, it is really an issue of isolation levels - we need to implement repeatable read isolation in the kernel to allow cypher to expose a single cypher statement as a read committed operation.

If you suspect an isolation issue

If you believe you are hitting a problem related to transaction isolation levels, please post a comment on this ticket with:

  • Any setup required
  • All cypher statements involved
  • What you expected the result to be
  • What the result actually is
  • Your Neo4j version, Java version and operating system

Workarounds

Lock the read set

Many (but not all) of the cases where this is an issue have a format like:

<match some stuff>
<perform some mutation>

For this category of statements, we suffer the same problem as SQL solves with SELECT ... FOR UPDATE. Cypher does not yet support a construct like that, but it can be emulated using the following pattern:

<match some stuff>
<set a property, for instance __lock__>
WITH <stuff>
<perform some mutation>

For example:

MATCH (n:Person)
SET n.__lock__ = 1
WITH n
SET n.description = "Some description"

Retry transaction

Particularly for small read operations and small writes, given the transactional nature of Neo4j, you can rollback and retry any transaction where a statement fails due to this issue. A common pattern for this is to model your query as a unit of work that can be retried.

Original message

@peterneubauer: 'See https://groups.google.com/group/neo4j/browse_thread/thread/9355edd2059d70e2/a51d06c894107327?lnk=gst&q=Concurrent+reading+and+deleting+on+relationships+leads+to+NotFoundException.+How+to+ignore%3F#a51d06c894107327 for background.

Example code is at http://code.google.com/p/graph-query-benchmarks/source/browse/trunk/graph-query-benchmarks/src/test/nz/ac/massey/cs/graphbenchmarks/spikes/neo4j/NeoIssues.java'

data browser: button to hide unselected nodes/relationships in graph view

@flipside: 'I don't use the data browser graph view as much as I'd like to because the screen gets cluttered very fast as I add more and more nodes with all the grey, unselected nodes on the screen. It'd be really great if there was a button to hide all this unselected nodes and relationships so I can get an uncluttered look at the part of the graph I'm interested in.

Thanks,

-Mat'

Can't use TYPE() in CREATE statement

@fynnfeldpausch: 'The TYPE() function's return value should be usable in a CREATE statement. However, the example below is an invalid Query (Don't know how to extract parameters from this type: org.neo4j.kernel.impl.core.RelationshipProxy ):

START targetNode = node(42)
MATCH sourceNode -[r]-> targetNode
CREATE sourceNode -[s:TYPE(r)]-> targetNode
RETURN s

The example above was meant to be used for copying relationships between existing nodes.'

Issue with auto indexing upon removal of nodes

@vlg: 'OK so there is an issue with key-value automatic indices (code bellow) upon node removal. The scenario tested here is the following:

Assume that we index a property named 'ID', and that we want to use it to manage unicity of nodes. We create a database, and init indexing of this property, then we do the following:
addNode('N1)
deleteNode('N1)
graph.shutdown()
graph.openAgain()
addNode('N1')
addNode('N2')
getNodeFromIndex('ID', 'N1)

The issue is that nothing is retrieved by the last instruction while N1 should be retrieved. Additional observations:

(1) If we add N2 BEFORE N1, results are OK
(1) If we do not remove N1, results are OK
(2) If we don't close and reopen the database, results are OK
(3) If we drop the reference node at the database creation, results are OK

CODE:

import java.util.logging.Level;
import java.util.logging.Logger;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.NotFoundException;
import org.neo4j.graphdb.Transaction;
import org.neo4j.graphdb.index.IndexHits;
import org.neo4j.kernel.EmbeddedGraphDatabase;

public class Neo4jKeyIndexIssues
{    
    public static final String DBPATH   = "NeoTest" ;
    public static final String INDEXED  = "ID" ;
    public static final String N1       = "Node1" ;
    public static final String N2       = "Node2" ;


    public static void main(String[] args) 
        throws Exception {

        Node node1, node2 ;

        GraphDatabaseService g =  new EmbeddedGraphDatabase(DBPATH);
        g.index().getNodeAutoIndexer().setEnabled(true);
        g.index().getNodeAutoIndexer().startAutoIndexingProperty(INDEXED);

        // dropNeoReferenceNode(g);

        System.out.println("(1)");
        node1 = addNode(g, N1);

        IndexHits<Node> hits = g.index().getNodeAutoIndexer().getAutoIndex().get(INDEXED, N1);
        System.out.println("1) Query Hits for '"+N1+"': " + hits.size()+" "+hits.hasNext());
        Node hit = hits.getSingle();
        System.out.println("1) Hit for '"+N1+"': " + hit.getProperty(INDEXED));

        // Remove the nodes
        Transaction tx = g.beginTx();
        System.out.println("Removing node 1 "+N1);
        node1.delete();
        tx.success(); tx.finish();

        // Reopen database
        System.out.println("-Shutting down and reopening the database-");
        g.shutdown();
        g = new EmbeddedGraphDatabase(DBPATH);
        g.index().getNodeAutoIndexer().setEnabled(true);
        g.index().getNodeAutoIndexer().startAutoIndexingProperty(INDEXED);

        // OK, add new nodes again
        System.out.println("\n(2)");
        node1 = addNode(g, N1);
        node2 = addNode(g, N2);

        hits = g.index().getNodeAutoIndexer().getAutoIndex().get(INDEXED, N1);
        System.out.println("2) Query Hits for 'N1': "+hits.size()+" "+hits.hasNext());

        // Something should be found
        node1 = hits.getSingle();
        if(node1 == null) {
            System.out.println("2) ERROR: nothing found ID='"+N1+"'");
        }
        else {
            System.out.println("2) Hit for 'N1': " + node1+" ID="+node1.getProperty("ID"));
        }

        // Something should be found too
        hits = g.index().getNodeAutoIndexer().getAutoIndex().get(INDEXED, N2);
        System.out.println("2) Query Hits for 'N2': "+hits.size()+" "+hits.hasNext());

        // Nothing was found
        node2 = hits.getSingle();
        if(node2 == null) {
            System.out.println("2) ERROR: nothing found ID='"+N2+"'");
        }
        else {
            System.out.println("2) Hit for 'N2': " + node2+" ID="+node2.getProperty("ID"));
        }

        g.shutdown();
    }

    /**
    * Add a node to a database, only if a node with the same identifier does not
    * exist yet.
    */
    private static Node addNode(GraphDatabaseService g, String id) 
        throws Exception {
        System.out.println("Adding node "+id);

        Transaction tx = g.beginTx();

        Node node = null ;
        try {
            IndexHits<Node> hits = 
                    g.index().getNodeAutoIndexer().getAutoIndex().get("ID", id);

            System.out.println("   Existing nodes in index: "+hits.size()+" "+hits.hasNext());
            if(hits.size() > 0 && hits.hasNext()) {
                System.out.print("   Duplicate: "+id);

                node = hits.getSingle();
                System.out.println(" --> "+node);
                return node;
            }

            node = g.createNode();
            node.setProperty("ID", id);

            tx.success();
        }
        catch(Exception e) {
            Logger.getLogger("App").log(Level.FINE,
                                        "Could not add node node "+id, e);
            throw e ;
        }
        finally {
            tx.finish();
        }

        System.out.println("   Node added: "+node);

        return node;
    }

    /**
    * Drop the refernce node from a database
    */
    private static void dropNeoReferenceNode(GraphDatabaseService neoGraph) {
        Transaction t = neoGraph.beginTx();
        try {
            Node node = neoGraph.getReferenceNode();
            if (node != null) {
                node.delete();
            }
            t.success();
        }
        catch (NotFoundException e) {
            Logger.getLogger("App").log(Level.FINE,
                                        "Could not drop reference node!", e);
            t.failure();
        }
        finally {
            t.finish();
        }
    }
}

'

Using property names with special characters in style in Data Browser does not work

@blevine: 'We have property names on nodes and relationships that use period '.' separators. This doesn't present a problem in Cypher queries as we just escape the property name by surrounding it with back single quotes. However, we can't seem to get these properties to display in the graph view of the Data Browser. When we specify something like {Node.name} in the style, "{Node.name}" is displayed rather than the value of that property. Using back single quotes here doesn't seem to work.

See discusion here https://groups.google.com/d/topic/neo4j/fCAt9p9uOpw/discussion'

neo4j server: http logs always show 200 status

@wfreeman: 'Even if the status was not 200... (which I found very confusing for several hours--and had several moments of self doubt, basing my knowledge on those log status codes 😄 ).

Maybe my expectations were wrong, but I don't see much use for that log if it doesn't show errors.'

Cannot use neo4j with lucene 4

@apatry: 'Lucene 4 introduced a breaking change (https://issues.apache.org/jira/browse/LUCENE-3396) that caused the following exception to be thrown in my project using neo4j 1.9.M01 and lucene 4:

Caused by: java.lang.VerifyError: class org.neo4j.index.impl.lucene.LuceneDataSource$1 overrides final method tokenStream.(Ljava/lang/String;Ljava/io/Reader;)Lorg/apache/lucene/analysis/TokenStream;
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:787)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:447)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    at org.neo4j.index.lucene.LuceneKernelExtension.start(LuceneKernelExtension.java:77)
    at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:489)
    ... 37 more
```'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.