#!/usr/bin/env python3
"""
Ingest Space/Astronomy knowledge base into the brain system.
Creates:
- 1 umbrella entity (space)
- 5 category entities (solar_system, planets, moon, stars, earth_space)
- ~20 concept entities
- Edges: part_of, co_occurs
Usage:
python3 ~/wiki/ingest_space_knowledge.py
python3 ~/wiki/ingest_space_knowledge.py --dry
python3 ~/wiki/ingest_space_knowledge.py --query
"""
import sys
from pathlib import Path
from datetime import date
sys.path.insert(0, str(Path.home() / '.hermes' / 'brain'))
import brain
brain._db_connection = None
brain.init_db()
TODAY = date.today().isoformat()
def ce(content, category, entity_type="space_concept", pinned=False, strength="moderate"):
return brain.create_entity(
content=content,
entity_type=entity_type,
category=category,
strength=strength,
pinned=pinned,
metadata={"source": "space_knowledge_ingest", "date": TODAY},
log=True,
)
DATA = {
"umbrella": {
"category": "space",
"content": f"""## Space & Astronomy β 2nd Grade Knowledge Base
General knowledge about space, the solar system, planets, stars, and the night sky.
Complements the science curriculum (which focuses on earth science) by covering
astronomical concepts not taught in weekly science lessons.
### Domains
- **Solar System:** The Sun and everything that orbits it
- **Planets:** All 8 planets β what makes each one special
- **The Moon:** Earth's natural satellite, phases, eclipses
- **Stars & Constellations:** Night sky, stars, constellations, the Milky Way
- **Earth in Space:** Day/night, seasons, orbit, rotation
### Key Concepts
- 8 planets: Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune
- The Sun is a star at the center of our solar system
- The Moon orbits Earth and has 4 main phases
- Stars are far away suns β they look small because of distance
- Earth rotates (day/night) and revolves around the Sun (seasons)
**Ingested:** {TODAY}
**Source:** Space knowledge base (general education)
"""
},
"categories": [
{
"category": "space/solar_system",
"type": "space_category",
"content": """## The Solar System
Our Sun and everything that orbits it β planets, moons, asteroids, comets, and more.
### What's in Our Solar System
- **The Sun** β A star at the center. Holds everything together with gravity.
- **8 Planets** β Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune
- **Dwarf Planets** β Pluto, Ceres, Eris (smaller than planets)
- **Moons** β Over 200 known moons orbiting planets (Earth has 1)
- **Asteroids** β Rocky objects, mostly in the asteroid belt between Mars and Jupiter
- **Comets** β Ice and dust that orbit the Sun in long paths, creating tails
### Inner vs Outer Planets
- **Inner (Rocky) Planets:** Mercury, Venus, Earth, Mars
- Made of rock and metal
- Closest to the Sun
- Smaller, no rings
- **Outer (Gas Giant) Planets:** Jupiter, Saturn, Uranus, Neptune
- Made of gas (hydrogen, helium) and ice
- Farthest from the Sun
- Larger, have rings and many moons
### Key Facts
- Our solar system is about 4.6 billion years old
- The Sun contains 99.8% of all the mass in the solar system
- Light from the Sun takes about 8 minutes to reach Earth
- If the solar system were the size of a basketball court, Earth would be a grain of rice"""
},
{
"category": "space/planets",
"type": "space_category",
"content": """## Planets of the Solar System
All 8 planets, ordered from closest to the Sun to farthest.
### Order (Memory Aid)
"My Very Educated Mother Just Served Us Noodles"
**M**ercury, **V**enus, **E**arth, **M**ars, **J**upiter, **S**aturn, **U**ranus, **N**eptune
### The 8 Planets
1. **Mercury** β Closest to the Sun, smallest planet
2. **Venus** β Hottest planet (thick clouds trap heat), "Earth's twin" in size
3. **Earth** β Our home, only planet known to have life
4. **Mars** β The "Red Planet", has the tallest volcano (Olympus Mons)
5. **Jupiter** β Largest planet, Great Red Spot is a giant storm
6. **Saturn** β Famous for its beautiful rings, could float in water
7. **Uranus** β Spins on its side, has faint rings
8. **Neptune** β Farthest planet, very windy and cold
### Pluto β Not a Planet Anymore
Pluto was considered the 9th planet until 2006. Scientists reclassified it
as a "dwarf planet" because it's small and shares its orbital neighborhood
with other objects in the Kuiper Belt. It's still interesting though!"""
},
{
"category": "space/moon",
"type": "space_category",
"content": """## The Moon
Earth's only natural satellite β always with us in the night sky.
### Basic Facts
- The Moon orbits Earth every ~27 days
- It's about 240,000 miles (384,000 km) from Earth
- The Moon has no atmosphere (no air), no water, no life
- Gravity on the Moon is 1/6 of Earth's β you'd bounce if you jumped!
### Moon Phases (4 Main Phases)
1. **New Moon** β Can't see the Moon (dark side faces Earth)
2. **First Quarter** β Right half lit
3. **Full Moon** β Entire face lit (brightest)
4. **Last Quarter** β Left half lit
The phases repeat in a cycle about every 29.5 days.
### Fun Facts
- The Moon always shows the same face to Earth (tidal locking)
- The Moon causes ocean tides through its gravitational pull
- Apollo 11 was the first mission to land humans on the Moon (1969)
- There are dark patches on the Moon called "maria" (Latin for "seas") β they're actually ancient lava flows
- You can see craters on the Moon β they're from space rocks hitting the surface"""
},
{
"category": "space/stars",
"type": "space_category",
"content": """## Stars & Constellations
The lights in the night sky β our Sun and everything like it.
### What Are Stars?
- A star is a giant ball of hot gas (mostly hydrogen and helium)
- Stars make their own light and heat through nuclear fusion
- Our Sun is a star β it looks big because it's closest to us
- There are billions of stars in our galaxy (the Milky Way)
- At night, the stars we see are suns from other solar systems
### Star Facts
- Stars come in different sizes, colors, and temperatures
- Blue stars are hottest, red stars are coolest
- Some stars are much bigger than our Sun (supergiants)
- Some stars are smaller (white dwarfs, neutron stars)
- Stars are born in clouds of gas and dust called nebulae
### Constellations
- A constellation is a pattern of stars that people named after shapes
- Different cultures saw different patterns in the same stars
- The stars in a constellation aren't actually close to each other β they just appear that way from Earth
### Famous Constellations
- **Big Dipper** β Looks like a spoon/bucket, part of Ursa Major
- **Orion** β The Hunter, with a belt of 3 stars
- **Ursa Minor** β Contains the North Star (Polaris)
- **Cassiopeia** β Looks like a W or M shape
- **Scorpius** β Looks like a scorpion (visible in summer)
### The North Star (Polaris)
- Always appears in the north β doesn't move while other stars seem to
- Used for navigation for thousands of years
- Found by following the Big Dipper's pointer stars"""
},
{
"category": "space/earth_orbit",
"type": "space_category",
"content": """## Earth in Space
How Earth moves through space and why we have day, night, and seasons.
### Earth's Two Main Movements
**Rotation** β Earth spinning on its axis
- Takes about 24 hours (one day)
- Causes day and night
- The side facing the Sun has daylight, the dark side has night
- Earth spins from west to east, so the Sun appears to rise in the east
**Revolution** β Earth orbiting around the Sun
- Takes about 365 days (one year)
- Earth's tilted axis + orbit = seasons
- Earth is about 93 million miles from the Sun
### Why We Have Seasons
- Earth's axis is tilted at 23.5 degrees
- This tilt stays pointing in the same direction as Earth orbits the Sun
- **Summer** β Your hemisphere is tilted TOWARD the Sun (more direct sunlight, longer days)
- **Winter** β Your hemisphere is tilted AWAY from the Sun (less direct sunlight, shorter days)
- **Spring & Fall** β Transition periods (equal sunlight)
- Seasons are NOT caused by Earth being closer or farther from the Sun
### The Equinox & Solstice
- **Vernal Equinox** (~March 20) β Day and night are equal (spring begins)
- **Summer Solstice** (~June 21) β Longest day of the year
- **Autumnal Equinox** (~September 22) β Day and night are equal (fall begins)
- **Winter Solstice** (~December 21) β Shortest day of the year"""
},
],
"concepts": [
{
"category": "space/planet/mercury",
"content": """## Mercury
The smallest planet and closest to the Sun.
### Key Facts
- **Distance from Sun:** 36 million miles (58 million km) β closest
- **Size:** Smallest planet (slightly larger than Earth's Moon)
- **Temperature:** -290Β°F at night to 800Β°F during the day (hottest swings!)
- **Day length:** 59 Earth days (very slow rotation)
- **Year length:** 88 Earth days (shortest year)
- **Moons:** None
- **Rings:** None
### What It's Like
- Surface covered in craters (looks like our Moon)
- No atmosphere to hold in heat
- Named after the Roman messenger god (it moves fastest)
- If you could stand on Mercury, the Sun would look 3Γ bigger than from Earth"""
},
{
"category": "space/planet/venus",
"content": """## Venus
The hottest planet β a runaway greenhouse effect makes it unbearable.
### Key Facts
- **Distance from Sun:** 67 million miles (108 million km)
- **Size:** Similar to Earth (about 95% of Earth's size) β "Earth's twin"
- **Temperature:** 900Β°F (475Β°C) β hottest planet!
- **Day length:** 243 Earth days (longer than its year!)
- **Year length:** 225 Earth days
- **Moons:** None
- **Rings:** None
### Why So Hot?
- Thick clouds of carbon dioxide trap heat (greenhouse effect)
- Like a blanket that never opens β heat gets in but can't escape
- Hot enough to melt lead!
### Fun Facts
- Venus spins backward (retrograde rotation) compared to most planets
- Brightest planet in the night sky (after the Moon) β called the "Morning Star" or "Evening Star"
- Named after the Roman goddess of love and beauty"""
},
{
"category": "space/planet/earth",
"content": """## Earth
Our home β the only planet known to support life.
### Key Facts
- **Distance from Sun:** 93 million miles (150 million km) β the "Goldilocks Zone"
- **Size:** 5th largest planet
- **Temperature:** Averages about 59Β°F (15Β°C)
- **Day length:** 24 hours
- **Year length:** 365 days
- **Moons:** 1 (the Moon)
- **Rings:** None
### Why Life Exists Here
- **Liquid water** β About 71% of Earth's surface is water
- **Right temperature** β Not too hot, not too cold ("Goldilocks Zone")
- **Atmosphere** β Protects us from harmful radiation and holds in heat
- **Oxygen** β We need it to breathe (plants make it)
- **Magnetic field** β Protects us from solar wind
### Fun Facts
- Earth is not a perfect sphere β it bulges at the equator
- About 4.5 billion years old
- The tallest mountain: Mount Everest (29,032 ft)
- The deepest ocean point: Mariana Trench (36,070 ft deep)
- Earth moves through space at about 67,000 mph around the Sun"""
},
{
"category": "space/planet/mars",
"content": """## Mars
The Red Planet β humanity's next destination for exploration.
### Key Facts
- **Distance from Sun:** 142 million miles (228 million km)
- **Size:** About half of Earth's size
- **Temperature:** Averages -80Β°F (-60Β°C) β very cold
- **Day length:** 24 hours 37 minutes (almost the same as Earth!)
- **Year length:** 687 Earth days
- **Moons:** 2 (Phobos and Deimos β tiny, potato-shaped)
- **Rings:** None
### Why Is It Red?
- Iron oxide (rust) in the soil and rocks gives Mars its red color
- If you left a bike on Mars, it would rust very quickly!
### What's on Mars
- **Olympus Mons** β Tallest volcano in the solar system (3Γ Mount Everest!)
- **Valles Marineris** β A canyon system 4,000 miles long
- **Polar ice caps** β Made of water ice and frozen carbon dioxide ("dry ice")
- Evidence that Mars once had liquid water
### Exploration
- Rovers: Spirit, Opportunity, Curiosity, Perseverance
- Perseverance is looking for signs of ancient microbial life
- Many plans to send humans to Mars in the coming decades"""
},
{
"category": "space/planet/jupiter",
"content": """## Jupiter
The king of the planets β the largest by far.
### Key Facts
- **Distance from Sun:** 484 million miles (778 million km)
- **Size:** 11Γ wider than Earth β could fit 1,300 Earths inside it!
- **Temperature:** -160Β°F at the cloud tops
- **Day length:** 10 hours (fastest rotation!)
- **Year length:** 12 Earth years
- **Moons:** 95 known moons (and counting)
- **Rings:** Yes, but faint
### The Great Red Spot
- A giant storm that has been raging for at least 350 years
- Big enough to swallow Earth 3 times over
- Wind speeds up to 400 mph
### Major Moons (The Galilean Moons)
- **Io** β Most volcanic world in the solar system
- **Europa** β Ice-covered ocean underneath β could harbor life!
- **Ganymede** β Largest moon in the solar system (bigger than Mercury!)
- **Callisto** β Most heavily cratered object in the solar system
### Fun Facts
- Jupiter is a gas giant β no solid surface to stand on
- Made mostly of hydrogen and helium (like the Sun)
- Acts as a "vacuum cleaner" β its gravity protects inner planets from asteroids"""
},
{
"category": "space/planet/saturn",
"content": """## Saturn
The jewel of the solar system β famous for its spectacular rings.
### Key Facts
- **Distance from Sun:** 886 million miles (1.4 billion km)
- **Size:** 9Γ wider than Earth β could fit 760 Earths inside it!
- **Temperature:** -220Β°F at the cloud tops
- **Day length:** 10.7 hours
- **Year length:** 29 Earth years
- **Moons:** 146 known moons (most of any planet!)
- **Rings:** The most spectacular in the solar system
### Saturn's Rings
- Made of billions of pieces of ice and rock
- Range from tiny grains to house-sized chunks
- Extend up to 175,000 miles from the planet but are only about 30 feet thick
- There are gaps in the rings caused by moon gravity
### Titan β Saturn's Biggest Moon
- Larger than Mercury and Pluto
- Only moon with a thick atmosphere
- Has lakes of liquid methane and ethane
- Could have conditions for some form of life
### Fun Facts
- Saturn is the least dense planet β it would float in water (if you could find a bathtub big enough!)
- Has hexagonal clouds at its north pole β a wind pattern unique in the solar system
- Named after the Roman god of agriculture"""
},
{
"category": "space/planet/uranus",
"content": """## Uranus
The sideways planet β it rolls around the Sun on its side.
### Key Facts
- **Distance from Sun:** 1.8 billion miles (2.9 billion km)
- **Size:** 4Γ wider than Earth β could fit 63 Earths inside
- **Temperature:** -350Β°F β coldest planet!
- **Day length:** 17 hours
- **Year length:** 84 Earth years
- **Moons:** 27 known moons
- **Rings:** Yes, 13 faint rings discovered in 1977
### Why Does It Spin on Its Side?
- Uranus is tilted 98 degrees β essentially rolling around the Sun
- Scientists think a massive collision early in its history knocked it over
- This means each pole gets 42 years of continuous sunlight, then 42 years of darkness
### What Makes It Blue-Green?
- Methane gas in the atmosphere absorbs red light and reflects blue-green
- Uranus and Neptune are called "ice giants" (different from gas giants)
### Fun Facts
- Discovered by William Herschel in 1781 β first planet found with a telescope
- Named after the Greek god of the sky
- The windiest planet with winds up to 560 mph"""
},
{
"category": "space/planet/neptune",
"content": """## Neptune
The farthest planet β windy, cold, and beautiful blue.
### Key Facts
- **Distance from Sun:** 2.8 billion miles (4.5 billion km) β farthest
- **Size:** 4Γ wider than Earth (similar to Uranus)
- **Temperature:** -350Β°F (very cold)
- **Day length:** 16 hours
- **Year length:** 165 Earth years
- **Moons:** 16 known moons
- **Rings:** Yes, faint rings
### Triton β Neptune's Biggest Moon
- One of the coldest places in the solar system (-390Β°F)
- Orbits backward (retrograde) β probably captured by Neptune's gravity
- Has geysers that shoot nitrogen gas into space
### What Makes It Blue?
- Methane in the atmosphere absorbs red light and reflects blue
- The blue is even deeper than Uranus's β Neptune is a rich, vivid blue
### Fun Facts
- Winds on Neptune are the fastest in the solar system (up to 1,200 mph!)
- Neptune was the first planet found by math β astronomers noticed Uranus's orbit was wobbly and predicted Neptune's position
- Only been visited once β by Voyager 2 in 1989 (took 12 years to get there!)
- Takes 165 Earth years to orbit the Sun β it just completed its first full orbit since discovery"""
},
{
"category": "space/moon_phases",
"content": """## Moon Phases
The Moon appears to change shape throughout the month β these changes are called phases.
### The 8 Phases (in order)
1. **New Moon** β Dark, not visible (Moon between Earth and Sun)
2. **Waxing Crescent** β Thin sliver of light on the right
3. **First Quarter** β Right half lit
4. **Waxing Gibbous** β More than half lit, growing
5. **Full Moon** β Entire face lit (Earth between Moon and Sun)
6. **Waning Gibbous** β More than half lit, shrinking
7. **Last Quarter** β Left half lit
8. **Waning Crescent** β Thin sliver of light on the left
### Key Terms
- **Waxing** = Growing (getting bigger)
- **Waning** = Shrinking (getting smaller)
- The full cycle takes about 29.5 days
### Memory Aid
"Wax on, Wane off" β The Moon waxes (grows) from right to left, then wanes (shrinks) from right to left.
### Why Do Phases Happen?
- The Moon doesn't actually change shape
- We see different amounts of the sunlit side as the Moon orbits Earth
- The side facing away from us is always dark (night on the Moon)"""
},
{
"category": "space/eclipses",
"content": """## Eclipses
When the Sun, Earth, and Moon line up and one blocks the light of another.
### Solar Eclipse β Moon blocks the Sun
- The Moon passes between the Sun and Earth
- The Moon's shadow falls on Earth
- You can see it from a small area on Earth
- Happens during a New Moon
- **Total solar eclipse:** Moon completely covers the Sun (rare, spectacular!)
- **Partial solar eclipse:** Moon only partially covers the Sun
### Lunar Eclipse β Earth blocks sunlight to the Moon
- Earth passes between the Sun and the Moon
- Earth's shadow falls on the Moon
- You can see it from anywhere on the night side of Earth
- Happens during a Full Moon
- The Moon often looks reddish during a lunar eclipse ("Blood Moon")
### Why Don't Eclipses Happen Every Month?
- The Moon's orbit is tilted relative to Earth's orbit
- Most months, the Moon passes above or below Earth's shadow
- Eclipses only happen when the Moon crosses the same plane as Earth's orbit
### Safety
- NEVER look directly at the Sun during a solar eclipse without proper eclipse glasses
- A lunar eclipse is safe to watch with your naked eyes"""
},
{
"category": "space/constellations",
"content": """## Constellations
Star patterns that have been named and recognized for thousands of years.
### What Are Constellations?
- A constellation is a group of stars that form a recognizable pattern
- The stars in a constellation aren't necessarily close to each other β they just appear aligned from our viewpoint on Earth
- There are 88 officially recognized constellations
- Different cultures named the same stars differently
### Most Famous Constellations
**Big Dipper (Ursa Major)**
- Looks like a spoon or bucket
- The two "pointer" stars point to the North Star
- Visible year-round in the Northern Hemisphere
**Orion (The Hunter)**
- Three stars in a row = "Orion's Belt"
- Very bright and easy to find in winter
- One of the most recognizable constellations
**Ursa Minor (Little Dipper)**
- Contains Polaris (the North Star)
- Smaller version of the Big Dipper
**Cassiopeia**
- Looks like a W or M shape
- Easy to spot β it's quite bright
- Named after a queen in Greek mythology
**Scorpius**
- Looks like a scorpion with a curved tail
- Visible in summer
- Has Antares, a bright red star (the "heart of the scorpion")
### Why Constellations Change Seasonally
- As Earth orbits the Sun, we face different directions in space at night
- Different constellations become visible at different times of year"""
},
{
"category": "space/the_sun",
"content": """## The Sun
The star at the center of our solar system β the source of all energy for life on Earth.
### Key Facts
- **Type:** Star (yellow dwarf / G-type main sequence star)
- **Size:** 109Γ wider than Earth β could fit 1.3 million Earths inside!
- **Temperature:** Surface is about 10,000Β°F (5,500Β°C), core is 27 millionΒ°F (15 millionΒ°C)
- **Age:** About 4.6 billion years old (middle-aged)
- **Distance from Earth:** 93 million miles (150 million km)
- **Light travel time:** 8 minutes and 20 seconds
### What Is the Sun Made Of?
- Mostly hydrogen (73%) and helium (25%)
- Nuclear fusion in the core turns hydrogen into helium, releasing energy
- This energy travels outward and reaches us as light and heat
### Why the Sun Matters
- Provides light for daytime
- Provides heat for Earth's climate
- Powers plant growth (photosynthesis) β base of the food chain
- Drives weather patterns (wind, rain, ocean currents)
- Without the Sun, Earth would be a frozen, dark rock
### Sun Features
- **Sunspots** β Darker, cooler areas on the surface
- **Solar flares** β Explosions of energy
- **Solar wind** β Stream of charged particles that causes auroras (Northern/Southern Lights)"""
},
{
"category": "space/asteroids_comets",
"content": """## Asteroids, Comets & Meteors
Small objects in space β the debris of planet formation.
### Asteroids
- Rocky objects orbiting the Sun
- Mostly found in the **asteroid belt** between Mars and Jupiter
- Range from tiny rocks to Ceres (dwarf planet, 600 miles wide)
- Made of rock and metal
- Named after Greek heroes or mythology
- Sometimes called "minor planets" or "planetoids"
### Comets
- Made of ice, dust, and rock β "dirty snowballs"
- Orbit the Sun in long, elliptical paths
- When close to the Sun, ice melts and creates a glowing **tail** that always points away from the Sun
- Famous comets: Halley's Comet (returns every 75 years), Comet Hale-Bopp (1997)
- Come from the Kuiper Belt and Oort Cloud (far outside Neptune)
### Meteors
- A **meteoroid** is a small piece of rock or metal in space
- A **meteor** (shooting star) is what we see when a meteoroid burns up in Earth's atmosphere
- A **meteorite** is what hits the ground if any piece survives
- Meteor showers happen when Earth passes through comet debris trails
- Famous meteor shower: Perseids (August), Leonids (November)
### Key Difference
- Asteroids = rock, in the asteroid belt
- Comets = ice + dust, with tails
- Meteors = the streak of light in our sky"""
},
{
"category": "space/space_exploration",
"content": """## Space Exploration
How humans study and travel through space.
### Spacecraft
- **Satellites** β Orbit Earth for communication, weather, GPS
- **Space stations** β Living labs in orbit (International Space Station)
- **Rovers** β Drive on other planets (Mars rovers: Curiosity, Perseverance)
- **Probes** β Fly by or orbit distant planets (Voyager 1 & 2, Cassini, New Horizons)
- **Telescopes** β Observe space from orbit (Hubble, James Webb)
### Rockets
- Powerful engines that push spacecraft out of Earth's atmosphere
- NASA's Space Shuttle, SpaceX Falcon rockets, Saturn V (Apollo)
- Rockets need a LOT of fuel to escape Earth's gravity
### Important Milestones
- 1957: Sputnik β First satellite (Soviet Union)
- 1961: Yuri Gagarin β First human in space
- 1969: Apollo 11 β First humans on the Moon (Neil Armstrong, Buzz Aldrin)
- 1990: Hubble Space Telescope launched
- 1998: International Space Station assembly begins
- 2012: Curiosity rover lands on Mars
- 2021: James Webb Space Telescope launched
### The International Space Station (ISS)
- A space lab orbiting 250 miles above Earth
- Complete one orbit every 90 minutes
- Astronauts live and work there for 6+ months at a time
- Built by NASA, Roscosmos, ESA, JAXA, and CSA together"""
},
{
"category": "space/galaxies",
"content": """## Galaxies & The Universe
Our solar system is just one tiny part of a vast cosmos.
### What Is a Galaxy?
- A galaxy is a huge collection of stars, gas, dust, and dark matter
- Galaxies contain billions to trillions of stars
- Our galaxy is called the **Milky Way**
### The Milky Way
- Contains about 200-400 billion stars (our Sun is one of them)
- Spiral shape with arms (like a pinwheel)
- Our solar system is in one of the spiral arms, about halfway from the center
- The Milky Way is about 100,000 light-years across
- There's a supermassive black hole at the center
### Types of Galaxies
- **Spiral** β Pinwheel shape (like the Milky Way)
- **Elliptical** β Round or oval, no spiral arms
- **Irregular** β No defined shape
### The Universe
- Contains billions of galaxies
- The observable universe is about 93 billion light-years across
- A light-year is the distance light travels in one year (about 6 trillion miles)
- The universe is still expanding β getting bigger every day
- The Big Bang happened about 13.8 billion years ago
### Scale (to help understand)
- Earth β Moon: 240,000 miles
- Earth β Sun: 93 million miles
- Sun β nearest star: 25 trillion miles (4 light-years)
- Milky Way: 200+ billion stars
- Observable universe: 2+ trillion galaxies"""
},
],
}
def main():
mode = sys.argv[1] if len(sys.argv) > 1 else "--ingest"
if mode == "--query":
run_queries()
return
if mode == "--dry":
print("=== Space Knowledge Base (DRY RUN) ===")
print(f" 1 umbrella entity")
print(f" {len(DATA['categories'])} category entities")
print(f" {len(DATA['concepts'])} concept entities")
print(f" Total: {1 + len(DATA['categories']) + len(DATA['concepts'])} entities")
return
print("=== Space Knowledge Base Ingestion ===")
# Umbrella
umbrella_id = ce(
DATA["umbrella"]["content"],
DATA["umbrella"]["category"],
entity_type="space_umbrella",
pinned=True,
strength="strong",
)
print(f" β
Umbrella: space β {umbrella_id[:16]}")
# Categories
cat_ids = {}
for cat in DATA["categories"]:
cid = ce(
cat["content"],
cat["category"],
entity_type=cat["type"],
pinned=True,
strength="strong",
)
cat_ids[cat["category"]] = cid
brain.add_edge(cid, "part_of", umbrella_id)
print(f" β
Category: {cat['category']} β {cid[:16]}")
# Concepts
for concept in DATA["concepts"]:
eid = ce(
concept["content"],
concept["category"],
)
# Link to parent category
for cat_name, cat_id in cat_ids.items():
if concept["category"].startswith(cat_name):
brain.add_edge(eid, "part_of", cat_id)
break
print(f" β
Concept: {concept['category']} β {eid[:16]}")
total = 1 + len(DATA["categories"]) + len(DATA["concepts"])
print(f"\n=== DONE: {total} space entities ingested ===")
# Auto-run queries
run_queries()
def run_queries():
queries = [
"solar system planets order",
"moon phases waxing waning",
"what causes day and night",
"why we have seasons",
"constellations big dipper orion",
"what are stars made of",
"jupiter great red spot",
"mars red planet rover",
"saturn rings",
"what is a comet asteroid",
"lunar eclipse solar eclipse",
"milky way galaxy",
"space exploration moon landing",
]
print("\n=== TEST QUERIES ===")
passed = 0
for q in queries:
result = brain.search(q, limit=3)
hits = len(result) if result else 0
status = "β" if hits > 0 else "β"
print(f" {status} '{q}' β {hits} hits")
if hits > 0:
passed += 1
print(f"\n Results: {passed}/{len(queries)} queries returned hits")
if __name__ == "__main__":
main()