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:
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")).
> 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 > <mailto:a...@morgner.de>> wrote:
> Hi,
> I'm struggling with getting the indexed node from a LayerNodeIndex.
> Let's say adding a node (id 1) to the layer index:
On Thu, May 3, 2012 at 7:00 PM, Axel Morgner <a...@morgner.de> wrote:
> 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")).
> 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:
>> 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, the id is saved as id property on the
>> SpatialDatabaseRecord object.
>> layer.add(
>> decodeGeometry, new String[] { "id" },
>> new Object[] { geometry.getId() } );
>> Internally, (in EditableLayerImpl), an additional geomNode (let's say id
>> 2) is created:
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?
> If you can write, you can code - @coderdojomalmo
> If you can sketch, you can use a graph database - @neo4j
> On Thu, May 3, 2012 at 7:00 PM, Axel Morgner <a...@morgner.de> wrote:
> > 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")).
> > 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:
> >> 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, the id is saved as id property on the
> >> SpatialDatabaseRecord object.
> >> layer.add(
> >> decodeGeometry, new String[] { "id" },
> >> new Object[] { geometry.getId() } );
> >> Internally, (in EditableLayerImpl), an additional geomNode (let's say id
> >> 2) is created:
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:
> 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 <
> peter.neuba...@neotechnology.com> wrote:
>> That is true. Do you think that would be better? Craig, WDYT of
>> changing this to be a relationship?
>> If you can write, you can code - @coderdojomalmo
>> If you can sketch, you can use a graph database - @neo4j
>> On Thu, May 3, 2012 at 7:00 PM, Axel Morgner <a...@morgner.de> wrote:
>> > 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")).
>> > 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:
>> >> 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, the id is saved as id property on the
>> >> SpatialDatabaseRecord object.
>> >> layer.add(
>> >> decodeGeometry, new String[] { "id" },
>> >> new Object[] { geometry.getId() } );
>> >> Internally, (in EditableLayerImpl), an additional geomNode (let's say
>> id
>> >> 2) is created:
> 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 > <mailto:cr...@amanzi.com>> wrote:
> 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
> <peter.neuba...@neotechnology.com
> <mailto:peter.neuba...@neotechnology.com>> wrote:
> That is true. Do you think that would be better? Craig, WDYT of
> changing this to be a relationship?
> If you can write, you can code - @coderdojomalmo
> If you can sketch, you can use a graph database - @neo4j
> On Thu, May 3, 2012 at 7:00 PM, Axel Morgner <a...@morgner.de
> <mailto:a...@morgner.de>> wrote:
> > 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")).
> > 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
> <mailto:a...@morgner.de>> wrote:
> >> 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, the id is saved as id property on the
> >> SpatialDatabaseRecord object.
> >> layer.add(
> >> decodeGeometry, new String[] { "id" },
> >> new Object[] { geometry.getId() } );
> >> Internally, (in EditableLayerImpl), an additional geomNode
> (let's say id
> >> 2) is created:
> Ok! If I find a little time tomorrow, I will have a look on it and make a
> suggestion and PR.
> 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:
>> 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 <
>> peter.neuba...@neotechnology.com> wrote:
>>> That is true. Do you think that would be better? Craig, WDYT of
>>> changing this to be a relationship?
>>> If you can write, you can code - @coderdojomalmo
>>> If you can sketch, you can use a graph database - @neo4j
>>> On Thu, May 3, 2012 at 7:00 PM, Axel Morgner <a...@morgner.de> wrote:
>>> > 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")).
>>> > 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:
>>> >> 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, the id is saved as id property on the
>>> >> SpatialDatabaseRecord object.
>>> >> layer.add(
>>> >> decodeGeometry, new String[] { "id" },
>>> >> new Object[] { geometry.getId() } );
>>> >> Internally, (in EditableLayerImpl), an additional geomNode (let's say
>>> id
>>> >> 2) is created:
> Ok! If I find a little time tomorrow, I will have a look on it and > make a suggestion and PR.
>> 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 >> <mailto:cr...@amanzi.com>> wrote:
>> 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
>> <peter.neuba...@neotechnology.com
>> <mailto:peter.neuba...@neotechnology.com>> wrote:
>> That is true. Do you think that would be better? Craig, WDYT of
>> changing this to be a relationship?
>> If you can write, you can code - @coderdojomalmo
>> If you can sketch, you can use a graph database - @neo4j
>> On Thu, May 3, 2012 at 7:00 PM, Axel Morgner <a...@morgner.de
>> <mailto:a...@morgner.de>> wrote:
>> > 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")).
>> > 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
>> <mailto:a...@morgner.de>> wrote:
>> >> 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, the id is saved as id property on the
>> >> SpatialDatabaseRecord object.
>> >> layer.add(
>> >> decodeGeometry, new String[] { "id" },
>> >> new Object[] { geometry.getId() } );
>> >> Internally, (in EditableLayerImpl), an additional geomNode
>> (let's say id
>> >> 2) is created: