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
spatial: How to get indexed nodes from LayerNodeIndex?
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
 
Axel Morgner  
View profile  
 More options May 3 2012, 12:16 pm
From: Axel Morgner <a...@morgner.de>
Date: Thu, 03 May 2012 18:16:10 +0200
Local: Thurs, May 3 2012 12:16 pm
Subject: spatial: How to get indexed nodes from LayerNodeIndex?

Hi,

I'm struggling with getting the indexed node from a LayerNodeIndex.

Let's say adding a node (id 1) to the layer index:

layerIndex.add(node, "", "");

In LayerNodeIndex
<https://github.com/neo4j/spatial/blob/master/src/main/java/org/neo4j/...>,
the id is saved as id property on the SpatialDatabaseRecord object.

     layer.add(
                 decodeGeometry, new String[] { "id" },
                 new Object[] { geometry.getId() } );

Internally, (in EditableLayerImpl
<https://github.com/neo4j/spatial/blob/master/src/main/java/org/neo4j/...>),
an additional geomNode (let's say id 2) is created:

     private Node addGeomNode(Geometry geom, String[] fieldsName,
Object[] fields) {
         Node geomNode = getDatabase().createNode();
     [...]

When querying the index, the iterator returns node 2, not node 1.

SpatialRecordHits
<https://github.com/neo4j/spatial/blob/master/src/main/java/org/neo4j/...>:

     protected Node fetchNextOrNull()
     {
         int i = index++;
         return i < size() ? hits.get( i ).getGeomNode() : null;
     }

I would expect to get the original node (id 1 here) from the index. Am I
missing something?

Greetings
Axel


 
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 May 3 2012, 12:25 pm
From: Peter Neubauer <neubauer.pe...@gmail.com>
Date: Thu, 3 May 2012 18:25:37 +0200
Local: Thurs, May 3 2012 12:25 pm
Subject: Re: [Neo4j] spatial: How to get indexed nodes from LayerNodeIndex?

Well,
Thing is that there might not be a one to one mapping between geometry and
your domain node. It might just be the entry point to a whole polygon or a
traversal. That is why you get back the geometry node, and the decoder can
then resolve it to original underlying domain subgraphs (in the easiest
case only one node)

Makes sense?
On May 3, 2012 6:16 PM, "Axel Morgner" <a...@morgner.de> 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.
Axel Morgner  
View profile  
 More options May 3 2012, 1:00 pm
From: Axel Morgner <a...@morgner.de>
Date: Thu, 03 May 2012 19:00:49 +0200
Local: Thurs, May 3 2012 1:00 pm
Subject: Re: [Neo4j] spatial: How to get indexed nodes from LayerNodeIndex?

Thanks Peter for the quick reply!

Ok, with a decoder (f.e. the SimplePointEncoder#decodeGeometry), I get
the geometry, but still no reference to my domain node which I added to
the index.

Solved it for me by using graphDb.getNodeById((Long)
geomNode.getProperty("id")).


 
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 May 3 2012, 3:00 pm
From: Peter Neubauer <peter.neuba...@neotechnology.com>
Date: Thu, 3 May 2012 21:00:43 +0200
Local: Thurs, May 3 2012 3:00 pm
Subject: Re: [Neo4j] spatial: How to get indexed nodes from LayerNodeIndex?
That is true. Do you think that would be better? Craig, WDYT of
changing this to be a relationship?

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

If you can write, you can code - @coderdojomalmo
If you can sketch, you can use a graph database - @neo4j


 
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.
Craig Taverner  
View profile  
 More options May 4 2012, 5:19 pm
From: Craig Taverner <cr...@amanzi.com>
Date: Fri, 4 May 2012 23:19:08 +0200
Local: Fri, May 4 2012 5:19 pm
Subject: Re: [Neo4j] spatial: How to get indexed nodes from LayerNodeIndex?

This differs somewhat from my memory of how things work. In the
SimplePointLayer the node added to the index is in fact the geometry node.
Are you using some other GeometryEncoder that expects the node to be
something else?

On the other hand, reading the code above I see you are actually not
working with the original index, but the LayerNodeIndex which Peter added
as a wrapper. In that case I think only Peter knows the reason for not
storing and retrieving the node originally passed. I know very little about
the indexProvider wrappings.

My own vote is to keep to the original model conceptually, which is that
whatever you add to the index is whatever you get back, and in principle
this should be the node that represents the geometry. How that geometry is
actually stored is up to the geometry encoder, and can be separate from the
node passed, but is usually either the node passed (as in
SimplePointGeometryEncoder and DefaultGeometryEncoder) or closely linked by
relationships to it (as in the OSMGeometryEncoder).

Peter, do you remember why you used a different node in the IndexProvider?

On Thu, May 3, 2012 at 9:00 PM, 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.
Peter Neubauer  
View profile  
 More options May 5 2012, 1:33 am
From: Peter Neubauer <neubauer.pe...@gmail.com>
Date: Sat, 5 May 2012 07:33:16 +0200
Local: Sat, May 5 2012 1:33 am
Subject: Re: [Neo4j] spatial: How to get indexed nodes from LayerNodeIndex?

No, I don't. Thisight actually be a bug. Axel, if you change it and send a
PR ad I am not on my machine, I'd that OK?
On May 4, 2012 11:19 PM, "Craig Taverner" <cr...@amanzi.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.
Axel Morgner  
View profile  
 More options May 5 2012, 3:10 pm
From: Axel Morgner <a...@morgner.de>
Date: Sat, 05 May 2012 21:10:15 +0200
Local: Sat, May 5 2012 3:10 pm
Subject: Re: [Neo4j] spatial: How to get indexed nodes from LayerNodeIndex?

Ok! If I find a little time tomorrow, I will have a look on it and make
a suggestion and PR.


 
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 May 5 2012, 3:13 pm
From: Peter Neubauer <neubauer.pe...@gmail.com>
Date: Sat, 5 May 2012 21:13:21 +0200
Local: Sat, May 5 2012 3:13 pm
Subject: Re: [Neo4j] spatial: How to get indexed nodes from LayerNodeIndex?

You rock.
On May 5, 2012 9:10 PM, "Axel Morgner" <a...@morgner.de> 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.
Axel Morgner  
View profile  
 More options May 6 2012, 5:54 pm
From: Axel Morgner <a...@morgner.de>
Date: Sun, 06 May 2012 23:54:54 +0200
Local: Sun, May 6 2012 5:54 pm
Subject: Re: [Neo4j] spatial: How to get indexed nodes from LayerNodeIndex?

Unfortunately, I did not succeed in making changes that won't break the
tests. We'll see what insights tomorrow will bring perhaps ..

--
Axel Morgner
Morgner UG
Hanauer Landstr. 291a
60314 Frankfurt
Germany

Phone +49 151 40522060
Skype axel.morgner
E-mail a...@morgner.de
Web http://www.morgner.de
Twitter @amorgner


 
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 »