UPDATE: tl;dr: db.schema() is broken, use apoc.meta.schema() instead.
I have the following sample cypher, creating some nodes and some relations:
CREATE
(footypeA:Footype {name:'FootypeA'}),
(fooA:Foo {name:'FooA'}),
(fooB:Foo {name:'FooB'}),
(bartypeA:Bartype {name:'BartypeA'}),
(bartypeB:Bartype {name:'BartypeB'}),
(barA:Bar {name:'BarA'}),
(barB:Bar {name:'BarB'}),
(fooA)-[:HAS_TYPE]->(footypeA),
(fooB)-[:HAS_TYPE]->(footypeA),
(barA)-[:HAS_TYPE]->(bartypeA),
(barB)-[:HAS_TYPE]->(bartypeB);
This gives us some nodes and relations as in the image below, in the top section:
But why, oh why, does the call to db.schema in the bottom section show us some ackward meta schema? Why does neo4j think that there is a "has_type" relation from a Foo to a Bartype? I mean, everybody knows that foos and bars are different things...
This is on neo4j-community-3.3.5.
UPDATE: And it turns out, this is a long known bug:
https://github.com/neo4j/neo4j/issues/9726
Workaround:
call apoc.meta.graph()
Silly me, I should have looked up the bug in the first place. Or maybe neo4j should have fixed it? Or changed their documentation?...