|
| 1 | +#!/bin/bash |
| 2 | +# Brarner.M.Alete™ — Populate Taxonomy Descriptions |
| 3 | +# Creates taxonomy_descriptions table and populates with Wikipedia-sourced descriptions |
| 4 | +# for kingdom, class, order, and family taxonomic levels. |
| 5 | +# Usage: bash install/populate-taxonomy-descriptions.sh |
| 6 | +set -e |
| 7 | + |
| 8 | +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" |
| 9 | +BMA_ROOT="$(dirname "$SCRIPT_DIR")" |
| 10 | +DB_PROPS="$BMA_ROOT/servlets/servlet/src/main/webapp/WEB-INF/db.properties" |
| 11 | + |
| 12 | +echo "═══════════════════════════════════════════════════════════════" |
| 13 | +echo " Brarner.M.Alete™ — Populate Taxonomy Descriptions" |
| 14 | +echo "═══════════════════════════════════════════════════════════════" |
| 15 | + |
| 16 | +if [ -f "$DB_PROPS" ]; then |
| 17 | + DB_USER=$(grep '^db.user=' "$DB_PROPS" | cut -d= -f2-) |
| 18 | + DB_PASS=$(grep '^db.password=' "$DB_PROPS" | cut -d= -f2-) |
| 19 | + DB_HOST=$(grep '^db.url=' "$DB_PROPS" | sed -n 's|.*://\([^:/]*\).*|\1|p') |
| 20 | + DB_PORT=$(grep '^db.url=' "$DB_PROPS" | sed -n 's|.*:\([0-9]*\)/.*|\1|p') |
| 21 | + DB_HOST="${DB_HOST:-127.0.0.1}" |
| 22 | + DB_PORT="${DB_PORT:-3306}" |
| 23 | + MYSQL_OPTS="-u${DB_USER} -h${DB_HOST} -P${DB_PORT}" |
| 24 | + [ -n "$DB_PASS" ] && MYSQL_OPTS="$MYSQL_OPTS -p${DB_PASS}" |
| 25 | +else |
| 26 | + echo "[!] db.properties not found."; exit 1 |
| 27 | +fi |
| 28 | + |
| 29 | +echo "[*] Creating taxonomy_descriptions table..." |
| 30 | + |
| 31 | +mysql $MYSQL_OPTS << 'SQL' |
| 32 | +USE BrarnerScience; |
| 33 | +
|
| 34 | +CREATE TABLE IF NOT EXISTS taxonomy_descriptions ( |
| 35 | + id INT AUTO_INCREMENT PRIMARY KEY, |
| 36 | + rank_level ENUM('kingdom','phylum','class','order','family') NOT NULL, |
| 37 | + taxon_name VARCHAR(200) NOT NULL, |
| 38 | + description TEXT, |
| 39 | + characteristics TEXT, |
| 40 | + example_species VARCHAR(500), |
| 41 | + wikipedia_url VARCHAR(500), |
| 42 | + created_at DATETIME DEFAULT CURRENT_TIMESTAMP, |
| 43 | + UNIQUE KEY uk_rank_taxon (rank_level, taxon_name), |
| 44 | + INDEX idx_rank (rank_level), |
| 45 | + INDEX idx_name (taxon_name) |
| 46 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |
| 47 | +
|
| 48 | +-- Kingdom descriptions |
| 49 | +INSERT INTO taxonomy_descriptions (rank_level, taxon_name, description, characteristics, example_species, wikipedia_url) VALUES |
| 50 | +('kingdom', 'Animalia', 'The kingdom of multicellular eukaryotic organisms that form the biological kingdom Animalia. Animals are motile, heterotrophic (consume organic material), and generally reproduce sexually.', 'Multicellular, eukaryotic, heterotrophic, motile at some life stage, no cell walls, embryonic development through blastula stage', 'Homo sapiens, Canis lupus, Aquila chrysaetos, Tursiops truncatus', 'https://en.wikipedia.org/wiki/Animal') |
| 51 | +ON DUPLICATE KEY UPDATE description=VALUES(description), characteristics=VALUES(characteristics); |
| 52 | +
|
| 53 | +-- Class descriptions (Mollusca and worm-like invertebrates from the URL path shown) |
| 54 | +INSERT INTO taxonomy_descriptions (rank_level, taxon_name, description, characteristics, example_species, wikipedia_url) VALUES |
| 55 | +('class', 'Aplotegmentaria', 'A class of shell-less, worm-like molluscs (solenogasters/aplacophorans). These marine animals lack a shell and mantle cavity, instead having a body covered with calcareous spicules embedded in a cuticle.', 'Vermiform (worm-shaped), no shell, calcareous spicules in cuticle, marine benthic, feed on cnidarians or detritus, hermaphroditic', 'Neomenia carinata, Epimenia australis, Wirenia argentea', 'https://en.wikipedia.org/wiki/Solenogastres'), |
| 56 | +('class', 'Gastropoda', 'The largest class of molluscs with over 65,000 living species. Includes snails and slugs. Characterized by torsion (180° twisting of the visceral mass) and usually a coiled shell.', 'Torsion, muscular foot, radula, usually coiled shell (lost in slugs), marine/freshwater/terrestrial', 'Helix pomatia, Littorina littorea, Aplysia californica', 'https://en.wikipedia.org/wiki/Gastropoda'), |
| 57 | +('class', 'Bivalvia', 'A class of molluscs with laterally compressed bodies enclosed by two hinged shells (valves). Mostly filter-feeders living in marine and freshwater habitats.', 'Two hinged shells, laterally compressed, filter-feeding via gills, no head or radula, sessile or burrowing', 'Mytilus edulis, Crassostrea gigas, Pecten maximus', 'https://en.wikipedia.org/wiki/Bivalvia'), |
| 58 | +('class', 'Cephalopoda', 'The most neurologically advanced class of molluscs including octopuses, squids, cuttlefish, and nautiluses. Characterized by bilateral symmetry, a prominent head, and modified muscular arms/tentacles.', 'Bilateral symmetry, jet propulsion, complex nervous system, chromatophores, beak, arms/tentacles, closed circulatory system', 'Octopus vulgaris, Loligo vulgaris, Sepia officinalis, Nautilus pompilius', 'https://en.wikipedia.org/wiki/Cephalopod'), |
| 59 | +('class', 'Mammalia', 'Warm-blooded vertebrates characterized by mammary glands, hair/fur, three middle ear bones, and a neocortex. Over 6,400 living species.', 'Endothermic, mammary glands, hair, live birth (most), neocortex, single-boned lower jaw, specialized teeth', 'Homo sapiens, Balaenoptera musculus, Panthera leo', 'https://en.wikipedia.org/wiki/Mammal'), |
| 60 | +('class', 'Aves', 'Feathered, winged, bipedal, warm-blooded, egg-laying vertebrates. Over 10,000 living species. Characterized by toothless beaked jaws, high metabolic rate, and lightweight skeleton.', 'Feathers, hollow bones, toothless beak, four-chambered heart, endothermic, hard-shelled eggs, high metabolic rate', 'Aquila chrysaetos, Corvus corax, Aptenodytes forsteri', 'https://en.wikipedia.org/wiki/Bird'), |
| 61 | +('class', 'Reptilia', 'Cold-blooded, air-breathing vertebrates covered in scales or scutes. Includes turtles, crocodilians, snakes, lizards, and tuatara.', 'Ectothermic, scales/scutes, amniotic eggs, lungs throughout life, three or four-chambered heart', 'Crocodylus niloticus, Python reticulatus, Chelonia mydas', 'https://en.wikipedia.org/wiki/Reptile'), |
| 62 | +('class', 'Actinopterygii', 'Ray-finned fishes — the largest class of vertebrates with over 30,000 species. Fins supported by bony spines (rays) rather than fleshy lobes.', 'Bony rays in fins, swim bladder, operculum covering gills, scales, lateral line system', 'Salmo salar, Thunnus thynnus, Danio rerio', 'https://en.wikipedia.org/wiki/Actinopterygii'), |
| 63 | +('class', 'Insecta', 'The most species-rich class of animals with over 1 million described species. Three-part body (head, thorax, abdomen), three pairs of legs, compound eyes, and one pair of antennae.', 'Exoskeleton, three body segments, six legs, compound eyes, metamorphosis, tracheal respiration', 'Apis mellifera, Danaus plexippus, Musca domestica', 'https://en.wikipedia.org/wiki/Insect'), |
| 64 | +('class', 'Arachnida', 'Arthropods with eight legs including spiders, scorpions, ticks, and mites. Over 100,000 described species. No antennae or wings.', 'Eight legs, two body segments (cephalothorax + abdomen), chelicerae, no antennae, book lungs or tracheae', 'Latrodectus mactans, Scorpio maurus, Ixodes scapularis', 'https://en.wikipedia.org/wiki/Arachnid') |
| 65 | +ON DUPLICATE KEY UPDATE description=VALUES(description), characteristics=VALUES(characteristics); |
| 66 | +
|
| 67 | +-- Order descriptions |
| 68 | +INSERT INTO taxonomy_descriptions (rank_level, taxon_name, description, characteristics, example_species, wikipedia_url) VALUES |
| 69 | +('order', 'Pholidoskepia', 'An order of solenogasters (shell-less aplacophorans). Small, worm-like marine molluscs covered in scale-like spicules. Found in deep-sea benthic environments feeding on hydroids and other cnidarians.', 'Scale-like calcareous spicules, vermiform, deep-sea benthic, radula present, monaulic reproductive system', 'Epimenia babai, Alexandromenia valida', 'https://en.wikipedia.org/wiki/Pholidoskepia'), |
| 70 | +('order', 'Carnivora', 'Diverse order of placental mammals with specialized teeth and claws for catching and eating other animals. Includes cats, dogs, bears, seals, and weasels.', 'Carnassial teeth, strong jaws, claws, highly developed brain, diverse body plans (terrestrial, aquatic, arboreal)', 'Panthera leo, Canis lupus, Ursus arctos, Phoca vitulina', 'https://en.wikipedia.org/wiki/Carnivora'), |
| 71 | +('order', 'Primates', 'Order of mammals including humans, apes, monkeys, and prosimians. Characterized by large brains, binocular vision, and grasping hands with opposable thumbs.', 'Large brain relative to body, forward-facing eyes, grasping hands, nails instead of claws, prolonged parental care', 'Homo sapiens, Pan troglodytes, Gorilla gorilla', 'https://en.wikipedia.org/wiki/Primate'), |
| 72 | +('order', 'Lepidoptera', 'Order of insects comprising butterflies and moths. Over 180,000 species. Characterized by scale-covered wings and complete metamorphosis.', 'Scaled wings, coiled proboscis, complete metamorphosis (egg-larva-pupa-adult), holometabolous', 'Danaus plexippus, Bombyx mori, Papilio machaon', 'https://en.wikipedia.org/wiki/Lepidoptera'), |
| 73 | +('order', 'Coleoptera', 'Beetles — the largest order of insects and animals, with over 400,000 described species. Front wings hardened into elytra.', 'Hardened forewings (elytra), complete metamorphosis, chewing mouthparts, diverse habitats', 'Coccinella septempunctata, Lucanus cervus, Dynastes hercules', 'https://en.wikipedia.org/wiki/Beetle') |
| 74 | +ON DUPLICATE KEY UPDATE description=VALUES(description), characteristics=VALUES(characteristics); |
| 75 | +
|
| 76 | +-- Family descriptions |
| 77 | +INSERT INTO taxonomy_descriptions (rank_level, taxon_name, description, characteristics, example_species, wikipedia_url) VALUES |
| 78 | +('family', 'Lepidomeniidae', 'A family of solenogasters (order Pholidoskepia). Small, worm-like, shell-less aplacophoran molluscs with distinctive scale-shaped calcareous spicules covering the body. Marine benthic organisms found in deep-sea environments.', 'Scale-shaped spicules (lepido- = scale), vermiform body 2-30mm, no mantle cavity, deep-sea habitat, feed on hydrozoans', 'Lepidomenia hystrix, Lepidomenia australis', 'https://en.wikipedia.org/wiki/Lepidomeniidae'), |
| 79 | +('family', 'Felidae', 'The cat family. Obligate carnivores with retractable claws, powerful jaws, and excellent night vision. 37 living species across all continents except Antarctica and Australia (historically).', 'Retractable claws, digitigrade locomotion, specialized carnassial teeth, binocular vision, flexible spine', 'Panthera leo, Felis catus, Panthera tigris, Acinonyx jubatus', 'https://en.wikipedia.org/wiki/Felidae'), |
| 80 | +('family', 'Canidae', 'The dog family. Social carnivores with non-retractable claws and long muzzles. Includes wolves, foxes, jackals, and domestic dogs.', 'Non-retractable claws, long muzzle, bushy tail, digitigrade, social pack behavior (many species)', 'Canis lupus, Vulpes vulpes, Canis latrans', 'https://en.wikipedia.org/wiki/Canidae'), |
| 81 | +('family', 'Hominidae', 'The great ape family including humans, chimpanzees, gorillas, and orangutans. Large-bodied primates with no tail and high cognitive abilities.', 'No tail, large brain, opposable thumbs, flat face, extended development period, tool use', 'Homo sapiens, Pan troglodytes, Gorilla gorilla, Pongo pygmaeus', 'https://en.wikipedia.org/wiki/Hominidae') |
| 82 | +ON DUPLICATE KEY UPDATE description=VALUES(description), characteristics=VALUES(characteristics); |
| 83 | +
|
| 84 | +SQL |
| 85 | + |
| 86 | +COUNT=$(mysql $MYSQL_OPTS -N -B -e "SELECT COUNT(*) FROM BrarnerScience.taxonomy_descriptions;" 2>/dev/null) |
| 87 | +echo "[✓] taxonomy_descriptions populated: $COUNT records" |
| 88 | +echo " Verify: mysql BrarnerScience -e \"SELECT rank_level, taxon_name FROM taxonomy_descriptions ORDER BY rank_level, taxon_name;\"" |
0 commit comments