I couldn't reproduce it with server, I ran exactly the same test that failed against server and it worked for me.
Let me see if we can figure out a test-case against server that shows it. Michael Am 05.02.2014 um 12:27 schrieb Gwendal Mousset <[email protected]>: > Hi Michael, > > We have switched to neo4j-2.0.1 with SDN 3.0.0-RC1 and I found that this bug > is fixed with embedded database but not with server. > Do you think it will be fixed in next RC ? > Could you provide a patch waiting for the next release ? > > Thanks > > On Monday, January 20, 2014 7:57:54 PM UTC+1, Gwendal Mousset wrote: > Thanks :-) > > > On Mon, Jan 20, 2014 at 5:53 PM, Michael Hunger > <[email protected]> wrote: > Good point, I should check the same thing in the java-rest-binding. > > Michael > > Am 20.01.2014 um 16:33 schrieb Gwendal Mousset <[email protected]>: > >> Hi, >> >> Michael, your patch works well with embedded database but not with neo4j >> server. >> Thanks for your help >> >> Gwendal >> >> On Friday, January 10, 2014 10:23:27 AM UTC+1, Gwendal Mousset wrote: >> Thank you very much Michael for your work and your reactivity ! >> >> On Friday, January 10, 2014 9:26:46 AM UTC+1, Michael Hunger wrote: >> Hi, >> >> its a bug in SDN, I fixed it here, in case you want to patch locally. >> >> https://github.com/spring-projects/spring-data-neo4j/blob/master/spring-data-neo4j/src/main/java/org/springframework/data/neo4j/support/conversion/ResultColumnValueExtractor.java#L75 >> >> if (returnType.isCollectionLike()) { >> QueryResultBuilder qrb = new >> QueryResultBuilder((Iterable)columnValue, converter); >> return >> qrb.to(returnType.getActualType().getType()).as(returnType.getType()); >> } else >> return converter.convert(columnValue, returnType.getType(), >> mappingPolicy); >> } >> >> It will be part of the next release, thanks again for reporting it. >> >> Cheers >> >> Michael >> >> Am 09.01.2014 um 09:13 schrieb Gwendal Mousset <[email protected]>: >> >>> A precision i missed, the exception is not thrown when i execute the >>> request but when i try accessing to Iterable<CategoryDAO> >>> getSubCategories(). >>> >>> >>> On Wednesday, January 8, 2014 1:47:18 PM UTC+1, Gwendal Mousset wrote: >>> Hello, >>> >>> I have an issue with cypher request using collect() function. >>> I'm using spring-data-neo4j 3.0.0-M1 and Neo4j 2.0.0-M06. >>> >>> In my data model i have Category nodes. >>> Each category can have subcategories. >>> I want to retrieve the top categories list with the associated >>> subcategories. >>> >>> Categ3 -- IS_SUBCATEGORY_OF --> Categ1 <-- IS_SUBCATEGORY_OF -- Categ2 >>> >>> My request: >>> >>> MATCH (cat:Category) >>> WITH cat >>> MATCH (cat)<-[?:IS_SUBCATEGORY_OF]-(subCat:Category) >>> WHERE NOT cat-[:IS_SUBCATEGORY_OF]->() >>> RETURN cat as category, collect(subCat) as subCategories >>> >>> >>> The query result is exactly what i expect in the console: >>> >>> +--------------------------------------------------------------------------------------------------------------------------------------------------------+ >>> | category | subCategories >>> >>> | >>> +--------------------------------------------------------------------------------------------------------------------------------------------------------+ >>> | Node[128]{id:"e9c27555f46c4acdb29c8d0e89814467"} | [] >>> >>> | >>> | Node[176]{id:"78f7c907068c4e1abd018fe560c2c03a"} | [] >>> >>> | >>> | Node[134]{id:"e362b9c05a8f41f0aee877f914f2658f"} | [] >>> >>> | >>> | Node[136]{id:"7b3d58a89ebd4010964004d58e962526"} | [] >>> >>> | >>> | Node[118]{id:"3378af0b1f54405fb7ab2970cba5bff3"} | >>> [Node[34]{id:"d10cc4418c914c1281f7183da8109a4f"},Node[46]{id:"b3012831db924c22829a0335df2e90d1"}] >>> | >>> | Node[130]{id:"e3e290b4d2c648b3a6a7d0fe8da461ef"} | [] >>> >>> | >>> | Node[138]{id:"eb828c120cb248c2a5baa92734e39b91"} | [] >>> >>> | >>> | Node[132]{id:"057aeb6913474454a329571b9a266305"} | [] >>> >>> | >>> | Node[126]{id:"2671039fa6f24f5b806df682c238d1c4"} | >>> [Node[120]{id:"48bc7f2b34db49bfb40936864a7a4a80"},Node[122]{id:"373d94527286482fb8c807aee90d7f5e"}] >>> | >>> +--------------------------------------------------------------------------------------------------------------------------------------------------------+ >>> >>> >>> My QueryResult interface: >>> >>> @QueryResult >>> public interface CategoryWithSubCategories { >>> >>> >>> /** >>> * >>> * @return A category. >>> */ >>> @ResultColumn("category") >>> CategoryDAO getCategory(); >>> >>> /** >>> * >>> * @return The subcategories. >>> */ >>> @ResultColumn("subCategories") >>> Iterable<CategoryDAO> getSubCategories(); >>> } >>> >>> My Query: >>> >>> @Query("MATCH (cat:Category) " >>> + "WITH cat " >>> + "MATCH (cat)<-[?:IS_SUBCATEGORY_OF]-(subCat:Category) " >>> + "WHERE NOT cat-[:IS_SUBCATEGORY_OF]->() " >>> + "RETURN distinct cat as category, collect(subCat) as >>> subCategories") >>> Iterable<CategoryDAO> getAll(); >>> >>> When i call this method, i get an exception: >>> >>> java.lang.RuntimeException: Cannot extract single value from Iterable with >>> more than one elements. >>> at >>> org.springframework.data.neo4j.conversion.DefaultConverter.extractSingle(DefaultConverter.java:60) >>> at >>> org.springframework.data.neo4j.conversion.DefaultConverter.extractValue(DefaultConverter.java:51) >>> at >>> org.springframework.data.neo4j.conversion.DefaultConverter.convert(DefaultConverter.java:40) >>> at >>> org.springframework.data.neo4j.support.conversion.EntityResultConverter.convert(EntityResultConverter.java:165) >>> at >>> org.springframework.data.neo4j.conversion.DefaultConverter.convert(DefaultConverter.java:36) >>> at >>> org.springframework.data.neo4j.rest.SpringRestGraphDatabase$SpringResultConverter.convert(SpringRestGraphDatabase.java:148) >>> at >>> org.neo4j.rest.graphdb.util.QueryResultBuilder$1$1.underlyingObjectToObject(QueryResultBuilder.java:98) >>> at >>> org.neo4j.helpers.collection.IteratorWrapper.next(IteratorWrapper.java:47) >>> ... >>> ... >>> >>> >>> I think my code is quite similar with the exemple in documentation at >>> http://docs.spring.io/spring-data/data-neo4j/docs/3.0.0.M1/reference/htmlsingle/#reference_programming-model_mapresult >>> >>> Please could you tell me what i'm doing wrong ? >>> >>> Tank you >>> >>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Neo4j" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to [email protected]. >>> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Neo4j" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. > > > -- > You received this message because you are subscribed to the Google Groups > "Neo4j" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > > -- > Gwendal Mousset > > -- > You received this message because you are subscribed to the Google Groups > "Neo4j" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
