From 0e871e9ae8f18c973a61514296f2a5c29a027342 Mon Sep 17 00:00:00 2001 From: Michael Hunger Date: Thu, 7 Nov 2013 22:08:59 -0500 Subject: [PATCH] DATAGRAPH-406 Removing Gremlin Dependency --- developer_notes.html | 4 +- pom.xml | 3 - spring-data-neo4j-aspects/pom.xml | 27 ---- .../data/neo4j/aspects/PersonRepository.java | 3 - .../aspects/support/GraphRepositoryTests.java | 7 - .../query/GremlinQueryEngineTests.java | 77 ----------- spring-data-neo4j-cross-store/template.mf | 5 +- spring-data-neo4j-rest/pom.xml | 37 ----- .../neo4j/rest/SpringRestGraphDatabase.java | 4 - .../rest/SpringRestGremlinQueryEngine.java | 44 ------ .../support/RestGremlinQueryEngineTests.java | 69 ---------- spring-data-neo4j/pom.xml | 31 ----- .../data/neo4j/annotation/QueryType.java | 2 +- .../data/neo4j/core/GraphDatabase.java | 4 +- .../repository/query/GraphQueryMethod.java | 4 +- .../query/GremlinGraphRepositoryQuery.java | 44 ------ .../support/DelegatingGraphDatabase.java | 18 --- .../data/neo4j/support/Neo4jTemplate.java | 7 - .../neo4j/support/query/GremlinExecutor.java | 126 ------------------ .../support/query/GremlinQueryEngine.java | 53 -------- .../data/neo4j/template/Neo4jOperations.java | 8 +- .../data/neo4j/model/PersonRepository.java | 3 - .../repository/GraphRepositoryTests.java | 6 - .../neo4j/repository/PersonRepository.java | 3 - .../support/EntityNeo4jTemplateTests.java | 6 - .../template/FullNeo4jTemplateTests.java | 6 - .../neo4j/template/Neo4jTemplateApiTests.java | 6 - .../SnippetNeo4jTemplateMethodsTests.java | 4 - spring-data-neo4j/template.mf | 5 +- src/docbkx/index.xml | 7 +- src/docbkx/reference/neo4j-server.xml | 4 +- src/docbkx/reference/neo4j.xml | 29 ---- src/docbkx/reference/preface.xml | 6 +- .../reference/programming-model/indexing.xml | 4 +- .../programming-model/repositories.xml | 7 +- .../reference/programming-model/template.xml | 12 -- src/docbkx/reference/setup.xml | 2 - src/docbkx/tutorial/neo4j-server.xml | 4 +- src/docbkx/tutorial/neo4j.xml | 3 +- 39 files changed, 22 insertions(+), 672 deletions(-) delete mode 100644 spring-data-neo4j-aspects/src/test/java/org/springframework/data/neo4j/aspects/support/query/GremlinQueryEngineTests.java delete mode 100644 spring-data-neo4j-rest/src/main/java/org/springframework/data/neo4j/rest/SpringRestGremlinQueryEngine.java delete mode 100644 spring-data-neo4j-rest/src/test/java/org/springframework/data/neo4j/rest/support/RestGremlinQueryEngineTests.java delete mode 100644 spring-data-neo4j/src/main/java/org/springframework/data/neo4j/repository/query/GremlinGraphRepositoryQuery.java delete mode 100644 spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/query/GremlinExecutor.java delete mode 100644 spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/query/GremlinQueryEngine.java diff --git a/developer_notes.html b/developer_notes.html index 5c05a801e..560c9040c 100644 --- a/developer_notes.html +++ b/developer_notes.html @@ -109,7 +109,7 @@ try {
  • @Indexed([fulltext=true],[indexName=name]) Auto-Indexing
  • @RelatedTo([direction=Direction], [type=TYPE]) define type and direction of relationship on Entity, Iterable<E>, Set<E> fields
  • @RelatedToVia([direction=Direction], [type=TYPE]) like @RelatedTo, but targets Relationship-Entities
  • -
  • @Query(query, [type=QueryType]) computed field, executes graph query in Cypher or Gremlin
  • +
  • @Query(query, [type=QueryType]) computed field, executes graph query in Cypher
  • @GraphTraversal(traversal=~TraversalBuilder.class, [elementClass=Person.class]) computed field, executes traversal starting from entity-node
  • @@ -160,7 +160,7 @@ interface MovieRepository extends GraphRepository<Movie> {

    Neo4jTemplate

    diff --git a/pom.xml b/pom.xml index 73810e139..d6e59ca76 100644 --- a/pom.xml +++ b/pom.xml @@ -42,9 +42,6 @@ 0.12-neo4j-2.0.0-M06 0.7.1-neo4j-2.0.0-M06 - 1.2 - 1.5 - 1.5 2.0.0-M06 diff --git a/spring-data-neo4j-aspects/pom.xml b/spring-data-neo4j-aspects/pom.xml index a1001fdf7..9f225d975 100644 --- a/spring-data-neo4j-aspects/pom.xml +++ b/spring-data-neo4j-aspects/pom.xml @@ -147,33 +147,6 @@ - - - - com.tinkerpop.blueprints - blueprints-core - ${blueprints.version} - test - true - - - com.tinkerpop.blueprints - blueprints-neo4j-graph - ${blueprints.version} - - - org.neo4j - neo4j-management - - - org.neo4j - neo4j - - - test - true - - diff --git a/spring-data-neo4j-aspects/src/test/java/org/springframework/data/neo4j/aspects/PersonRepository.java b/spring-data-neo4j-aspects/src/test/java/org/springframework/data/neo4j/aspects/PersonRepository.java index baa8ddf24..b19c1171d 100644 --- a/spring-data-neo4j-aspects/src/test/java/org/springframework/data/neo4j/aspects/PersonRepository.java +++ b/spring-data-neo4j-aspects/src/test/java/org/springframework/data/neo4j/aspects/PersonRepository.java @@ -36,9 +36,6 @@ public interface PersonRepository extends GraphRepository, NamedIndexRep @Query("start team=node({p_team}) match (team)-[:persons]->(member) return member") Iterable findAllTeamMembers(@Param("p_team") Group team); - @Query(value = "g.v(team).out('persons')", type = QueryType.Gremlin) - Iterable findAllTeamMembersGremlin(@Param("team") Group team); - @Query("start team=node({p_team}) match (team)-[:persons]->(member) return member.name,member.age") Iterable> findAllTeamMemberData(@Param("p_team") Group team); diff --git a/spring-data-neo4j-aspects/src/test/java/org/springframework/data/neo4j/aspects/support/GraphRepositoryTests.java b/spring-data-neo4j-aspects/src/test/java/org/springframework/data/neo4j/aspects/support/GraphRepositoryTests.java index af3116c10..0ec065d6c 100644 --- a/spring-data-neo4j-aspects/src/test/java/org/springframework/data/neo4j/aspects/support/GraphRepositoryTests.java +++ b/spring-data-neo4j-aspects/src/test/java/org/springframework/data/neo4j/aspects/support/GraphRepositoryTests.java @@ -60,13 +60,6 @@ public class GraphRepositoryTests extends EntityTestBase { Iterable teamMembers = personRepository.findAllTeamMembers(testTeam.sdg); assertThat(asCollection(teamMembers), hasItems(testTeam.michael, testTeam.david, testTeam.emil)); } - @Test - @Transactional - @Ignore - public void testFindIterableOfPersonWithQueryAnnotationAndGremlin() { - Iterable teamMembers = personRepository.findAllTeamMembersGremlin(testTeam.sdg); - assertThat(asCollection(teamMembers), hasItems(testTeam.michael, testTeam.david, testTeam.emil)); - } @Test @Transactional diff --git a/spring-data-neo4j-aspects/src/test/java/org/springframework/data/neo4j/aspects/support/query/GremlinQueryEngineTests.java b/spring-data-neo4j-aspects/src/test/java/org/springframework/data/neo4j/aspects/support/query/GremlinQueryEngineTests.java deleted file mode 100644 index 87b1a53ed..000000000 --- a/spring-data-neo4j-aspects/src/test/java/org/springframework/data/neo4j/aspects/support/query/GremlinQueryEngineTests.java +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Copyright 2011 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.data.neo4j.aspects.support.query; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.neo4j.helpers.collection.IteratorUtil; -import org.neo4j.helpers.collection.MapUtil; -import org.springframework.data.neo4j.annotation.QueryType; -import org.springframework.data.neo4j.aspects.Person; -import org.springframework.data.neo4j.aspects.support.EntityTestBase; -import org.springframework.data.neo4j.core.GraphDatabase; -import org.springframework.data.neo4j.support.DelegatingGraphDatabase; -import org.springframework.data.neo4j.support.query.QueryEngine; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Collection; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; - - -/** - * @author mh - * @since 13.06.11 - */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = {"classpath:org/springframework/data/neo4j/aspects/support/Neo4jGraphPersistenceTests-context.xml"}) -@Transactional -@Ignore -public class GremlinQueryEngineTests extends EntityTestBase { - private QueryEngine queryEngine; - private Person michael; - - @Before - public void setUp() throws Exception { - GraphDatabase graphDatabase = createGraphDatabase(); - testTeam.createSDGTeam(); - queryEngine = graphDatabase.queryEngineFor(QueryType.Gremlin); - michael = testTeam.michael; - } - - protected GraphDatabase createGraphDatabase() throws Exception { - final DelegatingGraphDatabase graphDatabase = new DelegatingGraphDatabase(neo4jTemplate.getGraphDatabaseService()); - graphDatabase.setConversionService(conversionService); - return graphDatabase; - } - - @SuppressWarnings("unchecked") - @Test - @Transactional - public void testQueryList() throws Exception { - final String queryString = "t = new Table(); [g.v(michael),g.v(david)].each{ n -> n.as('person.name').as('person.age').table(t,['person.name','person.age']){ it.age }{ it.name }.iterate()}; t;" ; - final Collection result = IteratorUtil.asCollection(queryEngine.query(queryString, MapUtil.map("michael", getNodeId(michael), "david", getNodeId(testTeam.david)))); - - assertEquals(asList(testTeam.simpleRowFor(michael, "person"), testTeam.simpleRowFor(testTeam.david, "person")), result); - } - -} diff --git a/spring-data-neo4j-cross-store/template.mf b/spring-data-neo4j-cross-store/template.mf index f897a9b1c..d1d4f63b4 100644 --- a/spring-data-neo4j-cross-store/template.mf +++ b/spring-data-neo4j-cross-store/template.mf @@ -29,10 +29,7 @@ Import-Template: javax.persistence.*;version="[1.0.0, 3.0.0)";resolution:=optional, javax.persistence.spi.*;version="[1.0.0, 3.0.0)";resolution:=optional, javax.transaction.*;version="[1.0.1, 2.0.0)";resolution:=optional, - com.tinkerpop.blueprints.*;version="[0.8,1.0)";resolution:=optional, - com.tinkerpop.gremlin.*;version="[1.1,2.0)";resolution:=optional, - com.tinkerpop.pipes.util.*;version="[0.8,1.0)";resolution:=optional -Import-Package: +Import-Package: sun.reflect;version="0";resolution:=optional, net.sf.cglib.proxy;version="[2.2.0,3.0.0)", net.sf.cglib.core;version="[2.2.0,3.0.0)", diff --git a/spring-data-neo4j-rest/pom.xml b/spring-data-neo4j-rest/pom.xml index 62985989b..8cbee2166 100644 --- a/spring-data-neo4j-rest/pom.xml +++ b/spring-data-neo4j-rest/pom.xml @@ -124,13 +124,6 @@ - org.neo4j.app neo4j-server @@ -185,36 +178,6 @@ - - commons-configuration commons-configuration diff --git a/spring-data-neo4j-rest/src/main/java/org/springframework/data/neo4j/rest/SpringRestGraphDatabase.java b/spring-data-neo4j-rest/src/main/java/org/springframework/data/neo4j/rest/SpringRestGraphDatabase.java index 32a83e15a..8925d129e 100644 --- a/spring-data-neo4j-rest/src/main/java/org/springframework/data/neo4j/rest/SpringRestGraphDatabase.java +++ b/spring-data-neo4j-rest/src/main/java/org/springframework/data/neo4j/rest/SpringRestGraphDatabase.java @@ -17,17 +17,14 @@ package org.springframework.data.neo4j.rest; import org.neo4j.graphdb.*; import org.neo4j.graphdb.index.Index; -import org.neo4j.graphdb.traversal.TraversalDescription; import org.neo4j.rest.graphdb.RestAPI; import org.neo4j.rest.graphdb.RestAPIFacade; import org.neo4j.rest.graphdb.entity.RestNode; import org.neo4j.rest.graphdb.index.RestIndex; import org.neo4j.rest.graphdb.index.RestIndexManager; import org.neo4j.rest.graphdb.query.RestCypherQueryEngine; -import org.neo4j.rest.graphdb.query.RestGremlinQueryEngine; import org.neo4j.rest.graphdb.transaction.NullTransaction; import org.neo4j.rest.graphdb.transaction.NullTransactionManager; -import org.neo4j.rest.graphdb.traversal.RestTraversalDescription; import org.neo4j.rest.graphdb.util.Config; import org.springframework.core.convert.ConversionService; import org.springframework.data.neo4j.annotation.QueryType; @@ -114,7 +111,6 @@ public class SpringRestGraphDatabase extends org.neo4j.rest.graphdb.RestGraphDat public QueryEngine queryEngineFor(QueryType type, final ResultConverter resultConverter) { switch (type) { case Cypher: return (QueryEngine)new SpringRestCypherQueryEngine(new RestCypherQueryEngine(getRestAPI(), new SpringResultConverter(resultConverter))); - case Gremlin: return (QueryEngine)new SpringRestGremlinQueryEngine(new RestGremlinQueryEngine(getRestAPI(),new SpringResultConverter(resultConverter))); } throw new IllegalArgumentException("Unknown Query Engine Type "+type); } diff --git a/spring-data-neo4j-rest/src/main/java/org/springframework/data/neo4j/rest/SpringRestGremlinQueryEngine.java b/spring-data-neo4j-rest/src/main/java/org/springframework/data/neo4j/rest/SpringRestGremlinQueryEngine.java deleted file mode 100644 index 246efd7ba..000000000 --- a/spring-data-neo4j-rest/src/main/java/org/springframework/data/neo4j/rest/SpringRestGremlinQueryEngine.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright 2011 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.data.neo4j.rest; - - -import org.neo4j.rest.graphdb.query.RestGremlinQueryEngine; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.data.neo4j.support.query.QueryEngine; - -import java.util.Map; - - -public class SpringRestGremlinQueryEngine implements QueryEngine { - - public static final Logger log = LoggerFactory.getLogger(SpringRestGremlinQueryEngine.class); - - private final RestGremlinQueryEngine restGremlinQueryEngine; - - public SpringRestGremlinQueryEngine(RestGremlinQueryEngine restGremlinQueryEngine) { - this.restGremlinQueryEngine = restGremlinQueryEngine; - } - - @Override - public SpringRestResult query(String statement, Map params) { - if (log.isDebugEnabled()) log.debug(String.format("Executing remote gremlin query: %s params %s",statement,params)); - - return new SpringRestResult(restGremlinQueryEngine.query(statement, params)); - } - -} diff --git a/spring-data-neo4j-rest/src/test/java/org/springframework/data/neo4j/rest/support/RestGremlinQueryEngineTests.java b/spring-data-neo4j-rest/src/test/java/org/springframework/data/neo4j/rest/support/RestGremlinQueryEngineTests.java deleted file mode 100644 index f15fda703..000000000 --- a/spring-data-neo4j-rest/src/test/java/org/springframework/data/neo4j/rest/support/RestGremlinQueryEngineTests.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright 2011 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.data.neo4j.rest.support; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.neo4j.aspects.support.query.GremlinQueryEngineTests; -import org.springframework.data.neo4j.core.GraphDatabase; -import org.springframework.data.neo4j.rest.SpringRestGraphDatabase; -import org.springframework.test.context.CleanContextCacheTestExecutionListener; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.TestExecutionListeners; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; -import org.springframework.test.context.transaction.BeforeTransaction; -import org.springframework.test.context.transaction.TransactionalTestExecutionListener; - -/** - * @author mh - * @since 23.06.11 - */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = {"classpath:org/springframework/data/neo4j/aspects/support/Neo4jGraphPersistenceTests-context.xml", - "classpath:RestTests-context.xml"}) -@TestExecutionListeners({CleanContextCacheTestExecutionListener.class, DependencyInjectionTestExecutionListener.class, TransactionalTestExecutionListener.class}) -@Ignore -public class RestGremlinQueryEngineTests extends GremlinQueryEngineTests { - - @Autowired - SpringRestGraphDatabase restGraphDatabase; - - @BeforeClass - public static void startDb() throws Exception { - RestTestBase.startDb(); - } - - @BeforeTransaction - public void cleanDb() { - RestTestBase.cleanDb(); - } - - @AfterClass - public static void shutdownDb() { - RestTestBase.shutdownDb(); - } - - @Override - protected GraphDatabase createGraphDatabase() throws Exception { - restGraphDatabase.setConversionService(conversionService); - return restGraphDatabase; - } -} \ No newline at end of file diff --git a/spring-data-neo4j/pom.xml b/spring-data-neo4j/pom.xml index 60565ad14..210ddbebb 100644 --- a/spring-data-neo4j/pom.xml +++ b/spring-data-neo4j/pom.xml @@ -219,37 +219,6 @@ provided - - - com.tinkerpop.blueprints - blueprints-core - ${blueprints.version} - true - - - com.tinkerpop.blueprints - blueprints-neo4j-graph - ${blueprints.version} - - - org.neo4j - neo4j-management - - - org.neo4j - neo4j - - - true - - - - com.tinkerpop.gremlin - gremlin-groovy - ${gremlin.version} - true - - diff --git a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/annotation/QueryType.java b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/annotation/QueryType.java index ac702c790..7e8b2c3ed 100644 --- a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/annotation/QueryType.java +++ b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/annotation/QueryType.java @@ -21,5 +21,5 @@ package org.springframework.data.neo4j.annotation; * @since 25.07.11 */ public enum QueryType { - Cypher, Gremlin + Cypher } diff --git a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/core/GraphDatabase.java b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/core/GraphDatabase.java index 92c30350b..44dc08dfe 100644 --- a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/core/GraphDatabase.java +++ b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/core/GraphDatabase.java @@ -104,12 +104,12 @@ public interface GraphDatabase { TraversalDescription traversalDescription(); /** - * returns a query engine for the provided type (Cypher or Gremlin) which is initialized with the default result converter + * returns a query engine for the provided type (Cypher) which is initialized with the default result converter */ QueryEngine queryEngineFor(QueryType type); /** - * returns a query engine for the provided type (Cypher or Gremlin) which is initialized with the provided result converter + * returns a query engine for the provided type (Cypher) which is initialized with the provided result converter */ QueryEngine queryEngineFor(QueryType type, ResultConverter resultConverter); diff --git a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/repository/query/GraphQueryMethod.java b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/repository/query/GraphQueryMethod.java index e7120dca6..7f0a9e2a2 100644 --- a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/repository/query/GraphQueryMethod.java +++ b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/repository/query/GraphQueryMethod.java @@ -149,10 +149,8 @@ public class GraphQueryMethod extends QueryMethod { switch (queryAnnotation.type()) { case Cypher: return new CypherGraphRepositoryQuery(this, template); - case Gremlin: - return new GremlinGraphRepositoryQuery(this, template); default: - throw new IllegalStateException("@Query Annotation has to be configured as Cypher or Gremlin Query"); + throw new IllegalStateException("@Query Annotation has to be configured as Cypher Query"); } } diff --git a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/repository/query/GremlinGraphRepositoryQuery.java b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/repository/query/GremlinGraphRepositoryQuery.java deleted file mode 100644 index de25601f5..000000000 --- a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/repository/query/GremlinGraphRepositoryQuery.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright 2011 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.data.neo4j.repository.query; - -import org.springframework.data.domain.Pageable; -import org.springframework.data.neo4j.annotation.QueryType; -import org.springframework.data.neo4j.support.Neo4jTemplate; -import org.springframework.data.neo4j.support.query.QueryEngine; -import org.springframework.data.repository.core.RepositoryMetadata; -import org.springframework.data.repository.query.ParameterAccessor; - -import java.util.Map; - -/** -* @author mh -* @since 31.10.11 -*/ -class GremlinGraphRepositoryQuery extends GraphRepositoryQuery { - - private QueryEngine queryEngine; - - public GremlinGraphRepositoryQuery(GraphQueryMethod queryMethod, final Neo4jTemplate template) { - super(queryMethod, template); - } - - protected QueryEngine getQueryEngine() { - if (this.queryEngine !=null) return queryEngine; - this.queryEngine = getTemplate().queryEngineFor(QueryType.Gremlin); - return this.queryEngine; - } -} diff --git a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/DelegatingGraphDatabase.java b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/DelegatingGraphDatabase.java index 0795b85fb..8556a430a 100644 --- a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/DelegatingGraphDatabase.java +++ b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/DelegatingGraphDatabase.java @@ -37,7 +37,6 @@ import org.springframework.data.neo4j.support.index.IndexType; import org.springframework.data.neo4j.support.index.NoSuchIndexException; import org.springframework.data.neo4j.support.query.ConversionServiceQueryResultConverter; import org.springframework.data.neo4j.support.query.CypherQueryEngine; -import org.springframework.data.neo4j.support.query.GremlinQueryEngine; import org.springframework.data.neo4j.support.query.QueryEngine; import org.springframework.util.ClassUtils; import org.springframework.util.ObjectUtils; @@ -59,7 +58,6 @@ public class DelegatingGraphDatabase implements GraphDatabase { private ConversionService conversionService; private ResultConverter resultConverter; private volatile QueryEngine cypherQueryEngine; - private volatile QueryEngine gremlinQueryEngine; public DelegatingGraphDatabase(final GraphDatabaseService delegate) { this(delegate,null); @@ -90,7 +88,6 @@ public class DelegatingGraphDatabase implements GraphDatabase { private void reinitQueryEngines() { if (cypherQueryEngine != null) this.cypherQueryEngine = queryEngineFor(QueryType.Cypher, resultConverter, true); - if (gremlinQueryEngine != null) this.gremlinQueryEngine = queryEngineFor(QueryType.Gremlin, resultConverter, true); } @Override @@ -211,14 +208,6 @@ public class DelegatingGraphDatabase implements GraphDatabase { } return (QueryEngine) cypherQueryEngine; } - case Gremlin: { - if (reinit || gremlinQueryEngine==null) { - synchronized (this) { - if (reinit || gremlinQueryEngine==null) gremlinQueryEngine=createGremlinQueryEngine(resultConverter); - } - } - return (QueryEngine) gremlinQueryEngine; - } } throw new IllegalArgumentException("Unknown Query Engine Type "+type); } @@ -228,13 +217,6 @@ public class DelegatingGraphDatabase implements GraphDatabase { return queryEngineFor(type,resultConverter,false); } - private QueryEngine createGremlinQueryEngine(ResultConverter resultConverter) { - if (!ClassUtils.isPresent("com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jGraph", getClass().getClassLoader())) { - return new FailingQueryEngine("Gremlin"); - } - return (QueryEngine) new GremlinQueryEngine(delegate,resultConverter); - } - private QueryEngine createCypherQueryEngine(ResultConverter resultConverter) { if (!ClassUtils.isPresent("org.neo4j.cypher.javacompat.ExecutionEngine", getClass().getClassLoader())) { return new FailingQueryEngine("Cypher"); diff --git a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/Neo4jTemplate.java b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/Neo4jTemplate.java index 50a186404..97d7457b8 100644 --- a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/Neo4jTemplate.java +++ b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/Neo4jTemplate.java @@ -528,13 +528,6 @@ public class Neo4jTemplate implements Neo4jOperations, ApplicationContextAware { return queryEngine.query(statement, params); } - @Override - @SuppressWarnings("unchecked") - public Result execute(String statement, Map params) { - notNull(statement, "statement"); - return queryEngineFor(QueryType.Gremlin).query(statement, params); - } - @Override public Result traverse(Object start, TraversalDescription traversal) { return traverse((Node) getPersistentState(start), traversal); diff --git a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/query/GremlinExecutor.java b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/query/GremlinExecutor.java deleted file mode 100644 index 48c4f49ef..000000000 --- a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/query/GremlinExecutor.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Copyright 2011 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.data.neo4j.support.query; - -import com.tinkerpop.blueprints.pgm.Edge; -import com.tinkerpop.blueprints.pgm.Vertex; -import com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jEdge; -import com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jGraph; -import com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jVertex; -import com.tinkerpop.pipes.util.structures.Row; -import com.tinkerpop.pipes.util.structures.Table; -import org.neo4j.graphdb.GraphDatabaseService; -import org.neo4j.helpers.collection.IterableWrapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.script.*; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.concurrent.atomic.AtomicInteger; - -public class GremlinExecutor { - - public static final Logger log = LoggerFactory.getLogger(GremlinExecutor.class); - public static final int REFRESH_ENGINE_COUNT = 10000; - private static final String GRAPH_VARIABLE = "g"; - private volatile ScriptEngine engine; - - private ScriptEngine createScriptEngine() { - return new ScriptEngineManager().getEngineByName("gremlin-groovy"); - } - - private static final AtomicInteger executionCount = new AtomicInteger(); - private final GraphDatabaseService graphDatabaseService; - - public GremlinExecutor(GraphDatabaseService graphDatabaseService) { - this.graphDatabaseService = graphDatabaseService; - } - - @SuppressWarnings("unchecked") - public Iterable query(String statement, Map params) { - try { - if (log.isDebugEnabled()) log.debug(String.format("Executing gremlin query: %s params %s",statement,params)); - - final Bindings bindings = createBindings(params); - final ScriptEngine engine = engine(); - final Object result = engine.eval(statement, bindings); - return getRepresentation(result); - } catch (final ScriptException e) { - throw new RuntimeException("Error executing statement " + statement, e); - } - } - - private Bindings createBindings(Map params) { - final Bindings bindings = new SimpleBindings(); - bindings.put(GRAPH_VARIABLE, new Neo4jGraph(graphDatabaseService,false)); - if (params==null) return bindings; - for (Map.Entry entry : params.entrySet()) { - bindings.put(entry.getKey(),entry.getValue()); - } - return bindings; - } - - private ScriptEngine engine() { - if (engine == null || executionCount.incrementAndGet() > REFRESH_ENGINE_COUNT) { - executionCount.set(0); - this.engine = createScriptEngine(); - } - return this.engine; - } - - - @SuppressWarnings("unchecked") - public static Iterable getRepresentation(final Object result) { - if (result instanceof Iterable) { - if (result instanceof Table) { - final Table table = (Table) result; - return new IterableWrapper,Row>(table) { - @Override - protected Map underlyingObjectToObject(Row row) { - Map result=new LinkedHashMap(); - for (String column : table.getColumnNames()) { - result.put(column, row.getColumn(column)); - } - return result; - } - }; - } - return new IterableWrapper((Iterable) result) { - @Override - protected Object underlyingObjectToObject(Object object) { - return getSingleResult(object); - } - }; - } else { - return Collections.singleton(getSingleResult(result)); - } - } - - private static Object getSingleResult(Object result) { - if (result instanceof Vertex) { - return ((Neo4jVertex) result).getRawVertex(); - } else if (result instanceof Edge) { - return ((Neo4jEdge) result).getRawEdge(); - } else if (result instanceof Neo4jGraph) { - return ((Neo4jGraph) result).getRawGraph(); - } else { - return result; - } - } -} \ No newline at end of file diff --git a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/query/GremlinQueryEngine.java b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/query/GremlinQueryEngine.java deleted file mode 100644 index 6abacb72e..000000000 --- a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/query/GremlinQueryEngine.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright 2011 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.data.neo4j.support.query; - -import org.neo4j.graphdb.GraphDatabaseService; -import org.springframework.dao.InvalidDataAccessResourceUsageException; -import org.springframework.data.neo4j.conversion.DefaultConverter; -import org.springframework.data.neo4j.conversion.Result; -import org.springframework.data.neo4j.conversion.QueryResultBuilder; -import org.springframework.data.neo4j.conversion.ResultConverter; - -import java.util.Map; - -public class GremlinQueryEngine implements QueryEngine { - - private final GremlinExecutor gremlinExecutor; - private final ResultConverter resultConverter; - - public GremlinQueryEngine(GraphDatabaseService graphDatabaseService) { - this(graphDatabaseService, new DefaultConverter()); - } - - - public GremlinQueryEngine(GraphDatabaseService graphDatabaseService, ResultConverter resultConverter) { - this.resultConverter = resultConverter != null ? resultConverter : new DefaultConverter(); - this.gremlinExecutor = new GremlinExecutor(graphDatabaseService); - } - - @SuppressWarnings("unchecked") - @Override - public Result query(String statement, Map params) { - try { - Iterable result = gremlinExecutor.query(statement, params); - return new QueryResultBuilder(result,resultConverter); - } catch (Exception e) { - throw new InvalidDataAccessResourceUsageException("Error executing statement " + statement, e); - } - } -} \ No newline at end of file diff --git a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/template/Neo4jOperations.java b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/template/Neo4jOperations.java index e6e1ac60c..a48fc4e0d 100644 --- a/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/template/Neo4jOperations.java +++ b/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/template/Neo4jOperations.java @@ -189,7 +189,7 @@ public interface Neo4jOperations { Result lookup(String indexName, Object query); /** - * Provides a cypher or gremlin query engine set up with a default entity converter. + * Provides a cypher query engine set up with a default entity converter. */ QueryEngine queryEngineFor(QueryType type); @@ -199,12 +199,6 @@ public interface Neo4jOperations { */ Result> query(String statement, Map params); - /** - * Executes the given Gremlin statement and returns the result packaged as Result as Neo4j types, not - * Gremlin types. The Neo4j-Graph is provided as variable "g". Table rows are converted to Map. - */ - Result execute(String statement, Map params); - /** * Traverses the graph starting at the given node with the provided traversal description. The Path's of the * traversal will be packaged into a Result which can be easily converted into Nodes, Relationships or diff --git a/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/model/PersonRepository.java b/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/model/PersonRepository.java index a4749a607..6ac6bcb46 100644 --- a/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/model/PersonRepository.java +++ b/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/model/PersonRepository.java @@ -36,9 +36,6 @@ public interface PersonRepository extends GraphRepository, NamedIndexRep @Query("start team=node({p_team}) match (team)-[:persons]->(member) return member") Iterable findAllTeamMembers(@Param("p_team") Group team); - @Query(value = "g.v(team).out('persons')", type = QueryType.Gremlin) - Iterable findAllTeamMembersGremlin(@Param("team") Group team); - @Query("start team=node({p_team}) match (team)-[:persons]->(member) return member.name,member.age") Iterable> findAllTeamMemberData(@Param("p_team") Group team); diff --git a/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/repository/GraphRepositoryTests.java b/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/repository/GraphRepositoryTests.java index f3f3a586d..33ed4f8c6 100644 --- a/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/repository/GraphRepositoryTests.java +++ b/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/repository/GraphRepositoryTests.java @@ -216,12 +216,6 @@ public class GraphRepositoryTests { assertThat(asCollection(teamMembers), hasItems(testTeam.michael, testTeam.david)); } - @Test @Transactional - public void testFindIterableOfPersonWithQueryAnnotationAndGremlin() { - Iterable teamMembers = personRepository.findAllTeamMembersGremlin(testTeam.sdg); - assertThat( asCollection( teamMembers ), hasItems(testTeam.michael, testTeam.david, testTeam.emil) ); - } - @Test @Transactional public void testFindPersonWithQueryAnnotation() { Person boss = personRepository.findBoss( testTeam.michael ); diff --git a/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/repository/PersonRepository.java b/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/repository/PersonRepository.java index 958b5ceaf..6cbc6bc83 100644 --- a/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/repository/PersonRepository.java +++ b/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/repository/PersonRepository.java @@ -43,9 +43,6 @@ public interface PersonRepository extends GraphRepository, NamedIndexRep @Query("start team=node({p_team}) match (team)-[:persons]->(member) return member") Iterable findAllTeamMembers(@Param("p_team") Group team); - @Query(value = "g.v(team).out('persons')", type = QueryType.Gremlin) - Iterable findAllTeamMembersGremlin(@Param("team") Group team); - @Query("start team=node({p_team}) match (team)-[:persons]->(member) return member.name,member.age") Iterable> findAllTeamMemberData(@Param("p_team") Group team); diff --git a/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/support/EntityNeo4jTemplateTests.java b/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/support/EntityNeo4jTemplateTests.java index 1b69092e1..9a43ba426 100644 --- a/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/support/EntityNeo4jTemplateTests.java +++ b/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/support/EntityNeo4jTemplateTests.java @@ -371,12 +371,6 @@ public class EntityNeo4jTemplateTests extends EntityTestBase { final Person result = engine.query("start n=node({self}) return n", map("self", testTeam.michael.getId())).to(Person.class).single(); assertEquals(testTeam.michael.getId(), result.getId()); } - @Test @Transactional - public void testQueryEngineForGremlin() throws Exception { - final QueryEngine> engine = neo4jOperations.queryEngineFor(QueryType.Gremlin); - final Person result = engine.query("g.v(self)", map("self", testTeam.michael.getId())).to(Person.class).single(); - assertEquals(testTeam.michael.getId(), result.getId()); - } @Test @Transactional public void testTraverse() throws Exception { diff --git a/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/template/FullNeo4jTemplateTests.java b/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/template/FullNeo4jTemplateTests.java index 8aed709e7..6882dc63e 100644 --- a/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/template/FullNeo4jTemplateTests.java +++ b/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/template/FullNeo4jTemplateTests.java @@ -328,12 +328,6 @@ public class FullNeo4jTemplateTests { assertSingleResult(node1, neo4jTemplate.query("start n=node(0) match n-[:knows]->m return m", null).to(Node.class)); } - @Test - @Transactional - public void shouldFindNextNodeViaGremlin() throws Exception { - assertSingleResult(node1, neo4jTemplate.execute("g.v(0).outE.filter{it.label=='knows'}.inV", null).to(Node.class)); - } - @Test @Transactional public void shouldGetDirectRelationship() throws Exception { diff --git a/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/template/Neo4jTemplateApiTests.java b/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/template/Neo4jTemplateApiTests.java index 39ae6e973..da1877508 100644 --- a/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/template/Neo4jTemplateApiTests.java +++ b/spring-data-neo4j/src/test/java/org/springframework/data/neo4j/template/Neo4jTemplateApiTests.java @@ -188,12 +188,6 @@ public class Neo4jTemplateApiTests { assertSingleResult(node1, template.query("start n=node(0) match n-->m return m", null).to(Node.class)); } - @Test - @Ignore - public void shouldFindNextNodeViaGremlin() throws Exception { - assertSingleResult(node1, template.execute("g.v(0).out", null).to(Node.class)); - } - @Test public void shouldGetDirectRelationship() throws Exception { assertSingleResult("rel1", template.convert(referenceNode.getRelationships()).to(String.class, new RelationshipNameConverter())); diff --git a/spring-data-neo4j/src/test/java/org/springframework/data/test/snippets/SnippetNeo4jTemplateMethodsTests.java b/spring-data-neo4j/src/test/java/org/springframework/data/test/snippets/SnippetNeo4jTemplateMethodsTests.java index 2006b65a6..124132d78 100644 --- a/spring-data-neo4j/src/test/java/org/springframework/data/test/snippets/SnippetNeo4jTemplateMethodsTests.java +++ b/spring-data-neo4j/src/test/java/org/springframework/data/test/snippets/SnippetNeo4jTemplateMethodsTests.java @@ -84,10 +84,6 @@ public class SnippetNeo4jTemplateMethodsTests extends DocumentingTestBase { // SNIPPET template - // Gremlin - assertEquals(thomas, neo.execute("g.v(person).out('WORKS_WITH')", - map("person", mark.getId())).to(Node.class).single()); - // Index lookup assertEquals(thomas, neo.lookup("devs", "name", "Thomas").to(Node.class).single()); diff --git a/spring-data-neo4j/template.mf b/spring-data-neo4j/template.mf index 2803bc20e..ea9c9087e 100644 --- a/spring-data-neo4j/template.mf +++ b/spring-data-neo4j/template.mf @@ -37,10 +37,7 @@ Import-Template: com.mysema.query.annotations.*;version="0";resolution:=optional, com.mysema.query.apt.*;version="0";resolution:=optional, com.mysema.query.types.*;version="0";resolution:=optional, - com.tinkerpop.blueprints.*;version="[0.8,1.0)";resolution:=optional, - com.tinkerpop.gremlin.*;version="[1.1,2.0)";resolution:=optional, - com.tinkerpop.pipes.util.*;version="[0.8,1.0)";resolution:=optional -Import-Package: +Import-Package: sun.reflect;version="0";resolution:=optional, scala.collection;version="0";resolution:=optional, net.sf.cglib.proxy;version="[2.2.0,3.0.0)", diff --git a/src/docbkx/index.xml b/src/docbkx/index.xml index 516695d6c..c0ab698ab 100644 --- a/src/docbkx/index.xml +++ b/src/docbkx/index.xml @@ -3,20 +3,17 @@ Good Relationships diff --git a/src/docbkx/reference/neo4j-server.xml b/src/docbkx/reference/neo4j-server.xml index 7e98fcce0..5f0690414 100644 --- a/src/docbkx/reference/neo4j-server.xml +++ b/src/docbkx/reference/neo4j-server.xml @@ -95,7 +95,7 @@ public void foo( @Context WorldRepository repo ) { Please also keep in mind that performing graph operations via the REST-API is about one order of magnitude slower than local operations. Try to use the Neo4j Cypher query language, - server-side traversals (RestTraversal) or Gremlin expressions whenever possible for retrieving large sets of data. + or server-side traversals (RestTraversal) whenever possible for retrieving large sets of data. Future versions of Spring Data Neo4j will use the more performant batch API as well as a binary protocol. @@ -128,7 +128,7 @@ public void foo( @Context WorldRepository repo ) { Your project is now set up to work against a remote Neo4j Server. - For traversals and Cypher and Gremlin graph queries it is sensible to forward those to the remote endpoint and execute them there + For traversals and Cypher graph queries it is sensible to forward those to the remote endpoint and execute them there instead of walking the graph over the wire. SpringRestGraphDatabase already supports that by providing methods that forward to the remote instance. (e.g. queryEngineFor(), index() and createTraversalDescription()). Please use those methods when interacting with a remote server for optimal performance. Those methods are also diff --git a/src/docbkx/reference/neo4j.xml b/src/docbkx/reference/neo4j.xml index 2212df71b..8202b3f80 100644 --- a/src/docbkx/reference/neo4j.xml +++ b/src/docbkx/reference/neo4j.xml @@ -205,35 +205,6 @@ start lucy=node(1000) match lucy-[:ACTS_IN]->movie<-[:ACTS_IN]-co_actor // Recommendations including counts, grouping and sorting start user=node:User(login='micha') match user-[:FRIEND]-()-[r:RATED]->movie return movie.title, AVG(r.stars), count(*) order by AVG(r.stars) desc, count(*) desc -]]> - - -
    - Gremlin - a Graph Traversal DSL - - Gremlin is an expressive Groovy DSL developed by Marko Rodriguez - as part of the Tinkerpop stack. It builds on top of a pipe implementation - (Blueprints Pipes) that uses connected operations to traverse a graph. Gremlin has a concise syntax but is - Turing complete. - - Gremlin can be executed by including the Tinkerpop and Blueprints dependencies and then requesting a ScriptEngine - of type "gremlin" from the javax.Script* facilities. In Spring Data Neo4j this is encapsulated in - GremlinQueryEngine. The Neo4j-REST-Server also comes with a Gremlin-Plugin that is accessible remotely and is - available in the Spring Data Neo4j REST-Binding. - - - Sample Gremlin Queries - 30}.name - -// calculate basic collaborative filtering for vertex 1 -m = [:] -g.v(1).out('likes').in('likes').out('likes').groupCount(m) -m.sort{a,b -> a.value <=> b.value} ]]>
    diff --git a/src/docbkx/reference/preface.xml b/src/docbkx/reference/preface.xml index b2359ec79..b0c3bec51 100644 --- a/src/docbkx/reference/preface.xml +++ b/src/docbkx/reference/preface.xml @@ -52,7 +52,7 @@ references to other entities this is straightforward.
    - To use advanced functionality like traversals, Cypher and Gremlin, a basic understanding of the graph data model is required. + To use advanced functionality like traversals and Cypher, a basic understanding of the graph data model is required. The graph data model is explained in the chapter about Neo4j, see . @@ -70,7 +70,7 @@ () for interacting with the mapped entities and the Neo4j graph database. The operations provided by Spring Data Neo4j - Repositories per mapped entity class are based on the API offered by the Neo4j-Template. It also provides the operations of the Neo4j Core API - in a more convenient way. Especially the querying (Indexes, Cypher, Gremlin and Traversals) and result conversion + in a more convenient way. Especially the querying (Indexes, Cypher and Traversals) and result conversion facilities allow writing very concise code. @@ -94,7 +94,7 @@ Using computed fields that are dynamically backed by graph operations is a bit more involved. First you should know - about traversals, Cypher queries and Gremlin expressions. + about traversals and Cypher queries. Those are explained in . Then you can start using virtual, computed fields in your entities . diff --git a/src/docbkx/reference/programming-model/indexing.xml b/src/docbkx/reference/programming-model/indexing.xml index 74cfb2bab..c95a0a2c4 100644 --- a/src/docbkx/reference/programming-model/indexing.xml +++ b/src/docbkx/reference/programming-model/indexing.xml @@ -5,7 +5,7 @@ Indexing is used in Neo4j to quickly find nodes and relationships to start graph operations from. - Either for manually traversing the graph, using the traversal framework, cypher or gremlin queries + Either for manually traversing the graph, using the traversal framework, cypher queries or for "global" graph operations. Indexes are also employed to ensure uniqueness of elements with certain properties. @@ -226,7 +226,7 @@ personFulltextIndex.query("{name:*cha*}"); from the approach used in Spring Data Neo4j because it only updates the indexes when the transaction is committed. So the index modifications will only be available after the successful commit. It is possible to use the specific index names node_auto_index and relationship_auto_index when - querying indexes in Spring Data Neo4j either with the query methods in template and repositories or via Cypher and Gremlin. + querying indexes in Spring Data Neo4j either with the query methods in template and repositories or via Cypher.
    diff --git a/src/docbkx/reference/programming-model/repositories.xml b/src/docbkx/reference/programming-model/repositories.xml index 80061cd45..74c2cf333 100644 --- a/src/docbkx/reference/programming-model/repositories.xml +++ b/src/docbkx/reference/programming-model/repositories.xml @@ -10,8 +10,7 @@ Spring Data Neo4j repositories support annotated and named queries for the Neo4j - Cypher query-language and - Gremlin graph DSL. + Cypher query-language. Spring Data Neo4j comes with typed repository implementations that provide methods for @@ -136,10 +135,6 @@ If it is required that paged results return the correct total count, the @Query annotation can be supplied with a count query in the countQuery attribute. This query is executed separately after the result query and its result is used to populate the totalCount property of the returned Page. - - Gremlin queries can be used similarly, the @Query annotation would just need a type=QueryType.GREMLIN attribute. - Parameters are supported in the same way. -
    diff --git a/src/docbkx/reference/programming-model/template.xml b/src/docbkx/reference/programming-model/template.xml index 48f16afda..5e4bbd103 100644 --- a/src/docbkx/reference/programming-model/template.xml +++ b/src/docbkx/reference/programming-model/template.xml @@ -44,10 +44,6 @@ - // Gremlin - assertEquals(thomas, neo.execute("g.v(person).out('WORKS_WITH')", - map("person", mark.getId())).to(Node.class).single()); - // Index lookup assertEquals(thomas, neo.lookup("devs", "name", "Thomas").to(Node.class).single()); @@ -123,14 +119,6 @@ or converted as needed.
    -
    - Gremlin Scripts - - Gremlin Scripts can run with the execute method, which also takes the parameters that will be - available as variables inside the script. The result of the executions is a generic - Result<Object> fit for conversion or usage. - -
    Transactions diff --git a/src/docbkx/reference/setup.xml b/src/docbkx/reference/setup.xml index f869abaa1..15d53ef27 100644 --- a/src/docbkx/reference/setup.xml +++ b/src/docbkx/reference/setup.xml @@ -120,8 +120,6 @@ repositories { Spring Framework (core, context, aop, aspects, tx), AspectJ, Neo4j, and Spring Data Commons. If you already use these (or different versions of these) in your project, then include those dependencies on your own. In this case, please make sure that the versions match. - If you want to use Gremlin, please add the dependency (which is optional in SDN) - accordingly. Maven dependencies diff --git a/src/docbkx/tutorial/neo4j-server.xml b/src/docbkx/tutorial/neo4j-server.xml index a53130fa9..486051cad 100644 --- a/src/docbkx/tutorial/neo4j-server.xml +++ b/src/docbkx/tutorial/neo4j-server.xml @@ -83,8 +83,8 @@ - We looked into the different modes of remotely executed operations and found traversals, Cypher and Gremlin queries - and index lookups. Most of them already matched our needs but the Cypher and Gremlin approaches were best + We looked into the different modes of remotely executed operations and found traversals, Cypher queries + and index lookups. Most of them already matched our needs but the Cypher approaches were best suited, because they also handled index operations and allowed to return partial attribute sets and subgraphs. diff --git a/src/docbkx/tutorial/neo4j.xml b/src/docbkx/tutorial/neo4j.xml index d69aadbb3..e60458554 100644 --- a/src/docbkx/tutorial/neo4j.xml +++ b/src/docbkx/tutorial/neo4j.xml @@ -18,8 +18,7 @@ the core API, and declaratively using a query-like Traversal Description. Besides those programmatic traversals there was the powerful graph query language called - Cypher and an interesting - looking DSL named Gremlin. So lots of ways of working with the graph. + Cypher. So lots of ways of working with the graph. We also learned that Neo4j is fully transactional and therefore upholds