[Neo4j] Simple paging question - Gremlin

2011-11-14 Thread Kevin Versfeld
hi folks

I'm implementing paging in a gremlin query - Can anyone tell me the
difference(s) between the following two techniques:

g.v(293).in.drop(5).take(5)

and

g.v(293).in[5..9]

(Both return the same, correct result set)
I will be doing some performance tests today on the two, but last week when
I tried them both on fairly heavy queries, the second method seemed faster
(I only say seemed, because I'm hesitant to draw conclusions before I've
properly measured the times)



--
View this message in context: 
http://neo4j-community-discussions.438527.n3.nabble.com/Simple-paging-question-Gremlin-tp3506242p3506242.html
Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] Debug server plugin?

2011-11-14 Thread Anders Lindström

Hi all,
What's the best way to debug a server plugin you've written?
I saw something about debugging the server in the documentation 
(http://docs.neo4j.org/chunked/1.5/server-debugging.html), but I don't know if 
this applies to plugins as well, or how I could do that.
Any help is appreciated!
Thanks!
Regards,Anders
  
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Debug server plugin?

2011-11-14 Thread Anders Lindström

Never mind, I got it working.
FYI for other ppl: It is possible. Just add the 3rd line to the configuration 
file as described in the documentation (link is given in previous message), 
start your server with your plugin, and then connect from e.g. Eclipse. Works 
like a charm!
From: andli...@hotmail.com
To: user@lists.neo4j.org
Subject: Debug server plugin?
Date: Mon, 14 Nov 2011 10:24:14 +0100








Hi all,
What's the best way to debug a server plugin you've written?
I saw something about debugging the server in the documentation 
(http://docs.neo4j.org/chunked/1.5/server-debugging.html), but I don't know if 
this applies to plugins as well, or how I could do that.
Any help is appreciated!
Thanks!
Regards,Anders

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


Re: [Neo4j] Debug server plugin?

2011-11-14 Thread Peter Neubauer
Great Anders,
feel free to comment on the manual if you have other remarks!

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              - NOSQL for the Enterprise.
http://startupbootcamp.org/    - Öresund - Innovation happens HERE.



2011/11/14 Anders Lindström andli...@hotmail.com:

 Never mind, I got it working.
 FYI for other ppl: It is possible. Just add the 3rd line to the configuration 
 file as described in the documentation (link is given in previous message), 
 start your server with your plugin, and then connect from e.g. Eclipse. Works 
 like a charm!
 From: andli...@hotmail.com
 To: user@lists.neo4j.org
 Subject: Debug server plugin?
 Date: Mon, 14 Nov 2011 10:24:14 +0100








 Hi all,
 What's the best way to debug a server plugin you've written?
 I saw something about debugging the server in the documentation 
 (http://docs.neo4j.org/chunked/1.5/server-debugging.html), but I don't know 
 if this applies to plugins as well, or how I could do that.
 Any help is appreciated!
 Thanks!
 Regards,Anders

 ___
 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] Simple paging question - Gremlin

2011-11-14 Thread Peter Neubauer
Kevin,
intuitively your conclusion sounds sound right. The in()[..] is
probably collecting into a Groovy array, and drop().take() are two
more pipes doing stuff, which is probably more expensive than a simple
array oparation. OTOH, I think the pipes are lazy, so you are not
running out of memory with big result sets.

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              - NOSQL for the Enterprise.
http://startupbootcamp.org/    - Öresund - Innovation happens HERE.



On Mon, Nov 14, 2011 at 9:49 AM, Kevin Versfeld
kevin.versf...@gmail.com wrote:
 hi folks

 I'm implementing paging in a gremlin query - Can anyone tell me the
 difference(s) between the following two techniques:

 g.v(293).in.drop(5).take(5)

 and

 g.v(293).in[5..9]

 (Both return the same, correct result set)
 I will be doing some performance tests today on the two, but last week when
 I tried them both on fairly heavy queries, the second method seemed faster
 (I only say seemed, because I'm hesitant to draw conclusions before I've
 properly measured the times)



 --
 View this message in context: 
 http://neo4j-community-discussions.438527.n3.nabble.com/Simple-paging-question-Gremlin-tp3506242p3506242.html
 Sent from the Neo4j Community Discussions mailing list archive at Nabble.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] Using Webadmin Console to Execute Spatial Cypher Query

2011-11-14 Thread bm3780
I've tried Gremlin but am not finding the syntax very friendly.  Is this
'withinDistance' spatial index query possible with Gremlin?

--
View this message in context: 
http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Using-Webadmin-Console-to-Execute-Spatial-Cypher-Query-tp3500531p3506994.html
Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Using Webadmin Console to Execute Spatial Cypher Query

2011-11-14 Thread Peter Neubauer
Mmh,
this is a design issue of passing index-specific queries and
parameters into an index. Mattias or anyone else, do you have any
thoughts on how to expose that better? If you have some ideas, maybe
you can raise an issue for a feature and suggest some approaches?

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              - NOSQL for the Enterprise.
http://startupbootcamp.org/    - Öresund - Innovation happens HERE.



On Mon, Nov 14, 2011 at 3:36 PM, bm3780 bm3...@gmail.com wrote:
 I've tried Gremlin but am not finding the syntax very friendly.  Is this
 'withinDistance' spatial index query possible with Gremlin?

 --
 View this message in context: 
 http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Using-Webadmin-Console-to-Execute-Spatial-Cypher-Query-tp3500531p3506994.html
 Sent from the Neo4j Community Discussions mailing list archive at Nabble.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] Traversing Performance (Slow?)

2011-11-14 Thread effy
Hi, 

I've trying to use Neo4j to simulate a graph database I need to create for a
website I'm working on (currently running on SQL server). 
I created a bulk loading scripts and generated data (~100K nodes, ~120K
properties, ~120K relationships, 2 relationship types). 
While running a simple traverse using Cypher, my query finishes in ~20
seconds. 
I'm running my tests on webadmin, while the server (same computer) is
running Windows 7, i7 920 (Quad Core) with 12GB RAM. 
Using neo4j latest community version (with default configuration, only
enabled auto indexing for any case). 

If possible, I'd be glad if someone might show me what I'm doing wrong for
getting these results... 

*This is how I built my nodes:*

Product Details 
 - Properties: Name, Price 

Battery Details 
- Properties: MaH 
- Relationships: parent (Pointing to a Product Details node) 

Electronic Product Details 
- Properties: Voltage, Manufacturer 
- Relationships: parent (Pointing to a Product Details node) 

Mobile Phone 
- Properties: NetworkType, BluetoothEnabled, Color, MobileOperatingSystem 
- Relationships: parent (Pointing to a Electronic Product details node) 

For example, storing a mobile phone details in the database would have the
following information stored: 
Battery: 
- Product Details (NodeID = 1): Name = Standard Battery, Manufacturer =
Apple 
- Battery Details (NodeID = 2): MaH: 1600, Relationship: 'parent' pointing
to NodeID = 1 

Mobile phone: 
- Product Details (NodeID = 3): Name = iPhone 3GS, Price = 300USD 
- Electronic Product Details (NodeID = 4): Manufacturer: Apple,
Relationship: 'parent' pointing to NodeID = 3 
- Mobile Phone Details (NodeID = 5): NetworkType: GSM, Color: White,
Relationship: 'parent' pointing to NodeID = 4, Relationship:
'BatteryProductNodeID' pointing to NodeID = 1 

I would like to allow browsing through all mobile phones (for instance) and
show the users all of the allowed filter options (for example, show each
possible Color and it's value). 
The Cypher query I've written for getting this data is (while also filtering
the Battery MaH for example): 

start Products = node(1) 
match 
Products-[a:parent]-Product, 
Product-[b:parent]-ElectronicProduct, 
ElectronicProduct-[c:parent]-MobilePhone, 
MobilePhone-[d:Battery]-Battery 
where Battery.MaH?  1000 
return 
MobilePhone.Color, 
count(MobilePhone) 

Thanks for your help ! 
Effy.

--
View this message in context: 
http://neo4j-community-discussions.438527.n3.nabble.com/Traversing-Performance-Slow-tp3507202p3507202.html
Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Simple paging question - Gremlin

2011-11-14 Thread Marko Rodriguez
Hey Kevin,

 g.v(293).in.drop(5).take(5)
 
 and
 
 g.v(293).in[5..9]
 
 (Both return the same, correct result set)
 I will be doing some performance tests today on the two, but last week when
 I tried them both on fairly heavy queries, the second method seemed faster
 (I only say seemed, because I'm hesitant to draw conclusions before I've
 properly measured the times)

I've never seen drop() and take() until I saw Peter do it in the Gremlin 
documentation. I do not recommend using any of Groovy's collection methods 
because they tend to NOT be lazy. The range filter [5..9] is native Gremlin and 
lazy/stream-based without intermediate collection construction.

In general, do not use:
collect{}
each{}
drop()/take()
...

Gremlin will have its own lazy version of such constructs and those should be 
used.

Enjoy,
Marko.

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


Re: [Neo4j] Simple paging question - Gremlin

2011-11-14 Thread Peter Neubauer
Ahh,
Will then change the docs to reflect this.
On Nov 14, 2011 5:35 PM, Marko Rodriguez okramma...@gmail.com wrote:

 Hey Kevin,

  g.v(293).in.drop(5).take(5)
 
  and
 
  g.v(293).in[5..9]
 
  (Both return the same, correct result set)
  I will be doing some performance tests today on the two, but last week
 when
  I tried them both on fairly heavy queries, the second method seemed
 faster
  (I only say seemed, because I'm hesitant to draw conclusions before
 I've
  properly measured the times)

 I've never seen drop() and take() until I saw Peter do it in the Gremlin
 documentation. I do not recommend using any of Groovy's collection methods
 because they tend to NOT be lazy. The range filter [5..9] is native Gremlin
 and lazy/stream-based without intermediate collection construction.

 In general, do not use:
collect{}
each{}
drop()/take()
...

 Gremlin will have its own lazy version of such constructs and those should
 be used.

 Enjoy,
 Marko.

 http://markorodriguez.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 for semantic graphs + algorithms

2011-11-14 Thread Marko Rodriguez
Hello,

 Any information to load OWL specifications into Neo4J or guidance to design
 algorithms (managment of temporary data is the blocking point)?

When you use the OpenRDF SAIL bindings provided by TinkerPop, you will be able 
to use OpenRDF's OWL reasoners and other tools. Basically, the stack looks like 
this:

OpenRDF Sail  TinkerPop GraphSail --- Neo4j

1. OpenRDF Sail is a tool set for working with various aspects of RDF. It is 
large, heavily developed on, and a standard in the RDF community.
2. TinkerPop GraphSail provides a way to turn any graph database (e.g. Neo4j) 
into an RDF triple/quad store.
3. Neo4j is a graph database.

Hope that helps,
Marko.

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


Re: [Neo4j] Traversing Performance (Slow?)

2011-11-14 Thread Alistair Jones
Hi Effy,

From how you describe the model you've created, I don't think it's
structured very well to help you perform the kind of queries you're looking
for.
It looks like you have a single tree with products as the root.  This
single tree structure means that there is no way to navigate between data
other than by going up and down the tree.  To find the data you're looking
for the query is having to visit every single node in the database - hence
the slow performance.

I recommend that you change the model so where you want to find products
that have similar attributes, you create nodes for the attribute values.
 For example, in your current model, two different phones made by Apple
with be stored as two nodes, each with a string property manufacturer =
Apple.  Instead, I recommend creating a node that represents the
manufacturer Apple, and connecting the two phone nodes to the manufacturer
using a MANFUCTURED_BY relationship. In this model, finding other phones
from the same manufacturer is just a matter of traversing relationships,
rather than visiting every phone and testing the string value of its
manufacturer property.  This approach could be applied to all
the attributes where you there is a connection between different phones.
 For example, MobileOperatingSystem properties would be replaced by
relationships to nodes such as iOS and Android.  You should only be left
with properties that do not represent a connection between nodes, for
example model number.

In the case of battery capacity, you want to do range queries, and this is
slightly more complicated, because you want to find phones that have
better capacity, not exactly the same capacity.  This could be achieved
by creating a chain of capacity values, connected by
GREATER_THAN relationships.  Alternatively, you could index these fields
and find the set of capacity nodes from which to start your traversal.  See:
http://docs.neo4j.org/chunked/snapshot/indexing-lucene-extras.html#indexing-lucene-numeric-ranges

If I have time I will try to come up with some example Cypher queries for
model described here.

hope that helps,

-Alistair

On 14 November 2011 15:51, effy e...@think-teva.com wrote:

 Hi,

 I've trying to use Neo4j to simulate a graph database I need to create for
 a
 website I'm working on (currently running on SQL server).
 I created a bulk loading scripts and generated data (~100K nodes, ~120K
 properties, ~120K relationships, 2 relationship types).
 While running a simple traverse using Cypher, my query finishes in ~20
 seconds.
 I'm running my tests on webadmin, while the server (same computer) is
 running Windows 7, i7 920 (Quad Core) with 12GB RAM.
 Using neo4j latest community version (with default configuration, only
 enabled auto indexing for any case).

 If possible, I'd be glad if someone might show me what I'm doing wrong for
 getting these results...

 *This is how I built my nodes:*

 Product Details
  - Properties: Name, Price

 Battery Details
 - Properties: MaH
 - Relationships: parent (Pointing to a Product Details node)

 Electronic Product Details
 - Properties: Voltage, Manufacturer
 - Relationships: parent (Pointing to a Product Details node)

 Mobile Phone
 - Properties: NetworkType, BluetoothEnabled, Color, MobileOperatingSystem
 - Relationships: parent (Pointing to a Electronic Product details node)

 For example, storing a mobile phone details in the database would have the
 following information stored:
 Battery:
 - Product Details (NodeID = 1): Name = Standard Battery, Manufacturer =
 Apple
 - Battery Details (NodeID = 2): MaH: 1600, Relationship: 'parent' pointing
 to NodeID = 1

 Mobile phone:
 - Product Details (NodeID = 3): Name = iPhone 3GS, Price = 300USD
 - Electronic Product Details (NodeID = 4): Manufacturer: Apple,
 Relationship: 'parent' pointing to NodeID = 3
 - Mobile Phone Details (NodeID = 5): NetworkType: GSM, Color: White,
 Relationship: 'parent' pointing to NodeID = 4, Relationship:
 'BatteryProductNodeID' pointing to NodeID = 1

 I would like to allow browsing through all mobile phones (for instance) and
 show the users all of the allowed filter options (for example, show each
 possible Color and it's value).
 The Cypher query I've written for getting this data is (while also
 filtering
 the Battery MaH for example):

 start Products = node(1)
 match
Products-[a:parent]-Product,
Product-[b:parent]-ElectronicProduct,
ElectronicProduct-[c:parent]-MobilePhone,
MobilePhone-[d:Battery]-Battery
 where Battery.MaH?  1000
 return
MobilePhone.Color,
count(MobilePhone)

 Thanks for your help !
 Effy.

 --
 View this message in context:
 http://neo4j-community-discussions.438527.n3.nabble.com/Traversing-Performance-Slow-tp3507202p3507202.html
 Sent from the Neo4j Community Discussions mailing list archive at
 Nabble.com.
 ___
 Neo4j mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] Limiting the number of returned paths or finding next shortest path

2011-11-14 Thread pdobrev
Hi guys,

I have a decent size graph (2.5M nodes, 8M relationships) and am interested
in finding paths between two nodes. I am using the REST API since the app I
am working on is developed in .NET.

Due to the nature of the graph the paths can be quite long, so I am using 8
for the max depth parameter. 

Searching for the shortest path between two nodes is quite fast. On the
other hand, searching for allSimplePaths  is really slow. Up to a max depth
value of 5 it is still ok, but going further makes it very slow and as I
mentioned already, I can have meaningful connections of depth up to 8. 
I think the reason might be because there may be too many paths between the
nodes. Is there any way I can tell the API to return not all paths, but
rather just the first 3-4-5 it finds? I think that might speed up things
significantly and I don't really need to show more paths than that.

Alternatively, if I can ask Neo4j for the next shortest path, after the one
I already got, that would also be a great solution. However, I don't expect
that there's an easy way to do that.


Thanks a lot in advance!!

Best regards,
Petar

--
View this message in context: 
http://neo4j-community-discussions.438527.n3.nabble.com/Limiting-the-number-of-returned-paths-or-finding-next-shortest-path-tp3507449p3507449.html
Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


[Neo4j] Neo4j Events this week

2011-11-14 Thread Allison Sparrow
***
Hi Everyone,

Events this week!

Remember, check back to http://plancast.com/neo4j for updates..
**
*San Francisco Tutorial | A Programmatic Introduction to Neo4j *
Monday, 14 November 2011*

*
This tutorial covers the core functionality from the Neo4j graph database,
providing a mixture of theory and accompanying practical sessions to
demonstrate the capabilities of graph data and the Neo4j database.
Specifically attendees will learn about:

- NoSQL and Graph Database overview
- Neo4j Fundamentals and Architecture
- The Neo4j Core API
- Indexing
- Neo4j Traverser APIs
- Declarative querying with Cypher
- Graph algorithms
- Solutions architecture: using Neo4j in large systems

qconsf.com/sf2011/presentations/show_presentation.jsp?oid=3459
*
San Francisco Tutorial | REST in Practice - A Tutorial on Web-based
Distributed Systems *
Tuesday, 15 November 2011

The Web is fast becoming a serious competitor to traditional enterprise
architecture approaches. This tutorial will provide an introduction to
designing robust enterprise systems with RESTful. The tutorial is broken
down as follows:

* Introduction and Motivation
* The Web Architecture
* Simple Web Integration including POX and URI tunnelling
* CRUD Services using URI templates and HTTP
* Hypermedia and the REST architectural style
* Scalability and how a text-based client-server polling protocol
outperforms everything else!
* ATOM and ATOMPub for event-driven and pub/sub applications Security
* Conclusions and further thoughts

qconsf.com/sf2011/presentations/show_presentation.jsp?oid=3458

*Webinar | Getting Started with Neo4j*
Thursday, 17 November 2011*

*
This webinar is designed to help developers achieve a fast start with
Neo4j.. There are no prerequisites. Join this webinar to learn:
* basic graph concepts
* modeling data in a graph
* querying a graph

https://www1.gotomeeting.com/register/911016521

**
***

*Allison Sparrow* *
**Marketing Manager | Neo Technology*
+19499036091 | @ayeeson http://twitter.com/#%21/ayeeson

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


Re: [Neo4j] Simple paging question - Gremlin

2011-11-14 Thread Peter Neubauer
Done.

https://github.com/neo4j/gremlin-plugin/commit/d19a16b596ee00f89bf18a2f722d3735b229d290

Thanks for pointing this out!

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  - NOSQL for the Enterprise.
http://startupbootcamp.org/- Öresund - Innovation happens HERE.


On Mon, Nov 14, 2011 at 5:39 PM, Peter Neubauer 
peter.neuba...@neotechnology.com wrote:

 Ahh,
 Will then change the docs to reflect this.
 On Nov 14, 2011 5:35 PM, Marko Rodriguez okramma...@gmail.com wrote:

 Hey Kevin,

  g.v(293).in.drop(5).take(5)
 
  and
 
  g.v(293).in[5..9]
 
  (Both return the same, correct result set)
  I will be doing some performance tests today on the two, but last week
 when
  I tried them both on fairly heavy queries, the second method seemed
 faster
  (I only say seemed, because I'm hesitant to draw conclusions before
 I've
  properly measured the times)

 I've never seen drop() and take() until I saw Peter do it in the Gremlin
 documentation. I do not recommend using any of Groovy's collection methods
 because they tend to NOT be lazy. The range filter [5..9] is native Gremlin
 and lazy/stream-based without intermediate collection construction.

 In general, do not use:
collect{}
each{}
drop()/take()
...

 Gremlin will have its own lazy version of such constructs and those
 should be used.

 Enjoy,
 Marko.

 http://markorodriguez.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] Limiting the number of returned paths or finding next shortest path

2011-11-14 Thread Peter Neubauer
Mmh,
there is an implementation for this in
https://github.com/neo4j/community/blob/master/graph-algo/src/main/java/org/neo4j/graphalgo/GraphAlgoFactory.java#L93if
that is what you want, we then should expose this as part of the REST
API right?

What REST call are you using right now? Please raise a feature request on
this at https://github.com/neo4j/community/issues, would be great.

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  - NOSQL for the Enterprise.
http://startupbootcamp.org/- Öresund - Innovation happens HERE.


On Mon, Nov 14, 2011 at 6:27 PM, pdobrev peter.dob...@gmail.com wrote:

 Hi guys,

 I have a decent size graph (2.5M nodes, 8M relationships) and am interested
 in finding paths between two nodes. I am using the REST API since the app I
 am working on is developed in .NET.

 Due to the nature of the graph the paths can be quite long, so I am using 8
 for the max depth parameter.

 Searching for the shortest path between two nodes is quite fast. On the
 other hand, searching for allSimplePaths  is really slow. Up to a max depth
 value of 5 it is still ok, but going further makes it very slow and as I
 mentioned already, I can have meaningful connections of depth up to 8.
 I think the reason might be because there may be too many paths between the
 nodes. Is there any way I can tell the API to return not all paths, but
 rather just the first 3-4-5 it finds? I think that might speed up things
 significantly and I don't really need to show more paths than that.

 Alternatively, if I can ask Neo4j for the next shortest path, after the one
 I already got, that would also be a great solution. However, I don't expect
 that there's an easy way to do that.


 Thanks a lot in advance!!

 Best regards,
 Petar

 --
 View this message in context:
 http://neo4j-community-discussions.438527.n3.nabble.com/Limiting-the-number-of-returned-paths-or-finding-next-shortest-path-tp3507449p3507449.html
 Sent from the Neo4j Community Discussions mailing list archive at
 Nabble.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] HowTo: Dijkstra with Limited Depth

2011-11-14 Thread Joel Cordeiro
Hi there,

I'm having performance issues with Neo4J while using GraphAlgoFactory to
find a path between two nodes. I want to calculate the cost between the two
nodes (each relation type has a different cost), with the maximum depth of
3 (paths with more length can be discarded). I'm using the findAllPaths
method, since the findShorthestPath method takes into account the path
length and not the cost associated to it. But this is not the ideal
solution, because of the performance issues I'm having.

I'm thinking about using something like the Dijkstra algorithm, but with a
maximum depth of 3. I already took a look at the Neo4J source code and
found the class *org.neo4j.graphalgo.impl.shortestpath.Dijkstra, *which I
have tried to use with limitMaxRelationShipsToTraverse set to 3. Most of
the times it doesn't found any path, and  throws the exception:
java.lang.RuntimeException: Trying to decrease to a greater key
at
org.neo4j.graphalgo.impl.util.FibonacciHeap.decreaseKey(FibonacciHeap.java:318)
at
org.neo4j.graphalgo.impl.shortestpath.DijkstraPriorityQueueFibonacciImpl.decreaseValue(DijkstraPriorityQueueFibonacciImpl.java:103)
at
org.neo4j.graphalgo.impl.shortestpath.Dijkstra$DijstraIterator.next(Dijkstra.java:393)
at
org.neo4j.graphalgo.impl.shortestpath.Dijkstra.calculate(Dijkstra.java:516)

Is this class appropriate for what I want to accomplish? I also would like
to know if this is a good solution for the discribed problem, or if there
is a better solution out there.

Best regards,
Joel Filipe Antunes Cordeiro
jkorde...@gmail.com
j...@student.dei.uc.pt
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Limiting the number of returned paths or finding next shortest path

2011-11-14 Thread Petar Dobrev
Hi Peter,

thanks for the swift response. Just a quick question about the ShortestPath
path finder -- does it return paths of only the same (shortest) length or
does it sort all simple paths according to their length. I am almost
certain it does the former, but if it's the latter then that's exactly what
I need.

If not then I think this effect can be achieved by first running
shortestPath and then pathsWithLength for all the lengths up to maxDepth.
Not optimal, but would do the job. However, pathsWithLength is also not
exposed via the API.


Otherwise this looks exactly like what I'm looking for. Would be great to
have them as part of the API.

The API call I am using now is:
POST http://localhost:7474/db/data/node/nodeid/paths
Data:
{
  to: http://localhost:7474/db/data/node/nodeid,
  max_depth: 8,
  relationships: [{ type: reltype }],
  algorithm: shortestPath
}


I created a feature request at: https://github.com/neo4j/community/issues/99

Thanks a lot!


Best regards,
Petar

On Mon, Nov 14, 2011 at 10:11 PM, Peter Neubauer 
peter.neuba...@neotechnology.com wrote:

 Mmh,
 there is an implementation for this in

 https://github.com/neo4j/community/blob/master/graph-algo/src/main/java/org/neo4j/graphalgo/GraphAlgoFactory.java#L93if
 that is what you want, we then should expose this as part of the REST
 API right?

 What REST call are you using right now? Please raise a feature request on
 this at https://github.com/neo4j/community/issues, would be great.

 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  - NOSQL for the Enterprise.
 http://startupbootcamp.org/- Öresund - Innovation happens HERE.


 On Mon, Nov 14, 2011 at 6:27 PM, pdobrev peter.dob...@gmail.com wrote:

  Hi guys,
 
  I have a decent size graph (2.5M nodes, 8M relationships) and am
 interested
  in finding paths between two nodes. I am using the REST API since the
 app I
  am working on is developed in .NET.
 
  Due to the nature of the graph the paths can be quite long, so I am
 using 8
  for the max depth parameter.
 
  Searching for the shortest path between two nodes is quite fast. On the
  other hand, searching for allSimplePaths  is really slow. Up to a max
 depth
  value of 5 it is still ok, but going further makes it very slow and as I
  mentioned already, I can have meaningful connections of depth up to 8.
  I think the reason might be because there may be too many paths between
 the
  nodes. Is there any way I can tell the API to return not all paths, but
  rather just the first 3-4-5 it finds? I think that might speed up things
  significantly and I don't really need to show more paths than that.
 
  Alternatively, if I can ask Neo4j for the next shortest path, after the
 one
  I already got, that would also be a great solution. However, I don't
 expect
  that there's an easy way to do that.
 
 
  Thanks a lot in advance!!
 
  Best regards,
  Petar
 
  --
  View this message in context:
 
 http://neo4j-community-discussions.438527.n3.nabble.com/Limiting-the-number-of-returned-paths-or-finding-next-shortest-path-tp3507449p3507449.html
  Sent from the Neo4j Community Discussions mailing list archive at
  Nabble.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




-- 
Petar Dobrev
Engineer
Philanthropedia
http://www.myphilanthropedia.org
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Limiting the number of returned paths or finding next shortest path

2011-11-14 Thread Peter Neubauer
Thanks Petar,
will get on it as soon as I have time. Good contribution!

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  - NOSQL for the Enterprise.
http://startupbootcamp.org/- Öresund - Innovation happens HERE.


On Mon, Nov 14, 2011 at 10:31 PM, Petar Dobrev 
petar.dob...@myphilanthropedia.org wrote:

 Hi Peter,

 thanks for the swift response. Just a quick question about the ShortestPath
 path finder -- does it return paths of only the same (shortest) length or
 does it sort all simple paths according to their length. I am almost
 certain it does the former, but if it's the latter then that's exactly what
 I need.

 If not then I think this effect can be achieved by first running
 shortestPath and then pathsWithLength for all the lengths up to maxDepth.
 Not optimal, but would do the job. However, pathsWithLength is also not
 exposed via the API.


 Otherwise this looks exactly like what I'm looking for. Would be great to
 have them as part of the API.

 The API call I am using now is:
 POST http://localhost:7474/db/data/node/nodeid/paths
 Data:
 {
  to: http://localhost:7474/db/data/node/nodeid,
  max_depth: 8,
  relationships: [{ type: reltype }],
  algorithm: shortestPath
 }


 I created a feature request at:
 https://github.com/neo4j/community/issues/99

 Thanks a lot!


 Best regards,
 Petar

 On Mon, Nov 14, 2011 at 10:11 PM, Peter Neubauer 
 peter.neuba...@neotechnology.com wrote:

  Mmh,
  there is an implementation for this in
 
 
 https://github.com/neo4j/community/blob/master/graph-algo/src/main/java/org/neo4j/graphalgo/GraphAlgoFactory.java#L93if
  that is what you want, we then should expose this as part of the REST
  API right?
 
  What REST call are you using right now? Please raise a feature request on
  this at https://github.com/neo4j/community/issues, would be great.
 
  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  - NOSQL for the Enterprise.
  http://startupbootcamp.org/- Öresund - Innovation happens HERE.
 
 
  On Mon, Nov 14, 2011 at 6:27 PM, pdobrev peter.dob...@gmail.com wrote:
 
   Hi guys,
  
   I have a decent size graph (2.5M nodes, 8M relationships) and am
  interested
   in finding paths between two nodes. I am using the REST API since the
  app I
   am working on is developed in .NET.
  
   Due to the nature of the graph the paths can be quite long, so I am
  using 8
   for the max depth parameter.
  
   Searching for the shortest path between two nodes is quite fast. On the
   other hand, searching for allSimplePaths  is really slow. Up to a max
  depth
   value of 5 it is still ok, but going further makes it very slow and as
 I
   mentioned already, I can have meaningful connections of depth up to 8.
   I think the reason might be because there may be too many paths between
  the
   nodes. Is there any way I can tell the API to return not all paths, but
   rather just the first 3-4-5 it finds? I think that might speed up
 things
   significantly and I don't really need to show more paths than that.
  
   Alternatively, if I can ask Neo4j for the next shortest path, after the
  one
   I already got, that would also be a great solution. However, I don't
  expect
   that there's an easy way to do that.
  
  
   Thanks a lot in advance!!
  
   Best regards,
   Petar
  
   --
   View this message in context:
  
 
 http://neo4j-community-discussions.438527.n3.nabble.com/Limiting-the-number-of-returned-paths-or-finding-next-shortest-path-tp3507449p3507449.html
   Sent from the Neo4j Community Discussions mailing list archive at
   Nabble.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
 



 --
 Petar Dobrev
 Engineer
 Philanthropedia
 http://www.myphilanthropedia.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


[Neo4j] Cypher DSL by Rickard

2011-11-14 Thread Peter Neubauer
Hi all,
Rickard Öberg just blogged about the Cypher Java DSL, I think it's very
interesting reading and will be part of 1.6 hopefully. Feedback very
welcome!

http://rickardoberg.wordpress.com/2011/11/14/creating-a-dsl-for-cypher-graph-queries/

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  - NOSQL for the Enterprise.
http://startupbootcamp.org/- Öresund - Innovation happens HERE.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Confirming existence of relationship between two nodes

2011-11-14 Thread gsingh93

 What version of Neo4j are you using? This query is valid syntax for 1.4.x
 and 1.5.M01.

 I'm using version 1.4.1


 Later you would want to use:

  start a=node:nodeIndex(identifier='0') return a

 I tried that and got the error:

org.neo4j.cypher.SyntaxException: `' expected but `n' found

 at org.neo4j.cypher.parser.CypherParser.parse(CypherParser.scala:75)

 at org.neo4j.cypher.javacompat.CypherParser.parse(CypherParser.java:39)

 at
 org.whispercomm.manes.server.graph.IntegrationTest.cypherTest(IntegrationTest.java:83)


And if you do in Java:
 Node node =
 gds.index().forNodes(nodeIndex).get(identifier,0).getSingle()

 then node is the user you want?

 Yes, that command gives me the user I want. How would I do that in cypher?


 I'm not sure if that makes a difference, did you index your identifiers as
 Strings or numeric values?

I set the properties of the node as byte [ ], and then the properties are
auto-indexed.


--
View this message in context: 
http://neo4j-community-discussions.438527.n3.nabble.com/Confirming-existence-of-relationship-between-two-nodes-tp3501458p3508562.html
Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Paths with null?

2011-11-14 Thread Andres Taylor
I just realized the obviousness of the truth.

The optional bit is viral - it spreads out if it can. So, a path pointing
to an optional relationship, is it self optional. Just like nodes hanging
from an optional relationship are also optional.
So, if the path happens to have any null parts, the whole path is null.

Makes sense?

Andrés

On Sun, Nov 13, 2011 at 1:11 PM, Mattias Persson
matt...@neotechnology.comwrote:

 A Path with null in it doesn't make much sense to me. I'd prefer b) also.

 Den lördagen den 12:e november 2011 skrev Andres Taylor
 andres.tay...@neotechnology.com:
  On Sat, Nov 12, 2011 at 3:02 PM, D. Frej dieter_f...@gmx.net wrote:
 
  to understand the question correctly: is it something like
  (a)-[:REL_TYPE*0..1]-(b)
 
 
  Sorry for not being clearer...
 
  No, that pattern is safe - it will never contain a null. The optional
  relationships have a question mark in them, like this:
 
   (a)-[?:REL_TYPE]-(b)
 
  Andrés
  ___
  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] Paths with null?

2011-11-14 Thread Mattias Persson
That may be a good solution, because you could not treat such a path (if it
were to have null in it somewhere) in a normal fashion anyway.

2011/11/15 Andres Taylor andres.tay...@neotechnology.com

 I just realized the obviousness of the truth.

 The optional bit is viral - it spreads out if it can. So, a path pointing
 to an optional relationship, is it self optional. Just like nodes hanging
 from an optional relationship are also optional.
 So, if the path happens to have any null parts, the whole path is null.

 Makes sense?

 Andrés

 On Sun, Nov 13, 2011 at 1:11 PM, Mattias Persson
 matt...@neotechnology.comwrote:

  A Path with null in it doesn't make much sense to me. I'd prefer b) also.
 
  Den lördagen den 12:e november 2011 skrev Andres Taylor
  andres.tay...@neotechnology.com:
   On Sat, Nov 12, 2011 at 3:02 PM, D. Frej dieter_f...@gmx.net wrote:
  
   to understand the question correctly: is it something like
   (a)-[:REL_TYPE*0..1]-(b)
  
  
   Sorry for not being clearer...
  
   No, that pattern is safe - it will never contain a null. The optional
   relationships have a question mark in them, like this:
  
(a)-[?:REL_TYPE]-(b)
  
   Andrés
   ___
   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