按源仓库内容呈现,保留标题、案例、代码、表格、链接以及原文引用的演示图片。
SKOS-XL Skill
Skill for building and working with SKOS (Simple Knowledge Organization System) and SKOS-XL vocabularies, with first-class support for Darwin Core integration following the TDWG TAG SKOS-XL patterns.
Setup
1. Install Python 3.9+
python --version2. Install dependencies
cd /path/to/skos-xl
pip install -r requirements.txtOne dependency: `rdflib` — handles all RDF formats (Turtle, RDF/XML, JSON-LD, N-Triples) and the SKOS namespace natively.
3. (Optional) Sync W3C schema files
Downloads the official SKOS/SKOS-XL RDF/OWL schemas and TDWG TAG examples:
python scripts/sync.pyUsage
1. Explain SKOS, SKOS-XL, and CTA properties
General SKOS overview:
python scripts/explain.pyExplain a specific SKOS term:
python scripts/explain.py --term broader
python scripts/explain.py --term prefLabel
python scripts/explain.py --term exactMatchList all SKOS terms:
python scripts/explain.py --listSKOS-XL overview (when to use XL vs plain SKOS):
python scripts/explain.py --xlExplain a specific SKOS-XL term:
python scripts/explain.py --xl --term Label
python scripts/explain.py --xl --term literalForm
python scripts/explain.py --xl --listTraditional Knowledge (CTA) properties overview:
python scripts/explain.py --cta
python scripts/explain.py --cta --list
python scripts/explain.py --cta --term accessLevel
python scripts/explain.py --cta --term sourcePeople
python scripts/explain.py --cta --term nagoyaStatus2. Validate a SKOS vocabulary file
Validates Turtle, RDF/XML, JSON-LD, N-Triples, or N3 files.
Standard checks (always run):
- File parses as valid RDF
- Contains at least one
skos:ConceptScheme - All
skos:Conceptinstances linked viaskos:inScheme - Each concept has
skos:prefLabel(orskosxl:prefLabel) - No duplicate
prefLabelin the same language within a scheme (S14) - No disjointness violations (
Concept/ConceptScheme/Collection) skos:relatednot used between broader/narrower concepts (S27)- SKOS-XL: each
skosxl:Labelhas exactly oneskosxl:literalForm
CTA checks (--cta flag, Traditional Knowledge / CARE / Nagoya):
ConceptSchemehasdct:rightsHolder(CARE Authority)ConceptSchemehasdct:license(TK Label recommended)- Each
skosxl:Labelhasetno:accessLevel - Labels in non-standard languages have
prov:wasAttributedTooretno:sourcePeople - Labels with
accessLevel = restricted/sacredhaveetno:validatedByorprov:wasAttributedTo
python scripts/validate.py vocab.ttl
python scripts/validate.py vocab.ttl --verbose
python scripts/validate.py vocab.ttl --cta
python scripts/validate.py vocab.ttl --cta --verbose
python scripts/validate.py vocab.rdf --format xmlExit code 0 on success, 1 if errors are found (suitable for CI pipelines).
3. Generate a SKOS vocabulary template
Four templates are available:
| Template | Use case |
|---|---|
basic (default) | Generic concept hierarchy with optional SKOS-XL labels |
dwc-vocab | Darwin Core controlled vocabulary (basisOfRecord, occurrenceStatus, etc.) |
dwc-names | Taxonomic name vocabulary using the TDWG TAG NameThing pattern (SKOS-XL) |
etno-tk | Traditional Knowledge vocabulary with CARE/PROV-O metadata (SKOS-XL) |
Basic vocabulary (plain SKOS):
python scripts/generate.py my_vocabBasic vocabulary with SKOS-XL labels:
python scripts/generate.py my_vocab --xlDarwin Core controlled vocabulary (e.g. for basisOfRecord):
python scripts/generate.py basisOfRecord --template dwc-vocabTaxonomic name vocabulary (TDWG TAG NameThing pattern, SKOS-XL):
python scripts/generate.py my_names --template dwc-namesTraditional Knowledge vocabulary (CTA / EtnoTermos pattern, CARE + Nagoya, SKOS-XL):
python scripts/generate.py etnotermos --template etno-tk
python scripts/generate.py etnotermos --template etno-tk --lang pt --dir ./outputChange output format and language:
python scripts/generate.py my_vocab --format jsonld --lang pt
python scripts/generate.py my_vocab --format rdfxml --dir ./output
python scripts/generate.py my_vocab --base http://vocab.example.org/myVocabSupported formats: turtle (default), rdfxml, jsonld, nt, n3
4. Convert vocabulary format or label style
Convert RDF serialization format:
python scripts/convert.py vocab.rdf --to-format turtle
python scripts/convert.py vocab.ttl --to-format jsonld --output vocab.jsonldUpgrade plain SKOS labels to SKOS-XL (adds URI resources for each label):
python scripts/convert.py vocab.ttl --to-xlDowngrade SKOS-XL labels to plain SKOS (extracts literalForm literals back to skos:prefLabel):
python scripts/convert.py vocab_xl.ttl --from-xlCombine operations (upgrade labels + change format):
python scripts/convert.py vocab.ttl --to-xl --to-format jsonld5. Sync reference files
Downloads W3C SKOS/SKOS-XL schemas and TDWG TAG Turtle examples:
python scripts/sync.pyTraditional Knowledge (CTA) Vocabularies
Overview
Traditional Knowledge Associated with Biodiversity (CTA — Conhecimento Tradicional Associado à Biodiversidade) requires a vocabulary architecture that is:
- Polyglot — multiple indigenous languages, each with individual metadata
- Governed — per-label access control (
public/restricted/community-only/sacred) - Attributed — provenance traceable to the originating people (CARE principles)
- Compliant — aligned with the Nagoya Protocol on Access and Benefit-Sharing
SKOS-XL is the correct choice because access restrictions live at the label level, not at the concept level. The scientific name of a plant may be public while the sacred ritual name is restricted — granularity impossible with skos:prefLabel literals.
CARE Principles
| Principle | Property | Description |
|---|---|---|
| Collective | prov:wasAttributedTo, etno:sourcePeople | Attribute knowledge to originating people |
| Authority | dct:rightsHolder, etno:accessLevel, etno:validatedBy | Community controls its own data |
| Responsibility | dct:source, etno:nagoyaStatus, prov:hadPrimarySource | Traceable provenance |
| Ethics | etno:languageStatus, etno:consentType, dct:license | Do no harm; respect restrictions |
Access levels (etno:accessLevel)
| Value | Meaning |
|---|---|
public | Available to anyone |
restricted | Researchers only, requires FPIC under Nagoya |
community-only | Members of the originating community only |
sacred | Sacred knowledge; never publish without explicit consent |
Generate the template
python scripts/generate.py etnotermos --template etno-tk --lang ptThis creates a Turtle file with:
skos:ConceptSchemewithdct:rightsHolderanddct:license(TK Label)- Ethnotaxonomic top-level categories (not western-science categories)
- Jatobá (Hymenaea courbaril) concept with labels in Portuguese, Guarani Mbya (
@gnm), and Latin — each with full CARE metadata - Ayahuasca concept with a
sacredlabel in Huni Kuĩ (@hux) alongside a public Spanish label — demonstrating per-label access control prov:Agentresources for each indigenous people- Darwin Core
dwc:vernacularNamebridge on each Concept
Validate CTA compliance
python scripts/validate.py etnotermos.ttl --cta --verboseExplain CTA properties
python scripts/explain.py --cta
python scripts/explain.py --cta --term accessLevel
python scripts/explain.py --cta --term sourcePeople
python scripts/explain.py --cta --term nagoyaStatus
python scripts/explain.py --cta --listKey references
- CARE Principles for Indigenous Data Governance
- Nagoya Protocol — CBD
- Local Contexts TK Labels
- ISO 639-3 (indigenous language codes)
- VocBench 3 — SKOS-XL editor used by FAO/Agrovoc
- EtnoTermos — JBRJ
Darwin Core Integration
SKOS is the recommended representation for Darwin Core controlled vocabularies. Two patterns are supported by this skill:
Pattern 1 — Controlled vocabulary for DwC term values
Used for terms like basisOfRecord, occurrenceStatus, sex, lifeStage, establishmentMeans, degreeOfEstablishment, habitat:
python scripts/generate.py basisOfRecord --template dwc-vocabEach concept maps to the authoritative TDWG IRI via skos:exactMatch.
Pattern 2 — Taxonomic name vocabulary (TDWG TAG NameThing)
Reference: tdwg/tag/skos-xl
Used for scientific names. Labels become skosxl:Label resources carrying parsed nomenclatural components:
skosxl:literalForm— full name string (e.g."Dicranum braunii Müll. Hal."@la)tnc:canonicalName— genus + epithet without authorshiptnc:genus,tnc:specificEpithet,tnc:authorshipskosxl:labelRelationsubproperties for basionyms and orthographic variants
This resolves the dwc: / dwciri: namespace split: SKOS-XL Labels provide a single IRI-addressable resource that bridges both.
python scripts/generate.py bryophytes --template dwc-namesKey DwC Terms That Benefit from SKOS Vocabularies
| DwC Term | Template | Notes |
|---|---|---|
basisOfRecord | dwc-vocab | 6 standard values |
occurrenceStatus | dwc-vocab | present / absent |
sex | dwc-vocab | Multilingual labels |
lifeStage | dwc-vocab | Hierarchical stages |
establishmentMeans | dwc-vocab | IUCN pathway-aligned |
degreeOfEstablishment | dwc-vocab | Ordered progression |
typeStatus | dwc-vocab | Type specimen designations |
habitat | dwc-vocab | EUNIS / IUCN hierarchy |
scientificName | dwc-names | NameThing with parsed components |
recordedBy / identifiedBy | dwc-names | Person labels with provenance |
References
- SKOS terms reference — 4 classes, 28 properties
- SKOS-XL terms reference — 1 class, 5 properties
- SKOS & SKOS-XL Quick Reference Guide — patterns, examples, DwC integration
- SKOS Core schema — official W3C RDF/OWL (after
sync.py) - SKOS-XL schema — official W3C RDF/OWL (after
sync.py) - TDWG TAG NameThing — Turtle example (after
sync.py) - Traditional Knowledge properties — CTA/CARE metadata properties
Related Skills
[darwin-core](../darwin-core/) — Use alongside this skill to package and validate occurrence data. Darwin Core defines the fields; SKOS defines the controlled vocabularies for the values. The dwc-vocab template generates SKOS representations of any Darwin Core controlled term.
[DataProvenance](../DataProvenance/) — Normative reference for the prov: terms (prov:wasAttributedTo, prov:Agent, qualification, prov:hadPrimarySource) already used by this skill's Traditional Knowledge (CTA) template, for provenance trails deeper than the template covers.

