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
cypher query connundrum
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
  9 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
 
Eugen Paraschiv  
View profile  
 More options Apr 14 2012, 7:20 am
From: Eugen Paraschiv <hanrisel...@gmail.com>
Date: Sat, 14 Apr 2012 04:20:32 -0700 (PDT)
Local: Sat, Apr 14 2012 7:20 am
Subject: cypher query connundrum

Hi,
I'm working with Spring Data Neo4J, Neo4j 1.6.1 and the following model:
@Indexed(indexName = "locationsindex")
public class Location {
    @GraphId
    private Long id;

    private float latitude;
    private float longitude;
    ...

}

and I'm trying to write a Cypher query like:
@Query("...")
Location findByLatAndLong(final float latitude, final float longitude);
I have tried several options and nothing seems to work; I'm now thinking
that perhaps I should select the node by an index query (because I need to
check both latitude and longitude).
Any help is appreciated.
Thanks.
Eugen.

 
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.
Peter Neubauer  
View profile  
 More options Apr 14 2012, 10:41 am
From: Peter Neubauer <neubauer.pe...@gmail.com>
Date: Sat, 14 Apr 2012 16:41:24 +0200
Local: Sat, Apr 14 2012 10:41 am
Subject: Re: [Neo4j] cypher query connundrum

Yes,
That sounds like a plan. Have you checked out the spatial support, with a
Well Known Text property to hold the points?
On Apr 14, 2012 1:20 PM, "Eugen Paraschiv" <hanrisel...@gmail.com> wrote:


 
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 Apr 14 2012, 10:46 am
From: Michael Hunger <michael.hun...@neotechnology.com>
Date: Sat, 14 Apr 2012 16:46:55 +0200
Local: Sat, Apr 14 2012 10:46 am
Subject: Re: [Neo4j] cypher query connundrum

You find some docs here:
http://static.springsource.org/spring-data/data-graph/snapshot-site/r...

Michael

Am 14.04.2012 um 16:41 schrieb Peter Neubauer:


 
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.
Eugen Paraschiv  
View profile  
 More options Apr 15 2012, 6:21 am
From: Eugen Paraschiv <hanrisel...@gmail.com>
Date: Sun, 15 Apr 2012 03:21:51 -0700 (PDT)
Local: Sun, Apr 15 2012 6:21 am
Subject: Re: [Neo4j] cypher query connundrum

Sorry, I shouldn't have used Location(lat,lng) necessarily - it can be any
other entity with two floats (I'm not using the spring data geo support at
the moment). So essentially it's not related to geospatial stuff - just a
general entity and an general query retrieving it by 2 fields.
I'm not exactly sure about the documentation helping all that much on this
- what exactly is the example query I should be looking at?
Thanks.
Eugen.


 
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.
Jacob Hansson  
View profile  
 More options Apr 16 2012, 3:09 am
From: Jacob Hansson <jacob.hans...@neotechnology.com>
Date: Mon, 16 Apr 2012 09:09:10 +0200
Local: Mon, Apr 16 2012 3:09 am
Subject: Re: [Neo4j] cypher query connundrum

Could you include an example of a query you have tried, and the result you
expected?

Like you mention, you need an index lookup (or a node id) for Cypher to
start from. It currently does not let you look globally for unindexed
properties.

I'm not super familiar with the spring integration.. does the @indexed in
the beginning of the entity mean all attributes are indexed?

If so, you should be able to do something like:

START nodes=node:locationsIndex(latitude=100, longitude=200)
RETURN nodes

Sent from my phone, please excuse typos and brievety.
On Apr 15, 2012 12:21 PM, "Eugen Paraschiv" <hanrisel...@gmail.com> wrote:


 
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 Apr 16 2012, 3:36 am
From: Michael Hunger <michael.hun...@neotechnology.com>
Date: Mon, 16 Apr 2012 09:36:54 +0200
Local: Mon, Apr 16 2012 3:36 am
Subject: Re: [Neo4j] cypher query connundrum

Eugen,

you should always be able to do something like:

> Location findByLatitudeAndLongitude(final float latitude, final float longitude);

Which auto-generates the query you need. (It uses the where-clause to filter for the entities).

You might index the properties (at least one, there is still a bug with indexing two) then the query would use that to look up.

Michael

Am 15.04.2012 um 12:21 schrieb Eugen Paraschiv:


 
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.
Eugen Paraschiv  
View profile  
 More options Apr 17 2012, 4:36 pm
From: Eugen Paraschiv <hanrisel...@gmail.com>
Date: Tue, 17 Apr 2012 23:36:17 +0300
Local: Tues, Apr 17 2012 4:36 pm
Subject: Re: [Neo4j] cypher query connundrum

Right, I had some trouble with the autogenerated queries (posted about it a
while back) so I didn't even try - it works well, thanks. Is there a way to
see the exact query that gets generated?
On the query you suggested, that's fine if you have the values (100 and
200) but if you have arguments:
Location findByLatAndLong(final float latitude, final float longitude);
then using {0} and {1} INSIDE the query:
@Query("START location=node:locationsindex(\"latitude:{0} AND
longitude:{1}\") RETURN location")
doesn't work.
Thanks.
Eugen.

On Mon, Apr 16, 2012 at 10:36 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 Apr 17 2012, 4:54 pm
From: Michael Hunger <michael.hun...@neotechnology.com>
Date: Tue, 17 Apr 2012 22:54:35 +0200
Local: Tues, Apr 17 2012 4:54 pm
Subject: Re: [Neo4j] cypher query connundrum

Eugen, you will have to construct the lucene index query outside and pass it in as an parameter:

String locationQuery = String.format("latitude:%d AND longitude:%d",lat,lon);

> @Query("START location=node:locationsindex({0}) RETURN location")

findByLocationQuery(String locationQuery)

HTH

Michael

Am 17.04.2012 um 22:36 schrieb Eugen Paraschiv:


 
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.
Eugen Paraschiv  
View profile  
 More options Apr 18 2012, 4:26 am
From: Eugen Paraschiv <hanrisel...@gmail.com>
Date: Wed, 18 Apr 2012 11:26:05 +0300
Local: Wed, Apr 18 2012 4:26 am
Subject: Re: [Neo4j] cypher query connundrum

Yeah, I thought about doing that - I just wanted to make sure there's no
other way.
Thanks for all the feedback and help.
Eugen.

On Tue, Apr 17, 2012 at 11:54 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.
End of messages
« Back to Discussions « Newer topic     Older topic »