DATAGRAPH-329 Upgrade to Neo4j 1.8.1

This commit is contained in:
Michael Hunger
2013-01-30 02:34:38 +01:00
parent e08b7d12ee
commit 4b098cc74c
12 changed files with 18 additions and 31 deletions

View File

@@ -13,7 +13,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>3.1.0.RELEASE</spring.version>
<slf4j.version>1.6.1</slf4j.version>
<neo4j.version>1.8</neo4j.version>
<neo4j.version>1.8.1</neo4j.version>
<spring-data-neo4j.version>${project.version}</spring-data-neo4j.version>
<aspectj.version>1.6.12</aspectj.version>
</properties>

View File

@@ -4,7 +4,7 @@
<groupId>org.neo4j</groupId>
<artifactId>cineasts-rest</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<packaging>war</packaging>
<name>Cineasts over REST</name>
@@ -13,7 +13,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>3.1.0.RELEASE</spring.version>
<slf4j.version>1.6.1</slf4j.version>
<neo4j.version>1.8</neo4j.version>
<neo4j.version>1.8.1</neo4j.version>
<spring-data-neo4j.version>${project.version}</spring-data-neo4j.version>
<aspectj.version>1.6.12</aspectj.version>
<jersey.version>1.4</jersey.version>

View File

@@ -15,7 +15,7 @@
<slf4j.version>1.6.1</slf4j.version>
<spring-data-neo4j.version>${project.version}</spring-data-neo4j.version>
<aspectj.version>1.6.12</aspectj.version>
<neo4j.version>1.8.RC1</neo4j.version>
<neo4j.version>1.8.1</neo4j.version>
</properties>
<repositories>

View File

@@ -11,7 +11,7 @@
<spring-data-neo4j.version>${project.version}</spring-data-neo4j.version>
<aspectj.version>1.6.12</aspectj.version>
<slf4j.version>1.6.1</slf4j.version>
<neo4j.version>1.8</neo4j.version>
<neo4j.version>1.8.1</neo4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-security.version>3.1.0.RELEASE</spring-security.version>
</properties>

View File

@@ -11,7 +11,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<neo4j.version>1.8</neo4j.version>
<neo4j.version>1.8.1</neo4j.version>
<spring.version>3.1.0.RELEASE</spring.version>
<spring-data-neo4j.version>${project.version}</spring-data-neo4j.version>
<aspectj.version>1.6.12</aspectj.version>

View File

@@ -125,8 +125,8 @@
<org.springframework.version.30>3.0.7.RELEASE</org.springframework.version.30>
<org.springframework.version>3.1.2.RELEASE</org.springframework.version>
<data.commons.version>1.5.0.BUILD-SNAPSHOT</data.commons.version>
<neo4j.version>1.8</neo4j.version>
<neo4j.spatial.version>0.9</neo4j.spatial.version>
<neo4j.version>1.8.1</neo4j.version>
<neo4j.spatial.version>0.10-SNAPSHOT</neo4j.spatial.version>
<aspectj.version>1.6.12</aspectj.version>
<blueprints.version>1.2</blueprints.version>
<gremlin.version>1.5</gremlin.version>
@@ -470,7 +470,7 @@
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-cypher-dsl</artifactId>
<version>${neo4j.version}</version>
<version>1.8</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>

View File

@@ -80,7 +80,7 @@ public abstract class AbstractGraphRepository<S extends PropertyContainer, T> im
private Result<T> geoQuery(String indexName, String geoQuery, Object params) {
final IndexHits<S> indexHits = getIndex(indexName,null).query(geoQuery, params);
return template.convert(new GeoNodeIndexHitsWrapper(indexHits));
return template.convert(new IndexHitsWrapper(indexHits));
}
public static final ClosableIterable EMPTY_CLOSABLE_ITERABLE = new ClosableIterable() {
@@ -433,19 +433,6 @@ public abstract class AbstractGraphRepository<S extends PropertyContainer, T> im
}
}
private class GeoNodeIndexHitsWrapper extends IndexHitsWrapper {
public GeoNodeIndexHitsWrapper(IndexHits<S> indexHits) {
super(indexHits);
}
@Override
protected T underlyingObjectToObject(S result) {
final Number objectNodeId = (Number) result.getProperty("id");
if (objectNodeId==null) return null;
return super.underlyingObjectToObject(getById(objectNodeId.longValue()));
}
}
@SuppressWarnings("unchecked")
@Override
public Page<T> query(Execute query, Execute countQuery, Map<String, Object> params, Pageable page) {

View File

@@ -51,7 +51,7 @@ public abstract class QueryTemplates {
static final String START_CLAUSE_INDEX_LOOKUP = "`%s`=node:`%s`(`%s`=" + PLACEHOLDER + ")";
static final String START_CLAUSE_INDEX_QUERY = "`%s`=node:`%s`(" + PLACEHOLDER + ")";
static final String WHERE_CLAUSE_1 = "`%1$s`.`%2$s`! %3$s {%4$d}";
static final String WHERE_TYPE_CHECK = "`%s`.__type__! IN [%s]";
static final String WHERE_TYPE_CHECK = "(has(`%1$s`.__type__) AND `%1$s`.__type__ IN [%2$s])";
static final String WHERE_CLAUSE_0 = "`%1$s`.`%2$s`! %3$s ";
static final String SORT_CLAUSE = "%s %s";
static final String ORDER_BY_CLAUSE = " ORDER BY %s";

View File

@@ -63,10 +63,10 @@ public interface PersonRepository extends GraphRepository<Person>, NamedIndexRep
@Query("start person=node({p_person}) match (boss)-[:boss]->(person) return boss")
Person findBoss(@Param("p_person") Long person);
@Query("start boss=node({0}) match (boss)-[:boss]->(person) return person order by count(*)")
@Query("start boss=node({0}) match (boss)-[:boss]->(person) with person, count(*) as cnt order by cnt return person")
Page<Person> findSubordinates(Person boss,Pageable page);
@Query(value = "start boss=node({0}) match (boss)-[:boss]->(person) return person order by count(*)",countQuery = "start boss=node({0}) match (boss)-[:boss]->(person) with person return count(*)")
@Query(value = "start boss=node({0}) match (boss)-[:boss]->(person) with person, count(*) as cnt order by cnt return person",countQuery = "start boss=node({0}) match (boss)-[:boss]->(person) with person return count(*)")
Page<Person> findSubordinatesWithCount(Person boss,Pageable page);
Group findTeam(@Param("p_person") Person person);

View File

@@ -126,7 +126,7 @@ public class CypherQueryBuilderUnitTests {
@Test
public void createsSimpleTraversalClauseCorrectly() {
query.addRestriction(new Part("group", Person.class));
assertThat(query.toString(), is("START `person_group`=node({0}) MATCH `person`<-[:`members`]-`person_group` WHERE `person`.__type__! IN ['Person'] RETURN `person`"));
assertThat(query.toString(), is("START `person_group`=node({0}) MATCH `person`<-[:`members`]-`person_group` WHERE (has(`person`.__type__) AND `person`.__type__ IN ['Person']) RETURN `person`"));
}
@Test
@@ -168,13 +168,13 @@ public class CypherQueryBuilderUnitTests {
public void shouldFindByNodeEntity() throws Exception {
query.addRestriction(new Part("pet", Person.class));
assertThat(query.toString(), is("START `person_pet`=node({0}) MATCH `person`-[:`owns`]->`person_pet` WHERE `person`.__type__! IN ['Person'] RETURN `person`"));
assertThat(query.toString(), is("START `person_pet`=node({0}) MATCH `person`-[:`owns`]->`person_pet` WHERE (has(`person`.__type__) AND `person`.__type__ IN ['Person']) RETURN `person`"));
}
@Test
public void shouldFindByNodeEntityForIncomingRelationship() {
query.addRestriction(new Part("group", Person.class));
assertThat(query.toString(), is("START `person_group`=node({0}) MATCH `person`<-[:`members`]-`person_group` WHERE `person`.__type__! IN ['Person'] RETURN `person`"));
assertThat(query.toString(), is("START `person_group`=node({0}) MATCH `person`<-[:`members`]-`person_group` WHERE (has(`person`.__type__) AND `person`.__type__ IN ['Person']) RETURN `person`"));
}
}

View File

@@ -111,7 +111,7 @@ public class DerivedFinderMethodTest {
@Test
public void testQueryWithEntityGraphId() throws Exception {
assertRepositoryQueryMethod(ThingRepository.class, "findByOwnerId",new Object[]{123},
"START `thing_owner`=node({0}) MATCH `thing`-[:`owner`]->`thing_owner` WHERE `thing`.__type__! IN ['org.springframework.data.neo4j.repository.query.DerivedFinderMethodTest$Thing'] ",
"START `thing_owner`=node({0}) MATCH `thing`-[:`owner`]->`thing_owner` WHERE (has(`thing`.__type__) AND `thing`.__type__ IN ['org.springframework.data.neo4j.repository.query.DerivedFinderMethodTest$Thing']) ",
123);
}

View File

@@ -40,7 +40,7 @@
<programlisting language="xml" ><![CDATA[<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>1.8</version>
<version>1.8.1</version>
</dependency>
]]></programlisting>
</example>