CREATE (sr:Game { name:'Star Realms' }),
(trd:Card { name:'Trade Card' }),
(pdv:Card { name:'Viper' }),
(pds:Card { name:'Scout' }),
(exp:Card { name:'Explorer' }),
(aut:Card { name:'Authority' }),
(sr)-[:CONTAINS_CARDS {quantity:80}]->(trd),
(sr)-[:CONTAINS_CARDS {quantity:4 }]->(pdv),
(sr)-[:CONTAINS_CARDS {quantity:16}]->(pds),
(sr)-[:CONTAINS_CARDS {quantity:10}]->(exp),
(sr)-[:CONTAINS_CARDS {quantity:18}]->(aut)
RETURN *
MATCH (trd:Card { name:'Trade Card' })
CREATE (g:Expansion { name:'Bases and Battleships' }),
(g)-[:CONTAINS_CARDS {quantity:12}]->(trd)
WITH trd
CREATE (g:Expansion { name:'Fleets and Fortresses' }),
(g)-[:CONTAINS_CARDS {quantity:12}]->(trd)
WITH trd
CREATE (g:Expansion { name:'Heroes' }),
(g)-[:CONTAINS_CARDS {quantity:12}]->(trd)
WITH trd
CREATE (g:Expansion { name:'Events' }),
(g)-[:CONTAINS_CARDS {quantity:12}]->(trd)
RETURN trd;
MATCH (g)-[rel:CONTAINS_CARDS]->(c:Card)
WHERE g:Game or g:Expansion
RETURN g.name,labels(g),SUM(rel.quantity) ORDER BY SUM(rel.quantity) DESC;