From 6ede30fb14a8478f14926946a844d27d917a1cfe Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Sun, 21 Sep 2025 21:16:51 +0000 Subject: [PATCH] Add SPECIES_PRESENT table --- db/schemas/sokwedb/tables/Makefile | 3 +- .../sokwedb/tables/create/species_present.m4 | 35 ++++++++++ doc/src/epilog.inc.m4 | 8 +++ doc/src/tables.m4 | 1 + doc/src/tables/species_present.m4 | 69 +++++++++++++++++++ 5 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 db/schemas/sokwedb/tables/create/species_present.m4 create mode 100644 doc/src/tables/species_present.m4 diff --git a/db/schemas/sokwedb/tables/Makefile b/db/schemas/sokwedb/tables/Makefile index 5ec9b89..18a6b8b 100644 --- a/db/schemas/sokwedb/tables/Makefile +++ b/db/schemas/sokwedb/tables/Makefile @@ -29,7 +29,8 @@ ORDER := biography_data \ follow_observers \ follow_studies \ events \ - humans + humans \ + species_present ## ## CAUTION: This Makefile is not designed to be run directly. It is normally ## invoked by another Makefile. diff --git a/db/schemas/sokwedb/tables/create/species_present.m4 b/db/schemas/sokwedb/tables/create/species_present.m4 new file mode 100644 index 0000000..cbe50a1 --- /dev/null +++ b/db/schemas/sokwedb/tables/create/species_present.m4 @@ -0,0 +1,35 @@ +dnl Copyright (C) 2025 The Meme Factory, Inc., http://www.karlpinc.com/ +dnl +dnl This program is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU Affero General Public License as published +dnl by the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU Affero General Public License for more details. +dnl +dnl You should have received a copy of the GNU Affero General Public License +dnl along with this program. If not, see . +dnl +dnl Karl O. Pinc +dnl +dnl +dnl m4 includes +include(`copyright.m4')dnl +include(`constants.m4')dnl +include(`tablemacros.m4')dnl +include(`grants.m4')dnl +dnl + +CREATE TABLE species_present ( + key_column(`SPECIES_PRESENT', `OSID', INTEGER) + ,eid INTEGER NOT NULL + REFERENCES events + ,species TEXT NOT NULL + CONSTRAINT "Species must be a SPECIES.Species value" + REFERENCES species +); + +grant_priv(`SPECIES_PRESENT') diff --git a/doc/src/epilog.inc.m4 b/doc/src/epilog.inc.m4 index 8fbcc13..6d5dc30 100644 --- a/doc/src/epilog.inc.m4 +++ b/doc/src/epilog.inc.m4 @@ -254,6 +254,14 @@ sdb_generated_rst()dnl .. |SPECIES.Species| replace:: :ref:`Species ` +.. |SPECIES_PRESENT| replace:: :ref:`SPECIES_PRESENT ` +.. |SPECIES_PRESENT.OSID| replace:: + :ref:`OSID ` +.. |SPECIES_PRESENT.EID| replace:: + :ref:`EID ` +.. |SPECIES_PRESENT.Species| replace:: + :ref:`Species ` + .. |STUDIES| replace:: :ref:`STUDIES ` .. |STUDIES.Study| replace:: :ref:`Study ` diff --git a/doc/src/tables.m4 b/doc/src/tables.m4 index 062a173..18523b0 100644 --- a/doc/src/tables.m4 +++ b/doc/src/tables.m4 @@ -37,3 +37,4 @@ Data Tables tables/follow_observers.rst tables/follow_studies.rst tables/humans.rst + tables/species_present.rst diff --git a/doc/src/tables/species_present.m4 b/doc/src/tables/species_present.m4 new file mode 100644 index 0000000..89a9162 --- /dev/null +++ b/doc/src/tables/species_present.m4 @@ -0,0 +1,69 @@ +.. Copyright (C) 2025 The Meme Factory, Inc. www.karlpinc.com + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +.. M4 setup +include(constants.m4)dnl +include(macros.m4)dnl +sdb_rst_quotes(`on')dnl +sdb_generated_rst()dnl +.. _SPECIES_PRESENT: + +SPECIES_PRESENT +--------------- + +.. |SPECIES_PRESENT_summary| replace:: + Each row records a kind of, non-chimpanzee, species which + were present. + +|SPECIES_PRESENT_summary| + +The related |EVENTS| row must must be one that records the presence of +other species; the |EVENTS| row with an |EVENTS.EID| value that +matches the SPECIES_PRESENT row's |SPECIES_PRESENT.EID| value must have an |EVENTS|\ +.|EVENTS.Behavior| value of ``sdb_other_species``. + +.. _SPECIES_PRESENT.OSID: + +OSID (Other Species ID) +``````````````````````` + +.. |SPECIES_PRESENT.OSID_summary| replace:: + |idcol| + +|SPECIES_PRESENT.OSID_summary| |notnull| + + +.. _SPECIES_PRESENT.EID: + +EID (Event IDentifier) +`````````````````````` + +.. |SPECIES_PRESENT.EID_summary| replace:: + The |EVENTS|.\ |EVENTS.EID| that identifies the event which records the + presence of non-chimpanzee species. + +|SPECIES_PRESENT.EID_summary| |notnull| + + +.. _SPECIES_PRESENT.Species: + +Species +``````` + +.. |SPECIES_PRESENT.Species_summary| replace:: + A species present during the event; a |SPECIES|\ .|SPECIES.Species| value. + +|SPECIES_PRESENT.Species_summary| +|notnull| -- 2.34.1