Skip to content

Commit

Permalink
DATAGRAPH-329 Upgrade to Neo4j 1.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jexp committed Jan 30, 2013
1 parent e08b7d1 commit 4b098cc
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 31 deletions.
2 changes: 1 addition & 1 deletion spring-data-neo4j-examples/cineasts-aspects/pom.xml
Expand Up @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions spring-data-neo4j-examples/cineasts-rest/pom.xml
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion spring-data-neo4j-examples/cineasts/pom.xml
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion spring-data-neo4j-examples/myrestaurants-social/pom.xml
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion spring-data-neo4j-examples/todos/pom.xml
Expand Up @@ -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>
Expand Down
6 changes: 3 additions & 3 deletions spring-data-neo4j-parent/pom.xml
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
Expand Up @@ -80,7 +80,7 @@ public EndResult<T> findWithinBoundingBox(final String indexName, final double l

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() {
Expand Down Expand Up @@ -433,19 +433,6 @@ public void close() {
}
}

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) {
Expand Down
Expand Up @@ -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";
Expand Down
Expand Up @@ -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);
Expand Down
Expand Up @@ -126,7 +126,7 @@ public void createsSimpleWhereClauseCorrectly() {
@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
Expand Down Expand Up @@ -168,13 +168,13 @@ public void buildsQueryWithPage() {
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`"));
}
}
Expand Up @@ -111,7 +111,7 @@ public void testQueryWithGraphId() throws Exception {
@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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/docbkx/tutorial/neo4j.xml
Expand Up @@ -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>
Expand Down

0 comments on commit 4b098cc

Please sign in to comment.