Re: [Neo4j] Please help me writting query for this example.

2016-08-25 Thread 'Michael Hunger' via Neo4j
simple double match

MATCH (p:Professor)<-[:STUDENT_OF]-(s:Student)
WITH p, avg(s.grade) as grade
MATCH (p:Professor)<-[:STUDENT_OF]-(s:Student)
WHERE s.grade > grade
RETURN p,collect(s) as students


better collect + filter

MATCH (p:Professor)<-[:STUDENT_OF]-(s:Student)
WITH p, avg(s.grade) as grade, collect(s) as all_students
RETURN p,[s IN all_students WHERE s.grade > grade] as students



> Am 25.08.2016 um 13:04 schrieb Sumit Neelam :
> 
> 
> Hi,
> 
> I am new to Neo4j and Cypher. I want to write a query for getting following 
> information:
> 
> Graph Description: Sample graph schema image is attached in this post with 
> properties of each node. Graph contains Professor nodes (labeled with P) and 
> student nodes (labeled with S). Professor nodes are connected to their 
> student nodes with edge having 'student' label. All students of same 
> professor form a group.
> 
> Professor nodes properties:
> name
> Student nodes properties:
> name
> grade
> Query: I want to find professors and their students who have grade greater 
> than average grade of their group.
> 
> Example:
> 
> Students' grades avg. for professor P1 group = (7.0+8.0)/2 = 7.5  
> S2 has grade greater than 7.5.
>
> Students' grades avg. for professor P2 group = (4.0+8.0+9.0)/3 = 7.0
> S4 and S5 have grade greater than 7.0.
> 
> Final output should be like this:
> 
> P1, S2, 8.0
> P2, S4, 8.0
> P2, S5, 9.0
> 
>  
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to neo4j+unsubscr...@googlegroups.com 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Neo4j] neo4j 3.0.1 [Full GC (Allocation Failure)

2016-08-25 Thread 'Michael Hunger' via Neo4j
Sorry, it's a bug we fixed in 3.0.2 I think.

Please upgrade to 3.0.4

then all of that should go away and you should be able to run your imports with 
1-2G heap.

Your page-cahe should be fine around 1-2G you can check your store-file sizes 
(neostore.*.db)

Michael

> Am 26.08.2016 um 00:24 schrieb kmcg...@absolute-performance.com:
> 
> I am using LOAD CSV to update nodes of an existing label. The label contains 
> 4M existing nodes. The CSV file contains 600k rows; some new, some updates.
> 
> My Centos 6.x box has 36G of ram. Using the 3.0.1 tuning guide, I have set 
> pagecache to 24G and heap_initial_size/heap_max_size to 8G.
> 
> Attached is my cql file. When executing this cql file neo4j consumes heap 
> space until space is exhausted. The query plan (attached) appears to indicate 
> there are no issues so I would expect period commits to re-use heap. I have 
> adjusted pagecache and heap sizes up and down but every load attempts fails 
> when heap is exhausted.
> 
> Any ideas or thoughts?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to neo4j+unsubscr...@googlegroups.com 
> .
> For more options, visit https://groups.google.com/d/optout 
> .
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Neo4j] Please help me writting query for this example.

2016-08-25 Thread Sumit Neelam


Hi,

I am new to Neo4j and Cypher. I want to write a query for getting following 
information:

*Graph Description:* Sample graph schema image is attached in this post 
with properties of each node. Graph contains Professor nodes (labeled with 
P) and student nodes (labeled with S). Professor nodes are connected to 
their student nodes with edge having 'student' label. All students of same 
professor form a *group*.

Professor nodes properties:

   - name

Student nodes properties:

   - name


   - grade

*Query:* I want to find professors and their students who have grade 
greater than average grade of their *group*.

*Example:*

Students' grades avg. for professor P1 group = (7.0+8.0)/2 = 7.5  
S2 has grade greater than 7.5.
   
Students' grades avg. for professor P2 group = (4.0+8.0+9.0)/3 = 7.0
S4 and S5 have grade greater than 7.0.

Final output should be like this:

P1, S2, 8.0
P2, S4, 8.0
P2, S5, 9.0



-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Neo4j] neo4j 3.0.1 [Full GC (Allocation Failure)

2016-08-25 Thread kmcginn
I am using LOAD CSV to update nodes of an existing label. The label 
contains 4M existing nodes. The CSV file contains 600k rows; some new, some 
updates.

My Centos 6.x box has 36G of ram. Using the 3.0.1 tuning guide, I have set 
pagecache to 24G and heap_initial_size/heap_max_size to 8G.

Attached is my cql file. When executing this cql file neo4j consumes heap 
space until space is exhausted. The query plan (attached) appears to 
indicate there are no issues so I would expect period commits to re-use 
heap. I have adjusted pagecache and heap sizes up and down but every load 
attempts fails when heap is exhausted.

Any ideas or thoughts?

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
USING PERIODIC COMMIT 100
LOAD CSV WITH HEADERS FROM 
'file:/export/warehouse/DW/accounts_XX_08-23-2016_03-03.txt' as row 
FIELDTERMINATOR '\t' 
merge (x:XXaccounts {AccountsID:row.AccountsID}) 
on create set x+=row on match set x=row;
Compiler CYPHER 3.0

Planner COST

Runtime INTERPRETED

+-++--+-+---++
| Operator| Estimated Rows | Rows | DB Hits | Variables 
| Other  |
+-++--+-+---++
| +ProduceResults |  1 |0 |   0 |   
||
| |   
++--+-+---++
| +EmptyResult||0 |   0 |   
||
| |   
++--+-+---++
| +Apply  |  1 |0 |   0 | row, x
||
| |\  
++--+-+---++
| | +AntiConditionalApply |  1 |0 |   0 | row, x
||
| | |\
++--+-+---++
| | | +SetNodePropertyFromMap |  1 |0 |   0 | row, x
||
| | | |   
++--+-+---++
| | | +MergeCreateNode|  1 |0 |   0 | x -- row  
||
| | | |   
++--+-+---++
| | | +Argument   |  1 |0 |   0 | row   
||
| | | 
++--+-+---++
| | +ConditionalApply |  1 |0 |   0 | row, x
||
| | |\
++--+-+---++
| | | +SetNodePropertyFromMap |  1 |0 |   0 | row, x
||
| | | |   
++--+-+---++
| | | +Argument   |  1 |0 |   0 | row -- x  
||
| | | 
++--+-+---++
| | +Optional |  1 |0 |   0 | x 
||
| | | 
++--+-+---++
| | +NodeUniqueIndexSeek(Locking) |  1 |0 |   0 | x 
| :XXaccounts(AccountsID) |
| |   
++--+-+---++
| +Limit  |  0 |0 |   0 | row   
| Literal(0) |
| |   
++--+-+---++
| +LoadCSV|  1 |1 |   0 | row   
||
+-++--+-+---++

Total database accesses: 0

Re: [Neo4j] Multiple statements using the Neo4j java driver with the bolt protocol

2016-08-25 Thread 'Michael Hunger' via Neo4j
Hi Davide,

You can open one tx and then run multiple statements in that tx

I think bolt packs stuff in the same fram of the open tcp connection 

Nigel will know more. 

Good luck with the update 

Michael 

Von meinem iPhone gesendet

> Am 25.08.2016 um 12:51 schrieb Davide D'Alto :
> 
> Hi,
> I'm using the Neoj4 java driver to replace the Rest called I've implemented 
> to connect to a remote server.
> 
> In a rest API I can run multiple statements in a single request, is it 
> possible to do the same with the Java driver? Would that make sense?
> 
> 
> Thanks,
> Davide
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to neo4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Neo4j] Multiple statements using the Neo4j java driver with the bolt protocol

2016-08-25 Thread Davide D'Alto
Hi,
I'm using the Neoj4 java driver to replace the Rest called I've implemented 
to connect to a remote server.

In a rest API I can run multiple statements in a single request, is it 
possible to do the same with the Java driver? Would that make sense?


Thanks,
Davide

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Neo4j] Re: Why does latency from neo4j increases when Database size is in large ?

2016-08-25 Thread 'Mattias Persson' via Neo4j
Perhaps GC? Sounds like far too many threads and things could potentially 
go a lot faster with fewer threads, something like number of cores on the 
server or some small multiple of that.

On Monday, August 22, 2016 at 5:05:42 PM UTC+2, gitansh...@freecharge.com 
wrote:
>
> My database has around 15 million nodes. 
> App server is hitting the database with 3000 parallel threads, earlier the 
> latency from database was in milliseconds, but as increase in DB size, 
> latencies are reaching 10 seconds. 
> What can be the possible reason for that?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Neo4j] Node creation and deletion doesn't persist in Neo4J Embedded

2016-08-25 Thread Dave Shepard
 

Hi All,


I'm posting here because I'm having a problem, and I feel like my question 
is too complex for StackOverflow. I've searched StackOverflow and the 
documentation for a help, but I'm really not sure exactly where to start 
with this, and if someone could provide some guidance, I'd really 
appreciate it.


I'm having a very strange problem. I'm writing an application that's 
basically a RESTful CRUD tool, which allows users to enter various kinds of 
data. I'm using Neo4J Embedded 2.3.6, writing in Scala using the Play 
framework. One kind of data is giving me problems, which I call a Schema. A 
Schema is one node type, and it can have several Field nodes. Schemas and 
Fields are created through the same request. Both Schema and Field nodes 
have several types of relations, and some point to existing nodes.


The problem is that when a user creates a new Schema, sometimes the data 
will disappear randomly. By that I mean that when I creates a Schema 
through the user interface, sometimes the newly-created Schema will show up 
in my application’s list of Schemas (in my UI and REST interface), but then 
it will disappear after I reload the list of Schemas a few times. Then, it 
will sometimes stay gone, or sometimes come back. Usually, the first few 
Schemas I create don't disappear. However, after I create the first few 
Schemas, whether a Schema disappears becomes random. Deletions can also be 
somewhat random. For example, once I created four schemas, then deleted 
one. Then, two of the Schemas I'd created disappeared, and the deleted one 
reappeared, and nothing else changed.


The best I can tell, the problem is with Neo4j Embedded (though I'm happy 
to be told I'm wrong). My unit tests for all these functions pass, though 
they use an ImpermanentDatabase. I’m pretty sure the problem isn’t browser 
caching because I’ve turned off caching in Chrome, and if I stop the 
application, the state of the database at that moment will be frozen when I 
stop the application.


There are two other weird things. First, the entire Schema creation process 
is wrapped in a transaction, so the process of creating a Schema should be 
atomic. In other words, either a Schema and its Fields should all be 
created together, or not created at all. I never see a failure message, or 
get a transaction failure exception. However, sometimes the Schema node 
will show up in the list of Schemas, but the Field nodes won't, although 
they will show up later. Second, as I create more Schemas, the creation 
process takes longer and longer. Eventually, it will get so slow that it 
will take the application down. It will then speed back up when I restart 
the application. I think there's some kind of leak, but I'm having a hard 
time pinning down where that's coming from.


So, my question is, where should I start looking? My best guess is that 
this is something with Neo4j and how I’m using it. I think it’s a problem 
with Neo4j because the changes persist across multiple requests, and I 
don't have any in-application caching. Also, JVisualVM shows that most of 
the time in my application is spent in various MuninPage methods.


For reference, here’s my code, in Scala. I can translate this into Java if 
that will help: http://pastebin.com/sZ3EwLB1


Apologies for the long post--I'm just not sure where to begin. Again, I'd 
appreciate any guidance.


Thanks,

Dave

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.