Re: [Neo4j] Cypher Query Optimizing
Am 01.12.2011 01:48, schrieb Michael Hunger: Martin, Michael, :) would you be so kind as to test the current neo4j-1.6 snapshot with your query? I used neo4j 1.6 M01 community edition for my tests. We did some changes in cypher and would like to see how that affects your query. Thanks a lot Michael Greetings, Martin Am 30.11.2011 um 18:34 schrieb Martin Junghanns: @Tero @Krzysztof thx for your fast replies. @Krzysztof for me it was not fairly well known. I will also check out the traverser api. @Tero I tried the same query using the internal id instead of my mapping index (lucene) orig: START n=node:words(w_id = '137') MATCH n-[:CO_S]-m, n-[:CO_S]- t, m-[r:CO_S]- t return m.w_id, t.w_id, r.sig, r.freq took: 662ms (average of 100 runs after 10 warmups) new: START n=node(119) MATCH n-[:CO_S]-m, n-[:CO_S]- t, m-[r:CO_S]- t return m.w_id, t.w_id, r.sig, r.freq took: 644ms (average of 100 runs after 10 warmups) So it doesn't seem to be much more faster not using the index for node lookup. I will check out your posts concerning Lucene Index. Greetings, Martin Am 30.11.2011 18:08, schrieb Krzysztof Raczyński: It is fairly well known that cypher queries are not (yet) optimised. If speed is a concern for you, try using traversal API, i can confirm it is much faster than cypher. cheers ___ 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] spring data neo4j Relationships
Hey, after reading the docs and looking at the examples, I give up trying to find a solution for myself. The problem is the following: How are @RelationshipEntity classes persistet? I have the same stucture as in the Movies Example: the classes Actor -- Role -- Movie. When adding a new Role to an Actor and saving the Actor Entity using the ActorRepository, the new edges are not persisted in the database. Do I have to persist the Role Entities manually? If yes, what Repository shall I use for that? this is part of my Actor class @GraphId private Long id; // 1:n relation @RelatedToVia CollectionTMS_Rel OpTmRs; // 1:1 relation to store the latest link ... this works and the ede is persistet private TMS OpTmRs_Latest; this is part of my Role class @GraphId Long id; @StartNode WTUR wturInstance; @EndNode TMS tmsInstance; long timestamp; and finally this is the other end of the edge, my Movie class @GraphId private Long id; @RelatedTo(type = TMS_REL, direction = INCOMING) SetWTUR wturs; @RelatedToVia(type = TMS_REL, direction = INCOMING) IterableTMS_Rel tmsRels; So, all single edges work perfectly, but the sets don't. Hope someone can help me out with that Greetings, Martin ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
[Neo4j] Cypher Query Optimizing
Hey, I'm currently converting some SQL Queries to Cypher and I'm very happy to see what is possible with the language. I was wondering if the following query can be optimized, it selects the edges between neighbours of a given node (137) who also know each other: SQL: select w1.w1_id,w1.w2_id,w1.freq,w1.sig from co_s w1 where w1.w1_id in (select w2.w2_id from co_s w2 where w2.w1_id=137) and w1.w2_id in (select w3.w2_id from co_s w3 where w3.w1_id=137); Cypher: START n=node:words(w_id = 137) MATCH n-[:CO_S]-m, n-[:CO_S]- t, m-[r:CO_S]- t return m.w_id, t.w_id, r.sig, r.freq The results are the same, but the Cypher Query is about 10 times slower than the SQL pendant. I currently do not use any additional indices. Just a map (words) between my word ID and the neo4j node id. Thx for your help! Great work! Rock on! Martin (@kc1s) ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Cypher Query Optimizing
@Tero @Krzysztof thx for your fast replies. @Krzysztof for me it was not fairly well known. I will also check out the traverser api. @Tero I tried the same query using the internal id instead of my mapping index (lucene) orig: START n=node:words(w_id = '137') MATCH n-[:CO_S]-m, n-[:CO_S]- t, m-[r:CO_S]- t return m.w_id, t.w_id, r.sig, r.freq took: 662ms (average of 100 runs after 10 warmups) new: START n=node(119) MATCH n-[:CO_S]-m, n-[:CO_S]- t, m-[r:CO_S]- t return m.w_id, t.w_id, r.sig, r.freq took: 644ms (average of 100 runs after 10 warmups) So it doesn't seem to be much more faster not using the index for node lookup. I will check out your posts concerning Lucene Index. Greetings, Martin Am 30.11.2011 18:08, schrieb Krzysztof Raczyński: It is fairly well known that cypher queries are not (yet) optimised. If speed is a concern for you, try using traversal API, i can confirm it is much faster than cypher. cheers ___ 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] Time Series Data with complex domain model
Hey Peter, thanks for the hint. I currently chose another way to store time series. I'll try to use versioned edges like so: node_a --- edge_a (t1) -- node_b If there is an update operation on node b at time t2, a copy of b will be created and referenced like so: node_a -- edge_a(t1) -- node_b node_a -- edge_a (t2) -- node b_new I will test this model with some benchmarks because there are obviously some drawbacks. Maybe you can tell me the best way to handle the edges via Spring Neo4J. Is there any possiblity to index the edges in Spring or define a sort order (maybe by timestamp)? I'd like to select the edge_a with latest timestamp at an instance of Node_A. Is something like ... @RelatedToVia SortedMaplong, Edge_A ... possible? Currently the implementation would look like this way: @NodeEntity class Node_A { @RelatedToVia CollectionEdge_A relations; // ... } @RelationshipEntity class Edge_A { @StartNode Node_A from; @EndNode Node_B to; long timestamp; // ... } @NodeEntity class Node_B { // no need for backward edges } Thanks for your help. Greetings, Martin Am 21.11.2011 14:19, schrieb Peter Neubauer: Martin, for storing times, you could try the timeline index in graph collections if things are not too long linked, see https://github.com/neo4j/graph-collections/blob/master/src/test/java/org/neo4j/collections/timeline/TestTimeline.java or some of the other indexes in that component. Would that help? 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 Tue, Nov 15, 2011 at 11:15 AM, s1ckmartin.jungha...@gmx.net wrote: Hey, I have a very complex domain model which can be perfectly mapped into the neo4j database. OR Mapping is much too complex for the model... The data itself is time series data from multiple sensors which needs to be stored and retrieved (at given timestamps or in given ranges). Are there any good explanations, articles or something else on how to handle this kind of data? The second question is: What's the best way to model a domain in neo4j? I currently use the aproach described in the http://docs.neo4j.org/chunked/milestone/tutorials-java-embedded-entities.html documentation and will also try out the spring graph. Best regards, Martin -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/Time-Series-Data-with-complex-domain-model-tp3509252p3509252.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 mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user