2011/2/21 Mark Nijhof <[email protected]>
> Ok perhaps I don't entirely get indexes yet:
>
> - Does the key value part need to map to an actual property_name and
> property_value of a node?
>
Doesn't need to, no
> - If the value changes then I should update the index manually? (i.e.
> delete
> the old index and create a new one).
>
Yup. But to have this done automatically you'll have to make use of
transaction event handlers, which can sit and listen to properties
added/removed and update indexes on commit. However there are no nice tools
for that yet.
> - Are indexes the only way I can find a node where property name is Mark?
> And for that I actually have to create an index /index_name/name/mark?
>
It's the best way IMHO, if you don't create some index in the graph itself
or loop through all persons linearly (which of course doesn't scale). You
can have an index "persons" where you map the key/value pair "name", "Mark"
to the Node denoting mark:
Node mark = graphDb.createNode();
mark.setProperty( "name", "Mark" );
Index<Node> personsIndex = graphDb.index().forNodes( "persons" );
personsIndex.add( mark, "name", "Mark" );
...
personsIndex.get( "name", "Mark" ).getSingle();
> - Would I create an index users/dummy/dummy to get all users or this should
> just go through a relation?
>
If you, at creation time, connect all users to a "users reference" node you
can reach all users later by iterating from that reference node to all
users:
// Assume this exists (perhaps created earlier).
Node usersRefNode = graphDb.getReferenceNode().getSingleRelationship(
USERS_REFERENCE, Direction.OUTGOING );
...
Node mark = graphDb.createNode();
usersRefNode.createRelationshipTo( mark, USER );
// Iterate over all the users
for ( Relationship rel : usersRefNode.getRelationships( USER,
Direction.OUTGOING ) ) {
Node person = rel.getEndNode();
...
}
>
> -Mark
>
>
>
>
> On Sat, Feb 19, 2011 at 11:37 PM, Max De Marzi Jr. <[email protected]
> >wrote:
>
> > The indexing piece is really lacking in Neography. I keep meaning to
> > get around to it, and it's about time I did (next week).
> >
> > It would be nice if we had full indexing support in the REST API first
> > since whatever I implement will need to change when we do.
> >
> > If the specs are done, but not yet implemented, can we get a preview?
> >
> > On Sat, Feb 19, 2011 at 5:03 PM, Michael Hunger
> > <[email protected]> wrote:
> > > The problem (as before) is that you have both in neography - the direct
> > REST API methods that just expose the procedural calls to ruby, and the
> more
> > OO-like Node and Relationship classes.
> > >
> > > Easy to mix them up and take them for the same API, but they aren't.
> > >
> > > Cheers
> > >
> > > Michael
> > >
> > > Am 19.02.2011 um 21:34 schrieb Mark Nijhof:
> > >
> > >> I think I got confused because neography has node classes that contain
> > >> properties. So key didn't make much sense to me. I actually think I'll
> > drop
> > >> neography and start using actual ReST command to get a better
> > understanding.
> > >>
> > >> -Mark
> > >>
> > >> On Sat, Feb 19, 2011 at 9:21 PM, Peter Neubauer <
> > >> [email protected]> wrote:
> > >>
> > >>> Yes, that should be about right! Is
> > >>>
> > >>>
> >
> http://components.neo4j.org/neo4j-server/1.3-SNAPSHOT/rest.html#Add_to_index
> > >>> unclear? In that case, we need to put that out more clearly ...
> > >>>
> > >>> Cheers,
> > >>>
> > >>> /peter neubauer
> > >>>
> > >>> GTalk: neubauer.peter
> > >>> Skype peter.neubauer
> > >>> Phone +46 704 106975
> > >>> LinkedIn http://www.linkedin.com/in/neubauer
> > >>> Twitter http://twitter.com/peterneubauer
> > >>>
> > >>> http://www.neo4j.org - Your high performance graph
> > database.
> > >>> http://startupbootcamp.org/ - Ă–resund - Innovation happens HERE.
> > >>> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing
> > party.
> > >>>
> > >>>
> > >>>
> > >>> On Sat, Feb 19, 2011 at 8:56 PM, Mark Nijhof
> > >>> <[email protected]> wrote:
> > >>>> Hmm ok, is it this?
> > >>>>
> > >>>> Key is the property name
> > >>>> Value is the property value
> > >>>>
> > >>>> ?
> > >>>>
> > >>>> -Mark
> > >>>>
> > >>>> On Sat, Feb 19, 2011 at 8:09 PM, Mark Nijhof <
> > >>> [email protected]
> > >>>>> wrote:
> > >>>>
> > >>>>> Hi,
> > >>>>>
> > >>>>> I have a question about indexes, when looking at neography I see a
> > >>> method: add_node_to_index(index,
> > >>>>> key, value, node)
> > >>>>>
> > >>>>> I can understand that index is the name of the index that I want to
> > put
> > >>> the
> > >>>>> node into, what I don't understand is the key value part of it.
> > >>>>>
> > >>>>> -Mark
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> --
> > >>>>> Mark Nijhof
> > >>>>> m: 0047 95 00 99 37
> > >>>>> e: [email protected]
> > >>>>> b: cre8ivethought.com/blog/index
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> "Walking on water and developing software from a specification are
> > easy
> > >>> if
> > >>>>> both are frozen."
> > >>>>>
> > >>>>> -- Edward V Berard
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>
> > >>>>
> > >>>> --
> > >>>> Mark Nijhof
> > >>>> m: 0047 95 00 99 37
> > >>>> e: [email protected]
> > >>>> b: cre8ivethought.com/blog/index
> > >>>>
> > >>>>
> > >>>>
> > >>>> "Walking on water and developing software from a specification are
> > easy
> > >>> if
> > >>>> both are frozen."
> > >>>>
> > >>>> -- Edward V Berard
> > >>>> _______________________________________________
> > >>>> Neo4j mailing list
> > >>>> [email protected]
> > >>>> https://lists.neo4j.org/mailman/listinfo/user
> > >>>>
> > >>>
> > >>
> > >>
> > >>
> > >> --
> > >> Mark Nijhof
> > >> m: 0047 95 00 99 37
> > >> e: [email protected]
> > >> b: cre8ivethought.com/blog/index
> > >>
> > >>
> > >>
> > >> "Walking on water and developing software from a specification are
> easy
> > if
> > >> both are frozen."
> > >>
> > >> -- Edward V Berard
> > >> _______________________________________________
> > >> Neo4j mailing list
> > >> [email protected]
> > >> https://lists.neo4j.org/mailman/listinfo/user
> > >
> > > _______________________________________________
> > > Neo4j mailing list
> > > [email protected]
> > > https://lists.neo4j.org/mailman/listinfo/user
> > >
> > _______________________________________________
> > Neo4j mailing list
> > [email protected]
> > https://lists.neo4j.org/mailman/listinfo/user
> >
>
>
>
> --
> Mark Nijhof
> m: 0047 95 00 99 37
> e: [email protected]
> b: cre8ivethought.com/blog/index
>
>
>
> "Walking on water and developing software from a specification are easy if
> both are frozen."
>
> -- Edward V Berard
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>
--
Mattias Persson, [[email protected]]
Hacker, Neo Technology
www.neotechnology.com
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user