Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump version to 3.5 #22

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
53 changes: 16 additions & 37 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
Implementation of Apache Licensed Neo4j API for Tinkerpop3
==========================================================

This repository contains both, the implementation of the `neo4j-tinkerpop-api`
in `neo4j-tinkerpop-api-impl`
This repository contains the implementation of the `neo4j-tinkerpop-api` as `neo4j-tinkerpop-api-impl`

This is work in progress, it depends on neo4j-gremlin being updated to use `neo4j-tinkerpop-api`
which is available here (https://github.com/jexp/incubator-tinkerpop)
This work depends on neo4j-gremlin being updated to use the latest version of `neo4j-tinkerpop-api(-impl)`.

To build:

````
# build tinkerpop3 branch with neo4j-gremlin updated

git clone https://github.com/jexp/incubator-tinkerpop
cd incubator-tinkerpop
git checkout neo4j-gremlin
mvn clean install -DskipTests
cd ..

# build neo4j-tinkerpop-api

git clone github.com/neo4j-contrib/neo4j-tinkerpop-api
Expand All @@ -31,33 +21,22 @@ git clone github.com/neo4j-contrib/neo4j-tinkerpop-api-impl
cd neo4j-tinkerpop-api-impl
mvn clean install

# run neo4j-gremlin tests
git clone github.com/neo4j-contrib/neo4j-tinkerpop-api-binding
cd neo4j-tinkerpop-api-binding/neo4j-tinkerpop-api-tests
mvn -o install

...
Tests run: 1903, Failures: 2, Errors: 12, Skipped: 382

````

# Support for running Gremlin as Stored Procedure in Neo4j 3.x
# build tinkerpop3 branch with neo4j-gremlin updated

git clone https://github.com/jexp/incubator-tinkerpop
cd incubator-tinkerpop/neo4j-gremlin
mvn clean install
# skip enforcer
# mvn clean install -DincludeNeo4j -Denforcer.skip=true
cd ..

```
mvn package
cp target/neo4j-tinkerpop-api-impl-0.3-3.0.0-procedure.jar $NEO4J_HOME/plugins/
$NEO4J_HOME/bin/neo4j restart
$NEO4J_HOME/bin/neo4j-shell
neo4j-sh (?)$ cypher call gremlin.run("g.V().hasLabel('Product').has('productName',name)", {name:'Chai'});

+--------------------------------------------------------------------+
| value |
+--------------------------------------------------------------------+
| Node[343]{productName:"Chai",quantityPerUnit:"10 boxes x 20 bags"} |
+--------------------------------------------------------------------+
1 row
Results :

```
Tests run: 4133, Failures: 0, Errors: 0, Skipped: 601

// cypher call gremlin.run("g.V().hasLabel('Product').has('productName',name).both().out().path().take(10)", {name:'Chai'});
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 28:18 min
```
133 changes: 133 additions & 0 deletions api-impl/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-tinkerpop-api-impl</artifactId>
<version>0.9-3.4.0</version>
<packaging>jar</packaging>
<name>Neo4j Tinkerpop API Implementation</name>
<description>Apache Licensed Neo4j Tinkerpop API Implementation</description>

<organization>
<name>Neo Technology, Inc.</name>
<url>http://neotechnology.com/</url>
</organization>
<developers>
<developer>
<id>neo-technology</id>
</developer>
</developers>

<url>http://github.com/neo4j-contrib/neo4j-tinkerpop-api-impl</url>
<properties>
<neo4j.version>3.4.11</neo4j.version>
</properties>

<scm>
<url>https://github.com/neo4j-contrib/neo4j-tinkerpop-api-impl</url>
</scm>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<comments>
Note that this license is for the project itself,
and not for its dependencies. See the included NOTICE.txt
file for further details.
</comments>
<distribution>repo</distribution>
</license>
</licenses>

<dependencies>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-tinkerpop-api</artifactId>
<version>0.1.1</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>${neo4j.version}</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-enterprise</artifactId>
<version>${neo4j.version}</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-kernel</artifactId>
<version>${neo4j.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-io</artifactId>
<version>${neo4j.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.mycila.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId>
<version>1.10.b1</version>
<configuration>
<header>gplv3-header.txt</header>
<strictCheck>true</strictCheck>
<failIfMissing>true</failIfMissing>
<includes>
<include>**/*.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@
*/
package org.neo4j.tinkerpop.api.impl;

import org.neo4j.graphdb.Label;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Label;
import org.neo4j.graphdb.StringSearchMode;
import org.neo4j.graphdb.schema.IndexDefinition;
import org.neo4j.helpers.collection.IteratorWrapper;
import org.neo4j.kernel.impl.core.NodeManager;
import org.neo4j.kernel.impl.core.EmbeddedProxySPI;
import org.neo4j.kernel.impl.core.GraphProperties;
import org.neo4j.kernel.internal.GraphDatabaseAPI;
import org.neo4j.tinkerpop.api.Neo4jGraphAPI;
import org.neo4j.tinkerpop.api.Neo4jNode;
import org.neo4j.tinkerpop.api.Neo4jRelationship;
import org.neo4j.tinkerpop.api.Neo4jTx;
import org.neo4j.tinkerpop.api.*;

import java.util.Collections;
import java.util.Iterator;
Expand All @@ -41,7 +39,7 @@ public class Neo4jGraphAPIImpl implements Neo4jGraphAPI {

public Neo4jGraphAPIImpl(GraphDatabaseService db) {
this.db = db;
graphProps = ((GraphDatabaseAPI) this.db).getDependencyResolver().resolveDependency(NodeManager.class).newGraphProperties();
graphProps = ((GraphDatabaseAPI) this.db).getDependencyResolver().resolveDependency(EmbeddedProxySPI.class).newGraphPropertiesProxy();
}

@Override
Expand Down Expand Up @@ -84,6 +82,11 @@ public Iterable<Neo4jNode> findNodes(String label, String property, Object value
return Util.wrapNodes(db.findNodes(Label.label(label), property, value));
}

@Override
public Iterable<Neo4jNode> findNodes(String label, String property, String template, Neo4jStringSearchMode searchMode) {
return Util.wrapNodes(db.findNodes(Label.label(label), property, template, StringSearchMode.valueOf(searchMode.toString())));
}

@Override
public Neo4jTx tx() {
return new Neo4jTxImpl(db.beginTx());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,33 @@ public void testCreateGraph() throws Exception {
db.shutdown();
}

@Test
public void testStringSearchMode() {
Neo4jGraphAPI db = new Neo4jFactoryImpl().newGraphDatabase("target/test.db", null);

// Create small test graph
try (Neo4jTx tx = db.tx()) {
Neo4jNode dan = db.createNode("Person");
dan.setProperty("name", "Foobar");
tx.success();
}

// Check
try (Neo4jTx tx = db.tx()) {
assertTrue(db.findNodes("Person", "name", "Foobar", Neo4jStringSearchMode.EXACT).iterator().hasNext());
assertFalse(db.findNodes("Person", "name", "ba", Neo4jStringSearchMode.EXACT).iterator().hasNext());
assertTrue(db.findNodes("Person", "name", "Foo", Neo4jStringSearchMode.PREFIX).iterator().hasNext());
assertFalse(db.findNodes("Person", "name", "123", Neo4jStringSearchMode.PREFIX).iterator().hasNext());
assertTrue(db.findNodes("Person", "name", "bar", Neo4jStringSearchMode.SUFFIX).iterator().hasNext());
assertFalse(db.findNodes("Person", "name", "123", Neo4jStringSearchMode.SUFFIX).iterator().hasNext());
assertTrue(db.findNodes("Person", "name", "ba", Neo4jStringSearchMode.CONTAINS).iterator().hasNext());
assertFalse(db.findNodes("Person", "name", "123", Neo4jStringSearchMode.CONTAINS).iterator().hasNext());
tx.success();
} finally {
db.shutdown();
}
}

protected void createGraph(Neo4jGraphAPI db, boolean success) {
try (Neo4jTx tx = db.tx()) {
Neo4jNode dan = db.createNode("Person");
Expand Down
65 changes: 12 additions & 53 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-tinkerpop-api-impl</artifactId>
<version>0.5-3.2.2</version>
<packaging>jar</packaging>
<name>Neo4j Tinkerpop API Implementation</name>
<description>Apache Licensed Neo4j Tinkerpop API Implementation</description>
<artifactId>neo4j-tinkerpop-api-parent</artifactId>
<version>0.9-3.4.0</version>
<packaging>pom</packaging>
<name>Neo4j Tinkerpop API Implementation Parent</name>
<description>Apache Licensed Neo4j Tinkerpop API Implementation Parent</description>

<organization>
<name>Neo Technology, Inc.</name>
Expand All @@ -20,11 +20,9 @@

<url>http://github.com/neo4j-contrib/neo4j-tinkerpop-api-impl</url>
<properties>
<neo4j.version>3.2.2</neo4j.version>
<gremlin.version>3.2.4</gremlin.version>
<neo4j.version>3.4.11</neo4j.version>
</properties>


<scm>
<url>https://github.com/neo4j-contrib/neo4j-tinkerpop-api-impl</url>
</scm>
Expand All @@ -42,18 +40,16 @@
</license>
</licenses>

<modules>
<module>api-impl</module>
<module>procedures</module>
</modules>

<dependencies>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-tinkerpop-api</artifactId>
<version>0.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-tinkerpop-api</artifactId>
<version>0.1</version>
<scope>provided</scope>
<version>0.1.1</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
Expand Down Expand Up @@ -85,24 +81,6 @@
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>neo4j-gremlin</artifactId>
<version>${gremlin.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tinkerpop</groupId>
<artifactId>gremlin-groovy</artifactId>
<version>${gremlin.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-groovysh</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -155,25 +133,6 @@
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.5</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
</build>
</project>
Loading