Hi Mohana,

That Java API is capable of that, but not currently the REST API. At this
point the REST API is making use primarily of the IndexProvider interface
which defines a way to find nodes based on some criteria. In this case it
lists nodes based on the distance search from a single point. The syntax "START
n=node:geom('withinDistance:[41.8082, -87.7084, 10.0]')" must have a
literal string in the query, so cannot be made dynamic.

You have two options:

   - Write this in your app code. This means you first query for all
   possible n nodes (all points), iterate over them and for each build a query
   to search for points within the right distance. Then you can also add the
   relationships between these pairs in the same Cypher query. I tested with
   the following:
      - START n=node:geom("withinDistance:[41.8082, -87.7084, 10.0]") MATCH
      (a {case_number:"HX363263"}) WHERE NOT a = n MERGE
n-[:CLOSE_TO]->a RETURN
      a,n
      - You would replace the lat and lon with the appropriate ones for
      your test node
   - The other option is to write a server extension to do this in the Java
   API. This is best if you have performance issues with the above approach.
   If there are many test nodes, then doing a big loop in your application
   will become very expensive. You should rather do the loop server side.

Regards, Craig



On Sun, Aug 17, 2014 at 3:14 PM, Mohana Krishna <[email protected]> wrote:

> I also need one more help Craig. I wish to query dynamically say "I want
> to find all nodes which are within a span of 10KM. Something like 'n,m
> where n<>m and withinDistance:[n.lat, n.lon, 10.0]'. I want to have
> distinct results - same pair (in any order) should not appear again in
> results. I have tried various ways but unable to formulate exact query.
> Please help me out.
>
> And is there a way by which I can dynamically add relationships between
> nodes from REST such that there is an edge between every two nodes which
> are within a span of 10KM ?
>
> Awaiting your reply. Regards.
>
>
> On Tuesday, 12 August 2014 20:00:01 UTC+5:30, Mohana Krishna wrote:
>
>> Hello,
>>
>> I have loaded the spatial data in the attached file using REST API script
>> (which is also attached). The nodes are created and I can visualize them on
>> DB.
>>
>> However when I perform the query
>>
>> "START n=node:geom('withinDistance:[41.8082, -87.7084, 10.0]') RETURN n"
>> in CYPHER window , I am getting "Unknown Error" as result.
>>
>> Please help.
>>
>  --
> 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/d/optout.
>

-- 
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/d/optout.

Reply via email to