Skip to content

Add monthly presence and text value types - #75

Merged
ehwenk merged 8 commits into
developfrom
new-trait-types
Nov 15, 2026
Merged

ehwenk merged 8 commits into
developfrom
new-trait-types

Conversation

@dfalster

@dfalster dfalster commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

APD typed its four twelve-month phenology traits as categorical variables with no allowable values, so austraits.build stripped an empty value list from each by name, and nothing said what their values look like.

They are now typed monthly presence (glossary_40126), and a second new value type, text, covers free text values such as taxon names. Monthly presence is a glossary term, since no published vocabulary defines it; text is borrowed from the NCI Thesaurus (NCIT_C25704). The site states a monthly-presence trait's format, and make check fails a trait whose fields disagree with its type. No trait, value, unit or range changes: four ets:valueType statements change, and 27,510 statements become 27,520.

Part of traitecoevo/traits.build#87

🤖 Generated with Claude Code

dfalster and others added 2 commits October 21, 2026 10:17
The four phenology traits record a Y or N per month, and were typed
categorical with no allowable values, which gave austraits.build an
empty list of allowed values. They are now typed month presence
(glossary_40126), and text (glossary_40128) is added for open-ended
values. Both are glossary terms: no published vocabulary has either.

APD_VALUE_TYPES (R/build.R) maps each type to its traits.build kind.
The site states a month-presence trait's format, and make check fails
a trait whose fields disagree with its type.

Refs traitecoevo/traits.build#87

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Generated by make data from the previous commit. 27,510 -> 27,526
statements: seven for each new glossary term, and the glossary's
hasTopConcept for both. The four phenology traits' ets:valueType now
names glossary_40126, and their trait_type in APD_traits.csv reads
"month presence [glossary_40126]". APD_categorical_values.csv is
unchanged.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@dfalster

Copy link
Copy Markdown
Member Author

Working detail for this PR. Companion PRs: traitecoevo/traits.build#306 (adds the month_presence and text trait types; closes traitecoevo/traits.build#87) and traitecoevo/austraits.build#884 (switches config/traits.yml and its generator). Portal follow-up: traitecoevo/austraits.portal#142.

Merge and release order

This PR and traits.build#306 can merge in either order. austraits.build#884 goes last: it needs an APD release carrying these terms, because its generator reads APD's published release (apd_version, pinned at 2.1.2 today). The two glossary URIs resolve only once a release is deployed.

Design: the two value types are glossary terms

identifier IRI label definition
glossary_40126 https://w3id.org/APD/glossary/glossary_40126 month presence Twelve characters, one per month starting with January, each Y if the trait (a phenophase such as flowering) occurs in that month and N if it does not.
glossary_40128 https://w3id.org/APD/glossary/glossary_40128 text Open-ended text with no fixed list of allowed values, such as a taxon name. Corresponds to the value type 'character' of the Ecological Trait-data Standard [ets:valueType].

A trait's type names a class: STATO_0000251 (continuous variable) or STATO_0000252 (categorical variable), resolved through published_classes.csv into ets:valueType. No published vocabulary has a class for either new type. ETS v0.10 lists "character" among the values of valueType, but as a word with no IRI, so there is nothing to match to; the correspondence is a sentence in the definition instead.

The glossary is where APD already keeps the terms it defines itself, so using it needed no new machinery:

  • The live w3id rule ^glossary/glossary_(.+)/?$ already resolves the URIs, so no w3id PR is needed.
  • The site anchors them, and the C1/C3 tests and check_redirects.sh cover them.
  • The set of published input tables is unchanged.

Rejected:

  • A new table or namespace for value types: it needs a w3id change and a new site section.
  • Minting the terms under traits/: that scheme holds trait concepts, groupings and values.
  • Rows in published_classes.csv: that table is for borrowed terms.
  • Readable slugs such as glossary/month_presence: the w3id rule requires the glossary_ prefix.

What consumers see. In APD_traits.csv, the trait_type of the four traits reads month presence [glossary_40126] (it read categorical variable [STATO_0000252]); a text trait would read text [glossary_40128]. austraits.build#884's generator maps on the bracketed identifier. austraits.build's current generator still runs, and still treats these four as categorical traits with no values, as it does today.

Every place APD branches on type

  • R/build.R: new APD_VALUE_TYPES, the one map from identifier to traits.build type (numeric, categorical, month_presence, text), and apd_value_kind().

  • R/convert_to_triples.R: the type lookup resolves glossary identifiers as well as published_classes. Before, an unrecognised type silently became <NA> and its statement was dropped. The "value type" label in APD_triples.csv resolves glossary terms too.

  • R/create_APD_trait_table.R: branches on the kind instead of on the labels "continuous variable" and "categorical variable".

    • The APD_TIME_TRAITS list of four names to skip is gone.
    • A month-presence or text trait shows its type's definition beside the type, with no units, range or values list.
    • categorical_value_lines() returns early when there are no values.
  • R/validate.R: new apd_value_type_problems() in validate_apd(). It fails:

    • a type that is not one of the four (STATO "ordinal variable" is in published_classes.csv, so it would otherwise resolve silently);
    • a categorical trait with no values;
    • values attached to a trait that is not categorical;
    • units or a range on a trait that is not numeric.

    Run against develop's data/, it flags exactly the four phenology traits.

  • R/flat_tables.R, index.qmd, APD_categorical_values.csv: no type branching; comments and the glossary section's prose only.

  • CONTRIBUTING.md gains a short table of the four value types and what each trait carries.

Golden / export changes (every line read)

The artefacts are in their own commit, per CONTRIBUTING. Statements go from 27,510 to 27,526.

  • APD.nt / APD.nq:
    • 4 statements change: trait_0030030, 0030214, 0030215 and 0030216 ets:valueType move from obo:STATO_0000252 to glossary/glossary_40126.
    • 16 are added: 7 per term (identifier, prefLabel, description, definition, inScheme, topConceptOf, rdf:type skos:Concept), plus the glossary's two skos:hasTopConcept.
  • APD.ttl and APD.json: the same 4 changes and 16 additions.
  • APD_triples.csv: the 4 value-type rows read month presence, and 14 rows are added (rdf:type rows are excluded by design).
  • APD_traits.csv: cell by cell, only trait_type changed, in the four rows.
  • APD_categorical_values.csv: byte-identical.
  • Entity-table digest: re-pinned after comparing every entity's rendering. The four phenology entries differ by one line each (the value type), the two glossary entries are new, and nothing else moved. Rendered pairs go from 16,803 to 16,815.

Checks

  • Baseline make check on develop: 27,510 statements, 1,586 expectations pass.
  • This branch: make check validates clean, with 27,526 statements in all four serialisations and the committed artefacts matching the build: 1,609 expectations pass, 0 fail. New test-value-types.R pins the four trait_type strings, and breaks each validation rule to show it fires.
  • make site: passes in about 2 minutes, with all 1,475 published entities anchored. flowering_time's entry shows its format, and the glossary lists the two new terms.

I regenerated austraits.build's traits.yml from this branch's export with its generator. Against the same generator on APD develop's export, the only difference is the four type lines.

Version and NEWS

No version bump here: NEWS gets an ## Unreleased entry, which RELEASING.md renames when the release is prepared, as #65 and #68 did. I suggest 2.3.0 (minor): two new terms, and nothing on CONTRIBUTING's breaking list (no URI changed, and no column, value or range was removed). Whether changing an existing trait's value type should count as breaking for consumers is worth deciding. CONTRIBUTING now says to coordinate such a change with austraits.build, but I didn't add it to the breaking list.

Judgement calls to confirm

  1. Identifiers 40126 and 40128. These are the next even numbers above the current maximum, 40124. Nothing above 40124 appears anywhere in git history.
  2. Labels month presence and text. These rather than, say, "month presence variable" to mirror STATO's naming. Changing them later changes the trait_type strings consumers read.
  3. The ETS sentence in the text definition. It makes the APD wording one sentence longer than traits.build's schema text.
  4. modified dates on the four traits are not bumped. This follows plant_height_reproductive accepts values down to 1 mm #65, which changed min without touching modified.
  5. The four traits' comments still say "Trait keyed as a sequences of 12 Ns ... and Ys". That now partly repeats the type's definition; I left it alone.
  6. APD writes Y/N in capitals; traits.build stores values lower-cased (nnyyyynnnnnn) and accepts either case. The APD text describes the concept, not the stored case.
  7. Stale counts updated. 1,473 → 1,475 published identifiers in README, COMMITMENTS (C1; C3 → 1,477), using_the_APD.qmd, R/site.R, check_redirects.sh and render.yml.

ehwenk and others added 2 commits October 23, 2026 10:52
Review on traitecoevo/traits.build#306: "monthly presence" reads as an
adjective modifying "presence", and "free text" is the standard term
for uncontrolled text. The text definition (glossary_40128) takes the
wording agreed for the traits.build schema. glossary_40126 keeps its
identifier; only its label changes.

Refs traitecoevo/traits.build#87

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Generated by make data from the previous commit. Same 27,526
statements: glossary_40126's prefLabel, glossary_40128's description
and definition, and the four phenology traits' trait_type in
APD_traits.csv, which now reads "monthly presence [glossary_40126]".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ehwenk added a commit to traitecoevo/austraits.build that referenced this pull request Oct 22, 2026
Follows traitecoevo/traits.build#306, which renames the trait type in
review, and traitecoevo/APD#75, which relabels glossary_40126 "monthly
presence". The dictionary also calls text values free text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ehwenk ehwenk changed the title Add month presence and text value types Add monthly presence and text value types Oct 22, 2026
Comment thread data/APD_glossary.csv Resolved
ehwenk and others added 2 commits October 23, 2026 10:58
Review on traitecoevo/traits.build#306: text has a definition in a core
ontology, so the APD should point at it rather than mint glossary_40128.
NCIT_C25704 "Text" is added to published_classes.csv in its obo form,
as the APD's other NCIT terms are, and glossary_40128 is removed. It was
never released. Monthly presence stays a glossary term.

APD_VALUE_TYPES maps NCIT_C25704 to text, and the tests that counted
26 glossary terms now count 25. A text trait's trait_type in
APD_traits.csv would read "text [NCIT_C25704]".

Refs traitecoevo/traits.build#87

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Generated by make data from the previous commit. 27,526 -> 27,520
statements: glossary_40128's seven and the glossary's hasTopConcept for
it go, and NCIT_C25704 gains a prefLabel and identifier. No trait has
type text, so APD_traits.csv is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ehwenk added a commit to traitecoevo/austraits.build that referenced this pull request Oct 22, 2026
traitecoevo/APD#75 now borrows text from the NCI Thesaurus in place of
the glossary term glossary_40128. No AusTraits trait is text yet, so
config/traits.yml is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ehwenk and others added 2 commits October 23, 2026 11:06
Review on traitecoevo/traits.build#306: glossary_40126's definition
now says a value is a bit string of length 12, written with Y for 1 and
N for 0, and recorded as a string (xsd:string), matching the traits.build
schema.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Generated by make data from the previous commit. Only
glossary_40126's description and definition change; 27,520 statements.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ehwenk ehwenk mentioned this pull request Nov 14, 2026
17 tasks
@ehwenk
ehwenk marked this pull request as ready for review November 15, 2026 00:49
@ehwenk
ehwenk merged commit 95cadfd into develop Nov 15, 2026
2 checks passed
@ehwenk
ehwenk deleted the new-trait-types branch November 15, 2026 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants