Code Monkey home page Code Monkey logo

java-rest-binding's People

Contributors

amorgner avatar anirudhvyas avatar cmorgner avatar fakod avatar jexp avatar jphautin avatar nawroth avatar nickithewatt avatar pingles avatar quantisan avatar sarmbruster avatar simpsonjulian avatar tbaum avatar

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

java-rest-binding's Issues

Version 1.7.2 to maven repo?

I need the fix "RestPathParser zero length path" for neo4j-scala.

Is it possible to release java-rest-binding version 1.7.2 to the Neo4j Maven repository?

(1.7 is the last available version)

java.lang.UnsupportedOperationException for org.neo4j.rest.graphdb.AbstractRemoteDatabase.getKernelData(AbstractRemoteDatabase.java:99)

    GraphDatabaseService ds = new RestGraphDatabase("http://localhost:7474/db/data");
    Neo4jGraph graph = new Neo4jGraph(ds);


           Exception in thread "main" java.lang.UnsupportedOperationException
at org.neo4j.rest.graphdb.AbstractRemoteDatabase.getKernelData(AbstractRemoteDatabase.java:99)
at org.neo4j.rest.graphdb.RestGraphDatabase.getKernelData(RestGraphDatabase.java:33)
at com.tinkerpop.blueprints.impls.neo4j.Neo4jGraph.getInternalIndexKeys(Neo4jGraph.java:217)
at com.tinkerpop.blueprints.impls.neo4j.Neo4jGraph.loadKeyIndices(Neo4jGraph.java:168)
at com.tinkerpop.blueprints.impls.neo4j.Neo4jGraph.<init>(Neo4jGraph.java:132)
at com.ibm.wsa.huiwen.wordnet.LoadWordNet.main(LoadWordNet.java:38)

RuntimeException is thrown when calling getOrCreateNode in batch mode

The following code segment works fine if calling from RestAPI directly.

RestNode userNode = restApi.getOrCreateNode(restApi.index().forNodes("user-id"),
                "user-id", userId, null);
        if (userNode != null){
            logger.debug("user node " + userNode.getId() + " is created.");
        }

However if running in a batch mode, I got RuntimeException:

public BatchRestResult recordBatch(RestAPI restApi) {
        BatchRestResult result = new BatchRestResult();
        RestNode userNode = restApi.getOrCreateNode(restApi.index().forNodes("user-id"),
            "user-id", user.getUserId(), null);
java.lang.RuntimeException: Error retrieving or creating node for key user-id and value +972548172847 with index user-id
    at org.neo4j.rest.graphdb.ExecutingRestAPI.getOrCreateNode(ExecutingRestAPI.java:448)
    at org.neo4j.rest.graphdb.RestAPIFacade.getOrCreateNode(RestAPIFacade.java:223)

Spatial headache

Hi I deploy on an 1.9.1 neo4j server on ubuntu x64 13.04 with latest server plugin

neo4j-spatial-0.11-neo4j-1.9-server-plugin.zip

I put data with parameters both lat/lon equal to 5

and I do a query within distance with x=y=5 and radius 10

The snippet of creation of index

Index<Node> spatialindex;

 if(!index.existsForNodes("layer1"))
        {
            spatialindex = index.forNodes("layer1",SpatialIndexProvider.SIMPLE_POINT_CONFIG);            

        }
        else
        {
            spatialindex=index.forNodes("layer1");
        }

The snippet of addition

Node v = this.bgr.gds.createNode(); //creation
v.setProperty("lat", pkg.latitude);
v.setProperty("lon", pkg.longitude);
this.spatialindex.add(v,"dummy","value");

The snippet for searching

public Iterator<Node> queryPackagesSpatial(BiopolisSpatialQuery sq)
    {
        HashMap<String, Object> params = new HashMap<String, Object>();
        params.put(LayerNodeIndex.POINT_PARAMETER, new Double[]{sq.longitude,sq.latitude} );
        params.put(LayerNodeIndex.DISTANCE_IN_KM_PARAMETER, sq.radius);
        return this.bgr.pkg_mgmnt.spatialindex.query(LayerNodeIndex.WITHIN_DISTANCE_QUERY,params);
    }

It returns nothing. The snippets work on the client side

Neo4j graphDatabaseService blows up on context initialization if remote DB is down

When the Neo4j config is initialzed, and the remote DB is not running, the server will not start ..

<neo4j:config graphDatabaseService="graphDatabaseService" />
<bean id="graphDatabaseService class="org.springframework.data.neo4j.rest.SpringRestGraphDatabase">

is there a way to gracefully stop or halt it's creation when the server isn't running ?

This is a module in a much larger Application & I can't not start the app b/c Neo4j has stopped running ..

When delete relationships using Batch API, server error message is not propagated

Client and server in different machines

Client:

  • Neo4j lib 1.7.2
  • Neo4j rest graphdb 1.7
  • java version "1.6.0_24"
    OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu3)
    OpenJDK Client VM (build 20.0-b12, mixed mode)

Server:

  • neo4j 1.7.2
  • java version "1.7.0_03"
    OpenJDK Runtime Environment (IcedTea7 2.1.1pre) (7u3-2.1.1pre1-1ubuntu3)
    OpenJDK Client VM (build 22.0-b10, mixed mode, sharing)
15:22:20 [main] DEBUG i.c.b.m.a.RecreatePersonNodesFromLdap - Deleting 26 relationships: [5, 10, 3, 19, 7, 4, 16, 17, 22, 9, 18, 13, 1, 16, 11, 10, 8, 5, 20, 14, 11, 2, 21, 15, 12, 6]
Exception in thread "main" java.lang.RuntimeException: Error recreating Person nodes
        at id.co.bippo.mall.admin.RecreatePersonNodesFromLdap.run(RecreatePersonNodesFromLdap.java:205)
        at id.co.bippo.mall.admin.RecreatePersonNodesFromLdap.main(RecreatePersonNodesFromLdap.java:213)
Caused by: org.neo4j.rest.graphdb.RestResultException:  at
org.neo4j.server.rest.domain.BatchOperationFailedException: 
   org.neo4j.server.rest.web.BatchOperationService.performJob(BatchOperationService.java:176)
   org.neo4j.server.rest.web.BatchOperationService.performBatchOperations(BatchOperationService.java:131)
   sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   java.lang.reflect.Method.invoke(Method.java:601)
   com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
   com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
   com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
   com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
   com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
   com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
   com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
   com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
   com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
   com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
   com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
   com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
   com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
   com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
   org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
   org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
   org.neo4j.server.statistic.StatisticFilter.doFilter(StatisticFilter.java:62)
   org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
   org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
   org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
   org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
   org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
   org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
   org.mortbay.jetty.Server.handle(Server.java:326)
   org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
   org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)
   org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
   org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
   org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
   org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
   org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

        at org.neo4j.rest.graphdb.RestAPI.convertRequestResultToEntities(RestAPI.java:232)
        at org.neo4j.rest.graphdb.RestAPI.executeBatch(RestAPI.java:194)
        at id.co.bippo.mall.admin.RecreatePersonNodesFromLdap.run(RecreatePersonNodesFromLdap.java:101)
        ... 1 more

Unique Factory NPE in batch transaction

The example in the Neo4j docs won't work due to NPE:
http://docs.neo4j.org/chunked/milestone/transactions-unique-nodes.html

public Node getOrCreateUserWithUniqueFactory(String username, GraphDatabaseService graphDb ){    
    UniqueFactory<Node> factory = new UniqueFactory.UniqueNodeFactory(     graphDb, "users" )    {        
        @Override        
        protected void initialize( Node created, Map<String, Object> properties )        {  
    created.setProperty( "name", properties.get( "name" ) );        
        }    
    };     
    return factory.getOrCreate( "name", username );
}

The issue is at the factory.getOrCreate throws a NPE if Batch Transactions are enabled:
Exception in thread "main" java.lang.NullPointerException
at org.neo4j.rest.graphdb.index.SimpleIndexHits.getSingle(SimpleIndexHits.java:67)
at org.neo4j.rest.graphdb.index.SimpleIndexHits.getSingle(SimpleIndexHits.java:37)
at org.neo4j.graphdb.index.UniqueFactory.getOrCreate(UniqueFactory.java:197)

The problem is due to I think:

    public T getSingle() {
        Iterator<Object> it = hits.iterator();
        return it.hasNext() ? transform(it.next()) : null;
    }

"hits" is null causing the error.

2.0.2 release

@jexp is it possible to get a 2.0.2 release or 2.0.2-SNAPSHOT at http://m2.neo4j.org/content/repositories/snapshots/?

Unit testing class not packaged?

Hi,

I'm trying to figure out how to do unit tests with this rest-interface. As I can see in the tests of the project, you are using RestTestBase in the tests. Is that what I am looking for? If yes, why is it not packaged?

The other option would be to start a new local neo4j rest server on every test-run. This seems to be a bit overkill to me.

How is it meant to be done?

Thank you!

Dependency?

I added the dependency for my Maven project using the IntelliJ IDE like:

org.neo4j neo4j-rest-graphdb 1.8.M07

But I get the error:

Dependeny "org.neo4j:neo4j:neo4j-rest-graphdb:1.8.M07" not found more.... (CTRL+F1)

Rest Query Socket timeout control

org.neo4j.rest.graphdb.query.RestCypherQueryEngine.query()

When calling this method it would be useful to be able to control the timeout of the underlying socket. The current read timeout appears to be 30 seconds by default.

Cannot query Lucene "*:*" using REST GraphDb

This works:

final QueryResult<Map<String, Object>> rows = cypher.query("START n=node:berbatikPerson('*:*') RETURN id(n) AS nodeId LIMIT 100", new HashMap<String, Object>());

While a direct Lucene query won't work :

graphDb.index().forNodes("berbatik").query("*:*")

UnsupportedOperationException - RestRelationshipIndex.query

RelationShipIndex not implemented.

RelationshipIndex idx = index.forRelationships("my_rels");
Relationship rel = idx.query("name:myname AND age:30", node1, node2).getSingle();

https://github.com/neo4j/java-rest-binding/blob/master/src/main/java/org/neo4j/rest/graphdb/index/RestRelationshipIndex.java

Exception in thread "main" java.lang.UnsupportedOperationException
    at org.neo4j.rest.graphdb.index.RestRelationshipIndex.query(RestRelationshipIndex.java:47)

2.0.1 conflict with neo4j-kernel's package version of org.neo4j.helpers.collection.WrappingResourceIterator

I'm getting

java.lang.IllegalAccessError: org/neo4j/helpers/collection/WrappingResourceIterator

in a project with neo4j 2.0.1.
It looks like there is a version of org.neo4j.helpers.collection.WrappingResourceIterator in neo4j-kernel.jar which is package protected https://github.com/neo4j/neo4j/blob/master/community/kernel/src/main/java/org/neo4j/helpers/collection/WrappingResourceIterator.java

The kernel version gets picked up first and cause the error.
Not sure which version is the original and what's the reason for the duplication?

Create Unique - NullPointerException

When I run this query in the Neo4j webadmin it runs perfectly:

start a = node(0) 
create unique a-[:Rel]->(b{key:'prop'})

However, when I use the above query like this:

GraphDatabaseService graphDb = new RestGraphDatabase("http://localhost:7474/db/data");

String query = "start a = node(0) "+
    "create unique a-[:Rel]->(b{key:'prop'})";  

ExecutionEngine engine = new ExecutionEngine( graphDb );        
engine.execute(query);

It results in a NullPointerException

Exception in thread "main" java.lang.NullPointerException
    at org.neo4j.cypher.internal.mutation.CreateUniqueAction$$anonfun$exec$2.apply(CreateUniqueAction.scala:53)
    at org.neo4j.cypher.internal.mutation.CreateUniqueAction$$anonfun$exec$2.apply(CreateUniqueAction.scala:53)
    at scala.collection.immutable.List.foreach(List.scala:309)
    at org.neo4j.cypher.internal.mutation.CreateUniqueAction.exec(CreateUniqueAction.scala:53)
    at org.neo4j.cypher.internal.pipes.ExecuteUpdateCommandsPipe.org$neo4j$cypher$internal$pipes$ExecuteUpdateCommandsPipe$$exec(ExecuteUpdateCommandsPipe.scala:56)
    at org.neo4j.cypher.internal.pipes.ExecuteUpdateCommandsPipe$$anonfun$org$neo4j$cypher$internal$pipes$ExecuteUpdateCommandsPipe$$executeMutationCommands$1$$anonfun$apply$1.apply(ExecuteUpdateCommandsPipe.scala:47)
    at org.neo4j.cypher.internal.pipes.ExecuteUpdateCommandsPipe$$anonfun$org$neo4j$cypher$internal$pipes$ExecuteUpdateCommandsPipe$$executeMutationCommands$1$$anonfun$apply$1.apply(ExecuteUpdateCommandsPipe.scala:47)
    at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
    at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
    at scala.collection.immutable.List.foreach(List.scala:309)
    at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:251)
    at scala.collection.AbstractTraversable.flatMap(Traversable.scala:105)
    at org.neo4j.cypher.internal.pipes.ExecuteUpdateCommandsPipe$$anonfun$org$neo4j$cypher$internal$pipes$ExecuteUpdateCommandsPipe$$executeMutationCommands$1.apply(ExecuteUpdateCommandsPipe.scala:47)
    at org.neo4j.cypher.internal.pipes.ExecuteUpdateCommandsPipe$$anonfun$org$neo4j$cypher$internal$pipes$ExecuteUpdateCommandsPipe$$executeMutationCommands$1.apply(ExecuteUpdateCommandsPipe.scala:47)
    at scala.collection.immutable.Stream.foldLeft(Stream.scala:563)
    at org.neo4j.cypher.internal.pipes.ExecuteUpdateCommandsPipe.org$neo4j$cypher$internal$pipes$ExecuteUpdateCommandsPipe$$executeMutationCommands(ExecuteUpdateCommandsPipe.scala:47)
    at org.neo4j.cypher.internal.pipes.ExecuteUpdateCommandsPipe$$anonfun$internalCreateResults$1.apply(ExecuteUpdateCommandsPipe.scala:40)
    at org.neo4j.cypher.internal.pipes.ExecuteUpdateCommandsPipe$$anonfun$internalCreateResults$1.apply(ExecuteUpdateCommandsPipe.scala:39)
    at scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371)
    at org.neo4j.cypher.internal.pipes.EmptyResultPipe.internalCreateResults(EmptyResultPipe.scala:28)
    at org.neo4j.cypher.internal.pipes.PipeWithSource.createResults(Pipe.scala:64)
    at org.neo4j.cypher.internal.executionplan.ExecutionPlanImpl.org$neo4j$cypher$internal$executionplan$ExecutionPlanImpl$$prepareStateAndResult(ExecutionPlanImpl.scala:160)
    at org.neo4j.cypher.internal.executionplan.ExecutionPlanImpl$$anonfun$6.apply(ExecutionPlanImpl.scala:139)
    at org.neo4j.cypher.internal.executionplan.ExecutionPlanImpl$$anonfun$6.apply(ExecutionPlanImpl.scala:138)
    at org.neo4j.cypher.internal.executionplan.ExecutionPlanImpl.execute(ExecutionPlanImpl.scala:38)
    at org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:72)
    at org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:67)
    at org.neo4j.cypher.javacompat.ExecutionEngine.execute(ExecutionEngine.java:66)

I used the latest version of java-rest-binding on github and version 1.9.M05 for development and server.

ConcurrentModificationException

Copied over from the Neo4j bug tracker:

@ceefour: 'Very strange error... I'm not doing anything multi-threaded here...

Stack trace:

Exception in thread "main" java.lang.RuntimeException: Error recreating Product nodes
        at id.co.bippo.mall.admin.RecreateProductNodesFromMagento.run(RecreateProductNodesFromMagento.java:234)
        at id.co.bippo.mall.admin.RecreateProductNodesFromMagento.main(RecreateProductNodesFromMagento.java:242)
Caused by: java.util.ConcurrentModificationException
        at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(LinkedHashMap.java:390)
        at java.util.LinkedHashMap$ValueIterator.next(LinkedHashMap.java:405)
        at org.neo4j.rest.graphdb.RestAPI.updateRestOperations(RestAPI.java:254)
        at org.neo4j.rest.graphdb.RestAPI.executeBatch(RestAPI.java:195)
        at id.co.bippo.mall.admin.RecreateProductNodesFromMagento.run(RecreateProductNodesFromMagento.java:192)
        ... 1 more

Code snippet to trigger :

for (final List<Product> productBatch : Lists.partition(products, 100)) {
    // map productID -> RestNode
    Map<String, Node> nodes = restApi.executeBatch(new BatchCallback<Map<String, Node>>() {
        @Override
        public Map<String, Node> recordBatch(RestAPI batchRestApi) {
            RestIndex<Node> productIndex = batchRestApi.index().forNodes(neo4jPrefix + "Product");
            Map<String, Node> nodes = new HashMap<String, Node>();
            for (Product product : productBatch) {
                HashMap<String,Object> map = new HashMap<String, Object>();
                map.put("kind", "Product");
                map.put("_rowId", product.getSku());
                map.put("slug", "");
                map.put("shopId", "");
                map.put("name", product.getName());
                map.put("photoId", "" );
                RestNode node = batchRestApi.createNode(map);

                productIndex.add(node, "_rowId", product.getSku());
                productIndex.add(node, "shopId", "");

                nodes.put(product.getSku(), node);
            }
            return nodes;
        }
    });

    Map<String, Long> nodeIds = Maps.transformValues(nodes, new Function<Node, Long>() {
        @Override
        public Long apply(Node node) {
            return node.getId();
        }
    });

    productNodeIds.putAll(nodeIds);
    log.info("Created {} Product nodes so far, added {} more: {}", new Object[] {
            productNodeIds.size(), nodeIds.size(), nodeIds });
}

Only happened once. Running the exact same code makes the problem "go away". :('

NullPointerException in ExecutionEngine on startup

Upon startup when using RestGraphDatabase as the GraphDatabaseService the following query is executed via the neo4j-cypher library:

MATCH (ref:ReferenceNode {name:{name}}) RETURN ref;

Which results in a NullPointerException. The reason why is as follows.

Within the ExecutionEngine at line 75 we have:

val statement = txBridge.instance()

The txBridge is null which causes the NPE. txBridge is defined on line 112 as:

private val txBridge = graph.asInstanceOf[GraphDatabaseAPI]
    .getDependencyResolver
    .resolveDependency(classOf[ThreadToStatementContextBridge])

The call to getDependencyResolver is causing the issue. In v2.0.0 of RestGraphDatabase at line 115:

@Override
public DependencyResolver getDependencyResolver() {
return new DependencyResolver.Adapter() {
    @Override
    public <T> T resolveDependency(Class<T> type, SelectionStrategy selector) throws IllegalArgumentException {
    if (TransactionManager.class.isAssignableFrom(type)) return (T)getTxManager();
    return null;
    }
};
}

The passed in type of ThreadToStatementContextBridge results in null being returned which manifests as the NPE in the ExecutionEngine.

In the latest version of RestGraphDatabase the getDependencyResolver has now been reomved which now results in:

Caused by: java.lang.UnsupportedOperationException
    at org.neo4j.rest.graphdb.AbstractRemoteDatabase.getDependencyResolver(AbstractRemoteDatabase.java:148)

My Dependencies:

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-neo4j</artifactId>
        <version>3.0.0.RC1</version>
        <exclusions>
            <exclusion>
                <groupId>org.neo4j</groupId>
                <artifactId>neo4j-cypher</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j-rest-graphdb</artifactId>
        <version>2.0.0-M06</version>
    </dependency>

    <dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j-cypher-dsl</artifactId>
        <version>2.0.1</version>
    </dependency>

    <dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j-cypher</artifactId>
        <version>2.0.1</version>
    </dependency>

Support Neo4j 1.9

Neo4j has hit it's 4th milestone now, but we still have no usable java rest api for it.

Failed tests preventing build: BatchRestAPITest exceptions

Way to reproduce:

  • clone repository
  • import project in Netbeans 7.2
  • right-click on the project "Neo4j - Rest GraphDatabaseService Wrapper"
  • select Show and Resolve Problems to import the dependencies locally
  • once done, select Build with Dependencies

Tests in error:
testCreateLargeSetOfNodes(org.neo4j.rest.graphdb.BatchRestAPITest): java.io.IOException: Error writing request body to server
testDeleteNodeAndRelationshipsInBatch(org.neo4j.rest.graphdb.BatchRestAPITest): Node[44] not found.
testDeleteNodeAndRelationshipsInBatch(org.neo4j.rest.graphdb.BatchRestAPITest)

Tests run: 227, Failures: 0, Errors: 3, Skipped: 3

Tests fail with the following exceptions:


Test set: org.neo4j.rest.graphdb.BatchRestAPITest

Tests run: 18, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 430.564 sec <<< FAILURE!
testCreateLargeSetOfNodes(org.neo4j.rest.graphdb.BatchRestAPITest) Time elapsed: 400.286 sec <<< ERROR!
com.sun.jersey.api.client.ClientHandlerException: java.io.IOException: Error writing request body to server
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:131)
at org.neo4j.rest.graphdb.UserAgent$1.handle(UserAgent.java:68)
at com.sun.jersey.api.client.Client.handle(Client.java:616)
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:559)
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:72)
at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:494)
at org.neo4j.rest.graphdb.ExecutingRestRequest.post(ExecutingRestRequest.java:150)
at org.neo4j.rest.graphdb.ExecutingRestAPI.batch(ExecutingRestAPI.java:522)
at org.neo4j.rest.graphdb.batch.BatchRestAPI.executeBatchRequest(BatchRestAPI.java:135)
at org.neo4j.rest.graphdb.BatchTransaction.finish(BatchTransaction.java:74)
at org.neo4j.rest.graphdb.RestAPIFacade.executeBatch(RestAPIFacade.java:311)
at org.neo4j.rest.graphdb.BatchRestAPITest.testCreateLargeSetOfNodes(BatchRestAPITest.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: java.io.IOException: Error writing request body to server
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:2809)
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:2792)
at com.sun.jersey.api.client.CommittingOutputStream.write(CommittingOutputStream.java:90)
at com.sun.jersey.core.util.ReaderWriter.writeTo(ReaderWriter.java:115)
at com.sun.jersey.core.provider.AbstractMessageReaderWriterProvider.writeTo(AbstractMessageReaderWriterProvider.java:76)
at com.sun.jersey.core.impl.provider.entity.InputStreamProvider.writeTo(InputStreamProvider.java:98)
at com.sun.jersey.core.impl.provider.entity.InputStreamProvider.writeTo(InputStreamProvider.java:59)
at com.sun.jersey.api.client.TerminatingClientHandler.writeRequestEntity(TerminatingClientHandler.java:305)
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:182)
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:129)
... 44 more

testDeleteNodeAndRelationshipsInBatch(org.neo4j.rest.graphdb.BatchRestAPITest) Time elapsed: 0.03 sec <<< ERROR!
org.neo4j.graphdb.NotFoundException: Node[44] not found.
at org.neo4j.kernel.impl.core.NodeManager.getNodeForProxy(NodeManager.java:399)
at org.neo4j.kernel.InternalAbstractGraphDatabase$5.lookup(InternalAbstractGraphDatabase.java:701)
at org.neo4j.kernel.impl.core.NodeProxy.delete(NodeProxy.java:67)
at org.neo4j.rest.graphdb.Neo4jDatabaseCleaner.removeNodes(Neo4jDatabaseCleaner.java:71)
at org.neo4j.rest.graphdb.Neo4jDatabaseCleaner.cleanDb(Neo4jDatabaseCleaner.java:53)
at org.neo4j.rest.graphdb.LocalTestServer.cleanDb(LocalTestServer.java:176)
at org.neo4j.rest.graphdb.RestTestBase.setUp(RestTestBase.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

testDeleteNodeAndRelationshipsInBatch(org.neo4j.rest.graphdb.BatchRestAPITest) Time elapsed: 0.03 sec <<< ERROR!
java.lang.NullPointerException
at org.neo4j.rest.graphdb.RestTestBase.tearDown(RestTestBase.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

at org.neo4j.rest.graphdb.entity.RestEntity.getEntityId(RestEntity.java:157) error

call node.getId() ,get following error:

java.lang.NumberFormatException: For input string: "{1}"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Long.parseLong(Long.java:410)
at java.lang.Long.parseLong(Long.java:468)
at org.neo4j.rest.graphdb.entity.RestEntity.getEntityId(RestEntity.java:157)
at org.neo4j.rest.graphdb.entity.RestEntity.getId(RestEntity.java:161)

error for both server 1.9.M02 and 1.8.1

QueryResult is not closing itself.

Problem issues are documented here:

http://stackoverflow.com/questions/16148190/neo4j-queryresult-wont-exit

Currently I have this class. When I remove QueryResult it runs the main method and completes on its own. When I add QueryResult I need to manually kill the run.

public class TestConnect {
public static void main(String[] args) {
System.out.println("starting test");
final RestAPI api = new RestAPIFacade("http://localhost:7474/db/data");
System.out.println("API created");
final RestCypherQueryEngine engine = new RestCypherQueryEngine(api);
System.out.println("engine created");
QueryResult<Map<String,Object>> result = engine.query("start n=node({id}) return n;", map("id",0));
}
}

lack of Documentation

I have a hard time trying to use the java-rest-bindings. There is no real API documentation, and in general I only can find how to make "raw" REST requests. If there is no documentation/tutorial at all, I'll expect at least meaningful javadocs. For example:
new RestCypherQueryEngine(RestApi, ResultConverter).
It starts with the Question "What Is a Result Converter, for what do I need it, And what happens if I use the other Constructor...". If you have an instance of it and want to call its 'query' Method, WHAT the hell is the Map<String, Object> supposed to do?
No documentation/JavaDoc at all! How do you expect developers to use this java-rest-binding library? By trial and error, or not at all?
If I purchase an Neo4jEnterprise licence will I get documentation/support for this java-rest-binding API?

Cannot call batchRestApi.getNodeById() inside BatchCallback

This won't work:

graphDb.getRestAPI().executeBatch(new BatchCallback<Void>() {
    @Override
    public Void recordBatch(RestAPI batchRestApi) {
        Node node = batchRestApi.getNodeById(nodeId);
        for (Relationship rel : node.getRelationships()) {
            rel.delete();
        }
        node.delete();
        return null;
    }
});

The workaround is: (for this specific case only)

graphDb.getRestAPI().executeBatch(new BatchCallback<Void>() {
    @Override
    public Void recordBatch(RestAPI batchRestApi) {
        batchRestApi.deleteEntity(new RestEntity("/node/" + nodeId, batchRestApi));
        return null;
    }
});

NullPointerException in ExecutionEngine

Hi, I'm developing a Maven plugin and I'm running an issue whenever I try to execute following Cypher query against a remote graph database (v2.1.2):

MATCH (changelog:__LiquigraphChangelog)<-[exec:EXECUTED_WITHIN_CHANGELOG]-(changeset:__LiquigraphChangeset)
RETURN changeset
ORDER BY exec.order ASC

Here is the Java code:

ExecutionEngine engine = new ExecutionEngine(graphDatabase);
try (Transaction transaction = graphDatabase.beginTx()) {
    for (Map<String, Object> columns : engine.execute(QUERY_ABOVE)) { // line 26
        Node node = (Node) columns.get("changeset");
        changesets.add(changeset(node));
    }
    transaction.success();
}

This is the stack I get from Neo4j jar (2.0.0 to 2.0.4):

Caused by: java.lang.NullPointerException
    at org.neo4j.cypher.ExecutionEngine.prepare(ExecutionEngine.scala:75)
    at org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:60)
    at org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:55)
    at org.neo4j.cypher.javacompat.ExecutionEngine.execute(ExecutionEngine.java:65)
    at com.liquigraph.core.writer.ChangelogReader.read(ChangelogReader.java:26)

This is the stack I get from 2.1.0 to 2.1.3:

Caused by: java.lang.NullPointerException
    at org.neo4j.cypher.internal.compiler.v2_1.Monitors.newMonitor(Monitors.scala:32)
    at org.neo4j.cypher.internal.compiler.v2_1.CypherCompilerFactory$.ronjaCompiler(CypherCompiler.scala:66)
    at org.neo4j.cypher.internal.CypherCompiler.<init>(CypherCompiler.scala:58)
    at org.neo4j.cypher.ExecutionEngine.createCompiler(ExecutionEngine.scala:141)
    at org.neo4j.cypher.ExecutionEngine.<init>(ExecutionEngine.scala:48)
    at org.neo4j.cypher.javacompat.ExecutionEngine.createInnerEngine(ExecutionEngine.java:59)
    at org.neo4j.cypher.javacompat.ExecutionEngine.<init>(ExecutionEngine.java:43)
    at com.liquigraph.core.writer.ChangelogReader.read(ChangelogReader.java:24)

From 2.1.4 to 2.1.5:

Caused by: java.lang.NullPointerException
    at org.neo4j.cypher.ExecutionEngine.createCompiler(ExecutionEngine.scala:149)
    at org.neo4j.cypher.ExecutionEngine.<init>(ExecutionEngine.scala:48)
    at org.neo4j.cypher.javacompat.ExecutionEngine.createInnerEngine(ExecutionEngine.java:59)
    at org.neo4j.cypher.javacompat.ExecutionEngine.<init>(ExecutionEngine.java:43)
    at com.liquigraph.core.writer.ChangelogReader.read(ChangelogReader.java:24)

I guess I'm doing something wrong, but I don't know what.

Btw, I'm using neo4j-rest-graphdb in 2.0.1 version.
Interestingly, the NPE moved from query execution in 2.0.x to the ExecutionEngine instantiation in 2.1.x.

Could the latter be due to an incompatibility between rest-graph-db and neo4j v. 2.1.x ?
I'll dig deeper into the issue today and keep you updated.

Executing Rest API throws a generic RuntimeException - Need more details

When the result of an operation is neither OK or CREATED, a plain RuntimeException with user inputs is thrown - as opposed to RequestResult's details:

if (result.statusIs(Response.Status.CREATED) || result.statusIs(Response.Status.OK)) {
return (RestRelationship)createExtractor().convertFromRepresentation(result);
}
throw new RuntimeException(String.format("Error retrieving or creating relationship for key %s and value %s with index %s", key, value, index.getIndexName()));

Propose to add client response and other details to runtime exception so that rest api java users can figure out whats going on.

"RestGraphDatabase" can not work with tinkerpop blueprints "Neo4jGraph"

hi, all, I am recently using tinkerpop blueprints stack as RDF triple store engine, and i try java-rest-binding api like this:

GraphDatabaseService ds = new RestGraphDatabase("http://localhost:7474/db/data");
Neo4jGraph graph = new Neo4jGraph(ds); //blueprints.impls.neo4j.Neo4jGraph

pop up a exception:
Exception in thread "main" java.lang.ClassCastException: org.neo4j.rest.graphdb.RestGraphDatabase cannot be cast to org.neo4j.kernel.InternalAbstractGraphDatabase

it seems "RestGraphDatabase" is not a subclass of "InternalAbstractGraphDatabase", is there any chance that i can work around this exception , so that i can reuse the whole blueprints stack for rdf sail processing ~

Unable to add label using Neo4j Rest API - Error reading as JSON ''

The neo4j rest api throws runtime exception (error reading as JSON '') when trying to add a label.

My current set up

org.neo4j neo4j-rest-graphdb 2.0.0 org.neo4j neo4j 2.0.0 org.neo4j.app neo4j-server 2.0.0 Code that tries to create a new node and add a property and label. The runtime exception is thrown when we try to add the label. The rollback is working fine though. It appears that the API is trying to get details for the resource that is not yet created and trying to parse the response.

try ( Transaction tx = db.beginTx() ) {
//create new user
Node userNode = db.createNode();
userNode.setProperty( "id", id );
userNode.addLabel(DynamicLabel.label("GuestUser")); //throws runtime exception
tx.success();
}
Stack trace

java.lang.RuntimeException: Error reading as JSON ''
at org.neo4j.rest.graphdb.util.JsonHelper.readJson(JsonHelper.java:57)
at org.neo4j.rest.graphdb.util.JsonHelper.jsonToSingleValue(JsonHelper.java:62)
at org.neo4j.rest.graphdb.RequestResult.toEntity(RequestResult.java:114)
at org.neo4j.rest.graphdb.RequestResult.toMap(RequestResult.java:120)
at org.neo4j.rest.graphdb.ExecutingRestAPI.getData(ExecutingRestAPI.java:501)
at org.neo4j.rest.graphdb.RestAPIFacade.getData(RestAPIFacade.java:179)
at org.neo4j.rest.graphdb.entity.RestEntity.getStructuralData(RestEntity.java:75)
at org.neo4j.rest.graphdb.entity.RestNode.labelsPath(RestNode.java:188)
at org.neo4j.rest.graphdb.entity.RestNode.addLabel(RestNode.java:147)

Caused by: java.io.EOFException: No content to map to Object due to end of input
at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2775)
...
at org.neo4j.rest.graphdb.util.JsonHelper.readJson(JsonHelper.java:55)
... 43 more

http://stackoverflow.com/questions/21169571/unable-to-add-label-using-neo4j-rest-api-error-reading-as-json

Implement schema support

public class RestGraphDatabase extends AbstractRemoteDatabase {
[...]
public Schema schema() {
throw new UnsupportedOperationException();
}

Failed tests preventing build

Failed tests:
testEnableDisableAutoIndexerRelationship(org.neo4j.rest.graphdb.RestAutoIndexTest)
testAddRemoveAutoIndexerPropertiesOnNodes(org.neo4j.rest.graphdb.RestAutoIndexTest)
testAddRemoveAutoIndexerPropertiesOnRelationships(org.neo4j.rest.graphdb.RestAutoIndexTest)

Create node with labels

It is possible to create a node with labels directly? Right now I am implementing a cypher query but would be nice if the create method from RestApi would support it (branch 2.0-labels-...)
The reason is to be able to use constraints. If we first create the node and then the label a constraint will not "constraint" until the node has not been created. As a result we have a node without label that has ignored a constraint.

batchRestApi.deleteEntity(new RestEntity("/node/" + nodeId, batchRestApi)); throws org.codehaus.jackson.JsonParseException: Unexpected character ('<' (code 60)) when node has relationships

Trying to use batchRestApi.deleteEntity() to delete a node with relationships causes this error:

Exception in thread "main" java.lang.RuntimeException: Error recreating Product nodes
    at id.co.bippo.mall.admin.RecreateProductNodesFromMagento.run(RecreateProductNodesFromMagento.java:199)
    at id.co.bippo.mall.admin.RecreateProductNodesFromMagento.main(RecreateProductNodesFromMagento.java:207)
Caused by: java.lang.RuntimeException: org.codehaus.jackson.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: java.io.StringReader@7786f3b3; line: 1, column: 2]
    at org.neo4j.rest.graphdb.util.JsonHelper.readJson(JsonHelper.java:56)
    at org.neo4j.rest.graphdb.RestAPI.convertRequestResultToEntities(RestAPI.java:230)
    at org.neo4j.rest.graphdb.RestAPI.executeBatch(RestAPI.java:194)
    at id.co.bippo.mall.admin.RecreateProductNodesFromMagento.run(RecreateProductNodesFromMagento.java:92)
    ... 1 more
Caused by: org.codehaus.jackson.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: java.io.StringReader@7786f3b3; line: 1, column: 2]
    at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1291)
    at org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:385)
    at org.codehaus.jackson.impl.JsonParserMinimalBase._reportUnexpectedChar(JsonParserMinimalBase.java:306)
    at org.codehaus.jackson.impl.ReaderBasedParser._handleUnexpectedValue(ReaderBasedParser.java:628)
    at org.codehaus.jackson.impl.ReaderBasedParser.nextToken(ReaderBasedParser.java:362)
    at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2432)
    at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2389)
    at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1595)
    at org.neo4j.rest.graphdb.util.JsonHelper.readJson(JsonHelper.java:54)
    ... 4 more

Which is not clear and misleading. Server error log:

Jul 8, 2012 3:51:57 PM org.mortbay.log.Slf4jLog warn
SEVERE: /db/data/batch
org.neo4j.graphdb.TransactionFailureException: Unable to commit transaction
        at org.neo4j.kernel.TopLevelTransaction.finish(TopLevelTransaction.java:131)
        at org.neo4j.server.rest.web.BatchOperationService.performBatchOperations(BatchOperationService.java:148)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
        at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
        at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
        at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
        at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
        at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
        at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
        at org.neo4j.server.statistic.StatisticFilter.doFilter(StatisticFilter.java:62)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
        at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
        at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
        at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
        at org.mortbay.jetty.Server.handle(Server.java:326)
        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
        at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
        at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
        at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: javax.transaction.HeuristicRollbackException: Failed to commit, transaction rolledback ---> org.neo4j.kernel.impl.nioneo.store.InvalidRecordException: Node record Node[7364,used=false,rel=11507,prop=9617] still has relationships
        at org.neo4j.kernel.impl.transaction.TxManager.commit(TxManager.java:521)
        at org.neo4j.kernel.impl.transaction.TxManager.commit(TxManager.java:406)
        at org.neo4j.kernel.impl.transaction.TransactionImpl.commit(TransactionImpl.java:117)
        at org.neo4j.kernel.TopLevelTransaction.finish(TopLevelTransaction.java:115)
        ... 37 more
Caused by: org.neo4j.kernel.impl.nioneo.store.InvalidRecordException: Node record Node[7364,used=false,rel=11507,prop=9617] still has relationships
        at org.neo4j.kernel.impl.nioneo.xa.WriteTransaction.doPrepare(WriteTransaction.java:175)
        at org.neo4j.kernel.impl.transaction.xaframework.XaTransaction.prepare(XaTransaction.java:299)
        at org.neo4j.kernel.impl.transaction.xaframework.XaResourceManager.commit(XaResourceManager.java:435)
        at org.neo4j.kernel.impl.transaction.xaframework.XaResourceHelpImpl.commit(XaResourceHelpImpl.java:64)
        at org.neo4j.kernel.impl.transaction.TransactionImpl.doCommit(TransactionImpl.java:541)
        at org.neo4j.kernel.impl.transaction.TxManager.commit(TxManager.java:444)
        ... 40 more

cannot compile - "cannot find parent: com.sun.jersey"

Once I cloned the java-rest-binding locally, I ran mvn package and got the following:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Neo4j - Rest GraphDatabaseService Wrapper
[INFO]    task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[INFO] [license:check {execution: check-licenses}]
[INFO] Checking licenses...
[debug] execute contextualize
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/chris/workspace/java-rest-binding/src/main/resources
[INFO] skip non existing resourceDirectory /home/chris/workspace/java-rest-binding/src/main/resources/META-INF
[INFO] Copying 4 resources to META-INF
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: null:jersey-server:bundle:null

Reason: Cannot find parent: com.sun.jersey:jersey-project for project: null:jersey-server:bundle:null for project null:jersey-server:bundle:null


[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5 seconds
[INFO] Finished at: Fri Feb 01 11:53:38 GMT 2013
[INFO] Final Memory: 63M/356M
[INFO] ------------------------------------------------------------------------

Just to confirm, this is a jersey issue isn't it?

cannot process big batch > 8k

Hello, I found the following bug in your library.
https://github.com/neo4j/java-rest-binding/blob/1.8.RC1/src/main/java/org/neo4j/rest/graphdb/ExecutingRestRequest.java
private InputStream toInputStream(Object data) {
try {
if (data instanceof InputStream) return (InputStream) data;
PipedInputStream inputStream = new PipedInputStream(8 * 1024);
PipedOutputStream outputStream = new PipedOutputStream(inputStream);
StreamJsonHelper.writeJsonTo(data, outputStream);
return inputStream;
} catch (IOException e) {
throw new RuntimeException("Error writing "+data+" to stream",e);
}
}
Here you have buffer of 8kB: new PipedInputStream(8 * 1024);
But when I have big json request s your library hangs on: the following code:

https://github.com/neo4j/java-rest-binding/blob/1.8.RC1/src/main/java/org/neo4j/rest/graphdb/util/StreamJsonHelper.java
public static void writeJsonTo( Object data , OutputStream stream) {
try {
JsonGenerator generator = OBJECT_MAPPER.getJsonFactory()
.createJsonGenerator(stream);
OBJECT_MAPPER.writeValue(generator, data);
stream.close();
} catch ( IOException e ) {
throw new RuntimeException( e );
}
}

Here the code block on this line: OBJECT_MAPPER.writeValue(generator, data);
The problem actually is that when you try to write big data (more than 8kB) to the outputStream , then the code hangs.

Please provide the fix for this issue, because your library is not able to process big messages.

Regards,

Vasil Yordanov

[email protected]

getReferenceNode throws Error

We are trying to switch from running as an embedded DB to using a Neo4j server and hit a consistent problem. It's occurring frequently enough that there must be something obvious we are doing wrong. This error shows up lots of places, but this is the simplest example I have.

In a call to myRestGraphDb.getReferenceNode(), we get the following:

Exception in thread "main" java.lang.RuntimeException: Error reading as JSON ''
at org.neo4j.rest.graphdb.util.JsonHelper.readJson(JsonHelper.java:57)
at org.neo4j.rest.graphdb.util.JsonHelper.jsonToSingleValue(JsonHelper.java:62)
at org.neo4j.rest.graphdb.RequestResult.toEntity(RequestResult.java:114)
at org.neo4j.rest.graphdb.RequestResult.toMap(RequestResult.java:120)
at org.neo4j.rest.graphdb.ExecutingRestAPI.getReferenceNode(ExecutingRestAPI.java:263)
at org.neo4j.rest.graphdb.RestAPIFacade.getReferenceNode(RestAPIFacade.java:107)
at org.neo4j.rest.graphdb.RestGraphDatabase.getReferenceNode(RestGraphDatabase.java:69)
at com.rootmusic.data.hadoop.database.neo4j.NeoQueryHelper.clearReference(NeoQueryHelper.java:203)
at com.rootmusic.data.hadoop.database.neo4j.BuildNeo.testRemote(BuildNeo.java:189)
at com.rootmusic.data.hadoop.database.neo4j.BuildNeo.main(BuildNeo.java:34)
Caused by: java.io.EOFException: No content to map to Object due to end of input
at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2437)
at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2389)
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1595)
at org.neo4j.rest.graphdb.util.JsonHelper.readJson(JsonHelper.java:55)
... 9 more

This error also occurs when we call node.getSingleRelationship and there does not exist a relationship. The embedded code returns null. The rest API throws the same exceptions.

We are using:

 Neoj4 1.8.M07 for both embedded and on the server   
 jackson-mapper-asl 1.8.5
 java 1.6
 server is running on Amazon AWS linux, clients are mac w/ OS X and PC w/ linux (same error on both clients)

Any thoughts, suggestions or solutions would be appreciated.

Warm regards,
Wallace

Neo4j - Java Heap Space Error - TraversalDescription.traverse(Node);

If maxDepth is 3 code runs fine, if maxDepth = 4 this code hangs @ the call to td.traverse(start) (~line 38) & then I get:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:2882) at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100) at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:515) at java.lang.StringBuilder.append(StringBuilder.java:189) at com.sun.jersey.core.util.ReaderWriter.readFromAsString(ReaderWriter.java:172) at com.sun.jersey.core.util.ReaderWriter.readFromAsString(ReaderWriter.java:157) at com.sun.jersey.core.provider.AbstractMessageReaderWriterProvider.readFromAsString(AbstractMessageReaderWriterProvider.java:114) at com.sun.jersey.core.impl.provider.entity.StringProvider.readFrom(StringProvider.java:73) at com.sun.jersey.core.impl.provider.entity.StringProvider.readFrom(StringProvider.java:58) at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:552) at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:505) at org.neo4j.rest.graphdb.RequestResult.extractFrom(RequestResult.java:87) at org.neo4j.rest.graphdb.ExecutingRestRequest.post(ExecutingRestRequest.java:138) at org.neo4j.rest.graphdb.ExecutingRestAPI.traverse(ExecutingRestAPI.java:486) at org.neo4j.rest.graphdb.RestAPIFacade.traverse(RestAPIFacade.java:202) at org.neo4j.rest.graphdb.traversal.RestTraversal.traverse(RestTraversal.java:162) at com.tr.cmg.alloy.dao.psd.RelationalPathSearchDAO.executeRelationalPathSearch(RelationalPathSearchDAO.java:38) at com.tr.cmg.alloy.dao.psd.RelationalPathSearchDAO.main(RelationalPathSearchDAO.java:115)

code ...

package com.tr.cmg.alloy.dao.psd;

import java.util.ArrayList;

import org.neo4j.graphdb.Direction;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Path;
import org.neo4j.graphdb.Relationship;
import org.neo4j.graphdb.traversal.TraversalDescription;
import org.neo4j.rest.graphdb.index.RestIndex;
import org.neo4j.rest.graphdb.traversal.RestTraversalDescription;

import com.tr.cmg.alloy.aspects.audit.DaoTierAuditAspect;
import com.tr.cmg.alloy.dao.psd.relationship.RelationType;
import com.tr.cmg.alloy.dao.support.neo4j.Neo4jDaoSupport;
import com.tr.cmg.alloy.domain.psd.NodeType;
import com.tr.cmg.alloy.services.psd.rps.RelationalPathSearch;
import com.tr.cmg.alloy.services.psd.rps.RelationalPathSearchResult;

public class RelationalPathSearchDAO extends Neo4jDaoSupport{

public RelationalPathSearchResult executeRelationalPathSearch(
RelationalPathSearch rps) {

RestIndex<Node> personIndex = API.getIndex(NodeType.PERSON.name());

Node start = personIndex.get("KEY", rps.getPerson1PermId()).getSingle();
Node end = personIndex.get("KEY", rps.getPerson2PermId()).getSingle();

Iterable<Node> nodes = null;
Iterable<Relationship> relationships = null;

if (start != null && end != null) {

    TraversalDescription td = createTraversalDescription(rps);
    nodes = null;
    relationships = null;
    for (Path position : td.traverse(start)) {

        // Log audit record info
        DaoTierAuditAspect
                .storeSqlStatement("Relational Path Neo4j Query: "
                        + rps.getPerson1PermId() + " -> "
                        + rps.getPerson2PermId());
        DaoTierAuditAspect.storeSqlParameters("");

        System.out.println(position);

        if (position.endNode().equals(end)) {
            nodes = position.nodes();
            relationships = position.relationships();
            break;
        }
    }

    if(nodes == null) {
        ArrayList<Node> x = new ArrayList<Node>();
        x.add(start);
        x.add(end);
        nodes = x;
    }
}

return new RelationalPathSearchResult(nodes, relationships);

}

private TraversalDescription createTraversalDescription(RelationalPathSearch rps) {

RestTraversalDescription rtd = (RestTraversalDescription) API.createTraversalDescription();
rtd.maxDepth(4);

return  rtd
        .depthFirst()
        .relationships(RelationType.IsDirector, Direction.BOTH)
        .relationships(RelationType.HasGraduatedFrom, Direction.BOTH)
        .relationships(RelationType.IsOfficer, Direction.BOTH)
        .relationships(RelationType.IsUnknownOfficerDirectorAt, Direction.BOTH)
        .relationships(RelationType.IsInsiderAt, Direction.BOTH)
        .relationships(RelationType.IsEquityAnalystAt, Direction.BOTH)
        .relationships(RelationType.IsMemberOrChairmanOf, Direction.BOTH)
        .relationships(RelationType.IsChiefInvestmentOfficerAt, Direction.BOTH)
        .relationships(RelationType.IsDirectorOfResearchAt, Direction.BOTH)
        .relationships(RelationType.IsPortfolioManagerAt, Direction.BOTH)
        .relationships(RelationType.IsTraderAt, Direction.BOTH)
        .relationships(RelationType.IsEconomistAt, Direction.BOTH)
        .relationships(RelationType.IsSalesProfessionalAt, Direction.BOTH)
        .relationships(RelationType.IsStrategistAt, Direction.BOTH)
        .relationships(RelationType.IsExecutiveOfficerAt, Direction.BOTH)
        .relationships(RelationType.IsShariahSupervisoryAt, Direction.BOTH)
        .relationships(RelationType.IsNonExecutiveAt, Direction.BOTH)
        .relationships(RelationType.IsVEExecutive, Direction.BOTH)
        .relationships(RelationType.IsProvidingResearchOn, Direction.BOTH)
        .relationships(RelationType.IsAnalystAt, Direction.BOTH)
        .relationships(RelationType.IsReuterMessengerUserAt, Direction.BOTH)
        .relationships(RelationType.IsProvidingAssetClassCoverageOn, Direction.BOTH)
        .relationships(RelationType.IsSpeakingLanguageOf, Direction.BOTH)
        .relationships(RelationType.IsProvidingGeographyCoverageOf, Direction.BOTH)
        .relationships(RelationType.IsUnknownSellSideBuySideAt, Direction.BOTH)
        .relationships(RelationType.IsUnknownInsiderAt, Direction.BOTH)
        .relationships(RelationType.IsUnknownResearchAnalystAt, Direction.BOTH)
        .relationships(RelationType.IsUnknownVEExecutiveAt, Direction.BOTH)
        .relationships(RelationType.IsUnknownReutersMessengerUserAt, Direction.BOTH)
        .relationships(RelationType.IsUnknownStreetEventsUserAt, Direction.BOTH);

}

public static void main(String[] args) {

RelationalPathSearchDAO dao = new RelationalPathSearchDAO();

RelationalPathSearch rps = new RelationalPathSearch();
rps.setPerson1PermId("34414591164");
rps.setPerson2PermId("34414710307");

RelationalPathSearchResult result = dao.executeRelationalPathSearch(rps);
result.toJSON();

}

REST Cypher Query Engine cannot return large result rows (> about 8000)

final RestAPI restApi = graphDb.getRestAPI();

log.info("Deleting existing Person nodes...");
RestIndex<Node> personIndex = graphDb.index().forNodes("berbatikPerson");
RestCypherQueryEngine cypher = new RestCypherQueryEngine(restApi);
for (List<Map<String, Object>> rows : Iterables.partition(cypher.query("START n=node:berbatikPerson('*:*') RETURN n", new HashMap<String, Object>()), 100)) {
    List<Long> nodeIds = Lists.transform(rows, new Function<Map<String, Object>, Long>() {
        @Override
        public Long apply(Map<String, Object> row) {
            Node node = (Node) row.get("n");
            Long nodeId = node.getId();
            log.debug("Deleting Person node {}", nodeId);
            for (Relationship rel : node.getRelationships()) {
                rel.delete();
            }
            node.delete();
            return nodeId;
        }
    });
    log.info("Deleted {} nodes: {}", nodeIds.size(), nodeIds);
}

Result:

22:19:16 [main] INFO  i.c.b.m.a.RecreatePersonNodesFromLdap - Deleting existing Person nodes...
Exception in thread "main" java.lang.RuntimeException: Error importing personlikeproduct
    at id.co.bippo.mall.admin.RecreatePersonNodesFromLdap.run(RecreatePersonNodesFromLdap.java:170)
    at id.co.bippo.mall.admin.RecreatePersonNodesFromLdap.main(RecreatePersonNodesFromLdap.java:178)
Caused by: java.lang.RuntimeException: org.codehaus.jackson.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: java.io.StringReader@52639bf1; line: 1, column: 2]
    at org.neo4j.rest.graphdb.util.JsonHelper.readJson(JsonHelper.java:56)
    at org.neo4j.rest.graphdb.util.JsonHelper.jsonToMap(JsonHelper.java:43)
    at org.neo4j.rest.graphdb.ExecutingRestRequest.toMap(ExecutingRestRequest.java:169)
    at org.neo4j.rest.graphdb.query.RestCypherQueryEngine.query(RestCypherQueryEngine.java:59)
    at id.co.bippo.mall.admin.RecreatePersonNodesFromLdap.run(RecreatePersonNodesFromLdap.java:90)
    ... 1 more
Caused by: org.codehaus.jackson.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: java.io.StringReader@52639bf1; line: 1, column: 2]
    at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1291)
    at org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:385)
    at org.codehaus.jackson.impl.JsonParserMinimalBase._reportUnexpectedChar(JsonParserMinimalBase.java:306)
    at org.codehaus.jackson.impl.ReaderBasedParser._handleUnexpectedValue(ReaderBasedParser.java:628)
    at org.codehaus.jackson.impl.ReaderBasedParser.nextToken(ReaderBasedParser.java:362)
    at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2432)
    at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2389)
    at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1595)
    at org.neo4j.rest.graphdb.util.JsonHelper.readJson(JsonHelper.java:54)
    ... 5 more

Workaround: Use LIMIT

Labels are not accessible immediately on Nodes returned from a Cypher query

I have found that Node.hasLabel(..) does not always work where Node is the return from a Cypher query. Adding a short delay into the client code resolves this problem. A test case follows.

The cause seems to be this;
Label data is not acquired at the same time as the return of a Node object in the Cypher query (why not? this may be the origin of the defect). However, the code is programmed to consider if the Node.labels data is up to date and so the consequence of waiting a short time is that the implementation refreshes the label data. This can be seen in Node.hasLabel() -> RestNode.updateLabels() -> RestEntity.hasToUpdateProperties() -> restApi.hasToUpdate(). This forces a refresh after ~1 second I think.

I am using my own build of the API based on the branch "20".

import java.util.Map;
import org.junit.Assert;
import org.junit.Test;
import org.neo4j.graphdb.Label;
import org.neo4j.graphdb.Node;
import org.neo4j.rest.graphdb.RestAPI;
import org.neo4j.rest.graphdb.RestAPIFacade;
import org.neo4j.rest.graphdb.query.RestCypherQueryEngine;
import org.neo4j.rest.graphdb.util.QueryResult;

public class LabelsNotAvailableDefect {

    private static final String REMOTE_URL = "http://localhost:7474/db/data/";

    private enum Labels implements Label {
        Person
    };

    @Test
    public void run() throws InterruptedException {
        RestAPI restAPI = new RestAPIFacade(REMOTE_URL);
        RestCypherQueryEngine cypherQueryEngine = new RestCypherQueryEngine(restAPI);

        //clear any old data
        cypherQueryEngine.query("MATCH n WHERE n:Person DELETE n", null);

        //create a node with a label
        cypherQueryEngine.query("CREATE (n:Person{name:'jim'})", null);

        //query for the node, pausing first before getting the label
        QueryResult<Map<String, Object>> qr = cypherQueryEngine.query("MATCH n WHERE n:Person RETURN n", null);
        for (Map<String, Object> row : qr) {
            Node n = (Node) row.get("n");
            Assert.assertEquals("jim", n.getProperty("name"));
            System.out.println("Found Jim at node: " + n.getId() + " sleeping before we access his Label...");
            Thread.sleep(1100L);
            Assert.assertTrue("Node should have Person label", n.hasLabel(Labels.Person));
            System.out.println("...got label");
        }

        QueryResult<Map<String, Object>> qr2 = cypherQueryEngine.query("MATCH n WHERE n:Person RETURN n", null);
        for (Map<String, Object> row : qr2) {
            Node n = (Node) row.get("n");
            Assert.assertEquals("jim", n.getProperty("name"));
            System.out.println("Found Jim at node: " + n.getId() + " not sleeping before we access his Label");

            //the following assertion will fail
            Assert.assertTrue("Node should have Person label", n.hasLabel(Labels.Person));
            System.out.println("...got label");
        }
    }
}

could you please uograde the jersey-client version

Now java-rest-binding uses the jersey-client version is 1.4 ,the latest jersey-client version is 2.7 . The jersey-client dependency is too old ,it will casue more conflict with other libraries ,could you please uograde the jersey-client version ?

Getting a 502 Bad gateway while saving nodes - RANDOMLY

Internal server error, for (POST) [/api/meetings/participate] ->
play.api.Application$$anon$1: Execution exception[[RuntimeException: Error reading as JSON '<html><body><h1>502 Bad Gateway</h1>
2014-11-15T17:32:11.834142+00:00 app[web.2]: The server returned an invalid or incomplete response.
2014-11-15T17:32:11.834143+00:00 app[web.2]: </body></html>
2014-11-15T17:32:11.834144+00:00 app[web.2]: ']]
2014-11-15T17:32:11.834146+00:00 app[web.2]:    at play.api.Application$class.handleError(Application.scala:293) ~[com.typesafe.play.play_2.10-2.2.3.jar:2.2.3]
2014-11-15T17:32:11.834148+00:00 app[web.2]:    at play.api.DefaultApplication.handleError(Application.scala:399) [com.typesafe.play.play_2.10-2.2.3.jar:2.2.3]
2014-11-15T17:32:11.834150+00:00 app[web.2]:    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:264) [com.typesafe.play.play_2.10-2.2.3.jar:2.2.3]
2014-11-15T17:32:11.834152+00:00 app[web.2]:    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:264) [com.typesafe.play.play_2.10-2.2.3.jar:2.2.3]
2014-11-15T17:32:11.834153+00:00 app[web.2]:    at scala.Option.map(Option.scala:145) [org.scala-lang.scala-library-2.10.4.jar:na]
2014-11-15T17:32:11.834155+00:00 app[web.2]:    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3.applyOrElse(PlayDefaultUpstreamHandler.scala:264) [com.typesafe.play.play_2.10-2.2.3.jar:2.2.3]
2014-11-15T17:32:11.834156+00:00 app[web.2]: Caused by: java.lang.RuntimeException: Error reading as JSON '<html><body><h1>502 Bad Gateway</h1>
2014-11-15T17:32:11.834158+00:00 app[web.2]: The server returned an invalid or incomplete response.
2014-11-15T17:32:11.834159+00:00 app[web.2]: </body></html>
2014-11-15T17:32:11.834160+00:00 app[web.2]: '
2014-11-15T17:32:11.834162+00:00 app[web.2]:    at org.neo4j.rest.graphdb.util.JsonHelper.readJson(JsonHelper.java:57) ~[org.neo4j.neo4j-rest-graphdb-2.0.1.jar:na]
2014-11-15T17:32:11.834163+00:00 app[web.2]:    at org.neo4j.rest.graphdb.util.JsonHelper.jsonToSingleValue(JsonHelper.java:62) ~[org.neo4j.neo4j-rest-graphdb-2.0.1.jar:na]
2014-11-15T17:32:11.834165+00:00 app[web.2]:    at org.neo4j.rest.graphdb.RequestResult.toEntity(RequestResult.java:114) ~[org.neo4j.neo4j-rest-graphdb-2.0.1.jar:na]
2014-11-15T17:32:11.834166+00:00 app[web.2]:    at org.neo4j.rest.graphdb.RequestResult.toMap(RequestResult.java:120) ~[org.neo4j.neo4j-rest-graphdb-2.0.1.jar:na]
2014-11-15T17:32:11.834209+00:00 app[web.2]:    at org.neo4j.rest.graphdb.ExecutingRestAPI.getNodeById(ExecutingRestAPI.java:97) ~[org.neo4j.neo4j-rest-graphdb-2.0.1.jar:na]
2014-11-15T17:32:11.834211+00:00 app[web.2]:    at org.neo4j.rest.graphdb.RestAPIFacade.getNodeById(RestAPIFacade.java:59) ~[org.neo4j.neo4j-rest-graphdb-2.0.1.jar:na]
2014-11-15T17:32:11.834213+00:00 app[web.2]: Caused by: org.codehaus.jackson.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
2014-11-15T17:32:11.834214+00:00 app[web.2]:  at [Source: java.io.StringReader@1e0cea19; line: 1, column: 2]
2014-11-15T17:32:11.834216+00:00 app[web.2]:    at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1433) ~[org.codehaus.jackson.jackson-core-asl-1.9.7.jar:1.9.7]
2014-11-15T17:32:11.834218+00:00 app[web.2]:    at org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:521) ~[org.codehaus.jackson.jackson-core-asl-1.9.7.jar:1.9.7]
2014-11-15T17:32:11.834219+00:00 app[web.2]:    at org.codehaus.jackson.impl.JsonParserMinimalBase._reportUnexpectedChar(JsonParserMinimalBase.java:442) ~[org.codehaus.jackson.jackson-core-asl-1.9.7.jar:1.9.7]
2014-11-15T17:32:11.834221+00:00 app[web.2]:    at org.codehaus.jackson.impl.ReaderBasedParser._handleUnexpectedValue(ReaderBasedParser.java:1198) ~[org.codehaus.jackson.jackson-core-asl-1.9.7.jar:1.9.7]
2014-11-15T17:32:11.834222+00:00 app[web.2]:    at org.codehaus.jackson.impl.ReaderBasedParser.nextToken(ReaderBasedParser.java:485) ~[org.codehaus.jackson.jackson-core-asl-1.9.7.jar:1.9.7]
2014-11-15T17:32:11.834224+00:00 app[web.2]:    at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2770) ~[org.codehaus.jackson.jackson-mapper-asl-1.9.7.jar:1.9.7]

It happens randomly in a few cases, so I don't think it's due to my code.

Any idea?

Cannot create Relationship from/to non-batched Nodes in BatchCallback

While this works:

    TestBatchResult r = this.restAPI.executeBatch(new BatchCallback<TestBatchResult>() {
        @Override
        public TestBatchResult recordBatch(RestAPI batchRestApi) {
            TestBatchResult result=new TestBatchResult();
            result.n1 = batchRestApi.createNode(map("name", "newnode1"));
            result.n2 = batchRestApi.createNode(map("name", "newnode2"));
            result.rel = batchRestApi.createRelationship(result.n1, result.n2, Type.TEST, map("name", "rel") );
            result.allRelationships = result.n1.getRelationships();
            return result;
        }
    });

This won't:

    final Node node1 = graphDb.getNodeById(1);
    final Node node2 = graphDb.getNodeById(2);
    TestBatchResult r = this.restAPI.executeBatch(new BatchCallback<TestBatchResult>() {
        @Override
        public TestBatchResult recordBatch(RestAPI batchRestApi) {
            TestBatchResult result=new TestBatchResult();
            result.rel = batchRestApi.createRelationship(node1, node2, Type.TEST, map("name", "rel") );
            return result;
        }
    });

RestNode.getProperty(...) returns String while Node.getProperty returns byte[]

We are facing issue for the below scenario.

  1. We have a requirement where we need to store java.util.Set in a graph node (where Rule is a complex business rule object). Since, node.setProperty(..., ...) doesn't allow complex objects, we have serialized the above Set and converted it to byte array and stored it as node.setProperty("rules",serialize("rules")) (2nd argument is a bytearray)

2.The above code works properly when we use EmbeddedGraphDatabase class. In this case, node.getProperty ("rules") returns us a byte array. We get the bytearray and deserialize it to retrieve our Set . (This works fine)

  1. But, when we use RestGraphDatabase class, node.getProperty("rules") returns us a String representation instead of a byte array. Is this expected ? Next, we tried to convert the String to byte array using String.getBytes()
    But, when we pass the bytearray to an ObjectInputStream to deserialize, we get "StreamCorruptedException: Invalid Stream Header".

We are looking for different alternatives to fix this . Need your help.

java.lang.UnsupportedOperationException: null when creating `RestGraphDatabase` index via Blueprints

REST Graph Database (v1.6), server powered by Neo4j v1.6.2 is unable to create index via Blueprints with the following error:

01:43:11.983 [main] INFO  com.hendyirawan.likebox.dao.LikeDao - Connecting to Neo4j REST Graph Database http://localhost:7474/db/data
01:43:12.246 [main] DEBUG com.hendyirawan.likebox.dao.LikeDao - Get vertex index likeboxPerson
01:43:12.476 [main] INFO  com.hendyirawan.likebox.dao.LikeDao - Creating vertex index likeboxPerson
java.lang.UnsupportedOperationException: null
    at org.neo4j.rest.graphdb.index.RestIndexManager.setConfiguration(RestIndexManager.java:134) ~[neo4j-rest-graphdb-1.6.jar:1.6]
    at com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jIndex.generateIndex(Neo4jIndex.java:127) ~[blueprints-neo4j-graph-1.2.jar:na]
    at com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jIndex.<init>(Neo4jIndex.java:37) ~[blueprints-neo4j-graph-1.2.jar:na]
    at com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jGraph.getIndex(Neo4jGraph.java:144) ~[blueprints-neo4j-graph-1.2.jar:na]
    at com.hendyirawan.likebox.dao.LikeDao.getIndex(LikeDao.java:43) [classes/:na]
    at com.hendyirawan.likebox.dao.LikeDao.getPerson(LikeDao.java:51) [classes/:na]
    at com.hendyirawan.likebox.LikeDaoTest.personShouldExist(LikeDaoTest.java:49) [test-classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_31]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_31]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_31]
    at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_31]
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) [junit-4.10.jar:na]
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) [junit-4.10.jar:na]
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) [junit-4.10.jar:na]
    at org.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:270) [arquillian-junit-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:60) [arquillian-container-test-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_31]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_31]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_31]
    at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_31]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-core-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-core-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-core-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135) [arquillian-core-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115) [arquillian-core-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67) [arquillian-core-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.container.test.impl.execution.ClientTestExecuter.execute(ClientTestExecuter.java:53) [arquillian-container-test-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_31]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_31]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_31]
    at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_31]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-core-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99) [arquillian-core-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81) [arquillian-core-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:142) [arquillian-container-test-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createTestContext(ContainerEventController.java:129) [arquillian-container-test-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_31]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_31]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_31]
    at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_31]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-core-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:89) [arquillian-test-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_31]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_31]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_31]
    at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_31]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-core-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75) [arquillian-test-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_31]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_31]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_31]
    at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_31]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-core-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60) [arquillian-test-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_31]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_31]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_31]
    at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_31]
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90) [arquillian-core-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88) [arquillian-core-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135) [arquillian-core-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111) [arquillian-test-impl-base-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:263) [arquillian-junit-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:226) [arquillian-junit-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314) [arquillian-junit-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46) [arquillian-junit-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:240) [arquillian-junit-core-1.0.0.Final.jar:1.0.0.Final]
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) [junit-4.10.jar:na]
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) [junit-4.10.jar:na]
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) [junit-4.10.jar:na]
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) [junit-4.10.jar:na]
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) [junit-4.10.jar:na]
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) [junit-4.10.jar:na]
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) [junit-4.10.jar:na]
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) [junit-4.10.jar:na]
    at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:185) [arquillian-junit-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314) [arquillian-junit-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46) [arquillian-junit-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199) [arquillian-junit-core-1.0.0.Final.jar:1.0.0.Final]
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300) [junit-4.10.jar:na]
    at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147) [arquillian-junit-core-1.0.0.Final.jar:1.0.0.Final]
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) [.cp/:na]
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [.cp/:na]
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) [.cp/:na]
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) [.cp/:na]
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) [.cp/:na]
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) [.cp/:na]

Sample project: https://github.com/ceefour/likebox/zipball/neo4j-rest-blueprint

Code to create index :

protected Index<Vertex> getIndex(String kind) {
    String indexName = prefix + kind;
    log.debug("Get vertex index {}", indexName);
    try {
        return g.getIndex(indexName, Vertex.class);
    } catch (Exception e) {
        log.info("Creating vertex index " + indexName, e);
        return g.createManualIndex(indexName, Vertex.class);
    }
}

Issue is still reproducible on Neo4j 1.7 via RestGraphDb and Blueprints 1.2.

Workaround : Go to webadmin Gremlin console then create the indexes via Gremlin/Blueprints :

g.createManualIndex('berbatikPerson', Vertex.class)
g.createManualIndex('berbatikProduct', Vertex.class)

A non-Blueprints index is not usable, because plain index have parameters of only:

{"type":"exact"}

while a Blueprints index has parameters of:

{"_blueprints:type":"MANUAL", "type":"exact"}

Moved from neo4j issue: https://github.com/neo4j/community/issues/416

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.