I created some vertices to represent MTG cards. Each card has a property called mana_cost
, which is the cost to play that card in the game. The mana_cost
value is stored between curly braces in a string. For example, "{G}{G}" would represent two green mana and "{3}{G}{R}" means that you must pay one red mana (R), one green mana (G) and 3 mana of any color (3).
Here is an example of a creature card I added to the graph:
SELECT * FROM cypher ('MTG', $$
CREATE (c:Creature {
name: 'Slippery Bogle',
set: 'Ultimate Masters (UMA)',
card_number: 223, rarity: 'Uncommon',
mana_cost: '{U/G}',
artist: 'Jesper Ejsing',
power: 1, toughness: 1,
type: 'Beast',
oracle_text: 'Hexproof (This creature can’t be the target of spells or abilities your opponents control.)',
flavor_text: 'Ogle the bogle, or goggle the boggle? Doesn’t matter. You weren’t going to catch it anyway.'
})
RETURN c
$$) AS (creature agtype);
If I wanted to find cards that had a mana_cost
less than or equal to '{2}{G}' and it could find Slippery Bogle (which it's mana_cost
is "{U/G} meaning that it can be one green or blue mana") how would I do it?