I'm not sure what you were trying to achieve, but this is a query (you will need APOC) that will collect all keys and sort them and it will return a set of keys:
MATCH (n:test) RETURN apoc.coll.sort(apoc.coll.toSet(apoc.coll.flatten(collect(keys(n))))) AS Keys;
HI
i should have told you what I try to archiev. It shell be a consitency check. All nodes withe the same label MUST have the same keys. I try to finde out if this is true.
Unfortunately, your answer is not a solution even if I have modified it a little ... (my fault)
MATCH (n:test) Delete n;
CREATE (n:test {name: 'I', prob_AA: 'terst'});
CREATE (n:test {prob_AA: '12QW', name: 'II'});
CREATE (n:test {name: 'III'});
MATCH (n:test {name: 'III'}) SET n.prob_AA = "SDFGHGFDSDFGHJHGFDSASDFGHJK";
CREATE (n:test {prob_cc: '12QW', name: 'OTHER'});
MATCH (n) RETURN apoc.coll.sort(apoc.coll.toSet(apoc.coll.flatten(collect(keys(n))))) AS Keys, labels(n);
Any idea how I can get the info? Create would be if i get a 0 if it is TRUE and FAlse if the keys are different.
thansk rob
Oddly enough, I recently discovered a similar problem that's not correctly answered in this otherwise very interesting and useful video: Lesser Known Features in Cypher - YouTube at 31:40
Here's my solution to fix it
MATCH(p1:Person)-[:ACTED_IN]->(m:Movie)<-[:ACTED_IN]-(p2:Person)
WHERE m.title = 'Top Gun'
WITH p1, p2 ORDER BY [p1.name]
RETURN COLLECT(distinct (apoc.coll.sort([p1.name, p2.name])))