Thanks for all the replies. To explain what I am doing: I'm harvesting information from the software engineering tool some guys here are using: Excel (gawk!). Excel sheets are parsed and converted to graphs, incrementally enriched with properties as I digest subsequent sheets so that at the end I get a database of everything which I intend to use for export into something useful like Enterprise Architect from Sparx.
The queries I write should do some kind of QA, showing inconsistencies introduced by typos in the sheets or incorrect parsing of free text in the cells. The model excerpt we are looking at is http://neo4j-community-discussions.438527.n3.nabble.com/file/n3545086/mockups.png There are some phenomena I do not understand regarding the query syntax and the resulting nodes: - Query 6 lists all mockups with no relations: 27 items, fine - Query 7 lists all mockups linked to a scenario but not linked to any subprocess: 53 - Query 8 lists all mockups linked to a subprocess but not linked to any scenario: 53. Exactly the same ones - Query 9 lists all mockups linked to both at least one subprocess and scenario: 53. Again, exactly the same ones Query 10 and 11 are the same as 9 and 10, but written according to the hints from the forum. - Query 10 returns no nodes, which I believe is correct, at least according to an overview supplied with the Excel sheet and a few random samples - Query 11 returns a node with _id and mockupName being <null> - huh? I'm using a quickly hacked POJO mapping layer. jo4neo only works up to neo 1.4 so I came up with my own which does the absolute minimum I needed for the job, but as _id is the primary key, I'm pretty sure I don't store such nodes. A bug is always possible, but - Query 19 lists all mockup nodes and there is no one with <null> in both fields. The math: there are 27 unlinked nodes, queries 7, 8, and 9 retrieve the very same 53 nodes which I believe to be linked to both scenarios and subprocesses so either the query or the result must be wrong and query 19 delivers a total of 80 nodes. 27 + 53 = 80. As I already said I'm not familiar with neo and cypher yet, but I do not see the semantic difference between queries 7 and 8 vs. 10 and 11, yet the results differ significantly, and this even between 10 and 11. As an overview, here are the queries and the (shortened) output: 6: Unused mockups START mock=node:nodeIndex(_simpleType = 'Mockup') MATCH ()-[r?:HAS_MOCKUP]->mock WHERE r IS NULL RETURN distinct mock._id, mock.mockupName ORDER BY mock.mockupName +--------------------------------------------------------+ | mock._id | mock.mockupName | +--------------------------------------------------------+ | e80cdb81-9283-3279-9ec4-1c27ace2a3fd | K01-05 | | 5095c15a-3230-3b5a-aa03-acd45057470b | K01-07-0 | ... | 6ba433d8-5989-399a-b463-8a088eafe756 | P2-P04-8-2 | | b3209a20-2081-3444-9047-4615bc6b95b3 | RAO-4-2 | +--------------------------------------------------------+ 27 rows, 37 ms 7: Mockup linked to scenario not used by any subprocess START scenario=node:nodeIndex(_simpleType = 'Scenario'), sub=node:nodeIndex(_simpleType = 'Subprocess') MATCH scenario-[:HAS_MOCKUP]->mock<-[r?:HAS_MOCKUP]-sub WHERE r IS NULL RETURN distinct mock._id, mock.mockupName ORDER BY mock.mockupName +--------------------------------------------------------+ | mock._id | mock.mockupName | +--------------------------------------------------------+ | 81a05542-99b2-3672-8498-a31770562416 | K00-1-1 | | 7bc08fcc-6380-3ba3-810c-b61d85e9d5d4 | K00-2-2 | ... | 0adf74e4-b28f-3301-b903-c65697129c24 | P2-P05-2-1 | | 4db08241-c9d7-3ac4-a453-6e8b5957efdb | P2-P05-2-2 | +--------------------------------------------------------+ 53 rows, 739 ms 8: Mockup linked to subprocess not used by any scenario START scenario=node:nodeIndex(_simpleType = 'Scenario'), sub=node:nodeIndex(_simpleType = 'Subprocess') MATCH sub-[:HAS_MOCKUP]->mock<-[r?:HAS_MOCKUP]-scenario WHERE r IS NULL RETURN distinct mock._id, mock.mockupName ORDER BY mock.mockupName +--------------------------------------------------------+ | mock._id | mock.mockupName | +--------------------------------------------------------+ | 81a05542-99b2-3672-8498-a31770562416 | K00-1-1 | | 7bc08fcc-6380-3ba3-810c-b61d85e9d5d4 | K00-2-2 | ... | 0adf74e4-b28f-3301-b903-c65697129c24 | P2-P05-2-1 | | 4db08241-c9d7-3ac4-a453-6e8b5957efdb | P2-P05-2-2 | +--------------------------------------------------------+ 53 rows, 987 ms 9: Test: Mockups linked to both scenario and subprocess START scenario=node:nodeIndex(_simpleType = 'Scenario'), sub=node:nodeIndex(_simpleType = 'Subprocess') MATCH sub-[:HAS_MOCKUP]->mock<-[:HAS_MOCKUP]-scenario RETURN distinct mock._id, mock.mockupName ORDER BY mock.mockupName +--------------------------------------------------------+ | mock._id | mock.mockupName | +--------------------------------------------------------+ | 81a05542-99b2-3672-8498-a31770562416 | K00-1-1 | | 7bc08fcc-6380-3ba3-810c-b61d85e9d5d4 | K00-2-2 | ... | 0adf74e4-b28f-3301-b903-c65697129c24 | P2-P05-2-1 | | 4db08241-c9d7-3ac4-a453-6e8b5957efdb | P2-P05-2-2 | +--------------------------------------------------------+ 53 rows, 430 ms 10: Test: Mockup linked to scenario not used by any subprocess START scenario=node:nodeIndex(_simpleType = 'Scenario'), sub=node:nodeIndex(_simpleType = 'Subprocess') MATCH scenario-[:HAS_MOCKUP]->mock, subprocess-[r?:HAS_MOCKUP]->mock WHERE r IS NULL RETURN distinct mock._id, mock.mockupName ORDER BY mock.mockupName +----------------------------+ | mock._id | mock.mockupName | +----------------------------+ +----------------------------+ 0 rows, 1997 ms 11: Test: Mockup linked to subprocess not used by any scenario START scenario=node:nodeIndex(_simpleType = 'Scenario'), sub=node:nodeIndex(_simpleType = 'Subprocess') MATCH scenario-[r?:HAS_MOCKUP]->mock, subprocess-[:HAS_MOCKUP]->mock WHERE r IS NULL RETURN distinct mock._id, mock.mockupName ORDER BY mock.mockupName +----------------------------+ | mock._id | mock.mockupName | +----------------------------+ | <null> | <null> | +----------------------------+ 1 rows, 1750 ms 19: All Mockups START mock=node:nodeIndex(_simpleType = 'Mockup') RETURN mock.mockupName ORDER BY mock.mockupName +-----------------+ | mock.mockupName | +-----------------+ | K00-1-1 | | K00-2-2 | ... | P2-P05-2-2 | | RAO-4-2 | +-----------------+ 80 rows, 3 ms -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/cypher-question-subqueries-possible-tp3543685p3545086.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