Re: [Neo4j] Generating suggestions in a Neo4j db

2011-06-17 Thread fajarmf
Ah this discussion is interesting, I want to join and throw in sonme idea too. 

If a user can visit a place for multiple times. And if there are 100 user visit 
USA. So we should suggest top 10 only.

Would traversing the graph be more efficient than normal database query?


Sent from my BlackBerry® smartphone from Sinyal Bagus XL, Nyambung Teruuusss...!

-Original Message-
From: Aman 
Sender: user-boun...@lists.neo4j.org
Date: Sat, 18 Jun 2011 10:50:34 
To: Neo4j user discussions
Reply-To: Neo4j user discussions 
Subject: Re: [Neo4j] Generating suggestions in a Neo4j db

Hi Jim,
The way you mentioned, that will take care of these suggestions,
thanks for the same. But here's a tougher problem
If I have a database of 50k people, and I want to find friends based
upon the places that those 50k people have visited (i.e. People who
have visited same places as me should be suggested as friends to me),
then how to to that... I've thought all that I could, but I always
come up with something stupid... Any suggestions about this?

On 6/18/11, Aman  wrote:
> Hi Jim,
> The way you mentioned, that will take care of these suggestions,
> thanks for the same. But here's a tougher problem
> If I have a database of 50k people, and I want to find friends based
> upon the places that those 50k people have visited (i.e. People who
> have visited same places as me should be suggested as friends to me),
> then how to to that... I've thought all that I could, but I always
> come up with something stupid... Any suggestions about this?
>
> On 6/18/11, Jim Webber  wrote:
>> Hi Aman,
>>
>> I'm puzzled.
>>
>> Why not
>>
>> Aman--HAS_VISITED-->USA
>> Jim--HAS_VISITED-->India
>>
>> And if:
>>
>> Aman--FRIEND-OF-->Jim
>>
>> Then you just need to traverse from Aman following outgoing FRIEND_OF
>> relationships to all your friends, and then traverse out their outgoing
>> HAS_VISITED relationships to find places your friends have been.
>>
>> The general idiom with Neo4j is use indexes the find your start node
>> (e.g.
>> the Aman node in the above) then traverse from there.
>>
>> Jim
>>
>> ___
>> Neo4j mailing list
>> User@lists.neo4j.org
>> https://lists.neo4j.org/mailman/listinfo/user
>>
>
>
> --
> Amandeep
> +91-9878483857
>


-- 
Amandeep
+91-9878483857
___
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] Generating suggestions in a Neo4j db

2011-06-17 Thread Aman
Hi Jim,
The way you mentioned, that will take care of these suggestions,
thanks for the same. But here's a tougher problem
If I have a database of 50k people, and I want to find friends based
upon the places that those 50k people have visited (i.e. People who
have visited same places as me should be suggested as friends to me),
then how to to that... I've thought all that I could, but I always
come up with something stupid... Any suggestions about this?

On 6/18/11, Aman  wrote:
> Hi Jim,
> The way you mentioned, that will take care of these suggestions,
> thanks for the same. But here's a tougher problem
> If I have a database of 50k people, and I want to find friends based
> upon the places that those 50k people have visited (i.e. People who
> have visited same places as me should be suggested as friends to me),
> then how to to that... I've thought all that I could, but I always
> come up with something stupid... Any suggestions about this?
>
> On 6/18/11, Jim Webber  wrote:
>> Hi Aman,
>>
>> I'm puzzled.
>>
>> Why not
>>
>> Aman--HAS_VISITED-->USA
>> Jim--HAS_VISITED-->India
>>
>> And if:
>>
>> Aman--FRIEND-OF-->Jim
>>
>> Then you just need to traverse from Aman following outgoing FRIEND_OF
>> relationships to all your friends, and then traverse out their outgoing
>> HAS_VISITED relationships to find places your friends have been.
>>
>> The general idiom with Neo4j is use indexes the find your start node
>> (e.g.
>> the Aman node in the above) then traverse from there.
>>
>> Jim
>>
>> ___
>> Neo4j mailing list
>> User@lists.neo4j.org
>> https://lists.neo4j.org/mailman/listinfo/user
>>
>
>
> --
> Amandeep
> +91-9878483857
>


-- 
Amandeep
+91-9878483857
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Generating suggestions in a Neo4j db

2011-06-17 Thread Aman
Hi Jim,
The way you mentioned, that will take care of these suggestions,
thanks for the same. But here's a tougher problem
If I have a database of 50k people, and I want to find friends based
upon the places that those 50k people have visited (i.e. People who
have visited same places as me should be suggested as friends to me),
then how to to that... I've thought all that I could, but I always
come up with something stupid... Any suggestions about this?

On 6/18/11, Jim Webber  wrote:
> Hi Aman,
>
> I'm puzzled.
>
> Why not
>
> Aman--HAS_VISITED-->USA
> Jim--HAS_VISITED-->India
>
> And if:
>
> Aman--FRIEND-OF-->Jim
>
> Then you just need to traverse from Aman following outgoing FRIEND_OF
> relationships to all your friends, and then traverse out their outgoing
> HAS_VISITED relationships to find places your friends have been.
>
> The general idiom with Neo4j is use indexes the find your start node (e.g.
> the Aman node in the above) then traverse from there.
>
> Jim
>
> ___
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>


-- 
Amandeep
+91-9878483857
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Can I model a Graph data structure without persisting it in DB using Neo4j ?

2011-06-17 Thread V
Any suggestions on this please ?


On Fri, Jun 17, 2011 at 11:03 PM, V  wrote:

> I created a graph model with 2 classes Node and Element as follows:
>
> public class Node {
>
>  @RelatedTo(type = "ELEMENT", elementClass = Element.class, direction =
> OUTGOING)
> private Set Element;
>
>
> public void addElement(Element e) {
> relateTo(e, Relationships.ELEMENT.toString());
> }
>
> }
>
> public class Element{
>
>public String name;
>
> }
> I want to create an in memory graph structure without persisting the nodes
> as follows :
>
> Node n = new Node();
> n.addElement(new Element());
>
> *However it throws an exception as the Node n has not been persisted so
> the call to relateTo(..) fails. *
>
> If instead I do
> n.persist()
> and then call addElement(..) it works fine as the aspect kicks in.
>
> Any workaround for this ?  That is, is there a way I can still use the
> above style without persisting the Node object ?
>
>
> My application needs this as first I create a structure and persist it, and
> then I create another structure to pass around some values to the persisted
> structure when doing some computations.
>
> -Karan
>
>
>
>
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Integer cost property

2011-06-17 Thread Jim Webber
Hi Josh,

I'm just wiring up a bunch of code that implements REST paging, and then I'll 
codify these tests and sort it out.

Jim

On 18 Jun 2011, at 01:17, Josh Adell wrote:

> Jim,
> The best I can do as far as a failing test is this series of curl
> calls.  I create 2 nodes, then connect them with a relationship that
> has a property called "distance".  When I ask for paths without
> specifying the algorithm, I get back the path with the relationship.
> When I specify the algorithm as "dijkstra" with a cost property of
> "distance", I get back a 400 Bad Request with a stack trace.
> 
> Now interestingly, if I create the relationship with a distance of
> 2.0, it works.  Unfortunately, PHP's json_encode method turns a double
> 2.0 into an integer 2.
> 
> My original thought was to make the DoubleEvaluator class cast the
> Integer cost property value to a basic double before wrapping it in a
> Double object.
> 
> Here is the series of commands:
> 
> = SHELL
> 
> $ curl -i -HAccept:application/json -HContent-Type:application/json -X
> POST -d '{"name":"A"}' http://localhost:7474/db/data/node
> HTTP/1.1 201 Created
> Content-Length: 996
> Location: http://localhost:7474/db/data/node/73
> Content-Encoding: UTF-8
> Content-Type: application/json
> Access-Control-Allow-Origin: *
> Server: Jetty(6.1.25)
> 
> {
>  "outgoing_relationships" :
> "http://localhost:7474/db/data/node/73/relationships/out";,
>  "data" : {
>"name" : "A"
>  },
>  "traverse" : "http://localhost:7474/db/data/node/73/traverse/{returnType}";,
>  "all_typed_relationships" :
> "http://localhost:7474/db/data/node/73/relationships/all/{-list|&|types}",
>  "property" : "http://localhost:7474/db/data/node/73/properties/{key}";,
>  "self" : "http://localhost:7474/db/data/node/73";,
>  "properties" : "http://localhost:7474/db/data/node/73/properties";,
>  "outgoing_typed_relationships" :
> "http://localhost:7474/db/data/node/73/relationships/out/{-list|&|types}",
>  "incoming_relationships" :
> "http://localhost:7474/db/data/node/73/relationships/in";,
>  "extensions" : {
>  },
>  "create_relationship" : 
> "http://localhost:7474/db/data/node/73/relationships";,
>  "all_relationships" :
> "http://localhost:7474/db/data/node/73/relationships/all";,
>  "incoming_typed_relationships" :
> "http://localhost:7474/db/data/node/73/relationships/in/{-list|&|types}"
> }
> 
> $ curl -i -HAccept:application/json -HContent-Type:application/json -X
> POST -d '{"name":"B"}' http://localhost:7474/db/data/node
> HTTP/1.1 201 Created
> Content-Length: 996
> Location: http://localhost:7474/db/data/node/74
> Content-Encoding: UTF-8
> Content-Type: application/json
> Access-Control-Allow-Origin: *
> Server: Jetty(6.1.25)
> 
> {
>  "outgoing_relationships" :
> "http://localhost:7474/db/data/node/74/relationships/out";,
>  "data" : {
>"name" : "B"
>  },
>  "traverse" : "http://localhost:7474/db/data/node/74/traverse/{returnType}";,
>  "all_typed_relationships" :
> "http://localhost:7474/db/data/node/74/relationships/all/{-list|&|types}",
>  "property" : "http://localhost:7474/db/data/node/74/properties/{key}";,
>  "self" : "http://localhost:7474/db/data/node/74";,
>  "properties" : "http://localhost:7474/db/data/node/74/properties";,
>  "outgoing_typed_relationships" :
> "http://localhost:7474/db/data/node/74/relationships/out/{-list|&|types}",
>  "incoming_relationships" :
> "http://localhost:7474/db/data/node/74/relationships/in";,
>  "extensions" : {
>  },
>  "create_relationship" : 
> "http://localhost:7474/db/data/node/74/relationships";,
>  "all_relationships" :
> "http://localhost:7474/db/data/node/74/relationships/all";,
>  "incoming_typed_relationships" :
> "http://localhost:7474/db/data/node/74/relationships/in/{-list|&|types}"
> }
> 
> $ curl -i -HAccept:application/json -HContent-Type:application/json -X
> POST -d 
> '{"to":"http://localhost:7474/db/data/node/74","type":"GO","data":{"name":"AB","distance":2}}'
> http://localhost:7474/db/data/node/73/relationships
> HTTP/1.1 201 Created
> Content-Length: 421
> Location: http://localhost:7474/db/data/relationship/64
> Content-Encoding: UTF-8
> Content-Type: application/json
> Access-Control-Allow-Origin: *
> Server: Jetty(6.1.25)
> 
> {
>  "start" : "http://localhost:7474/db/data/node/73";,
>  "data" : {
>"distance" : 2,
>"name" : "AB"
>  },
>  "self" : "http://localhost:7474/db/data/relationship/64";,
>  "property" : 
> "http://localhost:7474/db/data/relationship/64/properties/{key}";,
>  "properties" : "http://localhost:7474/db/data/relationship/64/properties";,
>  "type" : "GO",
>  "extensions" : {
>  },
>  "end" : "http://localhost:7474/db/data/node/74";
> }
> 
> #  This succeeds
> $ curl -i -HAccept:application/json -HContent-Type:application/json -X
> POST -d '{"to":"http://localhost:7474/db/data/node/74","type":"GO"}'
> http://localhost:7474/db/data/node/73/paths
> HTTP/1.1 200 OK
> Content-Length: 297
> Content-Encoding: UTF-8
> Content-Type: application/json
> Access-Control-Allow

Re: [Neo4j] Integer cost property

2011-06-17 Thread Josh Adell
Jim,
The best I can do as far as a failing test is this series of curl
calls.  I create 2 nodes, then connect them with a relationship that
has a property called "distance".  When I ask for paths without
specifying the algorithm, I get back the path with the relationship.
When I specify the algorithm as "dijkstra" with a cost property of
"distance", I get back a 400 Bad Request with a stack trace.

Now interestingly, if I create the relationship with a distance of
2.0, it works.  Unfortunately, PHP's json_encode method turns a double
2.0 into an integer 2.

My original thought was to make the DoubleEvaluator class cast the
Integer cost property value to a basic double before wrapping it in a
Double object.

Here is the series of commands:

= SHELL

$ curl -i -HAccept:application/json -HContent-Type:application/json -X
POST -d '{"name":"A"}' http://localhost:7474/db/data/node
HTTP/1.1 201 Created
Content-Length: 996
Location: http://localhost:7474/db/data/node/73
Content-Encoding: UTF-8
Content-Type: application/json
Access-Control-Allow-Origin: *
Server: Jetty(6.1.25)

{
  "outgoing_relationships" :
"http://localhost:7474/db/data/node/73/relationships/out";,
  "data" : {
"name" : "A"
  },
  "traverse" : "http://localhost:7474/db/data/node/73/traverse/{returnType}";,
  "all_typed_relationships" :
"http://localhost:7474/db/data/node/73/relationships/all/{-list|&|types}",
  "property" : "http://localhost:7474/db/data/node/73/properties/{key}";,
  "self" : "http://localhost:7474/db/data/node/73";,
  "properties" : "http://localhost:7474/db/data/node/73/properties";,
  "outgoing_typed_relationships" :
"http://localhost:7474/db/data/node/73/relationships/out/{-list|&|types}",
  "incoming_relationships" :
"http://localhost:7474/db/data/node/73/relationships/in";,
  "extensions" : {
  },
  "create_relationship" : "http://localhost:7474/db/data/node/73/relationships";,
  "all_relationships" :
"http://localhost:7474/db/data/node/73/relationships/all";,
  "incoming_typed_relationships" :
"http://localhost:7474/db/data/node/73/relationships/in/{-list|&|types}"
}

$ curl -i -HAccept:application/json -HContent-Type:application/json -X
POST -d '{"name":"B"}' http://localhost:7474/db/data/node
HTTP/1.1 201 Created
Content-Length: 996
Location: http://localhost:7474/db/data/node/74
Content-Encoding: UTF-8
Content-Type: application/json
Access-Control-Allow-Origin: *
Server: Jetty(6.1.25)

{
  "outgoing_relationships" :
"http://localhost:7474/db/data/node/74/relationships/out";,
  "data" : {
"name" : "B"
  },
  "traverse" : "http://localhost:7474/db/data/node/74/traverse/{returnType}";,
  "all_typed_relationships" :
"http://localhost:7474/db/data/node/74/relationships/all/{-list|&|types}",
  "property" : "http://localhost:7474/db/data/node/74/properties/{key}";,
  "self" : "http://localhost:7474/db/data/node/74";,
  "properties" : "http://localhost:7474/db/data/node/74/properties";,
  "outgoing_typed_relationships" :
"http://localhost:7474/db/data/node/74/relationships/out/{-list|&|types}",
  "incoming_relationships" :
"http://localhost:7474/db/data/node/74/relationships/in";,
  "extensions" : {
  },
  "create_relationship" : "http://localhost:7474/db/data/node/74/relationships";,
  "all_relationships" :
"http://localhost:7474/db/data/node/74/relationships/all";,
  "incoming_typed_relationships" :
"http://localhost:7474/db/data/node/74/relationships/in/{-list|&|types}"
}

$ curl -i -HAccept:application/json -HContent-Type:application/json -X
POST -d 
'{"to":"http://localhost:7474/db/data/node/74","type":"GO","data":{"name":"AB","distance":2}}'
http://localhost:7474/db/data/node/73/relationships
HTTP/1.1 201 Created
Content-Length: 421
Location: http://localhost:7474/db/data/relationship/64
Content-Encoding: UTF-8
Content-Type: application/json
Access-Control-Allow-Origin: *
Server: Jetty(6.1.25)

{
  "start" : "http://localhost:7474/db/data/node/73";,
  "data" : {
"distance" : 2,
"name" : "AB"
  },
  "self" : "http://localhost:7474/db/data/relationship/64";,
  "property" : "http://localhost:7474/db/data/relationship/64/properties/{key}";,
  "properties" : "http://localhost:7474/db/data/relationship/64/properties";,
  "type" : "GO",
  "extensions" : {
  },
  "end" : "http://localhost:7474/db/data/node/74";
}

#  This succeeds
$ curl -i -HAccept:application/json -HContent-Type:application/json -X
POST -d '{"to":"http://localhost:7474/db/data/node/74","type":"GO"}'
http://localhost:7474/db/data/node/73/paths
HTTP/1.1 200 OK
Content-Length: 297
Content-Encoding: UTF-8
Content-Type: application/json
Access-Control-Allow-Origin: *
Server: Jetty(6.1.25)

[ {
  "start" : "http://localhost:7474/db/data/node/73";,
  "nodes" : [ "http://localhost:7474/db/data/node/73";,
"http://localhost:7474/db/data/node/74"; ],
  "length" : 1,
  "relationships" : [ "http://localhost:7474/db/data/relationship/64"; ],
  "end" : "http://localhost:7474/db/data/node/74";
} ]


# This fails
$ curl -i -HAccept:application/json -

Re: [Neo4j] Announcing Neo4j 1.4 M04 “Kiruna Stol”

2011-06-17 Thread Aseem Kishore
That's awesome! Thanks.

Aseem

On Fri, Jun 17, 2011 at 11:54 AM, Michael Hunger <
michael.hun...@neotechnology.com> wrote:

> yes it does. one tx per batch
>
> M
>
> Sent from my iBrick4
>
>
> Am 17.06.2011 um 19:17 schrieb Aseem Kishore :
>
> > Quick q: will the new REST API batching feature treat the operations as a
> > single transaction? That would be convenient for some scenarios I think,
> > like swapping two nodes in a linked list.
> >
> > Aseem
> >
> > On Fri, Jun 10, 2011 at 7:48 AM, Peter Neubauer <
> > peter.neuba...@neotechnology.com> wrote:
> >
> >> Hello graphistas,
> >>
> >> today brings us the (hopefully) latest milestone towards the “Kiruna
> >> Stol” 1.4 release of Neo4j. You will find it contains two new major
> >> features that are meant to make your interaction with the database
> >> easier and more efficient as well as the usual range of minor bug
> >> fixes.
> >>
> >> Cypher, an expressive query language for graphs
> >> ==
> >>
> >> So far, the main means of interacting with the graph have been either
> >> the Traversal API or the REST API, leaving Neo4j wanting of a
> >> portable, expressive query language. Starting today, however, we are
> >> pleased to release Cypher, the first iteration of a query language
> >> designed for both application developers and operations specialists
> >> that want to create ad-hoc, portable queries against a Neo4j instance.
> >> You will find that the syntax has an SQL flavour to it so it is easy
> >> to get used to but all the graphy semantics goodness is there, ready
> >> to be harnessed. So, go right ahead and check out the manual at
> >>
> >> http://docs.neo4j.org/chunked/1.4.M04/query-lang.html
> >>
> >> and tell us what you think.
> >>
> >> Batching for the REST API
> >> 
> >>
> >> Cypher is not the only major feature in this milestone. The
> >> battle-proven REST interface gets new functionality, allowing
> >> definition and execution of batch operations. You can now post JSON
> >> encoded requests that contain any number of commands to the “batch
> >> URI” of the server and have the server execute them in one go,
> >> reducing this way the load on the server, the client and the network.
> >>
> >> Documentation on this experimental feature is available at
> >>
> >> http://docs.neo4j.org/chunked/1.4.M04/rest-api-batch-ops.html
> >>
> >> The above might be the stars of the show but, as always, there are
> >> many bug fixes and minor improvements scattered around the code. If
> >> you are curious, the changelogs have all the juicy details.
> >>
> >> So, go to http://neo4j.org to download 1.4.M04 and to
> >> http://blog.neo4j.org/2011/06/kiruna-stol-14-milestone-4.html to read
> >> more about it and let us know what you think.
> >>
> >>
> >>
> >> Cheers,
> >>
> >> /peter
> >> ___
> >> 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] traversing backwards to reference node

2011-06-17 Thread Matt C
Thanks guys, this mailing list is awesome.

On Thu, Jun 16, 2011 at 6:29 AM, Marko Rodriguez wrote:

> Hi,
>
> >  I think what he's
> > asking for is just to collect properties along the way.
>
>
> Yea. You are right he said "adding a name property to a list."
>
> In Gremlin, if you are still interested:
>
>x = [ ] // return list
> startSet = [ ... ] // fill an array/set with leaves
> startSet.in.sideEffect{x.add(it.name)}.loop(2){true}
>
> Or, as Mattias does using paths, do:
>
>startSet.in.name.back(1).loop(2){true}.paths
>
> The will give you all the paths from the leaves to the root. In a more
> friendly syntax, do:
>
>startSet.as('x').in.name.back(1).loop('x'){true}.paths
>
> Though, I would do it the first way with the list being filled as you go.
>
> Thanks,
> Marko.
>
> http://markorodriguez.com
>
> On Jun 16, 2011, at 2:23 AM, Mattias Persson wrote:
>
> > 2011/6/12 Marko Rodriguez 
> >
> >> Hi,
> >>
> >> In Gremlin (http://gremlin.tinkerpop.com), you can do:
> >>
> >>   startSet = [ ... ] // fill an array/set with leaves.
> >>   startSet.in.sideEffect{it.myProperty = 'blah'}.loop(2){true}
> >>
> >> In this code, it assumes no cycles in the graph and that the root of the
> >> tree as no incoming edges.
> >>
> >
> > That would actually set properties on entities, right? I think what he's
> > asking for is just to collect properties along the way.
> >
> > If you use a traversal from the leaf and tell it to traverse up to the
> root,
> > when you're there you have the full path there as an object (reversed
> > though) but can get all information from it directly w/o the need to
> gather
> > stuff along the way. Example:
> >
> >for ( Path pathToRoot : Traversal.description().relationships(
> >PARENT,OUTGOING).traverse(myFileNode) ) {
> >System.out.println( "Path to root of " + myFileNode + " is " +
> > pathToRoot );
> >}
> >
> > ...and the path contains all the information you need.
> >
> >
> >> ---
> >>
> >> If you are using Gremlin 1.1-SNAPSHOT (all pumped up on it), you can do:
> >>
> >>
> startSet.as('x').in.sideEffect{it.myProperty='blah'}.loop('x'){true}
> >>
> >> Finally: if you have lots and lots of data, then you will want to not
> have
> >> AUTOMATIC transactions and will want to put the graph into MANUAL
> >> transaction mode before you start the traversal. I can say more if you
> are
> >> interested.
> >>
> >> See ya,
> >> Marko.
> >>
> >> http://markorodriguez.com
> >>
> >> On Jun 11, 2011, at 9:42 PM, Matt C wrote:
> >>
> >>> Hey all, I'm new to Neo4j and I'm really liking it.  I'm not sure if
> its
> >> the
> >>> right tool for my particular job though.  I'd like to model a rather
> >> larse
> >>> filesystem (multi-petabyte) and use it to overlay additional metadata
> or
> >>> info.  The nice thing about neo4j is that if someone moves deeply
> nested
> >>> data, all I have to do is update a relationship to point somewhere
> else.
> >>>
> >>> I'm wondering if anyone can show me a traversal method that will walk
> >>> backwards to the reference node, adding a "name" property to a list as
> it
> >>> goes.
> >>>
> >>> -Matt
> >>> ___
> >>> 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
> >>
> >
> >
> >
> > --
> > 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
>
> ___
> 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 with MapReduce inserts

2011-06-17 Thread sulabh choudhury
Alright thank you all

On Fri, Jun 17, 2011 at 2:46 PM, Michael Hunger <
michael.hun...@neotechnology.com> wrote:

> No that would even be worse.
>
> A single BatchInserter  and every graphdb-store that is currently written
> to by a batch inserter MUST be accessed from only a single single threaded
> environment.
>
> Please use the normal EmbeddedGraphDbService for your multi-threaded MR
> jobs.
>
> Cheers
>
> Michael
>
> Am 17.06.2011 um 23:38 schrieb sulabh choudhury:
>
> Are you referring that in a M/R environment each Map (or Reduce) process
> will try to have its own instance of batchInserter and hence it would fail ?
>
> WHen I say "local" I mean that the code works fine when I just use the M/R
> api but fails when I try to run in distributed mode.
>
> On Fri, Jun 17, 2011 at 2:25 PM, Michael Hunger <
> michael.hun...@neotechnology.com> wrote:
>
>> Hi Sulabh,
>>
>> what do you mean by 'local' mode?
>>
>> The batch inserter can only be used in a single threaded environment. You
>> shouldn't use it in a concurrent env as it will fail unpredictably.
>>
>> Please use the EmbeddedGraphDatabase instead.
>>
>> Michael
>>
>> Am 17.06.2011 um 23:20 schrieb sulabh choudhury:
>>
>> Well as I mentioned the code does not fail anywhere, it runs it full
>> course and just skips the  writing to the graph part.
>> I have just one graph and I pass just 1 instance of the batchInserter  to
>> the map function.
>>
>> My code is in Scala, sample code attached below
>>
>>
>> class ExportReducer extends Reducer[Text,MapWritable,LongWritable,Text]{
>>
>>   type Context = org.apache.hadoop.mapreduce.Reducer[Text, MapWritable,
>> LongWritable, Text]#Context
>>
>>   @throws(classOf[Exception])
>>   override def reduce(key: Text, value: java.lang.Iterable[MapWritable],
>> context: Context) {
>>
>>   var keys: Array[String] = key.toString.split(":")
>>   var uri1 = "first" + keys(0)
>>   var uri2 = "last" + keys(1)
>>   ExportReducerObject.propertiesUID.put("ID",uri1);
>> var node1 =
>> ExportReducerObject.batchInserter.createNode(ExportReducerObject.propertiesUID);
>>
>> ExportReducerObject.indexService.add(node1,ExportReducerObject.propertiesUID)
>>   ExportReducerObject.propertiesCID.put("ID",uri2);
>>  var node2 =
>> ExportReducerObject.batchInserter.createNode(ExportReducerObject.propertiesCID);
>>
>> ExportReducerObject.indexService.add(node2,ExportReducerObject.propertiesCID);
>>
>>   ExportReducerObject.propertiesEdges.put("fullName","1.0");
>>
>> ExportReducerObject.batchInserter.createRelationship(node1,node2,DynamicRelationshipType.withName("fullName"),ExportReducerObject.propertiesEdges)
>>
>>   }
>>
>> My graph properties are defined as below :-
>> val batchInserter = new BatchInserterImpl("graph",
>> BatchInserterImpl.loadProperties("neo4j.props"))
>> val indexProvider = new LuceneBatchInserterIndexProvider(batchInserter)
>> val indexService =
>> indexProvider.nodeIndex("ID",MapUtil.stringMap("type","exact"))
>>
>>
>> Mind it that the code works perfectly( writes to the graph) when running
>> in local mode.
>>
>> On Fri, Jun 17, 2011 at 11:32 AM, sulabh choudhury wrote:
>>
>>> I am trying to write MapReduce job to do Neo4j Batchinserters.
>>> It works fine when I just run it like a java file(runs in local mode) and
>>> does the insert, but when I try to run it in the distributed mode it does
>>> not write to the graph.
>>> Is it issue related to permissions?
>>> I have no clue where to look.
>>>
>>
>>
>>
>> --
>> --
>> Thanks and Regards,
>> Sulabh Choudhury
>>
>>
>>
>
>
> --
> --
> Thanks and Regards,
> Sulabh Choudhury
>
>
>


-- 

-- 
Thanks and Regards,
Sulabh Choudhury
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Neo4j with MapReduce inserts

2011-06-17 Thread Michael Hunger
No that would even be worse.

A single BatchInserter  and every graphdb-store that is currently written to by 
a batch inserter MUST be accessed from only a single single threaded 
environment.

Please use the normal EmbeddedGraphDbService for your multi-threaded MR jobs.

Cheers

Michael

Am 17.06.2011 um 23:38 schrieb sulabh choudhury:

> Are you referring that in a M/R environment each Map (or Reduce) process will 
> try to have its own instance of batchInserter and hence it would fail ?
> 
> WHen I say "local" I mean that the code works fine when I just use the M/R 
> api but fails when I try to run in distributed mode.
> 
> On Fri, Jun 17, 2011 at 2:25 PM, Michael Hunger 
>  wrote:
> Hi Sulabh,
> 
> what do you mean by 'local' mode?
> 
> The batch inserter can only be used in a single threaded environment. You 
> shouldn't use it in a concurrent env as it will fail unpredictably.
> 
> Please use the EmbeddedGraphDatabase instead.
> 
> Michael
> 
> Am 17.06.2011 um 23:20 schrieb sulabh choudhury:
> 
>> Well as I mentioned the code does not fail anywhere, it runs it full course 
>> and just skips the  writing to the graph part.
>> I have just one graph and I pass just 1 instance of the batchInserter  to 
>> the map function.
>> 
>> My code is in Scala, sample code attached below
>> 
>> 
>> class ExportReducer extends Reducer[Text,MapWritable,LongWritable,Text]{
>> 
>>   type Context = org.apache.hadoop.mapreduce.Reducer[Text, MapWritable, 
>> LongWritable, Text]#Context
>> 
>>   @throws(classOf[Exception])
>>   override def reduce(key: Text, value: java.lang.Iterable[MapWritable], 
>> context: Context) {
>> 
>>   var keys: Array[String] = key.toString.split(":")
>>var uri1 = "first" + keys(0)
>>var uri2 = "last" + keys(1)
>>   ExportReducerObject.propertiesUID.put("ID",uri1);
>>  var node1 = 
>> ExportReducerObject.batchInserter.createNode(ExportReducerObject.propertiesUID);
>>  
>> ExportReducerObject.indexService.add(node1,ExportReducerObject.propertiesUID)
>>   ExportReducerObject.propertiesCID.put("ID",uri2);
>>  var node2 = 
>> ExportReducerObject.batchInserter.createNode(ExportReducerObject.propertiesCID);
>>  
>> ExportReducerObject.indexService.add(node2,ExportReducerObject.propertiesCID);
>> 
>>   ExportReducerObject.propertiesEdges.put("fullName","1.0");
>>   
>> ExportReducerObject.batchInserter.createRelationship(node1,node2,DynamicRelationshipType.withName("fullName"),ExportReducerObject.propertiesEdges)
>> 
>>   }
>> 
>> My graph properties are defined as below :-
>> val batchInserter = new BatchInserterImpl("graph", 
>> BatchInserterImpl.loadProperties("neo4j.props"))
>> val indexProvider = new LuceneBatchInserterIndexProvider(batchInserter)
>> val indexService = 
>> indexProvider.nodeIndex("ID",MapUtil.stringMap("type","exact"))
>> 
>> 
>> Mind it that the code works perfectly( writes to the graph) when running in 
>> local mode.
>> 
>> On Fri, Jun 17, 2011 at 11:32 AM, sulabh choudhury  wrote:
>> I am trying to write MapReduce job to do Neo4j Batchinserters.
>> It works fine when I just run it like a java file(runs in local mode) and 
>> does the insert, but when I try to run it in the distributed mode it does 
>> not write to the graph.
>> Is it issue related to permissions? 
>> I have no clue where to look.
>> 
>> 
>> 
>> -- 
>> -- 
>> Thanks and Regards,
>> Sulabh Choudhury
>> 
> 
> 
> 
> 
> -- 
> -- 
> Thanks and Regards,
> Sulabh Choudhury
> 

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


Re: [Neo4j] Connecting to a standalone server (not embedded server)

2011-06-17 Thread Jim Webber
Hi Aniceto,

It happens that there is a similar class in SDG, but you should look at the 
version in Michael Hunger's repo:

https://github.com/jexp/neo4j-java-rest-binding

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


Re: [Neo4j] Neo4j with MapReduce inserts

2011-06-17 Thread sulabh choudhury
Are you referring that in a M/R environment each Map (or Reduce) process
will try to have its own instance of batchInserter and hence it would fail ?

WHen I say "local" I mean that the code works fine when I just use the M/R
api but fails when I try to run in distributed mode.

On Fri, Jun 17, 2011 at 2:25 PM, Michael Hunger <
michael.hun...@neotechnology.com> wrote:

> Hi Sulabh,
>
> what do you mean by 'local' mode?
>
> The batch inserter can only be used in a single threaded environment. You
> shouldn't use it in a concurrent env as it will fail unpredictably.
>
> Please use the EmbeddedGraphDatabase instead.
>
> Michael
>
> Am 17.06.2011 um 23:20 schrieb sulabh choudhury:
>
> Well as I mentioned the code does not fail anywhere, it runs it full course
> and just skips the  writing to the graph part.
> I have just one graph and I pass just 1 instance of the batchInserter  to
> the map function.
>
> My code is in Scala, sample code attached below
>
>
> class ExportReducer extends Reducer[Text,MapWritable,LongWritable,Text]{
>
>   type Context = org.apache.hadoop.mapreduce.Reducer[Text, MapWritable,
> LongWritable, Text]#Context
>
>   @throws(classOf[Exception])
>   override def reduce(key: Text, value: java.lang.Iterable[MapWritable],
> context: Context) {
>
>   var keys: Array[String] = key.toString.split(":")
>   var uri1 = "first" + keys(0)
>   var uri2 = "last" + keys(1)
>   ExportReducerObject.propertiesUID.put("ID",uri1);
> var node1 =
> ExportReducerObject.batchInserter.createNode(ExportReducerObject.propertiesUID);
>
> ExportReducerObject.indexService.add(node1,ExportReducerObject.propertiesUID)
>   ExportReducerObject.propertiesCID.put("ID",uri2);
>  var node2 =
> ExportReducerObject.batchInserter.createNode(ExportReducerObject.propertiesCID);
>
> ExportReducerObject.indexService.add(node2,ExportReducerObject.propertiesCID);
>
>   ExportReducerObject.propertiesEdges.put("fullName","1.0");
>
> ExportReducerObject.batchInserter.createRelationship(node1,node2,DynamicRelationshipType.withName("fullName"),ExportReducerObject.propertiesEdges)
>
>   }
>
> My graph properties are defined as below :-
> val batchInserter = new BatchInserterImpl("graph",
> BatchInserterImpl.loadProperties("neo4j.props"))
> val indexProvider = new LuceneBatchInserterIndexProvider(batchInserter)
> val indexService =
> indexProvider.nodeIndex("ID",MapUtil.stringMap("type","exact"))
>
>
> Mind it that the code works perfectly( writes to the graph) when running in
> local mode.
>
> On Fri, Jun 17, 2011 at 11:32 AM, sulabh choudhury wrote:
>
>> I am trying to write MapReduce job to do Neo4j Batchinserters.
>> It works fine when I just run it like a java file(runs in local mode) and
>> does the insert, but when I try to run it in the distributed mode it does
>> not write to the graph.
>> Is it issue related to permissions?
>> I have no clue where to look.
>>
>
>
>
> --
> --
> Thanks and Regards,
> Sulabh Choudhury
>
>
>


-- 

-- 
Thanks and Regards,
Sulabh Choudhury
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Node and Relationships as properties

2011-06-17 Thread Niels Hoogeveen

That impedance mismatch you speak of can be overcome by writing your own API on 
top of Neo4J. 
Nothing keeps you for creating your own application layer that allows you to do 
the things you want to do. 
If you want relationships on relationships, create your own classes and 
interfaces, using nodes masquerading as relationships. 
You can even roll your own traversers that treat intermediate nodes as special 
cases, making the use of intermediate nodes just an implementation detail. 
Unlike SQL databases, Neo4j allows you to actually code pretty close to the 
metal, making it easier to create a setup that suits your particular needs.
Niels

> To: user@lists.neo4j.org
> Date: Fri, 17 Jun 2011 23:00:25 +0200
> From: ape...@innovasoftps.com
> Subject: Re: [Neo4j] Node and Relationships as properties
> 
>   BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px;
> }Yes, but you have to add an intermediate node and then graph becomes
> to be like the 4th normal form in SQL. An artifact to adapt real life
> scenarios to pure and simple technologies. Again an impedance mismatch
> between real life and implementing technology.
>  Aniceto
>  On Fri 17/06/11  8:19 PM , Niels Hoogeveen pd_aficion...@hotmail.com
> sent:
>  You can create a node type "community-role" with two outgoing
> relations "in_community" and "with_role", which respectively point to
> a "community" and to a "role". The "user node" can then have a
> relationship "has_community-role" pointing to a "community-role" node.
>  Every hypergraph structure can in principle be modeled in a property
> graph by introducing an intermediate node. > Date: Fri, 17 Jun 2011
> 18:52:55 +0200
>  > From: ape...@innovasoftps.com [1]
>  > To: user@lists.neo4j.org [2]
>  > Subject: Re: [Neo4j] Node and Relationships as properties
>  > 
>  > Peter
>  > 
>  > This could be a use case:
>  > 
>  > Let's have "users", "roles", "permissions" and "communities".
>  > 
>  > Each role is defined as a permissions set. Users have assigned a
> list of 
>  > roles for every community they belong to.
>  > 
>  > If roles could be assigned this way   (user)-- 
>  > (has_role)[community_neo4j] --> (role)
>  > 
>  > we can manage separately each user, permissions in role and
> community. 
>  > we don't need to have a set of roles for each community. The
> communities 
>  > won't be erased if role assignments are enacted. And mainly they
> could 
>  > be used in  custom traversers and patterns.
>  > 
>  > I agree we are not used to see these kind of handwritten graphs,
> but how 
>  > can you draw a clean graph and use it in neo4j with referential 
>  > integrity without the ability of having a node as property value?
>  > 
>  > Regards
>  > Aniceto
>  > 
>  > > Aniceto,
>  > > introducing real Node and Relationship links as fields on Nodes
> and
>  > > relationships would essentially blur the distinction between
> Nodes,
>  > > Properties and Relationships, and let you treat the graph as a
>  > > Hypergraph. We find that model too abstract and hard to deal
> with the
>  > > edge cases of these structures in real world scenarios.
>  > >
>  > > Instead, would it be possible for you to store NodeIDs in
> properties
>  > > instead, or serialise Node[] into byte arrays as properties? I
> don't
>  > > recommend it since it duplicates and unlinks information in the
> graph
>  > > that has to be maintained by triggers and updates, but that
> would be
>  > > one possibility. What is the concrete usecase that drives you to
> these
>  > > constructs?
>  > >
>  > > Cheers,
>  > >
>  > > /peter neubauer
>  > 
>  > ___
>  > Neo4j mailing list
>  > User@lists.neo4j.org [3]
>  > https://lists.neo4j.org/mailman/listinfo/user
>  ___
>  Neo4j mailing list
>  User@lists.neo4j.org [4]
>  https://lists.neo4j.org/mailman/listinfo/user
>  
> 
> Links:
> --
> [1] mailto:ape...@innovasoftps.com
> [2] mailto:user@lists.neo4j.org
> [3] mailto:User@lists.neo4j.org
> [4] mailto:User@lists.neo4j.org
> ___
> 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 with MapReduce inserts

2011-06-17 Thread Michael Hunger
Hi Sulabh,

what do you mean by 'local' mode?

The batch inserter can only be used in a single threaded environment. You 
shouldn't use it in a concurrent env as it will fail unpredictably.

Please use the EmbeddedGraphDatabase instead.

Michael

Am 17.06.2011 um 23:20 schrieb sulabh choudhury:

> Well as I mentioned the code does not fail anywhere, it runs it full course 
> and just skips the  writing to the graph part.
> I have just one graph and I pass just 1 instance of the batchInserter  to the 
> map function.
> 
> My code is in Scala, sample code attached below
> 
> 
> class ExportReducer extends Reducer[Text,MapWritable,LongWritable,Text]{
> 
>   type Context = org.apache.hadoop.mapreduce.Reducer[Text, MapWritable, 
> LongWritable, Text]#Context
> 
>   @throws(classOf[Exception])
>   override def reduce(key: Text, value: java.lang.Iterable[MapWritable], 
> context: Context) {
> 
>   var keys: Array[String] = key.toString.split(":")
> var uri1 = "first" + keys(0)
> var uri2 = "last" + keys(1)
>   ExportReducerObject.propertiesUID.put("ID",uri1);
>   var node1 = 
> ExportReducerObject.batchInserter.createNode(ExportReducerObject.propertiesUID);
>   
> ExportReducerObject.indexService.add(node1,ExportReducerObject.propertiesUID)
>   ExportReducerObject.propertiesCID.put("ID",uri2);
>   var node2 = 
> ExportReducerObject.batchInserter.createNode(ExportReducerObject.propertiesCID);
>   
> ExportReducerObject.indexService.add(node2,ExportReducerObject.propertiesCID);
> 
>   ExportReducerObject.propertiesEdges.put("fullName","1.0");
>   
> ExportReducerObject.batchInserter.createRelationship(node1,node2,DynamicRelationshipType.withName("fullName"),ExportReducerObject.propertiesEdges)
> 
>   }
> 
> My graph properties are defined as below :-
> val batchInserter = new BatchInserterImpl("graph", 
> BatchInserterImpl.loadProperties("neo4j.props"))
> val indexProvider = new LuceneBatchInserterIndexProvider(batchInserter)
> val indexService = 
> indexProvider.nodeIndex("ID",MapUtil.stringMap("type","exact"))
> 
> 
> Mind it that the code works perfectly( writes to the graph) when running in 
> local mode.
> 
> On Fri, Jun 17, 2011 at 11:32 AM, sulabh choudhury  wrote:
> I am trying to write MapReduce job to do Neo4j Batchinserters.
> It works fine when I just run it like a java file(runs in local mode) and 
> does the insert, but when I try to run it in the distributed mode it does not 
> write to the graph.
> Is it issue related to permissions? 
> I have no clue where to look.
> 
> 
> 
> -- 
> -- 
> Thanks and Regards,
> Sulabh Choudhury
> 

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


Re: [Neo4j] Neo4j with MapReduce inserts

2011-06-17 Thread sulabh choudhury
Well as I mentioned the code does not fail anywhere, it runs it full course
and just skips the  writing to the graph part.
I have just one graph and I pass just 1 instance of the batchInserter  to
the map function.

My code is in Scala, sample code attached below


class ExportReducer extends Reducer[Text,MapWritable,LongWritable,Text]{

  type Context = org.apache.hadoop.mapreduce.Reducer[Text, MapWritable,
LongWritable, Text]#Context

  @throws(classOf[Exception])
  override def reduce(key: Text, value: java.lang.Iterable[MapWritable],
context: Context) {

  var keys: Array[String] = key.toString.split(":")
  var uri1 = "first" + keys(0)
  var uri2 = "last" + keys(1)
  ExportReducerObject.propertiesUID.put("ID",uri1);
var node1 =
ExportReducerObject.batchInserter.createNode(ExportReducerObject.propertiesUID);

ExportReducerObject.indexService.add(node1,ExportReducerObject.propertiesUID)
  ExportReducerObject.propertiesCID.put("ID",uri2);
 var node2 =
ExportReducerObject.batchInserter.createNode(ExportReducerObject.propertiesCID);
ExportReducerObject.indexService.add(node2,ExportReducerObject.propertiesCID);

  ExportReducerObject.propertiesEdges.put("fullName","1.0");

ExportReducerObject.batchInserter.createRelationship(node1,node2,DynamicRelationshipType.withName("
fullName"),ExportReducerObject.propertiesEdges)

  }

My graph properties are defined as below :-
val batchInserter = new BatchInserterImpl("graph",
BatchInserterImpl.loadProperties("neo4j.props"))
val indexProvider = new LuceneBatchInserterIndexProvider(batchInserter)
val indexService =
indexProvider.nodeIndex("ID",MapUtil.stringMap("type","exact"))


Mind it that the code works perfectly( writes to the graph) when running in
local mode.

On Fri, Jun 17, 2011 at 11:32 AM, sulabh choudhury wrote:

> I am trying to write MapReduce job to do Neo4j Batchinserters.
> It works fine when I just run it like a java file(runs in local mode) and
> does the insert, but when I try to run it in the distributed mode it does
> not write to the graph.
> Is it issue related to permissions?
> I have no clue where to look.
>



-- 

-- 
Thanks and Regards,
Sulabh Choudhury
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Connecting to a standalone server (not embedded server)

2011-06-17 Thread Aniceto Pérez y Madrid
  BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }It
seems there is a class named 
ORG.NEO4J.REST.GRAPHDB.RESTGRAPHDATABASE

that implements GraphDatabaseService, but despite that package,
javadocs are in the spring-data server, and probably the class be also
part of Spring-data-graph package.
 Aniceto
 On Fri 17/06/11  8:18 PM , Jim Webber j...@neotechnology.com sent:
 Hello Aniceto,
 Michael Hunger wrote a Java wrapper that uses the REST API under the
covers:
 https://github.com/jexp/neo4j-java-rest-binding
 As Chris pointed out a couple of emails ago, although this API is
similar to the embedded API, it goes over HTTP and so is  far slower.
 Jim
 On 17 Jun 2011, at 18:56, Aniceto Pérez y Madrid wrote:
 >  BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px;
 > }I've been digging into documentation and it seems there is no
Java
 > wrapper to access it, only the REST API. Is that correct?
 > Thanks
 > 
 > ___
 > Neo4j mailing list
 > User@lists.neo4j.org [1]
 > https://lists.neo4j.org/mailman/listinfo/user
 ___
 Neo4j mailing list
 User@lists.neo4j.org [2]
 https://lists.neo4j.org/mailman/listinfo/user
 

Links:
--
[1] mailto:User@lists.neo4j.org
[2] mailto:User@lists.neo4j.org
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Node and Relationships as properties

2011-06-17 Thread Aniceto Pérez y Madrid
  BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px;
}Yes, but you have to add an intermediate node and then graph becomes
to be like the 4th normal form in SQL. An artifact to adapt real life
scenarios to pure and simple technologies. Again an impedance mismatch
between real life and implementing technology.
 Aniceto
 On Fri 17/06/11  8:19 PM , Niels Hoogeveen pd_aficion...@hotmail.com
sent:
 You can create a node type "community-role" with two outgoing
relations "in_community" and "with_role", which respectively point to
a "community" and to a "role". The "user node" can then have a
relationship "has_community-role" pointing to a "community-role" node.
 Every hypergraph structure can in principle be modeled in a property
graph by introducing an intermediate node. > Date: Fri, 17 Jun 2011
18:52:55 +0200
 > From: ape...@innovasoftps.com [1]
 > To: user@lists.neo4j.org [2]
 > Subject: Re: [Neo4j] Node and Relationships as properties
 > 
 > Peter
 > 
 > This could be a use case:
 > 
 > Let's have "users", "roles", "permissions" and "communities".
 > 
 > Each role is defined as a permissions set. Users have assigned a
list of 
 > roles for every community they belong to.
 > 
 > If roles could be assigned this way   (user)-- 
 > (has_role)[community_neo4j] --> (role)
 > 
 > we can manage separately each user, permissions in role and
community. 
 > we don't need to have a set of roles for each community. The
communities 
 > won't be erased if role assignments are enacted. And mainly they
could 
 > be used in  custom traversers and patterns.
 > 
 > I agree we are not used to see these kind of handwritten graphs,
but how 
 > can you draw a clean graph and use it in neo4j with referential 
 > integrity without the ability of having a node as property value?
 > 
 > Regards
 > Aniceto
 > 
 > > Aniceto,
 > > introducing real Node and Relationship links as fields on Nodes
and
 > > relationships would essentially blur the distinction between
Nodes,
 > > Properties and Relationships, and let you treat the graph as a
 > > Hypergraph. We find that model too abstract and hard to deal
with the
 > > edge cases of these structures in real world scenarios.
 > >
 > > Instead, would it be possible for you to store NodeIDs in
properties
 > > instead, or serialise Node[] into byte arrays as properties? I
don't
 > > recommend it since it duplicates and unlinks information in the
graph
 > > that has to be maintained by triggers and updates, but that
would be
 > > one possibility. What is the concrete usecase that drives you to
these
 > > constructs?
 > >
 > > Cheers,
 > >
 > > /peter neubauer
 > 
 > ___
 > Neo4j mailing list
 > User@lists.neo4j.org [3]
 > https://lists.neo4j.org/mailman/listinfo/user
 ___
 Neo4j mailing list
 User@lists.neo4j.org [4]
 https://lists.neo4j.org/mailman/listinfo/user
 

Links:
--
[1] mailto:ape...@innovasoftps.com
[2] mailto:user@lists.neo4j.org
[3] mailto:User@lists.neo4j.org
[4] mailto:User@lists.neo4j.org
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Integer cost property

2011-06-17 Thread Jim Webber
Hi Josh,

I'm currently working on some REST API stuff, so my head's right in this space.

I'm happy to take a look at this is if you send over a failing test.

Jim

On 17 Jun 2011, at 21:34, Josh Adell wrote:

> I am using the Dijkstra path finding algorithm.  I have several
> relationships set up through the REST interface with a cost property
> called "distance".  Unfortunately, it seems like I can't make the
> property a round number like 2.0, either through REST calls or through
> the webadmin panel.  It always seems to cast my value to an integer.
> 
> When I try to find my path, I get the following exception thrown:
> "java.lang.Integer cannot be cast to java.lang.Double"
> 
> The exception is thrown on line 38 of the DoubleEvaluator:
> "org.neo4j.graphalgo.impl.util.DoubleEvaluator.getCost(DoubleEvaluator.java:38)"
> 
> I don't know Java very well, and I don't have an environment set up to
> work on large Java projects, so I can't submit a patch.  I think the
> fix might be to change that line to:
> - return (Double) relationship.getProperty( costpropertyName );
> + return (Double) relationship.getProperty( costpropertyName ).doubleValue();
> 
> Should I file a bug as well as posting this to the list?
> 
> Thanks,
> Josh Adell
> ___
> 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 with MapReduce inserts

2011-06-17 Thread Michael Hunger
Also, 
what technology are you writing those map-reduce jobs with ? (framework, 
runtime-env, etc).

Some code samples would be great as well.

Cheers

Michael

Am 17.06.2011 um 22:24 schrieb Jim Webber:

> Hello Sulabh,
> 
> We're going to need a little more information before we can help.
> 
> Can you tell us how it fails? Are you trying to run a batch inserter on 
> different databases on each of your parallel jobs? 
> 
> 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] Integer cost property

2011-06-17 Thread Josh Adell
I am using the Dijkstra path finding algorithm.  I have several
relationships set up through the REST interface with a cost property
called "distance".  Unfortunately, it seems like I can't make the
property a round number like 2.0, either through REST calls or through
the webadmin panel.  It always seems to cast my value to an integer.

When I try to find my path, I get the following exception thrown:
"java.lang.Integer cannot be cast to java.lang.Double"

The exception is thrown on line 38 of the DoubleEvaluator:
"org.neo4j.graphalgo.impl.util.DoubleEvaluator.getCost(DoubleEvaluator.java:38)"

I don't know Java very well, and I don't have an environment set up to
work on large Java projects, so I can't submit a patch.  I think the
fix might be to change that line to:
- return (Double) relationship.getProperty( costpropertyName );
+ return (Double) relationship.getProperty( costpropertyName ).doubleValue();

Should I file a bug as well as posting this to the list?

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


Re: [Neo4j] Generating suggestions in a Neo4j db

2011-06-17 Thread Jim Webber
Hi Aman,

I'm puzzled.

Why not

Aman--HAS_VISITED-->USA
Jim--HAS_VISITED-->India

And if:

Aman--FRIEND-OF-->Jim

Then you just need to traverse from Aman following outgoing FRIEND_OF 
relationships to all your friends, and then traverse out their outgoing 
HAS_VISITED relationships to find places your friends have been. 

The general idiom with Neo4j is use indexes the find your start node (e.g. the 
Aman node in the above) then traverse from there.

Jim

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


Re: [Neo4j] Neo4j with MapReduce inserts

2011-06-17 Thread Jim Webber
Hello Sulabh,

We're going to need a little more information before we can help.

Can you tell us how it fails? Are you trying to run a batch inserter on 
different databases on each of your parallel jobs? 

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


Re: [Neo4j] Announcing Neo4j 1.4 M04 “Kiruna Stol”

2011-06-17 Thread Michael Hunger
yes it does. one tx per batch

M

Sent from my iBrick4


Am 17.06.2011 um 19:17 schrieb Aseem Kishore :

> Quick q: will the new REST API batching feature treat the operations as a
> single transaction? That would be convenient for some scenarios I think,
> like swapping two nodes in a linked list.
> 
> Aseem
> 
> On Fri, Jun 10, 2011 at 7:48 AM, Peter Neubauer <
> peter.neuba...@neotechnology.com> wrote:
> 
>> Hello graphistas,
>> 
>> today brings us the (hopefully) latest milestone towards the “Kiruna
>> Stol” 1.4 release of Neo4j. You will find it contains two new major
>> features that are meant to make your interaction with the database
>> easier and more efficient as well as the usual range of minor bug
>> fixes.
>> 
>> Cypher, an expressive query language for graphs
>> ==
>> 
>> So far, the main means of interacting with the graph have been either
>> the Traversal API or the REST API, leaving Neo4j wanting of a
>> portable, expressive query language. Starting today, however, we are
>> pleased to release Cypher, the first iteration of a query language
>> designed for both application developers and operations specialists
>> that want to create ad-hoc, portable queries against a Neo4j instance.
>> You will find that the syntax has an SQL flavour to it so it is easy
>> to get used to but all the graphy semantics goodness is there, ready
>> to be harnessed. So, go right ahead and check out the manual at
>> 
>> http://docs.neo4j.org/chunked/1.4.M04/query-lang.html
>> 
>> and tell us what you think.
>> 
>> Batching for the REST API
>> 
>> 
>> Cypher is not the only major feature in this milestone. The
>> battle-proven REST interface gets new functionality, allowing
>> definition and execution of batch operations. You can now post JSON
>> encoded requests that contain any number of commands to the “batch
>> URI” of the server and have the server execute them in one go,
>> reducing this way the load on the server, the client and the network.
>> 
>> Documentation on this experimental feature is available at
>> 
>> http://docs.neo4j.org/chunked/1.4.M04/rest-api-batch-ops.html
>> 
>> The above might be the stars of the show but, as always, there are
>> many bug fixes and minor improvements scattered around the code. If
>> you are curious, the changelogs have all the juicy details.
>> 
>> So, go to http://neo4j.org to download 1.4.M04 and to
>> http://blog.neo4j.org/2011/06/kiruna-stol-14-milestone-4.html to read
>> more about it and let us know what you think.
>> 
>> 
>> 
>> Cheers,
>> 
>> /peter
>> ___
>> 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] Generating suggestions in a Neo4j db

2011-06-17 Thread Aman
This is an extension of previous questions that I had posted (although no
knowledge of them is needed to understand this).

Here's what the relations look like in my db...

User1---VISITED PLACES---> Empty Node>HAS VISITED> Usa
User2---VISITED PLACES---> Empty Node>HAS VISITED> Usa
User1---VISITED PLACES---> Empty Node>HAS VISITED> Canada
User2---VISITED PLACES---> Empty Node>HAS VISITED> Canada
User1---VISITED PLACES---> Empty Node>HAS VISITED> India


(The Usa nodes are the same one). Each user has his/her own VISITED PLACES
empty node (so that the point from where all these relations emerge are
centralized).

User1 and User2 are friends. Now, as User1 and User2 have most of their
visited places common, I want to generate suggestions of places (here India)
where User2 can visit (based upon the places where User2's friends have
visited)... How can I do that? Any suggestions regarding the same? Indexing
or Traversals??
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] Neo4j with MapReduce inserts

2011-06-17 Thread sulabh choudhury
I am trying to write MapReduce job to do Neo4j Batchinserters.
It works fine when I just run it like a java file(runs in local mode) and
does the insert, but when I try to run it in the distributed mode it does
not write to the graph.
Is it issue related to permissions?
I have no clue where to look.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Extent of Indexing

2011-06-17 Thread Aman
Mattias,
I just listed one of the use cases, I have ample types of relationships in
my database.
I will be connecting all the 50k users to certain common nodes that will
depict something about the users. Example: A user node can be
directly/indirectly related to a "place" node that will depict the places
where users visit daily.

Now please consider this scenario, because this is where I am facing
problem...

I have stored all data regarding user in user node (like age etc in the way
described above). A user node is also connected to various nodes that he
posted. Suppose that I have 50k users and each of them has posted 10 posts.
Now I want to find out what posts have the people of certain age posted. How
do I do that?

I believe I WILL have to use indexing. If there is any way possible via
traversals, please share the same.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Node and Relationships as properties

2011-06-17 Thread Niels Hoogeveen

You can create a node type "community-role" with two outgoing relations 
"in_community" and "with_role", which respectively point to a "community" and 
to a "role". The "user node" can then have a relationship "has_community-role" 
pointing to a "community-role" node.  Every hypergraph structure can in 
principle be modeled in a property graph by introducing an intermediate node. > 
Date: Fri, 17 Jun 2011 18:52:55 +0200
> From: ape...@innovasoftps.com
> To: user@lists.neo4j.org
> Subject: Re: [Neo4j] Node and Relationships as properties
> 
> Peter
> 
> This could be a use case:
> 
> Let's have "users", "roles", "permissions" and "communities".
> 
> Each role is defined as a permissions set. Users have assigned a list of 
> roles for every community they belong to.
> 
> If roles could be assigned this way   (user)-- 
> (has_role)[community_neo4j] --> (role)
> 
> we can manage separately each user, permissions in role and community. 
> we don't need to have a set of roles for each community. The communities 
> won't be erased if role assignments are enacted. And mainly they could 
> be used in  custom traversers and patterns.
> 
> I agree we are not used to see these kind of handwritten graphs, but how 
> can you draw a clean graph and use it in neo4j with referential 
> integrity without the ability of having a node as property value?
> 
> Regards
> Aniceto
> 
> > Aniceto,
> > introducing real Node and Relationship links as fields on Nodes and
> > relationships would essentially blur the distinction between Nodes,
> > Properties and Relationships, and let you treat the graph as a
> > Hypergraph. We find that model too abstract and hard to deal with the
> > edge cases of these structures in real world scenarios.
> >
> > Instead, would it be possible for you to store NodeIDs in properties
> > instead, or serialise Node[] into byte arrays as properties? I don't
> > recommend it since it duplicates and unlinks information in the graph
> > that has to be maintained by triggers and updates, but that would be
> > one possibility. What is the concrete usecase that drives you to these
> > constructs?
> >
> > Cheers,
> >
> > /peter neubauer
> 
> ___
> 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] Connecting to a standalone server (not embedded server)

2011-06-17 Thread Jim Webber
Hello Aniceto,

Michael Hunger wrote a Java wrapper that uses the REST API under the covers:

https://github.com/jexp/neo4j-java-rest-binding

As Chris pointed out a couple of emails ago, although this API is similar to 
the embedded API, it goes over HTTP and so is  far slower.

Jim

On 17 Jun 2011, at 18:56, Aniceto Pérez y Madrid wrote:

>  BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px;
> }I've been digging into documentation and it seems there is no Java
> wrapper to access it, only the REST API. Is that correct?
> Thanks
> 
> ___
> 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] Connecting to a standalone server (not embedded server)

2011-06-17 Thread Aniceto Pérez y Madrid
  BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px;
}I've been digging into documentation and it seems there is no Java
wrapper to access it, only the REST API. Is that correct?
 Thanks
  
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] Null when iterating relationships

2011-06-17 Thread Aniceto Pérez y Madrid
  BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }Hi
 I have a graph where each node of a class have a relationship to a
master-class node and it has a relationship to referenceNode. Using
1.4.M04 and EmbeddedServer.
 I have a loop over all the relationships of the referenceNode, each
has a master-class node as endNode.
 Then I iterate over the relationships of each master-class node.
Iterator returns each relationship beginning with the newest. The las
one is the relation with the referenceNode.
 for (Iterator itr2 = nodo2Index.getRelationships().iterator();
itr2.hasNext();) {
 Relationship rel2Index;
 try {
 rel2Index = it.next();
 catch (Exception e){
  }
 }
 When the relationship net is from referenceNode to master-class
node, the oldest one, I get a java.util.NoSuchElementException and the
loop continues forever. Is that OK?
 Thanks
  
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] Can I model a Graph data structure without persisting it in DB using Neo4j ?

2011-06-17 Thread V
I created a graph model with 2 classes Node and Element as follows:

public class Node {

 @RelatedTo(type = "ELEMENT", elementClass = Element.class, direction =
OUTGOING)
private Set Element;


public void addElement(Element e) {
relateTo(e, Relationships.ELEMENT.toString());
}

}

public class Element{

   public String name;

}
I want to create an in memory graph structure without persisting the nodes
as follows :

Node n = new Node();
n.addElement(new Element());

*However it throws an exception as the Node n has not been persisted so the
call to relateTo(..) fails. *

If instead I do
n.persist()
and then call addElement(..) it works fine as the aspect kicks in.

Any workaround for this ?  That is, is there a way I can still use the above
style without persisting the Node object ?


My application needs this as first I create a structure and persist it, and
then I create another structure to pass around some values to the persisted
structure when doing some computations.

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


Re: [Neo4j] Announcing Neo4j 1.4 M04 “Kiruna Stol”

2011-06-17 Thread Aseem Kishore
Quick q: will the new REST API batching feature treat the operations as a
single transaction? That would be convenient for some scenarios I think,
like swapping two nodes in a linked list.

Aseem

On Fri, Jun 10, 2011 at 7:48 AM, Peter Neubauer <
peter.neuba...@neotechnology.com> wrote:

> Hello graphistas,
>
> today brings us the (hopefully) latest milestone towards the “Kiruna
> Stol” 1.4 release of Neo4j. You will find it contains two new major
> features that are meant to make your interaction with the database
> easier and more efficient as well as the usual range of minor bug
> fixes.
>
> Cypher, an expressive query language for graphs
> ==
>
> So far, the main means of interacting with the graph have been either
> the Traversal API or the REST API, leaving Neo4j wanting of a
> portable, expressive query language. Starting today, however, we are
> pleased to release Cypher, the first iteration of a query language
> designed for both application developers and operations specialists
> that want to create ad-hoc, portable queries against a Neo4j instance.
> You will find that the syntax has an SQL flavour to it so it is easy
> to get used to but all the graphy semantics goodness is there, ready
> to be harnessed. So, go right ahead and check out the manual at
>
>  http://docs.neo4j.org/chunked/1.4.M04/query-lang.html
>
> and tell us what you think.
>
> Batching for the REST API
> 
>
> Cypher is not the only major feature in this milestone. The
> battle-proven REST interface gets new functionality, allowing
> definition and execution of batch operations. You can now post JSON
> encoded requests that contain any number of commands to the “batch
> URI” of the server and have the server execute them in one go,
> reducing this way the load on the server, the client and the network.
>
> Documentation on this experimental feature is available at
>
>  http://docs.neo4j.org/chunked/1.4.M04/rest-api-batch-ops.html
>
> The above might be the stars of the show but, as always, there are
> many bug fixes and minor improvements scattered around the code. If
> you are curious, the changelogs have all the juicy details.
>
> So, go to http://neo4j.org to download 1.4.M04 and to
> http://blog.neo4j.org/2011/06/kiruna-stol-14-milestone-4.html to read
> more about it and let us know what you think.
>
>
>
> Cheers,
>
> /peter
> ___
> 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] Traversals versus Indexing

2011-06-17 Thread Aseem Kishore
Cool, thanks!

On Fri, Jun 17, 2011 at 5:01 AM, Mattias Persson
wrote:

> getNodeById is fast/immediate
>
> 2011/6/16 Aseem Kishore 
>
> > Indeed getNodeById().
> >
> > Aseem
> >
> > On Thu, Jun 16, 2011 at 10:11 AM, Mattias Persson <
> > matt...@neotechnology.com
> > > wrote:
> >
> > > Are you thinking of GraphDatabaseService#getNodeById /
> > #getRelationshipById
> > > ? Or index lookups?
> > >
> > > 2011/6/16 Aseem Kishore 
> > >
> > > > Are lookups by ID also so much slower than traversals?
> > > >
> > > > Aseem
> > > >
> > > > On Thu, Jun 16, 2011 at 3:45 AM, Mattias Persson
> > > > wrote:
> > > >
> > > > > I don't know your use case at all, but one of the benefits you get
> > with
> > > > > traversing compared to index lookups is that one hop from a node to
> > > > another
> > > > > is instantaneous ( > 1 million hops / second on a fully cached
> > graph),
> > > > > whereas index lookups are several order of magnitudes slower than
> > that.
> > > > But
> > > > > index lookups are good for when you f.ex. have thousands/millions
> of
> > > > names
> > > > > and you'd like to get the node with a certain name. Then that would
> > be
> > > > your
> > > > > starting point for doing a traversal to find other information
> > "local"
> > > to
> > > > > that node, or in its vicinity.
> > > > >
> > > > > 2011/6/13 Aman 
> > > > >
> > > > > > What is faster - Traversals or Indexing? I mean if one has a
> > database
> > > > > model
> > > > > > that can offer a choice between the two, what should one choose?
> > > > > > Also, what about when the scalability factor comes in?
> > > > > > ___
> > > > > > 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
> > > > >
> > > > ___
> > > > 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
> > >
> > ___
> > 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
>
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Neo4J server - java

2011-06-17 Thread Chris Gioran
Of course, on the other hand, if the access method per se is the
problem, then Michael Hunger has this to offer:

https://github.com/jexp/neo4j-java-rest-binding

which is a wrapper that exposes the REST server endpoint as a
GraphDatabaseService. Everything works through REST so performance
remains the same but you use Java APIs.

cheers,
CG

On Fri, Jun 17, 2011 at 7:56 PM, Chris Gioran
 wrote:
> Glad to help!
>
> The main overhead associated with the REST interface is the request
> processing. The new batch request functionality available as of the
> latest milestone can reduce significantly that cost, so if performance
> against a remote instance is your main goal and you are not hesitant
> about using milestones, i urge you to try it out wherever you can - it
> will give you a significant boost and we always welcome feedback.
>
> cheers,
> CG
>
> On Fri, Jun 17, 2011 at 7:36 PM, Antriani Stylianou
>  wrote:
>> Hi,
>> That answered my question!
>> I was just aiming for performance and thought that java api would be
>> better than REST.
>>
>> a.
>>
>> On 6/17/11 6:34 PM, Chris Gioran wrote:
>>> Hi Antriani,
>>>
>>> no, besides the two ways you mention, such functionality is not
>>> currently available, with a question mark over the HA way, depending
>>> on your use case.
>>>
>>> I assume what you need is to program against a remotely running
>>> instance of Neo4j through the same Java API, kind of like what is
>>> feasible through JDBC drivers for relational stores.
>>> The brand new Cypher query language is a step in this direction,
>>> providing a way to serialize 'job descriptions" that can lead to a
>>> binary protocol and finally a driver that will provide what you ask
>>> for.
>>>
>>> However, the REST API is currently the proper way to talk to a Neo4j
>>> server, recently improved by batch functionality.
>>>
>>> Does your use case have a particular reason for which the REST
>>> interface is not sufficient?
>>>
>>> cheers,
>>> CG
>>>
>>> On Fri, Jun 17, 2011 at 7:00 PM, Antriani Stylianou
>>>   wrote:
 Hi,

 A startup question here!
 Can I connect from java to a neo4j server running the database without
 using the REST API or the Remote Server.?

 Something like :

 GraphDatabaseService graphDb = new 
 EmbeddedGraphDatabase("localhost:7474/");


 Thanks,
 A.

 ___
 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] Neo4J server - java

2011-06-17 Thread Chris Gioran
Glad to help!

The main overhead associated with the REST interface is the request
processing. The new batch request functionality available as of the
latest milestone can reduce significantly that cost, so if performance
against a remote instance is your main goal and you are not hesitant
about using milestones, i urge you to try it out wherever you can - it
will give you a significant boost and we always welcome feedback.

cheers,
CG

On Fri, Jun 17, 2011 at 7:36 PM, Antriani Stylianou
 wrote:
> Hi,
> That answered my question!
> I was just aiming for performance and thought that java api would be
> better than REST.
>
> a.
>
> On 6/17/11 6:34 PM, Chris Gioran wrote:
>> Hi Antriani,
>>
>> no, besides the two ways you mention, such functionality is not
>> currently available, with a question mark over the HA way, depending
>> on your use case.
>>
>> I assume what you need is to program against a remotely running
>> instance of Neo4j through the same Java API, kind of like what is
>> feasible through JDBC drivers for relational stores.
>> The brand new Cypher query language is a step in this direction,
>> providing a way to serialize 'job descriptions" that can lead to a
>> binary protocol and finally a driver that will provide what you ask
>> for.
>>
>> However, the REST API is currently the proper way to talk to a Neo4j
>> server, recently improved by batch functionality.
>>
>> Does your use case have a particular reason for which the REST
>> interface is not sufficient?
>>
>> cheers,
>> CG
>>
>> On Fri, Jun 17, 2011 at 7:00 PM, Antriani Stylianou
>>   wrote:
>>> Hi,
>>>
>>> A startup question here!
>>> Can I connect from java to a neo4j server running the database without
>>> using the REST API or the Remote Server.?
>>>
>>> Something like :
>>>
>>> GraphDatabaseService graphDb = new EmbeddedGraphDatabase("localhost:7474/");
>>>
>>>
>>> Thanks,
>>> A.
>>>
>>> ___
>>> 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] Node and Relationships as properties

2011-06-17 Thread Aniceto Perez
Peter

This could be a use case:

Let's have "users", "roles", "permissions" and "communities".

Each role is defined as a permissions set. Users have assigned a list of 
roles for every community they belong to.

If roles could be assigned this way   (user)-- 
(has_role)[community_neo4j] --> (role)

we can manage separately each user, permissions in role and community. 
we don't need to have a set of roles for each community. The communities 
won't be erased if role assignments are enacted. And mainly they could 
be used in  custom traversers and patterns.

I agree we are not used to see these kind of handwritten graphs, but how 
can you draw a clean graph and use it in neo4j with referential 
integrity without the ability of having a node as property value?

Regards
Aniceto

> Aniceto,
> introducing real Node and Relationship links as fields on Nodes and
> relationships would essentially blur the distinction between Nodes,
> Properties and Relationships, and let you treat the graph as a
> Hypergraph. We find that model too abstract and hard to deal with the
> edge cases of these structures in real world scenarios.
>
> Instead, would it be possible for you to store NodeIDs in properties
> instead, or serialise Node[] into byte arrays as properties? I don't
> recommend it since it duplicates and unlinks information in the graph
> that has to be maintained by triggers and updates, but that would be
> one possibility. What is the concrete usecase that drives you to these
> constructs?
>
> Cheers,
>
> /peter neubauer

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


Re: [Neo4j] Spring Data Graph 1.1.0.M1 milestone released

2011-06-17 Thread Alfredas Chmieliauskas
>
> Today I discussed some nice derived-method for cypher queries.
> See: 
> https://github.com/SpringSource/spring-data-graph/wiki/Repository-query-methods
>
Looks great- but these are not implemented yet?

Also - uploaded the "simulation engine" on github:

https://github.com/alfredas/AgentSpring
"Agent Based Modeling framework based on Spring and Neo4J"

The current version is already on spring-data-graph version 1.1.0M1.

Still a lot of work before the framework is usable. But I'm continuing
to work on it, so something will happen :-)

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


Re: [Neo4j] Neo4J server - java

2011-06-17 Thread Antriani Stylianou
Hi,
That answered my question!
I was just aiming for performance and thought that java api would be 
better than REST.

a.

On 6/17/11 6:34 PM, Chris Gioran wrote:
> Hi Antriani,
>
> no, besides the two ways you mention, such functionality is not
> currently available, with a question mark over the HA way, depending
> on your use case.
>
> I assume what you need is to program against a remotely running
> instance of Neo4j through the same Java API, kind of like what is
> feasible through JDBC drivers for relational stores.
> The brand new Cypher query language is a step in this direction,
> providing a way to serialize 'job descriptions" that can lead to a
> binary protocol and finally a driver that will provide what you ask
> for.
>
> However, the REST API is currently the proper way to talk to a Neo4j
> server, recently improved by batch functionality.
>
> Does your use case have a particular reason for which the REST
> interface is not sufficient?
>
> cheers,
> CG
>
> On Fri, Jun 17, 2011 at 7:00 PM, Antriani Stylianou
>   wrote:
>> Hi,
>>
>> A startup question here!
>> Can I connect from java to a neo4j server running the database without
>> using the REST API or the Remote Server.?
>>
>> Something like :
>>
>> GraphDatabaseService graphDb = new EmbeddedGraphDatabase("localhost:7474/");
>>
>>
>> Thanks,
>> A.
>>
>> ___
>> 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 server - java

2011-06-17 Thread Chris Gioran
Hi Antriani,

no, besides the two ways you mention, such functionality is not
currently available, with a question mark over the HA way, depending
on your use case.

I assume what you need is to program against a remotely running
instance of Neo4j through the same Java API, kind of like what is
feasible through JDBC drivers for relational stores.
The brand new Cypher query language is a step in this direction,
providing a way to serialize 'job descriptions" that can lead to a
binary protocol and finally a driver that will provide what you ask
for.

However, the REST API is currently the proper way to talk to a Neo4j
server, recently improved by batch functionality.

Does your use case have a particular reason for which the REST
interface is not sufficient?

cheers,
CG

On Fri, Jun 17, 2011 at 7:00 PM, Antriani Stylianou
 wrote:
> Hi,
>
> A startup question here!
> Can I connect from java to a neo4j server running the database without
> using the REST API or the Remote Server.?
>
> Something like :
>
> GraphDatabaseService graphDb = new EmbeddedGraphDatabase("localhost:7474/");
>
>
> Thanks,
> A.
>
> ___
> 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] Blueprints implementation for Neo4J server/ REST?

2011-06-17 Thread Eelco Hillenius
>> while REST is not a very performant way to access any low level API
>> directly, there is a Java Wrapper for the Neo4j API over REST from Michael
>> Hunger https://github.com/jexp/neo4j-java-rest-binding that does the Neo4j
>> API over REST.

Gave this a try. Works great! Thanks for that contribution. Maybe
something that might be part of the core project some day?

>> This could be a drop-in replacement for the embedded Neo4j implementation in
>> Blueprints, but I haven't check that out. Would be great if you wanna take a
>> look?

I decided to rewrite to use Neo4J's native APIs, so it's not really a
use case I'm interested in anymore. Sorry :-)

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


Re: [Neo4j] Neo4J server - java

2011-06-17 Thread Charles Bedon
Hello   More info:   
http://www.mail-archive.com/user@lists.neo4j.org/msg08629.html However, by 
definition, an embedded db is just a file. 
-Charles Edward Bedón CortázarITIL 
Foundation CertifiedOpen Source Network Inventory for the masses!  
http://kuwaiba.sourceforge.net | Follow Kuwaiba on TwitterLinux Registered User 
#38  Am Fri, 17 Jun 2011 11:20:03 -0500 McKinley 
 schrieb   This should help 
http://docs.neo4j.org/chunked/1.4-SNAPSHOT/server-embedded.html Cheers, 
McKinley On Fri, Jun 17, 2011 at 9:00 AM, Antriani Stylianou 
wrote: > Hi, > > A startup question here! 
> Can I connect from java to a neo4j server running the database without 
> using the REST API or the Remote Server.? > > Something like : > 
> GraphDatabaseService graphDb = new > 
EmbeddedGraphDatabase("localhost:7474/"); > > > Thanks, > A. > 
> ___ > 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 server - java

2011-06-17 Thread McKinley
This should help

http://docs.neo4j.org/chunked/1.4-SNAPSHOT/server-embedded.html

Cheers,

McKinley

On Fri, Jun 17, 2011 at 9:00 AM, Antriani Stylianou wrote:

> Hi,
>
> A startup question here!
> Can I connect from java to a neo4j server running the database without
> using the REST API or the Remote Server.?
>
> Something like :
>
> GraphDatabaseService graphDb = new
> EmbeddedGraphDatabase("localhost:7474/");
>
>
> Thanks,
> A.
>
> ___
> 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] Neo4J server - java

2011-06-17 Thread Antriani Stylianou
Hi,

A startup question here!
Can I connect from java to a neo4j server running the database without 
using the REST API or the Remote Server.?

Something like :

GraphDatabaseService graphDb = new EmbeddedGraphDatabase("localhost:7474/");


Thanks,
A.

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


Re: [Neo4j] User Digest, Vol 51, Issue 110

2011-06-17 Thread Peter Neubauer
Aniceto,
introducing real Node and Relationship links as fields on Nodes and
relationships would essentially blur the distinction between Nodes,
Properties and Relationships, and let you treat the graph as a
Hypergraph. We find that model too abstract and hard to deal with the
edge cases of these structures in real world scenarios.

Instead, would it be possible for you to store NodeIDs in properties
instead, or serialise Node[] into byte arrays as properties? I don't
recommend it since it duplicates and unlinks information in the graph
that has to be maintained by triggers and updates, but that would be
one possibility. What is the concrete usecase that drives you to these
constructs?

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.



2011/6/17 Aniceto Pérez y Madrid :
> I agree,a Node is something that has 2 (user managed) fields:
> Relationship[]
> Property[]
>
> and a Relationship is something that has 2 (user managed) fields:
> Node[2]
> Property[]
>
> and currently Property has two fields
> String key
> Object value
>
> where Object can be a scalar or array of basic types: String, int, long, 
> boolean, ...
>
> My proposal is Node, Node[], Relationship and Relationsip[] be also valid 
> values for properties.
>
> Aniceto
>
>> Date: Fri, 17 Jun 2011 05:24:19 -0700
>> From: Rick Bullotta r
>> ick.bullo...@thingworx.com>Subject: Re: [Neo4j] Node[] or Relationship[] as 
>> properties
>> To: Neo4j user discussions user@lis
>> ts.neo4j.org>Message-ID:
>> 09DF3402C845EC489A3323A06208F
>> 20d0a9d4...@p3pw5ex1mb14.ex1.secureserver.net>
>> Content-Type: text/plain; charset="us-ascii"
>>
>> I think some further understanding of Neo4J and graph databases would
>> help:
>> Node == precisely what a single relationship from a node accomplishes
>> Node[] == precisely what multiple relationships from a node
>> accomplishes
>>
>>
>> -Original Message-
>> From: user-boun...@lists.neo4j.org [
>> user-boun...@lists.neo4j.org] On Behalf Of Aniceto PerezSent: Friday, June 
>> 17, 2011 8:19 AM
>> To: user@lis
>> ts.neo4j.orgSubject: [Neo4j] Node[] or Relationship[] as properties
>>
>> I think it could be very useful to add these types as possible property
>> values
>>
>> Node or Node[]
>> Relationship or Relationship[]
>>
>> This is useful to implement more complex graphs. For instance, security
>> roles:
>>
>> I can define a security role as a node and users nodes can HAVE a
>> relationship to that role.
>>
>> The use case is when that role is related to something, for instance a
>> project. Let's have there are 4 standard roles for each project, and
>> 1000 projects. Currently I would need 4000 effective roles to be related
>> to users or only 4 roles but relationships between users and roles have
>> a property with the project that relationship is related to. The 4000
>> roles solution is bad for management: every time a role is modified 1000
>> modifications must be done. The projectname-as-a-property solution
>> doesn't enable easy navigation.
>>
>> A more elegant solution is to add a property to the user-->role
>> relationship: the related to project node.
>>
>> If Node is allowed, better if Node[] are allowed too. And maybe there
>> are also use cases for Relationship and Relationship[] as property
>> value.
>> Aniceto
>>
>
>
> ___
> 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] User Digest, Vol 51, Issue 110

2011-06-17 Thread Aniceto Pérez y Madrid
I agree,a Node is something that has 2 (user managed) fields:
Relationship[]
Property[]

and a Relationship is something that has 2 (user managed) fields:
Node[2]
Property[]

and currently Property has two fields
String key
Object value

where Object can be a scalar or array of basic types: String, int, long, 
boolean, ...

My proposal is Node, Node[], Relationship and Relationsip[] be also valid 
values for properties.

Aniceto

> Date: Fri, 17 Jun 2011 05:24:19 -0700
> From: Rick Bullotta r
> ick.bullo...@thingworx.com>Subject: Re: [Neo4j] Node[] or Relationship[] as 
> properties
> To: Neo4j user discussions user@lis
> ts.neo4j.org>Message-ID:
> 09DF3402C845EC489A3323A06208F
> 20d0a9d4...@p3pw5ex1mb14.ex1.secureserver.net>
> Content-Type: text/plain; charset="us-ascii"
> 
> I think some further understanding of Neo4J and graph databases would
> help:
> Node == precisely what a single relationship from a node accomplishes
> Node[] == precisely what multiple relationships from a node
> accomplishes
> 
> 
> -Original Message-
> From: user-boun...@lists.neo4j.org [
> user-boun...@lists.neo4j.org] On Behalf Of Aniceto PerezSent: Friday, June 
> 17, 2011 8:19 AM
> To: user@lis
> ts.neo4j.orgSubject: [Neo4j] Node[] or Relationship[] as properties
> 
> I think it could be very useful to add these types as possible property
> values
> 
> Node or Node[]
> Relationship or Relationship[]
> 
> This is useful to implement more complex graphs. For instance, security
> roles:
> 
> I can define a security role as a node and users nodes can HAVE a 
> relationship to that role.
> 
> The use case is when that role is related to something, for instance a 
> project. Let's have there are 4 standard roles for each project, and 
> 1000 projects. Currently I would need 4000 effective roles to be related
> to users or only 4 roles but relationships between users and roles have
> a property with the project that relationship is related to. The 4000 
> roles solution is bad for management: every time a role is modified 1000
> modifications must be done. The projectname-as-a-property solution 
> doesn't enable easy navigation.
> 
> A more elegant solution is to add a property to the user-->role 
> relationship: the related to project node.
> 
> If Node is allowed, better if Node[] are allowed too. And maybe there 
> are also use cases for Relationship and Relationship[] as property
> value.
> Aniceto
> 


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


Re: [Neo4j] Find 2nd degree friends in order of mutual friend

2011-06-17 Thread fajarmf
Thank you for the code, I will use it as starting point of learning gremlin.

Sent from my BlackBerry® smartphone from Sinyal Bagus XL, Nyambung Teruuusss...!

-Original Message-
From: Marko Rodriguez 
Sender: user-boun...@lists.neo4j.org
Date: Fri, 17 Jun 2011 07:31:26 
To: Neo4j user discussions
Reply-To: Neo4j user discussions 
Subject: Re: [Neo4j] Find 2nd degree friends in order of mutual friend

Hi,

In Gremlin (http://gremlin.tinkerpop.com), friends of a friend (FOAF) who are 
not my friends:

x = [] as Set
g.v(1).out('friend').aggregate(x).out('friend').except(x)

- x is a Set to save intermediate friend vertices to to exclude (except) from 
the final step.
- g is your graph (e.g. g = new Neo4jGraph('/tmp/graph'))
- g.v(1) will grab vertex 1 by its id

If you give me some particular things you want to say, I can provide you the 
Gremlin code to do it.

Thanks,
Marko.

http://markorodriguez.com

On Jun 17, 2011, at 7:08 AM, faja...@gmail.com wrote:

> Oh thank you,
> 
> As I mentioned, I am new to neo4j. So a little sample code would be very 
> useful in my learning process. :)
> 
> My current state is that I managed to add few nodes, and add friend 
> relationship between several nodes.
> 
> User - friend - other node.
> 
> Friend is relationship
> 
> I don't have a very big node number so I think your suggested approach will 
> work.
> 
> Fajar
> 
> Sent from my BlackBerry® smartphone from Sinyal Bagus XL, Nyambung 
> Teruuusss...!
> 
> -Original Message-
> From: Peter Neubauer 
> Sender: user-boun...@lists.neo4j.org
> Date: Fri, 17 Jun 2011 14:12:48 
> To: Neo4j user discussions
> Reply-To: Neo4j user discussions 
> Subject: Re: [Neo4j] Find 2nd degree friends in order of mutual friend
> 
> Hi Fajar,
> this is a depth 2 traversal from the person in question. While
> exhaustively traversing his friends, you increase the group count as
> for each FOAF you get on the second step.
> 
> However, we have seen edge cases with supernodes where in a social
> network, persons can have 50K friends. There, you might use heuristics
> or indexing approaches to make this very fast.
> 
> If you have some more details, I could write down the query in Gremlin
> or Cypher (http://docs.neo4j.org/chunked/snapshot/cypher-query-lang.html),
> but in principle, it would be like
> https://github.com/tinkerpop/gremlin/wiki (actually using 3 steps, I
> think we could get it down to 2) for Gremlin.
> 
> In neo4j, if things are not cached, only the parts the data that are
> needed for this traversal wil be loaded from disk, so you don't need
> to hold all the graph in cache for this, since it is a data-local
> operation.
> 
> HTH
> 
> 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 Fri, Jun 17, 2011 at 1:33 PM, Fajar Maulana Firdaus
>  wrote:
>> Hi all,
>> 
>> I am new to neo4j and excited to know more about graph database.
>> 
>> First of all, could anyone please help me to figure out the documentation
>> about the query or rest client?
>> 
>> Then, back to my question, I want to find 2nd degree friends but ordered by
>> number of mutual friend. I understand that if I have all data in memory, I
>> could've traverse the graph to 2nd level, and keep counter for each nodes in
>> 2nd level. So in away its like finding all paths from start node to all
>> second degree friend, but if we do that, it would be inefficient.
>> 
>> Does anyone have any idea how to do this with neo4j?
>> 
>> Thank you,
>> Fajarmf
>>___
>> 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
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Find 2nd degree friends in order of mutual friend

2011-06-17 Thread Marko Rodriguez
Hi,

In Gremlin (http://gremlin.tinkerpop.com), friends of a friend (FOAF) who are 
not my friends:

x = [] as Set
g.v(1).out('friend').aggregate(x).out('friend').except(x)

- x is a Set to save intermediate friend vertices to to exclude (except) from 
the final step.
- g is your graph (e.g. g = new Neo4jGraph('/tmp/graph'))
- g.v(1) will grab vertex 1 by its id

If you give me some particular things you want to say, I can provide you the 
Gremlin code to do it.

Thanks,
Marko.

http://markorodriguez.com

On Jun 17, 2011, at 7:08 AM, faja...@gmail.com wrote:

> Oh thank you,
> 
> As I mentioned, I am new to neo4j. So a little sample code would be very 
> useful in my learning process. :)
> 
> My current state is that I managed to add few nodes, and add friend 
> relationship between several nodes.
> 
> User - friend - other node.
> 
> Friend is relationship
> 
> I don't have a very big node number so I think your suggested approach will 
> work.
> 
> Fajar
> 
> Sent from my BlackBerry® smartphone from Sinyal Bagus XL, Nyambung 
> Teruuusss...!
> 
> -Original Message-
> From: Peter Neubauer 
> Sender: user-boun...@lists.neo4j.org
> Date: Fri, 17 Jun 2011 14:12:48 
> To: Neo4j user discussions
> Reply-To: Neo4j user discussions 
> Subject: Re: [Neo4j] Find 2nd degree friends in order of mutual friend
> 
> Hi Fajar,
> this is a depth 2 traversal from the person in question. While
> exhaustively traversing his friends, you increase the group count as
> for each FOAF you get on the second step.
> 
> However, we have seen edge cases with supernodes where in a social
> network, persons can have 50K friends. There, you might use heuristics
> or indexing approaches to make this very fast.
> 
> If you have some more details, I could write down the query in Gremlin
> or Cypher (http://docs.neo4j.org/chunked/snapshot/cypher-query-lang.html),
> but in principle, it would be like
> https://github.com/tinkerpop/gremlin/wiki (actually using 3 steps, I
> think we could get it down to 2) for Gremlin.
> 
> In neo4j, if things are not cached, only the parts the data that are
> needed for this traversal wil be loaded from disk, so you don't need
> to hold all the graph in cache for this, since it is a data-local
> operation.
> 
> HTH
> 
> 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 Fri, Jun 17, 2011 at 1:33 PM, Fajar Maulana Firdaus
>  wrote:
>> Hi all,
>> 
>> I am new to neo4j and excited to know more about graph database.
>> 
>> First of all, could anyone please help me to figure out the documentation
>> about the query or rest client?
>> 
>> Then, back to my question, I want to find 2nd degree friends but ordered by
>> number of mutual friend. I understand that if I have all data in memory, I
>> could've traverse the graph to 2nd level, and keep counter for each nodes in
>> 2nd level. So in away its like finding all paths from start node to all
>> second degree friend, but if we do that, it would be inefficient.
>> 
>> Does anyone have any idea how to do this with neo4j?
>> 
>> Thank you,
>> Fajarmf
>> ___
>> 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] Change in behavior for QueryContext with Index ?

2011-06-17 Thread Kalin Wilson Development
Thanks Mattias, I'll use the 1.4M04 jars and try my code again. If I get the 
NPE, I'll post my code.

On Jun 17, 2011, at 1:57 AM, Mattias Persson wrote:

> I cannot reproduce this. I'm trying it with this code:
> 
>   // I also tried with FULLTEXT_CONFIG
>   Index index = graphDb.index().forNodes( "qc",
> LuceneIndexImplementation.EXACT_CONFIG );
>   Node node = graphDb.createNode();
>   index.add( node, "key", "value" );
>   index.query( new QueryContext( "key:value AND key:value" ) );
>   index.query( new QueryContext( "key:value key:value"
> ).defaultOperator( Operator.AND ) );
>   restartTx();
>   index.query( new QueryContext( "key:value AND key:value" ) );
>   index.query( new QueryContext( "key:value key:value"
> ).defaultOperator( Operator.AND ) );
> 
> it doesn't throw any NPE.
> 
> 2011/6/17 Mattias Persson 
> 
>> Hi Kalin,
>> 
>> I'll have a look at it right now
>> 
>> 
>> 2011/6/17 Kalin Wilson Development 
>> 
>>> Perhaps this is fixed in the latest milestone release, I haven't had a
>>> chance to test it yet. I upgraded from 1.3M03 to 1.4M03 and found that my
>>> code that queried node indexes using a QueryContext was throwing a NPE. In
>>> my code I constructed a string similar to "eclass:org.spp.data.Something AND
>>> eid:101" and constructed the QueryContext from that. The QueryContext object
>>> was then passed to an index.query() method.
>>> 
>>> Once I found that the NPE was being thrown by index.query(QueryContext), I
>>> put together a simple test that created and indexed a Node then queried the
>>> index using a QueryContext using various constructs, QueryContext("key:value
>>> key:value).defaultOperator(Operator.AND) and QueryContext("key:value AND
>>> key:value"). Passing either version of these objects to index.query() throws
>>> a NPE, however calling index.query("key:value AND key:value") works and
>>> calling index.query(qc.getQueryOrQueryObject()) works (at least when the
>>> full string with operators is used to build the QC).
>>> 
>>> Has there been a change in how or when to use a QueryContext? Perhaps I'm
>>> using it incorrectly now.
>>> 
>>> Thanks,
>>> Kalin
>>> 
>>> ___
>>> 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
>> 
> 
> 
> 
> -- 
> 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
> 

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


Re: [Neo4j] Find 2nd degree friends in order of mutual friend

2011-06-17 Thread fajarmf
Oh thank you,

As I mentioned, I am new to neo4j. So a little sample code would be very useful 
in my learning process. :)

My current state is that I managed to add few nodes, and add friend 
relationship between several nodes.

User - friend - other node.

Friend is relationship

I don't have a very big node number so I think your suggested approach will 
work.

Fajar

Sent from my BlackBerry® smartphone from Sinyal Bagus XL, Nyambung Teruuusss...!

-Original Message-
From: Peter Neubauer 
Sender: user-boun...@lists.neo4j.org
Date: Fri, 17 Jun 2011 14:12:48 
To: Neo4j user discussions
Reply-To: Neo4j user discussions 
Subject: Re: [Neo4j] Find 2nd degree friends in order of mutual friend

Hi Fajar,
this is a depth 2 traversal from the person in question. While
exhaustively traversing his friends, you increase the group count as
for each FOAF you get on the second step.

However, we have seen edge cases with supernodes where in a social
network, persons can have 50K friends. There, you might use heuristics
or indexing approaches to make this very fast.

If you have some more details, I could write down the query in Gremlin
or Cypher (http://docs.neo4j.org/chunked/snapshot/cypher-query-lang.html),
but in principle, it would be like
https://github.com/tinkerpop/gremlin/wiki (actually using 3 steps, I
think we could get it down to 2) for Gremlin.

In neo4j, if things are not cached, only the parts the data that are
needed for this traversal wil be loaded from disk, so you don't need
to hold all the graph in cache for this, since it is a data-local
operation.

HTH

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 Fri, Jun 17, 2011 at 1:33 PM, Fajar Maulana Firdaus
 wrote:
> Hi all,
>
> I am new to neo4j and excited to know more about graph database.
>
> First of all, could anyone please help me to figure out the documentation
> about the query or rest client?
>
> Then, back to my question, I want to find 2nd degree friends but ordered by
> number of mutual friend. I understand that if I have all data in memory, I
> could've traverse the graph to 2nd level, and keep counter for each nodes in
> 2nd level. So in away its like finding all paths from start node to all
> second degree friend, but if we do that, it would be inefficient.
>
> Does anyone have any idea how to do this with neo4j?
>
> Thank you,
> Fajarmf
>___
> 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] Parallelism

2011-06-17 Thread Chris Gioran
Hi,

Keep in mind that Neo4j is a fully ACID database. As such, it is safe
to use in the same manner as any other ACID database, since it makes
use of locking over primitives, deadlock detection, isolation between
transactions etc. Having said that:

Yes, the API Neo4j exposes is suitable for manipulation by
concurrently running threads.
Each thread will run in its own transaction - the XA standard that
Neo4j implements enforces a 1-1 correspondence between transaction
context and thread.
Yes, the API is thread safe. Of course, objects that maintain state,
such as Iterators, are still not safe to publish outside the thread.

The advantage of having multiple threads is dependent on your use case.
If you have lots of I/O blocking operations, read-only threads that
work with the memory resident set will progress faster.
Or if you have multiple cores to dedicate, it probably makes sense to
have one thread per such.
Or simply if you want the transaction isolation offered by working in
discreet threads such as when serving client requests.
Or whatever other scenario you might have where multiple threads make sense.

For example, building a web site over Neo4j is a good use case for
having multiple threads, one per request. Creating a bulk data import
tool on the other hand is not a good case to apply parallelism - since
it will be constantly writing to disk, a single thread is fast enough,
adding more does not increase throughput.

The reasoning behind multithreaded access to Neo4j is pretty much the
same as for any other use case. Whatever you choose however is well
supported.

cheers,
CG

On Fri, Jun 17, 2011 at 3:23 PM, Norbert Tausch  wrote:
> Hi,
>
> is it possible to traverse on a Neo4J graph DB using the Java API in
> parallel threads? Is this possible within one transaction or does every
> thread has to use its own transaction? Is the API thread-safe concerning
> read-only access?
> Is there any advantage of concerning parallelism when using Neo4j as an
> embedded DB?
>
> Best regards
>
> ___
> 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] Spring Data Graph 1.1.0.M1 milestone released

2011-06-17 Thread Alfredas Chmieliauskas
Thanks a lot.

On Thu, Jun 16, 2011 at 3:20 PM, Michael Hunger
 wrote:
> You could just use the direct repository factory for that.
>
> directGraphRepositoryFactory.createGraphRepository(clazz).findAll()
>
>
> normally you would have a
>
> interface PersonRepository extends GraphRepository {}
>

yep. that looks like a good solution. My use case is a bit "special" -
ie I have a a lot of classes and having repos for each would be a
waste. But again that's because we're using this technology in a weird
way (>20 domain classes)

On the other hand - graph db is probably the best option for us, as
having 20 tables instead would make it a nightmare. So in a way it
really supports the case for neo4j, although such application is
really a niche one.

> and get this injected.
>
> @Autowired PersonRepository personRepository;
>
> personRepository.findAll();
>
> Cheers
>
> Michael
>
> Today I discussed some nice derived-method for cypher queries.
> See: 
> https://github.com/SpringSource/spring-data-graph/wiki/Repository-query-methods
>
>
> Am 16.06.2011 um 14:30 schrieb Alfredas Chmieliauskas:
>
>> Dear Michael,
>>
>> sounds great! Especially the annotated repository methods. That was
>> something *really* desirable and now its there. Fantastischt!
>>
>> One question though. Before the upgrade i used to have a handy method
>> to find all things of a type (Class) by using a method like
>>
>> public  Iterable findAll(Class clazz) {
>>   finderFactory.createNodeEntityFinder(clazz).findAll();
>> }
>>
>> is there a good way to replicate such functionality in the current release?
>>
>> Alfredas
>>
>> P.S. we're delayed with publishing our energy simulations (bureaucracy
>> problems more than technical or conceptual). but i'm still determined
>> to make it happen (publish the thing online) before summer end.
>>
>> On Wed, Jun 15, 2011 at 10:17 AM, Michael Hunger
>>  wrote:
>>> Dear Graphistas,
>>>
>>> After some quiet time that I spend on other important issues, we're back on 
>>> our regular release cycle/rhythm.
>>>
>>> We discussed the future SDG roadmap with our CEO Emil and decided to work 
>>> first on the issues that were
>>> reported by our users here on the mailing list, on the spring forums and on 
>>> twitter.
>>>
>>> So primarily we updated the dependencies to Neo4j 1.4.M04 and AspectJ 
>>> (1.6.12.M1), the latter fixing some issues.
>>>
>>> With the new Neo4j release we are also able to start working some important 
>>> new features.
>>>
>>> The most interesting one is the adoption of the query language "cypher" 
>>> which is now accessible from NodeEntities (dynamic annotated fields, 
>>> introduced methods) and repositories (annotated repository interface 
>>> methods).
>>> (https://jira.springsource.org/browse/DATAGRAPH-91)
>>>
>>> Example, NodeEntity-field:
>>>
>>> @GraphQuery("start me=(%d) match 
>>> (me)-[:works_at]->(company)<-[:works_at]-(colleague) return colleague")
>>> Iterable colleagues;
>>>
>>> Example, Repository:
>>>
>>> interface PersonRepository extends GraphRepository {
>>>   @GraphQuery("start person=(%d) match (person)-[:boss]->(boss) return 
>>> boss")
>>>   Person findBoss(Person developer);
>>> }
>>>
>>> We also accommodate for the change of allowing self-relationships.
>>>
>>> Another annoyance for SDG users - the need to specify an elementClass on 
>>> @RelatedTo annotations has also been removed this change will also be added 
>>> to the other annotations that we use.
>>>
>>> We would like to get your feedback on those changes and also on Spring Data 
>>> Graph in general, so please check it out and get back to us.
>>>
>>> And please spread the word: 
>>> http://twitter.com/#!/neo4j/statuses/80503228319547392
>>>
>>> Cheers
>>>
>>> Michael
>>>
>>> Announcement: http://www.springsource.org/node/3152
>>> JIRA: https://jira.springsource.org/browse/DATAGRAPH
>>> Project Page: http://www.springsource.org/spring-data/neo4j
>>> Forum: forum.springsource.org/forumdisplay.php?f=80
>>>
>>> Github: http://github.com/springsource/spring-data-graph
>>> Download: 
>>> http://www.springsource.com/download/community?project=Spring%20Data%20Neo4j
>>>
>>>
>>>
>>>
>>>
>>>
>>> ___
>>> 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] Parallelism

2011-06-17 Thread Johan Svensson
Hi,

That is possible (and even recommended). The Java API is thread safe
(with the exception of batch inserter) both for reads and writes.

Each thread may use its own transaction but it is not required to have
a transaction when performing read operations (only for writes).
Reading is lock free and will always read the last committed value. A
multi core CPU is required to let the threads execute in parallel with
the advantage of scaling reads with the available number of cores.

It is not possible to have a transaction associated with more than one
thread at a time (but you can suspend a transaction and resume it in
another thread if needed).

Regards,
Johan

On Fri, Jun 17, 2011 at 2:23 PM, Norbert Tausch  wrote:
> Hi,
>
> is it possible to traverse on a Neo4J graph DB using the Java API in
> parallel threads? Is this possible within one transaction or does every
> thread has to use its own transaction? Is the API thread-safe concerning
> read-only access?
> Is there any advantage of concerning parallelism when using Neo4j as an
> embedded DB?
>
> Best regards
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] all values of a key-object pair

2011-06-17 Thread Niels Hoogeveen

Thanks Rick, I will try out this code. For my use case, I don't mind the lack 
of transactional state, though I can imagine there to be use cases where having 
access to transactional state is requred. It would be nice if this somehow 
would become part of the standard Neo4j API. Niels
 > From: rick.bullo...@thingworx.com
> To: user@lists.neo4j.org
> Date: Fri, 17 Jun 2011 05:34:05 -0700
> Subject: Re: [Neo4j] all values of a key-object pair
> 
> Hi, Niels.
> 
> Mattias just responded yesterday to me on a similar question.  See below:
> 
> Rick
> ==
> Hi Rick,
> 
> you could probably get the keys from the IndexReader, like so:
> 
> // I'm in LuceneIndex now
> public Iterable getKeys()
> {
> IndexSearcherRef searcher = service.dataSource().getIndexSearcher(
> identifier, true );
> try
> {
> IndexReader reader = searcher.getSearcher().getIndexReader();
> Collection fieldNames = reader.getFieldNames( 
> FieldOption.ALL );
> 
> // Make a copy since we don't know if the result is final or not
> Collection result = new ArrayList( fieldNames );
> result.remove( KEY_DOC_ID );
> result.remove( KEY_START_NODE_ID );
> result.remove( KEY_END_NODE_ID );
> return result;
> }
> finally
> {
> searcher.closeStrict();
> }
> }
> 
> This is a perhaps bit crude implementation and will only work on committed 
> stuff, not any transactional state. This is a start at least.
> 
> public Iterable getValues( String key )
> {
> IndexSearcherRef searcher = service.dataSource().getIndexSearcher(
> identifier, true );
> try
> {
> IndexReader reader = searcher.getSearcher().getIndexReader();
> Collection result = new ArrayList();
> TermEnum terms = reader.terms( new Term( key ) );
> do
> {
> result.add( terms.term().text() );
> }
> while ( terms.next() );
> return result;
> }
> catch ( IOException e )
> {
> throw new RuntimeException( e );
> }
> finally
> {
> searcher.closeStrict();
> }
> }
> 
> Suffers from the same problem of transactional state and also doesn't 
> consider that values could be other types, f.ex. integers where the string is 
> a weird encoding of such a value.
> 
> 
> -Original Message-
> From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On 
> Behalf Of Niels Hoogeveen
> Sent: Friday, June 17, 2011 8:30 AM
> To: user@lists.neo4j.org
> Subject: [Neo4j] all values of a key-object pair
> 
> 
> 
> 
> 
> I have run into the situation where I want to add key value pairs to the 
> Lucene index, where I have no need to store the value in a property, but I 
> would like to know which values are stored in the Lucene index for a given 
> key-object pair.  Use case: Loading Dbpedia in Neo4J, I load all entities and 
> all redirects. Every entity has a unique URL, as does every redirect. URL's 
> are stored in Lucene to look up the node that corresponds to an entity. I 
> have no need to store redirects, neither as node nor as a String array 
> property (one entity can have more than one redirect), instead I want to 
> store the redirect URL in the Lucene index, pointing to the associated entity 
> node. In certain cases, however, I would like to know the redirect URL's 
> associated with a certain entity. So I would like to be able to retrieve the 
> values stored in the Lucene index for a given key-object pair. Is this 
> possible? If not with the current setup, would it be possible to add such 
> functionality? Kind 
 re
>  gards,Niels Hoogeveen  
> ___
> 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] all values of a key-object pair

2011-06-17 Thread Rick Bullotta
Hi, Niels.

Mattias just responded yesterday to me on a similar question.  See below:

Rick
==
Hi Rick,

you could probably get the keys from the IndexReader, like so:

// I'm in LuceneIndex now
public Iterable getKeys()
{
IndexSearcherRef searcher = service.dataSource().getIndexSearcher(
identifier, true );
try
{
IndexReader reader = searcher.getSearcher().getIndexReader();
Collection fieldNames = reader.getFieldNames( 
FieldOption.ALL );

// Make a copy since we don't know if the result is final or not
Collection result = new ArrayList( fieldNames );
result.remove( KEY_DOC_ID );
result.remove( KEY_START_NODE_ID );
result.remove( KEY_END_NODE_ID );
return result;
}
finally
{
searcher.closeStrict();
}
}

This is a perhaps bit crude implementation and will only work on committed 
stuff, not any transactional state. This is a start at least.

public Iterable getValues( String key )
{
IndexSearcherRef searcher = service.dataSource().getIndexSearcher(
identifier, true );
try
{
IndexReader reader = searcher.getSearcher().getIndexReader();
Collection result = new ArrayList();
TermEnum terms = reader.terms( new Term( key ) );
do
{
result.add( terms.term().text() );
}
while ( terms.next() );
return result;
}
catch ( IOException e )
{
throw new RuntimeException( e );
}
finally
{
searcher.closeStrict();
}
}

Suffers from the same problem of transactional state and also doesn't consider 
that values could be other types, f.ex. integers where the string is a weird 
encoding of such a value.


-Original Message-
From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On 
Behalf Of Niels Hoogeveen
Sent: Friday, June 17, 2011 8:30 AM
To: user@lists.neo4j.org
Subject: [Neo4j] all values of a key-object pair





I have run into the situation where I want to add key value pairs to the Lucene 
index, where I have no need to store the value in a property, but I would like 
to know which values are stored in the Lucene index for a given key-object 
pair.  Use case: Loading Dbpedia in Neo4J, I load all entities and all 
redirects. Every entity has a unique URL, as does every redirect. URL's are 
stored in Lucene to look up the node that corresponds to an entity. I have no 
need to store redirects, neither as node nor as a String array property (one 
entity can have more than one redirect), instead I want to store the redirect 
URL in the Lucene index, pointing to the associated entity node. In certain 
cases, however, I would like to know the redirect URL's associated with a 
certain entity. So I would like to be able to retrieve the values stored in the 
Lucene index for a given key-object pair. Is this possible? If not with the 
current setup, would it be possible to add such functionality? Kind re
 gards,Niels Hoogeveen
___
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] all values of a key-object pair

2011-06-17 Thread Niels Hoogeveen




I have run into the situation where I want to add key value pairs to the Lucene 
index, where I have no need to store the value in a property, but I would like 
to know which values are stored in the Lucene index for a given key-object 
pair.  Use case: Loading Dbpedia in Neo4J, I load all entities and all 
redirects. Every entity has a unique URL, as does every redirect. URL's are 
stored in Lucene to look up the node that corresponds to an entity. I have no 
need to store redirects, neither as node nor as a String array property (one 
entity can have more than one redirect), instead I want to store the redirect 
URL in the Lucene index, pointing to the associated entity node. In certain 
cases, however, I would like to know the redirect URL's associated with a 
certain entity. So I would like to be able to retrieve the values stored in the 
Lucene index for a given key-object pair. Is this possible? If not with the 
current setup, would it be possible to add such functionality? Kind re
 gards,Niels Hoogeveen
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] Parallelism

2011-06-17 Thread Norbert Tausch
Hi,

is it possible to traverse on a Neo4J graph DB using the Java API in
parallel threads? Is this possible within one transaction or does every
thread has to use its own transaction? Is the API thread-safe concerning
read-only access?
Is there any advantage of concerning parallelism when using Neo4j as an
embedded DB?

Best regards

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


Re: [Neo4j] Node[] or Relationship[] as properties

2011-06-17 Thread Rick Bullotta
I think some further understanding of Neo4J and graph databases would help:

Node == precisely what a single relationship from a node accomplishes
Node[] == precisely what multiple relationships from a node accomplishes



-Original Message-
From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On 
Behalf Of Aniceto Perez
Sent: Friday, June 17, 2011 8:19 AM
To: user@lists.neo4j.org
Subject: [Neo4j] Node[] or Relationship[] as properties

I think it could be very useful to add these types as possible property 
values

  Node or Node[]
  Relationship or Relationship[]

This is useful to implement more complex graphs. For instance, security 
roles:

I can define a security role as a node and users nodes can HAVE a 
relationship to that role.

The use case is when that role is related to something, for instance a 
project. Let's have there are 4 standard roles for each project, and 
1000 projects. Currently I would need 4000 effective roles to be related 
to users or only 4 roles but relationships between users and roles have 
a property with the project that relationship is related to. The 4000 
roles solution is bad for management: every time a role is modified 1000 
modifications must be done. The projectname-as-a-property solution 
doesn't enable easy navigation.

A more elegant solution is to add a property to the user-->role 
relationship: the related to project node.

If Node is allowed, better if Node[] are allowed too. And maybe there 
are also use cases for Relationship and Relationship[] as property value.

Aniceto

___
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] Node[] or Relationship[] as properties

2011-06-17 Thread Aniceto Perez
I think it could be very useful to add these types as possible property 
values

  Node or Node[]
  Relationship or Relationship[]

This is useful to implement more complex graphs. For instance, security 
roles:

I can define a security role as a node and users nodes can HAVE a 
relationship to that role.

The use case is when that role is related to something, for instance a 
project. Let's have there are 4 standard roles for each project, and 
1000 projects. Currently I would need 4000 effective roles to be related 
to users or only 4 roles but relationships between users and roles have 
a property with the project that relationship is related to. The 4000 
roles solution is bad for management: every time a role is modified 1000 
modifications must be done. The projectname-as-a-property solution 
doesn't enable easy navigation.

A more elegant solution is to add a property to the user-->role 
relationship: the related to project node.

If Node is allowed, better if Node[] are allowed too. And maybe there 
are also use cases for Relationship and Relationship[] as property value.

Aniceto

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


Re: [Neo4j] storing long values overflow

2011-06-17 Thread Niels Hoogeveen

Hi Mattias, You're welcome. It actually helped me gain insight in the workings 
of the in-graph Timeline component, since that started to behave eratically 
(having later entries appearing as previous entries). It took some time before 
I realized the problem was in kernel and not in Timeline. Altogether a valuable 
excercise. :-)
For now I will stick to M.03, but will test against SNAPSHOT next week. Have 
you updated M.04 as it is available for download? Niels> Date: Fri, 17 Jun 2011 
09:23:03 +0200
> From: matt...@neotechnology.com
> To: user@lists.neo4j.org
> Subject: Re: [Neo4j] storing long values overflow
> 
> Hi Niels,
> 
> this is now fixed. Thanks for the test case.
> 
> 2011/6/17 Mattias Persson 
> 
> > I'm on this one, since I'm assuming I'm the one introducing it. And yes
> > there are some tests around this that I wrote for these changes...
> > apparently now good enough.
> >
> >
> > 2011/6/17 Jim Webber 
> >
> >> Michael,
> >>
> >> No we don't. Do you want to put together a test of {normal, edge positive,
> >> edge negative} case (where applicable) for each type we support in the
> >> kernel tests?
> >>
> >> D'oh.
> >>
> >> Jim
> >>
> >>
> >> On 16 Jun 2011, at 23:14, Michael Hunger wrote:
> >>
> >> > Damn, do we have tests for storing values and retrieving them.
> >> >
> >> > Anfang der weitergeleiteten E-Mail:
> >> >
> >> >> Von: Niels Hoogeveen 
> >> >> Datum: 16. Juni 2011 23:52:50 MESZ
> >> >> An: 
> >> >> Betreff: Re: [Neo4j] storing long values overflow
> >> >> Antwort an: Neo4j user discussions 
> >> >>
> >> >>
> >> >> I just tested the long property overflow behaviour against different
> >> neo4j 1.4 releases and found out it was introduced between M03 and M04.
> >> >> M03 correctly returns -134217729 when storing a property with value
> >> -134217729l.M04 and SNAPSHOT return 134217727 when storing a property with
> >> value -134217729l.
> >> >> Niels
> >> >>
> >> >>> From: pd_aficion...@hotmail.com
> >> >>> To: user@lists.neo4j.org
> >> >>> Date: Thu, 16 Jun 2011 23:21:54 +0200
> >> >>> Subject: Re: [Neo4j] storing long values overflow
> >> >>>
> >> >>>
> >> >>> Thank Marco,
> >> >>> Hope this looks better.
> >> >>> import org.neo4j.kernel.EmbeddedGraphDatabase;import
> >> org.neo4j.graphdb.GraphDatabaseService;
> >> >>> import org.neo4j.graphdb.Transaction;
> >> >>> import org.neo4j.graphdb.Node;
> >> >>>
> >> >>> public class Test2 {
> >> >>>
> >> >>> public static void main(String args[]){
> >> >>>
> >> >>> GraphDatabaseService db = new
> >>  EmbeddedGraphDatabase("var/db");
> >> >>> Transaction tx = db.beginTx();
> >> >>> try{
> >> >>> Node n = db.getReferenceNode();
> >> >>> long l = -134217728l;
> >> >>> n.setProperty("testvalue", l);
> >> >>> System.out.println(n.getProperty("testvalue"));
> >> >>> long l2 = -134217729l;
> >> >>> n.setProperty("testvalue2", l2);
> >> >>> System.out.println(n.getProperty("testvalue2"));
> >> >>> tx.success();
> >> >>> }finally{
> >> >>> tx.finish();
> >> >>> }
> >> >>>
> >> >>> }
> >> >>> }
> >>  From: okramma...@gmail.com
> >>  Date: Thu, 16 Jun 2011 15:06:23 -0600
> >>  To: user@lists.neo4j.org
> >>  Subject: Re: [Neo4j] storing long values overflow
> >> 
> >>  Hi,
> >> 
> >>  Try using:
> >> 
> >> http://paste.pocoo.org/
> >> 
> >>  Great for sending color formatted code snippets.
> >> 
> >>  Marko.
> >> 
> >>  http://markorodriguez.com
> >> 
> >>  On Jun 16, 2011, at 2:48 PM, Niels Hoogeveen wrote:
> >> 
> >> >
> >> > Don't know how to send a properly formatted email.
> >> >
> >> > Anyway, when storing a long value -134217728l in a node property,
> >> retrieving the value of the property is again -134217728.
> >> > When storing a long value -134217729l in a node property, retrieving
> >> the value of that property overflows and 134217727 is returned.
> >> > Kind regards,Niels Hoogeveen
> >> >
> >> >> From: pd_aficion...@hotmail.com
> >> >> To: user@lists.neo4j.org
> >> >> Date: Thu, 16 Jun 2011 22:40:24 +0200
> >> >> Subject: [Neo4j] storing long values overflow
> >> >>
> >> >>
> >> >> Using neo4j 1.4-SNAPSHOT it seems the storage or retrieval of long
> >> values no longer works properly.package com.multispective.snippet;import
> >> org.neo4j.kernel.EmbeddedGraphDatabase;import
> >> org.neo4j.graphdb.GraphDatabaseService;import
> >> org.neo4j.graphdb.Transaction;import org.neo4j.graphdb.Node;public class
> >> Test2 { public static void main(String args[]){
> >> GraphDatabaseService db = new  EmbeddedGraphDatabase("var/db");
> >> Transaction tx = db.beginTx();  try{Node n =
> >> db.getReferenceNode(); long l = -1342177

Re: [Neo4j] Find 2nd degree friends in order of mutual friend

2011-06-17 Thread Peter Neubauer
Hi Fajar,
this is a depth 2 traversal from the person in question. While
exhaustively traversing his friends, you increase the group count as
for each FOAF you get on the second step.

However, we have seen edge cases with supernodes where in a social
network, persons can have 50K friends. There, you might use heuristics
or indexing approaches to make this very fast.

If you have some more details, I could write down the query in Gremlin
or Cypher (http://docs.neo4j.org/chunked/snapshot/cypher-query-lang.html),
but in principle, it would be like
https://github.com/tinkerpop/gremlin/wiki (actually using 3 steps, I
think we could get it down to 2) for Gremlin.

In neo4j, if things are not cached, only the parts the data that are
needed for this traversal wil be loaded from disk, so you don't need
to hold all the graph in cache for this, since it is a data-local
operation.

HTH

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 Fri, Jun 17, 2011 at 1:33 PM, Fajar Maulana Firdaus
 wrote:
> Hi all,
>
> I am new to neo4j and excited to know more about graph database.
>
> First of all, could anyone please help me to figure out the documentation
> about the query or rest client?
>
> Then, back to my question, I want to find 2nd degree friends but ordered by
> number of mutual friend. I understand that if I have all data in memory, I
> could've traverse the graph to 2nd level, and keep counter for each nodes in
> 2nd level. So in away its like finding all paths from start node to all
> second degree friend, but if we do that, it would be inefficient.
>
> Does anyone have any idea how to do this with neo4j?
>
> Thank you,
> Fajarmf
> ___
> 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] Traversals versus Indexing

2011-06-17 Thread Mattias Persson
getNodeById is fast/immediate

2011/6/16 Aseem Kishore 

> Indeed getNodeById().
>
> Aseem
>
> On Thu, Jun 16, 2011 at 10:11 AM, Mattias Persson <
> matt...@neotechnology.com
> > wrote:
>
> > Are you thinking of GraphDatabaseService#getNodeById /
> #getRelationshipById
> > ? Or index lookups?
> >
> > 2011/6/16 Aseem Kishore 
> >
> > > Are lookups by ID also so much slower than traversals?
> > >
> > > Aseem
> > >
> > > On Thu, Jun 16, 2011 at 3:45 AM, Mattias Persson
> > > wrote:
> > >
> > > > I don't know your use case at all, but one of the benefits you get
> with
> > > > traversing compared to index lookups is that one hop from a node to
> > > another
> > > > is instantaneous ( > 1 million hops / second on a fully cached
> graph),
> > > > whereas index lookups are several order of magnitudes slower than
> that.
> > > But
> > > > index lookups are good for when you f.ex. have thousands/millions of
> > > names
> > > > and you'd like to get the node with a certain name. Then that would
> be
> > > your
> > > > starting point for doing a traversal to find other information
> "local"
> > to
> > > > that node, or in its vicinity.
> > > >
> > > > 2011/6/13 Aman 
> > > >
> > > > > What is faster - Traversals or Indexing? I mean if one has a
> database
> > > > model
> > > > > that can offer a choice between the two, what should one choose?
> > > > > Also, what about when the scalability factor comes in?
> > > > > ___
> > > > > 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
> > > >
> > > ___
> > > 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
> >
> ___
> 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


[Neo4j] Find 2nd degree friends in order of mutual friend

2011-06-17 Thread Fajar Maulana Firdaus
Hi all,

I am new to neo4j and excited to know more about graph database.

First of all, could anyone please help me to figure out the documentation
about the query or rest client?

Then, back to my question, I want to find 2nd degree friends but ordered by
number of mutual friend. I understand that if I have all data in memory, I
could've traverse the graph to 2nd level, and keep counter for each nodes in
2nd level. So in away its like finding all paths from start node to all
second degree friend, but if we do that, it would be inefficient.

Does anyone have any idea how to do this with neo4j?

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


Re: [Neo4j] ClosedChannelExceptions in highly concurrent environment

2011-06-17 Thread Johan Svensson
Great. Will merge that patch into trunk as soon as possible.

-Johan

On Thu, Jun 16, 2011 at 10:21 PM, Jennifer Hickey  wrote:
> Hi Johan,
> Sorry for the delay.  I was finally able to try out that patch (against 1.3) 
> on our test environment, and things are running smoothly.  I have not seen 
> the ClosedChannelException (or any others) once in 24 hours.  Previously on 
> the same system I saw it frequently, as early as 15 minutes into the uptime.  
> Thanks!
>
> Jennifer
> 
> From: user-boun...@lists.neo4j.org [user-boun...@lists.neo4j.org] On Behalf 
> Of Johan Svensson [jo...@neotechnology.com]
> Sent: Thursday, May 26, 2011 3:09 AM
> To: Neo4j user discussions
> Subject: Re: [Neo4j] ClosedChannelExceptions in highly concurrent environment
>
> Hi Jennifier,
>
> Could you apply this patch to the kernel and then see if the problem
> still exists? If you want I can send you a jar but then I need to know
> what version of Neo4j you are using.
>
> Regards,
> Johan
>
>
> On Mon, May 23, 2011 at 6:50 PM, Jennifer Hickey  wrote:
>> Hi Tobias,
>>
>> Looks like the environment is still setup, so I should be able to attempt a 
>> repro with a patched version.  Let me know what you would like me to use.
>>
>> Thanks,
>> Jennifer
>> 
>> From: user-boun...@lists.neo4j.org [user-boun...@lists.neo4j.org] On Behalf 
>> Of Tobias Ivarsson [tobias.ivars...@neotechnology.com]
>> Sent: Monday, May 16, 2011 11:01 PM
>> To: Neo4j user discussions
>> Subject: Re: [Neo4j] ClosedChannelExceptions in highly concurrent environment
>>
>> Hi Jennifer,
>>
>> Could you reproduce it on your side by doing the same kind of systems tests
>> again? If you could then I'd be very happy if you could try a patched
>> version that we have been working on and see if that fixes the issue.
>>
>> Cheers,
>> Tobias
>>
>> On Tue, May 17, 2011 at 2:49 AM, Jennifer Hickey  wrote:
>>
>>> Hi Tobias,
>>> Unfortunately I don't have an isolated test case, as I was doing a fairly
>>> involved system test at the time.  I may be able to have a colleague work on
>>> reproducing it at a later date (I've been diverted to something else for the
>>> moment).
>>>
>>> I was remote debugging with Eclipse, so I toggled a method breakpoint on
>>> Thread.interrupt() and then inspected the stack once the breakpoint was hit.
>>>
>>> Sorry I don't have more information at the moment.  I agree that
>>> eliminating the interrupts sounds like the best approach, if possible.
>>>
>>> Thanks,
>>> Jennifer
>>> 
>>> From: user-boun...@lists.neo4j.org [user-boun...@lists.neo4j.org] On
>>> Behalf Of Tobias Ivarsson [tobias.ivars...@neotechnology.com]
>>> Sent: Thursday, April 28, 2011 6:23 AM
>>> To: Neo4j user discussions
>>> Subject: Re: [Neo4j] ClosedChannelExceptions in highly concurrent
>>> environment
>>>
>>> Hi Jennifer,
>>>
>>> I'd first like to thank you for the testing and analysis you've done. Very
>>> useful stuff. Do you think you could send some test code our way that
>>> reproduces this issue?
>>>
>>> This is actually the first time this issue has been reported, so I wouldn't
>>> say it is a common issue. My guess is that your thread volume triggered a
>>> rare condition that wouldn't be encountered otherwise.
>>>
>>> I'm also curious to know how you found the source of the interruptions.
>>> When
>>> I debug thread interruptions I've never been able to find out where the
>>> thread got interrupted from without doing tedious procedures of breakpoint
>>> +
>>> logging + trying to match thread ids. If you have a better method for doing
>>> that I'd very much like to know.
>>>
>>> I think we should focus the effort on fixing the interruption issue if we
>>> can. And I believe we would be able to do that if the interruptions do in
>>> fact originate from where you say they do. But the suggestion of being able
>>> to switch the lucene directory implementation is still interesting, but as
>>> you point out since it has issues on some platforms it would be better if
>>> we
>>> could be rid of the interruption issue.
>>>
>>> Cheers,
>>> Tobias
>>>
>>> On Thu, Apr 28, 2011 at 12:41 AM, Jennifer Hickey >> >wrote:
>>>
>>> > Hello,
>>> > I've been running some tests w/approx 400 threads reading various indexed
>>> > property values.  I'm running on 64 bit Linux.  I was frequently seeing
>>> the
>>> > ClosedChannelException below.  The javadoc on Lucene's NIOFSDirectory
>>> states
>>> > that "Accessing this class either directly or indirectly from a thread
>>> while
>>> > it's interrupted can close the underlying file descriptor immediately if
>>> at
>>> > the same time the thread is blocked on IO. The file descriptor will
>>> remain
>>> > closed and subsequent access to {@link NIOFSDirectory} will throw a
>>> {@link
>>> > ClosedChannelException}.  If your application uses either {@link
>>> > Thread#interrupt()} or {@link Future#cancel(boolean)} you should use

Re: [Neo4j] Change in behavior for QueryContext with Index ?

2011-06-17 Thread Mattias Persson
I cannot reproduce this. I'm trying it with this code:

// I also tried with FULLTEXT_CONFIG
Index index = graphDb.index().forNodes( "qc",
LuceneIndexImplementation.EXACT_CONFIG );
Node node = graphDb.createNode();
index.add( node, "key", "value" );
index.query( new QueryContext( "key:value AND key:value" ) );
index.query( new QueryContext( "key:value key:value"
).defaultOperator( Operator.AND ) );
restartTx();
index.query( new QueryContext( "key:value AND key:value" ) );
index.query( new QueryContext( "key:value key:value"
).defaultOperator( Operator.AND ) );

it doesn't throw any NPE.

2011/6/17 Mattias Persson 

> Hi Kalin,
>
> I'll have a look at it right now
>
>
> 2011/6/17 Kalin Wilson Development 
>
>> Perhaps this is fixed in the latest milestone release, I haven't had a
>> chance to test it yet. I upgraded from 1.3M03 to 1.4M03 and found that my
>> code that queried node indexes using a QueryContext was throwing a NPE. In
>> my code I constructed a string similar to "eclass:org.spp.data.Something AND
>> eid:101" and constructed the QueryContext from that. The QueryContext object
>> was then passed to an index.query() method.
>>
>> Once I found that the NPE was being thrown by index.query(QueryContext), I
>> put together a simple test that created and indexed a Node then queried the
>> index using a QueryContext using various constructs, QueryContext("key:value
>> key:value).defaultOperator(Operator.AND) and QueryContext("key:value AND
>> key:value"). Passing either version of these objects to index.query() throws
>> a NPE, however calling index.query("key:value AND key:value") works and
>> calling index.query(qc.getQueryOrQueryObject()) works (at least when the
>> full string with operators is used to build the QC).
>>
>> Has there been a change in how or when to use a QueryContext? Perhaps I'm
>> using it incorrectly now.
>>
>> Thanks,
>> Kalin
>>
>> ___
>> 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
>



-- 
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] Change in behavior for QueryContext with Index ?

2011-06-17 Thread Mattias Persson
Hi Kalin,

I'll have a look at it right now

2011/6/17 Kalin Wilson Development 

> Perhaps this is fixed in the latest milestone release, I haven't had a
> chance to test it yet. I upgraded from 1.3M03 to 1.4M03 and found that my
> code that queried node indexes using a QueryContext was throwing a NPE. In
> my code I constructed a string similar to "eclass:org.spp.data.Something AND
> eid:101" and constructed the QueryContext from that. The QueryContext object
> was then passed to an index.query() method.
>
> Once I found that the NPE was being thrown by index.query(QueryContext), I
> put together a simple test that created and indexed a Node then queried the
> index using a QueryContext using various constructs, QueryContext("key:value
> key:value).defaultOperator(Operator.AND) and QueryContext("key:value AND
> key:value"). Passing either version of these objects to index.query() throws
> a NPE, however calling index.query("key:value AND key:value") works and
> calling index.query(qc.getQueryOrQueryObject()) works (at least when the
> full string with operators is used to build the QC).
>
> Has there been a change in how or when to use a QueryContext? Perhaps I'm
> using it incorrectly now.
>
> Thanks,
> Kalin
>
> ___
> 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] storing long values overflow

2011-06-17 Thread Mattias Persson
Hi Niels,

this is now fixed. Thanks for the test case.

2011/6/17 Mattias Persson 

> I'm on this one, since I'm assuming I'm the one introducing it. And yes
> there are some tests around this that I wrote for these changes...
> apparently now good enough.
>
>
> 2011/6/17 Jim Webber 
>
>> Michael,
>>
>> No we don't. Do you want to put together a test of {normal, edge positive,
>> edge negative} case (where applicable) for each type we support in the
>> kernel tests?
>>
>> D'oh.
>>
>> Jim
>>
>>
>> On 16 Jun 2011, at 23:14, Michael Hunger wrote:
>>
>> > Damn, do we have tests for storing values and retrieving them.
>> >
>> > Anfang der weitergeleiteten E-Mail:
>> >
>> >> Von: Niels Hoogeveen 
>> >> Datum: 16. Juni 2011 23:52:50 MESZ
>> >> An: 
>> >> Betreff: Re: [Neo4j] storing long values overflow
>> >> Antwort an: Neo4j user discussions 
>> >>
>> >>
>> >> I just tested the long property overflow behaviour against different
>> neo4j 1.4 releases and found out it was introduced between M03 and M04.
>> >> M03 correctly returns -134217729 when storing a property with value
>> -134217729l.M04 and SNAPSHOT return 134217727 when storing a property with
>> value -134217729l.
>> >> Niels
>> >>
>> >>> From: pd_aficion...@hotmail.com
>> >>> To: user@lists.neo4j.org
>> >>> Date: Thu, 16 Jun 2011 23:21:54 +0200
>> >>> Subject: Re: [Neo4j] storing long values overflow
>> >>>
>> >>>
>> >>> Thank Marco,
>> >>> Hope this looks better.
>> >>> import org.neo4j.kernel.EmbeddedGraphDatabase;import
>> org.neo4j.graphdb.GraphDatabaseService;
>> >>> import org.neo4j.graphdb.Transaction;
>> >>> import org.neo4j.graphdb.Node;
>> >>>
>> >>> public class Test2 {
>> >>>
>> >>> public static void main(String args[]){
>> >>>
>> >>> GraphDatabaseService db = new
>>  EmbeddedGraphDatabase("var/db");
>> >>> Transaction tx = db.beginTx();
>> >>> try{
>> >>> Node n = db.getReferenceNode();
>> >>> long l = -134217728l;
>> >>> n.setProperty("testvalue", l);
>> >>> System.out.println(n.getProperty("testvalue"));
>> >>> long l2 = -134217729l;
>> >>> n.setProperty("testvalue2", l2);
>> >>> System.out.println(n.getProperty("testvalue2"));
>> >>> tx.success();
>> >>> }finally{
>> >>> tx.finish();
>> >>> }
>> >>>
>> >>> }
>> >>> }
>>  From: okramma...@gmail.com
>>  Date: Thu, 16 Jun 2011 15:06:23 -0600
>>  To: user@lists.neo4j.org
>>  Subject: Re: [Neo4j] storing long values overflow
>> 
>>  Hi,
>> 
>>  Try using:
>> 
>> http://paste.pocoo.org/
>> 
>>  Great for sending color formatted code snippets.
>> 
>>  Marko.
>> 
>>  http://markorodriguez.com
>> 
>>  On Jun 16, 2011, at 2:48 PM, Niels Hoogeveen wrote:
>> 
>> >
>> > Don't know how to send a properly formatted email.
>> >
>> > Anyway, when storing a long value -134217728l in a node property,
>> retrieving the value of the property is again -134217728.
>> > When storing a long value -134217729l in a node property, retrieving
>> the value of that property overflows and 134217727 is returned.
>> > Kind regards,Niels Hoogeveen
>> >
>> >> From: pd_aficion...@hotmail.com
>> >> To: user@lists.neo4j.org
>> >> Date: Thu, 16 Jun 2011 22:40:24 +0200
>> >> Subject: [Neo4j] storing long values overflow
>> >>
>> >>
>> >> Using neo4j 1.4-SNAPSHOT it seems the storage or retrieval of long
>> values no longer works properly.package com.multispective.snippet;import
>> org.neo4j.kernel.EmbeddedGraphDatabase;import
>> org.neo4j.graphdb.GraphDatabaseService;import
>> org.neo4j.graphdb.Transaction;import org.neo4j.graphdb.Node;public class
>> Test2 { public static void main(String args[]){
>> GraphDatabaseService db = new  EmbeddedGraphDatabase("var/db");
>> Transaction tx = db.beginTx();  try{Node n =
>> db.getReferenceNode(); long l = -134217728l;
>>   n.setProperty("testvalue", l);
>>  System.out.println(n.getProperty("testvalue")); long l2 =
>> -134217729l;  n.setProperty("testvalue2", l2);
>>  System.out.println(n.getProperty("testvalue2"));
>>  tx.success();   }finally{   tx.finish();
>>  }   }}Result:-134217728134217727Kind regards,Niels Hoogeveen
>> >> ___
>> >> 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