Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Returning two node entities in one Cypher query through SDN
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Abdul Azeez Shaik  
View profile  
 More options Oct 8 2012, 11:41 pm
From: Abdul Azeez Shaik <azeeztechni...@gmail.com>
Date: Tue, 9 Oct 2012 09:11:00 +0530
Subject: Returning two node entities in one Cypher query through SDN

Hi,

Can i return two node entities through cypher query in SDN?
for ex:

@Query( "START n=node:search({0}) RETURN n")

Iterable<User> doBasicSearch(String query);

Apart from Iterable of one Node Entity, can i give a object which has User
and Product?
like this,
Class Result {
Iterable<User> users;
Iterable<Product> products;

}

Result doBasicSearch(String query);

Kindly let me know on how to achieve this through Spring Data Neo4j.
These are versions i have included in pom,
     <spring-data-neo4j.version>2.1.0.RC4</spring-data-neo4j.version>
     <org.jackson-version>1.9.7</org.jackson-version>
<neo4j.version>1.8.RC1</neo4j.version>

Thanks,
Abdul


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Hunger  
View profile  
 More options Oct 9 2012, 2:00 am
From: Michael Hunger <michael.hun...@neotechnology.com>
Date: Tue, 9 Oct 2012 08:02:44 +0200
Local: Tues, Oct 9 2012 2:02 am
Subject: Re: [Neo4j] Returning two node entities in one Cypher query through SDN

You mean two different node-entities?
What is your use-case?

You can actually project the entities.

it should be also possible to use

@MapResult
interface Result {
   @ResultColumn("n") Iterable<User> getAsUsers();
   @ResultColumn("n") Iterable<Product> getAsProducts();

}

please try that.

Am 09.10.2012 um 05:41 schrieb Abdul Azeez Shaik <azeeztechni...@gmail.com>:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Abdul Azeez Shaik  
View profile  
 More options Oct 10 2012, 12:42 pm
From: Abdul Azeez Shaik <azeeztechni...@gmail.com>
Date: Wed, 10 Oct 2012 22:11:39 +0530
Local: Wed, Oct 10 2012 12:41 pm
Subject: Re: [Neo4j] Returning two node entities in one Cypher query through SDN

This one looks great!
However, there is no mention of this in spring-data-neo4j documentation
except in one example of 17.1.
This would drag more attention, If this could be part of "Reference
Documentation" part.

Thanks for providing me this option.

Regards,
 Abdul

On Tue, Oct 9, 2012 at 11:32 AM, Michael Hunger <


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Hunger  
View profile  
 More options Oct 10 2012, 1:00 pm
From: Michael Hunger <michael.hun...@neotechnology.com>
Date: Wed, 10 Oct 2012 19:00:06 +0200
Local: Wed, Oct 10 2012 1:00 pm
Subject: Re: [Neo4j] Returning two node entities in one Cypher query through SDN

B/c this is a corner case :)
Projection in general is mentioned and promoted.

Michael

Am 10.10.2012 um 18:41 schrieb Abdul Azeez Shaik:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Abdul Azeez Shaik  
View profile  
 More options Oct 13 2012, 5:30 am
From: Abdul Azeez Shaik <azeeztechni...@gmail.com>
Date: Sat, 13 Oct 2012 15:00:13 +0530
Local: Sat, Oct 13 2012 5:30 am
Subject: Re: [Neo4j] Returning two node entities in one Cypher query through SDN

Hi Michael,

Apart from @MapResult, there is other form of Return type
Iterable<Map<String,Object>>

1.Can i use this return type to return one column and one entity?

For ex: Query("START n=node:username(username= {0}) MATCH n-[]-user RETURN
n.name, user"). Can i use Iterable<Map<String, Object>> for above query. Or
do i need to use @MapResult even for this?

2. In Neo4j(.i.e.without using SDN), Map is results of column names with
the respective data. But, in case of SDN, they will be directly associated
to @NodeEntity, so what could be the use cases where we can use
Iterable<Map<String, Object>>.

Kindly help me in understanding above result types.

Thanks,
Abdul

On Tue, Oct 9, 2012 at 11:32 AM, Michael Hunger <


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Hunger  
View profile  
 More options Oct 13 2012, 6:29 am
From: Michael Hunger <michael.hun...@neopersistence.com>
Date: Sat, 13 Oct 2012 12:28:53 +0200
Local: Sat, Oct 13 2012 6:28 am
Subject: Re: [Neo4j] Returning two node entities in one Cypher query through SDN

Sent from mobile device

Am 13.10.2012 um 11:30 schrieb Abdul Azeez Shaik <azeeztechni...@gmail.com>:

> Hi Michael,

> Apart from @MapResult, there is other form of Return type Iterable<Map<String,Object>>

> 1.Can i use this return type to return one column and one entity?

Yes

> For ex: Query("START n=node:username(username= {0}) MATCH n-[]-user RETURN n.name, user"). Can i use Iterable<Map<String, Object>> for above query. Or do i need to use @MapResult even for this?

No mapresult is just a thin wrapper around this for convenience

> 2. In Neo4j(.i.e.without using SDN), Map is results of column names with the respective data. But, in case of SDN, they will be directly associated to @NodeEntity, so what could be the use cases where we can use Iterable<Map<String, Object>>.

Here each map reprents a row mappin the column name to the object.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Abdul Azeez Shaik  
View profile  
 More options Oct 13 2012, 8:43 am
From: Abdul Azeez Shaik <azeeztechni...@gmail.com>
Date: Sat, 13 Oct 2012 18:13:27 +0530
Local: Sat, Oct 13 2012 8:43 am
Subject: Re: [Neo4j] Returning two node entities in one Cypher query through SDN

Hi Michael,

I just tried following query ("START n=node:username(username= {0}) MATCH
n-[]-user RETURN n.name, user") with Result type as Iterable<Map<String,
User>>.

User is NodeEntity in my code.

However, instead of returning USER object, it returned
org.neo4j.rest.graphdb.entity.RestNode type. Can you please let me know if
i need to add anything specific here.

Before this, i just had Iterable<User> which use to work fine.

Kindly let me know your opinion on this.

Thanks,
Abdul

On Sat, Oct 13, 2012 at 3:58 PM, Michael Hunger <


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Hunger  
View profile  
 More options Oct 13 2012, 9:33 am
From: Michael Hunger <michael.hun...@neopersistence.com>
Date: Sat, 13 Oct 2012 15:33:30 +0200
Local: Sat, Oct 13 2012 9:33 am
Subject: Re: [Neo4j] Returning two node entities in one Cypher query through SDN

Ok I probably incorrectly assumed that the nodes would be converted in this case.

So it seems you have to use MapResult anyway.

Sent from mobile device

Am 13.10.2012 um 14:43 schrieb Abdul Azeez Shaik <azeeztechni...@gmail.com>:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »