Re: [Neo4j] Cypher error in neo4j-spatial

2011-07-02 Thread Peter Neubauer
Fixed in spatial,
Thanks!

Sent from my phone.
On Jul 3, 2011 7:39 AM, "Andres Taylor" 
wrote:
> We decided that we needed a meta-data character that wasn't ":". Instead,
> you now write: "r~TYPE"
>
> Andrés
>
> On Sun, Jul 3, 2011 at 12:44 AM, Peter Neubauer wrote:
>
>> Just pinged Andres on this. The r:TYPE is the culprit.
>>
>> Sent from my phone.
>> On Jul 3, 2011 12:06 AM, "Craig Taverner"  wrote:
>> > Hi,
>> >
>> > Recent builds of Neo4j-Spatial no longer like Peters new bounding box
>> query.
>> > Peter is on vacation, and I am not familiar with the code (nor cypher),
>> so
>> I
>> > thought I would just dump the error message here for now in case
someone
>> can
>> > give me a quick pointer.
>> >
>> > The line of code is:
>> > Query query = parser.parse( "start n=(layer1,'bbox:[15.0, 16.0, 56.0,
>> > 57.0]') match (n) -[r] - (x) return n.bbox, r:TYPE, x.layer?, x.bbox?"
);
>> >
>> > The error is:
>> > org.neo4j.cypher.SyntaxError: string matching regex `\z' expected but
`:'
>> > found
>> > at org.neo4j.cypher.parser.CypherParser.parse(CypherParser.scala:75)
>> > at org.neo4j.cypher.javacompat.CypherParser.parse(CypherParser.java:39)
>> > at
>> >
>>
>>
org.neo4j.gis.spatial.IndexProviderTest.testNodeIndex(IndexProviderTest.java:91)
>> >
>> > Regards, Craig
>> > ___
>> > Neo4j mailing list
>> > User@lists.neo4j.org
>> > https://lists.neo4j.org/mailman/listinfo/user
>> ___
>> Neo4j mailing list
>> User@lists.neo4j.org
>> https://lists.neo4j.org/mailman/listinfo/user
>>
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] reify links with other neo4j databases located on different distributed servers

2011-07-02 Thread Aliabbas Petiwala
Thanks a lot Rick

can you please provide more details on  issues which you faced while
using this approach and  share some code with us .
Had you decided about this at design time itself and designed your
graph db schema accordingly?
Is there much perceived performance penalties if there are a large
number of such references spanning physical boundaries?

On 7/2/11, Rick Bullotta  wrote:
> We are using node-id property references (the node id as a property),
> qualified with a "logical server" reference, to provide this type of binding
> across graphs. If you combine these with an index, you can actually get a
> lot of the functionality of relationships "cross graph", spanning physical
> boundaries.  Of course, as Craig points out, this all has to be done at the
> application level, including dealing with cascading deletes when a node is
> removed from one graph, ensuring that references to it in another graph are
> removed/redirected.
>
> -Original Message-
> From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On
> Behalf Of Craig Taverner
> Sent: Saturday, July 02, 2011 6:03 AM
> To: Neo4j user discussions
> Subject: Re: [Neo4j] reify links with other neo4j databases located on
> different distributed servers
>
> As far as I know there is no internal support for transparent traversals
> across shards. Generally people are doing that in the application layer.
> However, I think there might be a middle ground of sorts. I we modify the
> relationship expander, I could imagine that relationships that are between
> shards could be modified to return node on the other shard. This would make
> the traversal return nodes across shards, but since I've not tried this
> myself, I am uncertain if there are other consequences.
>
> On Sat, Jul 2, 2011 at 4:03 AM, Aliabbas Petiwala
> wrote:
>
>> Hi,
>>
>> I cannot figure out how my application logic can reify links with
>> other neo4j databases located on different distributed servers?
>> hence , how can i make the traversals and graph algorithms transparent
>> to the location of the different databases ?
>> --
>> Aliabbas Petiwala
>> M.Tech CSE
>> ___
>> Neo4j mailing list
>> User@lists.neo4j.org
>> https://lists.neo4j.org/mailman/listinfo/user
>>
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>


-- 
Aliabbas Petiwala
M.Tech CSE
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Cypher error in neo4j-spatial

2011-07-02 Thread Andres Taylor
We decided that we needed a meta-data character that wasn't ":". Instead,
you now write: "r~TYPE"

Andrés

On Sun, Jul 3, 2011 at 12:44 AM, Peter Neubauer wrote:

> Just pinged Andres on this. The r:TYPE is the culprit.
>
> Sent from my phone.
> On Jul 3, 2011 12:06 AM, "Craig Taverner"  wrote:
> > Hi,
> >
> > Recent builds of Neo4j-Spatial no longer like Peters new bounding box
> query.
> > Peter is on vacation, and I am not familiar with the code (nor cypher),
> so
> I
> > thought I would just dump the error message here for now in case someone
> can
> > give me a quick pointer.
> >
> > The line of code is:
> > Query query = parser.parse( "start n=(layer1,'bbox:[15.0, 16.0, 56.0,
> > 57.0]') match (n) -[r] - (x) return n.bbox, r:TYPE, x.layer?, x.bbox?" );
> >
> > The error is:
> > org.neo4j.cypher.SyntaxError: string matching regex `\z' expected but `:'
> > found
> > at org.neo4j.cypher.parser.CypherParser.parse(CypherParser.scala:75)
> > at org.neo4j.cypher.javacompat.CypherParser.parse(CypherParser.java:39)
> > at
> >
>
> org.neo4j.gis.spatial.IndexProviderTest.testNodeIndex(IndexProviderTest.java:91)
> >
> > Regards, Craig
> > ___
> > Neo4j mailing list
> > User@lists.neo4j.org
> > https://lists.neo4j.org/mailman/listinfo/user
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Cypher error in neo4j-spatial

2011-07-02 Thread Peter Neubauer
Just pinged Andres on this. The r:TYPE is the culprit.

Sent from my phone.
On Jul 3, 2011 12:06 AM, "Craig Taverner"  wrote:
> Hi,
>
> Recent builds of Neo4j-Spatial no longer like Peters new bounding box
query.
> Peter is on vacation, and I am not familiar with the code (nor cypher), so
I
> thought I would just dump the error message here for now in case someone
can
> give me a quick pointer.
>
> The line of code is:
> Query query = parser.parse( "start n=(layer1,'bbox:[15.0, 16.0, 56.0,
> 57.0]') match (n) -[r] - (x) return n.bbox, r:TYPE, x.layer?, x.bbox?" );
>
> The error is:
> org.neo4j.cypher.SyntaxError: string matching regex `\z' expected but `:'
> found
> at org.neo4j.cypher.parser.CypherParser.parse(CypherParser.scala:75)
> at org.neo4j.cypher.javacompat.CypherParser.parse(CypherParser.java:39)
> at
>
org.neo4j.gis.spatial.IndexProviderTest.testNodeIndex(IndexProviderTest.java:91)
>
> Regards, Craig
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] Cypher error in neo4j-spatial

2011-07-02 Thread Craig Taverner
Hi,

Recent builds of Neo4j-Spatial no longer like Peters new bounding box query.
Peter is on vacation, and I am not familiar with the code (nor cypher), so I
thought I would just dump the error message here for now in case someone can
give me a quick pointer.

The line of code is:
Query query = parser.parse( "start n=(layer1,'bbox:[15.0, 16.0, 56.0,
57.0]') match (n) -[r] - (x) return n.bbox, r:TYPE, x.layer?, x.bbox?" );

The error is:
org.neo4j.cypher.SyntaxError: string matching regex `\z' expected but `:'
found
at org.neo4j.cypher.parser.CypherParser.parse(CypherParser.scala:75)
at org.neo4j.cypher.javacompat.CypherParser.parse(CypherParser.java:39)
at
org.neo4j.gis.spatial.IndexProviderTest.testNodeIndex(IndexProviderTest.java:91)

Regards, Craig
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] Distinct results in Cypher

2011-07-02 Thread Josh Adell
Is it possible to get distinct results in Cypher?  Something like

START a=(1) MATCH (a)-[:FOOTYPE]->(b) RETURN DISTINCT b

I have a scenario where a single node may be connected multiple times
to another node, and I only want that other node to be returned once.
I'd hate to have to do this in my client code.  If this feature isn't
available in Cypher, consider this a feature request.

Thanks!

-- Josh Adell
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] neo4j spatial bounding box vs. lat/lon

2011-07-02 Thread Craig Taverner
As I understand it, Andreas is working on the much more complex problem of
updating OSM geometries. That is more complex because it involves
restructuring the connected graph.

The case Boris has is much simpler, just modifying the WKT or WKB in the
editable layer. In the Java API this is simply to call the
GeometryEncoder.encodeGeometry() method, which will modify the geometry in
place (ie. replace the old geometry with a new one). However, I do not think
it is that simple on the REST interface. I can check, but think we will need
a new method for updating geometries. Internally it is trivial to code.

So I just added a quick method, called updateGeometryFromWKT, which requires
the geometry (in WKT), the existing geometry node-id, and the layer. Give it
a try.

On Sat, Jul 2, 2011 at 5:10 PM, Peter Neubauer wrote:

> Actually,
> Andreas Wilhelm is working right now on updating geometries.
>
> Sent from my phone.
> On Jul 2, 2011 5:00 PM, "Boris Kizelshteyn"  wrote:
> > Wow that's great! I'll try it out asap. This leads to my next question:
> how
> > do I update the geometry in a layer, rather than add new? What I am
> thinking
> > of doing is having a multipoint geometery associated with each of my user
> > nodes which will represent their location history. My plan is to add the
> > geometry to a "world" layer and then associate the returned node with the
> > user. How do I then add new points to that connecter node? Can I just
> edit
> > the wkt and assume the index will update? Or do you have a better
> suggestion
> > for doing this? I would rather avoid having each point be a seperate node
> as
> > I am tracking gps data and getting lots of coordinates, it would be many
> > thousands of nodes per user.
> >
> > Many thanks!
> >
> >>
> >>
> >> On Sat, Jul 2, 2011 at 6:48 AM, Craig Taverner 
> wrote:
> >>
> >>> Hi Boris,
> >>>
> >>> Ah! You are using the REST API. That changes a lot, since Neo4j Spatial
> is
> >>> only recently exposed in REST and we do not expose most of the
> >>> capabilities
> >>> I have discussed in this thread, or indeed in my other answer today.
> >>>
> >>> I did recently add some REST methods that might work for you,
> specifically
> >>> the addEditableLayer, which makes a WKB layer, and the
> >>> addGeometryWKTToLayer, for adding any kind of Geometry (including
> >>> LineString) to the layer. However, these were only added recently, and
> I
> >>> have no experience using them myself, so consider this very much
> prototype
> >>> code. From your other question today, can I assume you are having
> trouble
> >>> making sense of the data coming back? So we need a better way to return
> >>> the
> >>> results in WKT instead of WKB? One option would be to enhance the
> >>> addEditableLayer method to allow the creation of WKT layers instead of
> WKB
> >>> layers, so the internal representation is more internet friendly.
> >>>
> >>> I've just added untested support for setting the format to WKT for the
> >>> internal representation of the editable layer in the REST interface.
> This
> >>> is
> >>> untested (outside of my usual unit tests, that is), and is only in the
> >>> trunk
> >>> of neo4j-spatial, but you are welcome to try it out and see what
> happens.
> >>>
> >>> Regards, Craig
> >>>
> >>> On Fri, Jul 1, 2011 at 5:29 PM, Boris Kizelshteyn 
> >>> wrote:
> >>>
> >>> > Hi Craig,
> >>> >
> >>> > Thanks so much for this reply. It is very insightful. Is it possible
> for
> >>> me
> >>> > to implement the LineString geometries and lookups using REST?
> >>> >
> >>> > Many thanks!
> >>> >
> >>> > On Wed, Jun 8, 2011 at 4:58 PM, Craig Taverner 
> >>> wrote:
> >>> >
> >>> > > OK. I understand much better what you want now.
> >>> > >
> >>> > > Your person nodes are not geographic objects, they are persons that
> >>> can
> >>> > be
> >>> > > at many positions and indeed move around. However, the 'path' that
> >>> they
> >>> > > take
> >>> > > is a geographic object and can be placed on the map and analysed
> >>> > > geographically.
> >>> > >
> >>> > > So the question I have is how do you store the path the person
> takes?
> >>> Is
> >>> > > this a bunch of position nodes connected back to that person? Or
> >>> perhaps
> >>> > a
> >>> > > chain of position-(next)->position-(next)->position, etc? However
> you
> >>> > have
> >>> > > stored this in the graph, you can express this as a geographic
> object
> >>> by
> >>> > > implementing the GeometryEncoder interface. See, for example, the 6
> >>> lines
> >>> > > of
> >>> > > code it takes to traverse a chain of NEXT locations and produce a
> >>> > > LineString
> >>> > > geometry in the SimpleGraphEncoder at
> >>> > >
> >>> > >
> >>> >
> >>>
>
> https://github.com/neo4j/neo4j-spatial/blob/master/src/main/java/org/neo4j/gis/spatial/encoders/SimpleGraphEncoder.java#L82
> >>> > >
> >>> > > <
> >>> > >
> >>> >
> >>>
>
> https://github.com/neo4j/neo4j-spatial/blob/master/src/main/java/org/neo4j/gis/spatial/encoders/SimpleGraphEncoder.java#L82
> >>> > > >I

Re: [Neo4j] IMPORTANT: Corruption Bug in 1.4 M05

2011-07-02 Thread Axel Morgner
Hi Jim,

thanks for reporting anyway. We run some structr instances on the latest 
milestone, so I'd be interesed in some more details:

- Is 1.4 M04 safe?
- How can we detect whether corruption occured, and is there a way 
recover from that?
- Is this bug contained in the current SNAPSHOT?

Thanks and best regards

Axel

--
http://structr.org

On 02.07.2011 20:46, Jim Webber wrote:
> Hi fellow graphistas,
>
> In testing our upcoming 1.4 GA release, we discovered a subtle bug in our 1.4 
> M05 release that can result in database corruption. Under certain 
> circumstances with clean shutdowns of the database it's possible that freed 
> IDs will be recycled more than once, meaning that on restart, multiple nodes 
> may receive the same node ID, corrupting the graph.
>
> It's still fine to develop against 1.4 M05 to become familiar with the new 
> features and APIs which will be preserved in the GA release. However we do 
> not recommend, as with milestones in general, moving into production on the 
> 1.4 M05 release since data corruption of data is possible.
>
> We're now busy making sure that the 1.4 GA release is a completely solid - 
> thanks to you all for being such an awesome and supportive community.
>
> Jim
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user

___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] IMPORTANT: Corruption Bug in 1.4 M05

2011-07-02 Thread Jim Webber
Hi fellow graphistas,

In testing our upcoming 1.4 GA release, we discovered a subtle bug in our 1.4 
M05 release that can result in database corruption. Under certain circumstances 
with clean shutdowns of the database it's possible that freed IDs will be 
recycled more than once, meaning that on restart, multiple nodes may receive 
the same node ID, corrupting the graph.

It's still fine to develop against 1.4 M05 to become familiar with the new 
features and APIs which will be preserved in the GA release. However we do not 
recommend, as with milestones in general, moving into production on the 1.4 M05 
release since data corruption of data is possible.

We're now busy making sure that the 1.4 GA release is a completely solid - 
thanks to you all for being such an awesome and supportive community.

Jim
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Multiple sessions

2011-07-02 Thread Mattias Persson
Everything written to the database with successful transactions is persisted
and will be accessible in any following sessions. Just _don't_ think of a
GraphDatabaseService instance as a short lived object (like a SQL
connection), but instead see it more as your database server which benefits
from being long lived... even days, weeks...)

2011/7/1 Vaccaro, Kristen M 

> Hi, I have a question about sessions in Neo4j. I'm working with the
> embedded Java (not as a server) and I can load my data and query it between
> transactions without trouble. My question is whether/how it's possible to
> shut down my database at the end of a session and then access it in a new
> session later.
>
> Something like first doing:
> GraphDatabaseService graphDb = new EmbeddedGraphDatabase( "var/test/base"
> );
> ...Add all my data using transactions
> graphDb.shutdown();
>
> Then later opening a new session and accessing that database and indices
> I've already made. Is that possible (I didn't see anything covering that in
> the wiki/documentation)? Or will I need to convert to the server version?
> Kristen
>
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] neo4j spatial bounding box vs. lat/lon

2011-07-02 Thread Peter Neubauer
Actually,
Andreas Wilhelm is working right now on updating geometries.

Sent from my phone.
On Jul 2, 2011 5:00 PM, "Boris Kizelshteyn"  wrote:
> Wow that's great! I'll try it out asap. This leads to my next question:
how
> do I update the geometry in a layer, rather than add new? What I am
thinking
> of doing is having a multipoint geometery associated with each of my user
> nodes which will represent their location history. My plan is to add the
> geometry to a "world" layer and then associate the returned node with the
> user. How do I then add new points to that connecter node? Can I just edit
> the wkt and assume the index will update? Or do you have a better
suggestion
> for doing this? I would rather avoid having each point be a seperate node
as
> I am tracking gps data and getting lots of coordinates, it would be many
> thousands of nodes per user.
>
> Many thanks!
>
>>
>>
>> On Sat, Jul 2, 2011 at 6:48 AM, Craig Taverner  wrote:
>>
>>> Hi Boris,
>>>
>>> Ah! You are using the REST API. That changes a lot, since Neo4j Spatial
is
>>> only recently exposed in REST and we do not expose most of the
>>> capabilities
>>> I have discussed in this thread, or indeed in my other answer today.
>>>
>>> I did recently add some REST methods that might work for you,
specifically
>>> the addEditableLayer, which makes a WKB layer, and the
>>> addGeometryWKTToLayer, for adding any kind of Geometry (including
>>> LineString) to the layer. However, these were only added recently, and I
>>> have no experience using them myself, so consider this very much
prototype
>>> code. From your other question today, can I assume you are having
trouble
>>> making sense of the data coming back? So we need a better way to return
>>> the
>>> results in WKT instead of WKB? One option would be to enhance the
>>> addEditableLayer method to allow the creation of WKT layers instead of
WKB
>>> layers, so the internal representation is more internet friendly.
>>>
>>> I've just added untested support for setting the format to WKT for the
>>> internal representation of the editable layer in the REST interface.
This
>>> is
>>> untested (outside of my usual unit tests, that is), and is only in the
>>> trunk
>>> of neo4j-spatial, but you are welcome to try it out and see what
happens.
>>>
>>> Regards, Craig
>>>
>>> On Fri, Jul 1, 2011 at 5:29 PM, Boris Kizelshteyn 
>>> wrote:
>>>
>>> > Hi Craig,
>>> >
>>> > Thanks so much for this reply. It is very insightful. Is it possible
for
>>> me
>>> > to implement the LineString geometries and lookups using REST?
>>> >
>>> > Many thanks!
>>> >
>>> > On Wed, Jun 8, 2011 at 4:58 PM, Craig Taverner 
>>> wrote:
>>> >
>>> > > OK. I understand much better what you want now.
>>> > >
>>> > > Your person nodes are not geographic objects, they are persons that
>>> can
>>> > be
>>> > > at many positions and indeed move around. However, the 'path' that
>>> they
>>> > > take
>>> > > is a geographic object and can be placed on the map and analysed
>>> > > geographically.
>>> > >
>>> > > So the question I have is how do you store the path the person
takes?
>>> Is
>>> > > this a bunch of position nodes connected back to that person? Or
>>> perhaps
>>> > a
>>> > > chain of position-(next)->position-(next)->position, etc? However
you
>>> > have
>>> > > stored this in the graph, you can express this as a geographic
object
>>> by
>>> > > implementing the GeometryEncoder interface. See, for example, the 6
>>> lines
>>> > > of
>>> > > code it takes to traverse a chain of NEXT locations and produce a
>>> > > LineString
>>> > > geometry in the SimpleGraphEncoder at
>>> > >
>>> > >
>>> >
>>>
https://github.com/neo4j/neo4j-spatial/blob/master/src/main/java/org/neo4j/gis/spatial/encoders/SimpleGraphEncoder.java#L82
>>> > >
>>> > > <
>>> > >
>>> >
>>>
https://github.com/neo4j/neo4j-spatial/blob/master/src/main/java/org/neo4j/gis/spatial/encoders/SimpleGraphEncoder.java#L82
>>> > > >If
>>> > > you do this, you can create a layer that uses your own geometry
>>> encoder
>>> > (or
>>> > > the SimpleGraphEncoder I referenced above, if you use the same graph
>>> > > structure) and your own domain model will be expressed as LineString
>>> > > geometries and you can perform spatial operations on them.
>>> > >
>>> > > Alternatively, if your data is more static in nature, and you are
>>> > analysing
>>> > > only what the person did in the past, and the graph will therefor
not
>>> > > change, perhaps you do not care to store the locations in the graph,
>>> and
>>> > > you
>>> > > can just import them as a LineString directly into a standard layer.
>>> > >
>>> > > Whatever route you take, the final action you want to perform is to
>>> find
>>> > > points near the LineString (path the person took). I do not think
the
>>> > > bounding box is the right approach for that either. You need to try,
>>> for
>>> > > example, the method findClosestEdges in the utilities class at
>>> > >
>>> > >
>>> >
>>>
https://github.com/neo4j/neo4j-spatial/blob/master/

Re: [Neo4j] neo4j spatial bounding box vs. lat/lon

2011-07-02 Thread Boris Kizelshteyn
Wow that's great! I'll try it out asap. This leads to my next question: how
do I update the geometry in a layer, rather than add new? What I am thinking
of doing is having a multipoint geometery associated with each of my user
nodes which will represent their location history. My plan is to add the
geometry to a "world" layer and then associate the returned node with the
user. How do I then add new points to that connecter node? Can I just edit
the wkt and assume the index will update? Or do you have a better suggestion
for doing this? I would rather avoid having each point be a seperate node as
I am tracking gps data and getting lots of coordinates, it would be many
thousands of nodes per user.

Many thanks!

>
>
> On Sat, Jul 2, 2011 at 6:48 AM, Craig Taverner  wrote:
>
>> Hi Boris,
>>
>> Ah! You are using the REST API. That changes a lot, since Neo4j Spatial is
>> only recently exposed in REST and we do not expose most of the
>> capabilities
>> I have discussed in this thread, or indeed in my other answer today.
>>
>> I did recently add some REST methods that might work for you, specifically
>> the addEditableLayer, which makes a WKB layer, and the
>> addGeometryWKTToLayer, for adding any kind of Geometry (including
>> LineString) to the layer. However, these were only added recently, and I
>> have no experience using them myself, so consider this very much prototype
>> code. From your other question today, can I assume you are having trouble
>> making sense of the data coming back? So we need a better way to return
>> the
>> results in WKT instead of WKB? One option would be to enhance the
>> addEditableLayer method to allow the creation of WKT layers instead of WKB
>> layers, so the internal representation is more internet friendly.
>>
>> I've just added untested support for setting the format to WKT for the
>> internal representation of the editable layer in the REST interface. This
>> is
>> untested (outside of my usual unit tests, that is), and is only in the
>> trunk
>> of neo4j-spatial, but you are welcome to try it out and see what happens.
>>
>> Regards, Craig
>>
>> On Fri, Jul 1, 2011 at 5:29 PM, Boris Kizelshteyn 
>> wrote:
>>
>> > Hi Craig,
>> >
>> > Thanks so much for this reply. It is very insightful. Is it possible for
>> me
>> > to implement the LineString geometries and lookups using REST?
>> >
>> > Many thanks!
>> >
>> > On Wed, Jun 8, 2011 at 4:58 PM, Craig Taverner 
>> wrote:
>> >
>> > > OK. I understand much better what you want now.
>> > >
>> > > Your person nodes are not geographic objects, they are persons that
>> can
>> > be
>> > > at many positions and indeed move around. However, the 'path' that
>> they
>> > > take
>> > > is a geographic object and can be placed on the map and analysed
>> > > geographically.
>> > >
>> > > So the question I have is how do you store the path the person takes?
>> Is
>> > > this a bunch of position nodes connected back to that person? Or
>> perhaps
>> > a
>> > > chain of position-(next)->position-(next)->position, etc? However you
>> > have
>> > > stored this in the graph, you can express this as a geographic object
>> by
>> > > implementing the GeometryEncoder interface. See, for example, the 6
>> lines
>> > > of
>> > > code it takes to traverse a chain of NEXT locations and produce a
>> > > LineString
>> > > geometry in the SimpleGraphEncoder at
>> > >
>> > >
>> >
>> https://github.com/neo4j/neo4j-spatial/blob/master/src/main/java/org/neo4j/gis/spatial/encoders/SimpleGraphEncoder.java#L82
>> > >
>> > > <
>> > >
>> >
>> https://github.com/neo4j/neo4j-spatial/blob/master/src/main/java/org/neo4j/gis/spatial/encoders/SimpleGraphEncoder.java#L82
>> > > >If
>> > > you do this, you can create a layer that uses your own geometry
>> encoder
>> > (or
>> > > the SimpleGraphEncoder I referenced above, if you use the same graph
>> > > structure) and your own domain model will be expressed as LineString
>> > > geometries and you can perform spatial operations on them.
>> > >
>> > > Alternatively, if your data is more static in nature, and you are
>> > analysing
>> > > only what the person did in the past, and the graph will therefor not
>> > > change, perhaps you do not care to store the locations in the graph,
>> and
>> > > you
>> > > can just import them as a LineString directly into a standard layer.
>> > >
>> > > Whatever route you take, the final action you want to perform is to
>> find
>> > > points near the LineString (path the person took). I do not think the
>> > > bounding box is the right approach for that either. You need to try,
>> for
>> > > example, the method findClosestEdges in the utilities class at
>> > >
>> > >
>> >
>> https://github.com/neo4j/neo4j-spatial/blob/master/src/main/java/org/neo4j/gis/spatial/SpatialTopologyUtils.java#L115
>> > >
>> > > <
>> > >
>> >
>> https://github.com/neo4j/neo4j-spatial/blob/master/src/main/java/org/neo4j/gis/spatial/SpatialTopologyUtils.java#L115
>> > > >This
>> > > method can find the part of the persons

Re: [Neo4j] reify links with other neo4j databases located on different distributed servers

2011-07-02 Thread Rick Bullotta
We are using node-id property references (the node id as a property), qualified 
with a "logical server" reference, to provide this type of binding across 
graphs. If you combine these with an index, you can actually get a lot of the 
functionality of relationships "cross graph", spanning physical boundaries.  Of 
course, as Craig points out, this all has to be done at the application level, 
including dealing with cascading deletes when a node is removed from one graph, 
ensuring that references to it in another graph are removed/redirected.

-Original Message-
From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On 
Behalf Of Craig Taverner
Sent: Saturday, July 02, 2011 6:03 AM
To: Neo4j user discussions
Subject: Re: [Neo4j] reify links with other neo4j databases located on 
different distributed servers

As far as I know there is no internal support for transparent traversals
across shards. Generally people are doing that in the application layer.
However, I think there might be a middle ground of sorts. I we modify the
relationship expander, I could imagine that relationships that are between
shards could be modified to return node on the other shard. This would make
the traversal return nodes across shards, but since I've not tried this
myself, I am uncertain if there are other consequences.

On Sat, Jul 2, 2011 at 4:03 AM, Aliabbas Petiwala wrote:

> Hi,
>
> I cannot figure out how my application logic can reify links with
> other neo4j databases located on different distributed servers?
> hence , how can i make the traversals and graph algorithms transparent
> to the location of the different databases ?
> --
> Aliabbas Petiwala
> M.Tech CSE
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] neo4j spatial bounding box vs. lat/lon

2011-07-02 Thread Craig Taverner
Hi Boris,

Ah! You are using the REST API. That changes a lot, since Neo4j Spatial is
only recently exposed in REST and we do not expose most of the capabilities
I have discussed in this thread, or indeed in my other answer today.

I did recently add some REST methods that might work for you, specifically
the addEditableLayer, which makes a WKB layer, and the
addGeometryWKTToLayer, for adding any kind of Geometry (including
LineString) to the layer. However, these were only added recently, and I
have no experience using them myself, so consider this very much prototype
code. From your other question today, can I assume you are having trouble
making sense of the data coming back? So we need a better way to return the
results in WKT instead of WKB? One option would be to enhance the
addEditableLayer method to allow the creation of WKT layers instead of WKB
layers, so the internal representation is more internet friendly.

I've just added untested support for setting the format to WKT for the
internal representation of the editable layer in the REST interface. This is
untested (outside of my usual unit tests, that is), and is only in the trunk
of neo4j-spatial, but you are welcome to try it out and see what happens.

Regards, Craig

On Fri, Jul 1, 2011 at 5:29 PM, Boris Kizelshteyn  wrote:

> Hi Craig,
>
> Thanks so much for this reply. It is very insightful. Is it possible for me
> to implement the LineString geometries and lookups using REST?
>
> Many thanks!
>
> On Wed, Jun 8, 2011 at 4:58 PM, Craig Taverner  wrote:
>
> > OK. I understand much better what you want now.
> >
> > Your person nodes are not geographic objects, they are persons that can
> be
> > at many positions and indeed move around. However, the 'path' that they
> > take
> > is a geographic object and can be placed on the map and analysed
> > geographically.
> >
> > So the question I have is how do you store the path the person takes? Is
> > this a bunch of position nodes connected back to that person? Or perhaps
> a
> > chain of position-(next)->position-(next)->position, etc? However you
> have
> > stored this in the graph, you can express this as a geographic object by
> > implementing the GeometryEncoder interface. See, for example, the 6 lines
> > of
> > code it takes to traverse a chain of NEXT locations and produce a
> > LineString
> > geometry in the SimpleGraphEncoder at
> >
> >
> https://github.com/neo4j/neo4j-spatial/blob/master/src/main/java/org/neo4j/gis/spatial/encoders/SimpleGraphEncoder.java#L82
> >
> > <
> >
> https://github.com/neo4j/neo4j-spatial/blob/master/src/main/java/org/neo4j/gis/spatial/encoders/SimpleGraphEncoder.java#L82
> > >If
> > you do this, you can create a layer that uses your own geometry encoder
> (or
> > the SimpleGraphEncoder I referenced above, if you use the same graph
> > structure) and your own domain model will be expressed as LineString
> > geometries and you can perform spatial operations on them.
> >
> > Alternatively, if your data is more static in nature, and you are
> analysing
> > only what the person did in the past, and the graph will therefor not
> > change, perhaps you do not care to store the locations in the graph, and
> > you
> > can just import them as a LineString directly into a standard layer.
> >
> > Whatever route you take, the final action you want to perform is to find
> > points near the LineString (path the person took). I do not think the
> > bounding box is the right approach for that either. You need to try, for
> > example, the method findClosestEdges in the utilities class at
> >
> >
> https://github.com/neo4j/neo4j-spatial/blob/master/src/main/java/org/neo4j/gis/spatial/SpatialTopologyUtils.java#L115
> >
> > <
> >
> https://github.com/neo4j/neo4j-spatial/blob/master/src/main/java/org/neo4j/gis/spatial/SpatialTopologyUtils.java#L115
> > >This
> > method can find the part of the persons path that it closest to the point
> > of
> > interest. There also also many other geographic operations you might be
> > interested in trying, once you have a better feel for the types of
> queries
> > you want to ask.
> >
> > Regards, Craig
> >
> > On Wed, Jun 8, 2011 at 2:17 AM, Boris Kizelshteyn 
> > wrote:
> >
> > > Thanks for the detailed response! Here is what I'm trying to do and I'm
> > > still not sure how to accomplish it:
> > >
> > > 1. I have a node which is a person
> > >
> > > 2. I have geo data as that person moves around the world
> > >
> > > 3. I use the geodata to create a bounding box of where that person has
> > been
> > > today
> > >
> > > 4. I want to say, was this person A near location X today?
> > >
> > > 5. I do this by seeing if location X is in A's bounding box.
> > >
> > > From looking at what you suggest doing, it's not clear how I assign the
> > > node
> > > person A to a layer? Is it that the bounding box is now in the layer
> and
> > > not
> > > in the node? The issue then becomes, how od I associate the two as the
> > > RTree
> > > relationship seems to es

Re: [Neo4j] wkb value in node created by addGeometryWKTToLayer

2011-07-02 Thread Craig Taverner
Hi Boris,

You do not need to read the property yourself from the node, rather use the
GeometryEncoder for this, it converts from the internal spatial storage to
the Geometry class, which you can work with. If you call geom.toString() you
will get a nice printable version (in WKT). Using the GeometryEncoder is a
particularly good idea because we support many internal storage formats, not
just the WKB you found. If you have point data only, you should consider
using the SimplePointLayer (created with
SpatialDatabaseService.createSimplePointLayer()), which will store the Point
as two properties, for latitude and longitude.

Back to your main question: WKB and WKT are two different formats for
representing spatial data. We support both with the WKBGeometryEncoder and
WKTGeometryEncoder classes, but in both cases we convert from that format to
JTS Geometry class for performing spatial operations on. Internally these
classes use the WKBReader/WKBWriter (and WKT versions of this) for
performing the conversions. If you want to convert between WKB and WKT
yourself, you should just use the JTS code directly.

But as I said before, I do not think you need to do this. If you are getting
your nodes from a search using the index, something like
search.getResults().get(0).getGeometry().toString() will return the WKT
version.

Regards, Craig

On Sat, Jul 2, 2011 at 1:04 AM, Boris Kizelshteyn  wrote:

> Craig or anyone who can answer this: what does the wkb value represent
> here.
> I know its the well known bytes, but how do I get back to wkt? I thought it
> was a byte array, but I can't seem to get my original values back. Form the
> values in the test case I have:
>
> POINT(15.2 60.1)
>
>
> wkb:
>
> [0,0,0,0,2,0,0,0,2,64,46,51,51,51,51,51,51,64,78,25,-103,-103,-103,-103,-102,64,46,-103,-103,-103,-103,-103,-102,64,78,12,-52,-52,-52,-52,-51]
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] reify links with other neo4j databases located on different distributed servers

2011-07-02 Thread Craig Taverner
As far as I know there is no internal support for transparent traversals
across shards. Generally people are doing that in the application layer.
However, I think there might be a middle ground of sorts. I we modify the
relationship expander, I could imagine that relationships that are between
shards could be modified to return node on the other shard. This would make
the traversal return nodes across shards, but since I've not tried this
myself, I am uncertain if there are other consequences.

On Sat, Jul 2, 2011 at 4:03 AM, Aliabbas Petiwala wrote:

> Hi,
>
> I cannot figure out how my application logic can reify links with
> other neo4j databases located on different distributed servers?
> hence , how can i make the traversals and graph algorithms transparent
> to the location of the different databases ?
> --
> Aliabbas Petiwala
> M.Tech CSE
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] GSoC 2011 Neo4j Geoprocessing | Weekly Report #6

2011-07-02 Thread Craig Taverner
Hi Andreas,

Sounds like good progress over all. It is only a week to the mid-terms, so
it would be good to do a general code overview and see if this can be
integrated with trunk. Shall we plan for a review and test integration in
the middle of next week?

Regards, Craig

On Sat, Jul 2, 2011 at 10:25 AM, Andreas Wilhelm  wrote:

> Hi,
>
> This week I had a little blocker with deleting some subgraph nodes and
> relations. For that I made a seperate test to identify the problem and
> try to find a solution.
>
> Apart from that I integrated a additonal spatial type function to get
> the distance between geometry nodes and
> updated the already existing spatial type functions to the new API.
>
>
> Best Regards
>
> Andreas Wilhelm
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] GSoC 2011 Neo4j Geoprocessing | Weekly Report #6

2011-07-02 Thread Andreas Wilhelm
Hi,

This week I had a little blocker with deleting some subgraph nodes and 
relations. For that I made a seperate test to identify the problem and 
try to find a solution.

Apart from that I integrated a additonal spatial type function to get 
the distance between geometry nodes and
updated the already existing spatial type functions to the new API.


Best Regards

Andreas Wilhelm
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user