# Testing and Example script

from sample import *

init_mother('PUT_HERE_YOUR_CONF_FILE')

# Insert the Sun Star
SunDict= dict(star_name='sun', star_mass=20, star_age=10)
Sun= ClsStars(SunDict, MO_SAVE)

# Insert two plantes on the solar syste...
# note that foreign keys are not specified: Mother handle
# automatically the situation:
EarthDict= dict(planet_name='earth', planet_mass=1)
MarsDict= dict(planet_name='mars', planet_mass=2)

Earth= Sun.insertPlanets(EarthDict)
Mars= Sun.insertPlanets(MarsDict)

# Take all planets on solar system:
MyBox= Sun.getMultiplePlanets()
# Take all planets on solar system with mass > 1:
MyBox= Sun.getMultiplePlanets(filter= 'planet_mass>1')

# Create new form of lifes and, at the same time,
# create a relation with planets to say that a form
# of life is living on the planet:
HumanDict=   dict(life_name='humans', life_age= 12)
MartianDict= dict(life_name='martians')
MouseDict=  dict(life_name='mouses', life_age= 12)

Humans=   Earth.assignLifes(HumanDict, MO_SAVE)
Martians= Mars.assignLifes(MartianDict, MO_SAVE)
Mouses=   Earth.assignLifes(MouseDict, MO_SAVE)

# take all form of lifes living on Earth:
MyBox= Earth.joinLifes()
