agentleFS
kriegcloudkriegcloud/beep-effect/.claude/skills/ontology-mapper/SKILL.md

ontology-mapper

Skill78 starsChanged 7 days agoApache-2.0View on GitHub

Manages cross-ontology mapping and alignment. Generates, validates, and maintains SSSOM mapping sets. Runs lexical matching via oaklib and LLM-assisted verification. Use when working with ontology mappings, alignment, or cross-references.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. About 0 are common, 6 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read these files from _shared/ before beginning work:

    line 30
  2. Very specific:

    Update the SSSOM file with LLM-verified results marked as PROPOSED (steward ratification flips them to accepted), using …

    line 97
  3. Very specific:

    Critical: Treat owl:sameAs as a last-resort identity assertion only when true identity is proven.

    line 126
  4. Distinctive:

    No self-mappings (subject ≠ object)

    line 142
  5. Very specific:

    After validation, compute the transitive closure of skos:exactMatch and flag any clique larger than 3 terms for human review.

    line 147
  6. Distinctive:

    Before publishing bridge ontologies, review any generated identity axioms:

    line 203
  7. Distinctive:

    Every SSSOM file must include in its YAML header:

    line 253
  8. Distinctive:

    Every mapping row must include:

    line 264
  9. Distinctive:

    Mapping without context: Don't match by label alone.

    line 273
  10. Very specific:

    exactMatch overuse: Default to closeMatch when unsure.

    line 275
  11. Very specific:

    sameAs overuse: Never use owl:sameAs for "close enough" mappings.

    line 278
  12. Very specific:

    Missing justification: Every mapping needs a SEMAPV justification.

    line 282
  13. Distinctive:

    Stale mappings: When source or target ontology is updated, mappings must be rechecked for obsoleted terms.

    line 285

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Ontology Mapper

Role Statement

You are responsible for the integration phase — creating, validating, and maintaining cross-ontology mappings using the SSSOM standard. You generate mapping candidates via lexical matching, triage by confidence, apply LLM verification for uncertain pairs, and validate the final mapping set. You produce SSSOM TSV files and quality reports. You do NOT modify the source or target ontologies — that is the architect's or curator's job.

When to Activate

  • User mentions "mapping", "alignment", "cross-reference", or "SSSOM"
  • User wants to connect two ontologies
  • User wants to validate or update existing mappings
  • Pipeline B

Shared Reference Materials

Read these files from _shared/ before beginning work:

  • _shared/methodology-backbone.md — lifecycle phase context (Phase 5: Integration)
  • _shared/namespaces.json — canonical prefixes including sssom and semapv
  • _shared/naming-conventions.md — to understand label standards for matching

Core Workflow

Step 1: Candidate Generation (Lexical Matching)

# Using oaklib lexmatch
uv run runoak -i sqlite:obo:{source} lexmatch \
  --add sqlite:obo:{target} \
  -o ontologies/{name}/mappings/{source}-to-{target}.sssom.tsv

With custom match rules:

# lexmatch-rules.yaml
rules:
  - match_fields: [rdfs:label, oio:hasExactSynonym]
    predicate: skos:exactMatch
    weight: 0.9
  - match_fields: [rdfs:label, oio:hasRelatedSynonym]
    predicate: skos:closeMatch
    weight: 0.7
uv run runoak -i sqlite:obo:{source} lexmatch \
  --add sqlite:obo:{target} \
  --rules-file lexmatch-rules.yaml \
  -o ontologies/{name}/mappings/{source}-to-{target}.sssom.tsv

Step 2: Confidence Triage

Practitioner warning: Lexical matching at the 0.7-0.95 confidence level produces 40-60% false positives in practice. Labels match but meanings differ (homonyms across domains). The LLM verification step is not optional — it is essential for this tier.

Sort candidates into three tiers:

TierConfidenceAction
Propose-accept≥ 0.98 AND exact label match AND compatible parent classesPROPOSE with semapv:LexicalMatching justification — equivalence-class mappings remain proposals until the named human steward ratifies (_shared/stage-authority-matrix.yaml forbids autonomous equivalence; confidence is never truth)
LLM-verify0.7 – 0.98Present to LLM for semantic evaluation
Human queue< 0.7Flag for manual expert review

Step 3: LLM Verification (for uncertain mappings)

For each uncertain pair, evaluate:

Subject: {id} "{label}" — {definition} [parents: {parents}]
Object:  {id} "{label}" — {definition} [parents: {parents}]

Determine:
- predicate: exactMatch / closeMatch / broadMatch / narrowMatch /
             relatedMatch / no_match
- confidence: 0.0 – 1.0
- justification: reasoning for the decision

Update the SSSOM file with LLM-verified results marked as PROPOSED (steward ratification flips them to accepted), using semapv:SemanticSimilarityThresholdMatching as the mapping justification.

Step 4: Mapping Predicate Selection

Apply the predicate decision guide. The guide SELECTS the predicate to PROPOSE — every equivalence-class candidate (owl:equivalentClass, skos:exactMatch, owl:sameAs) stays mapping_status: PROPOSED and routes through ontology-foundational-auditor as a REUSE proposal (reuse.exact_reuse_found: true + mappings with compatibility justification): the auditor's identity/compatibility analysis and the steward's ratification of that otp: id — the shared rat- schema binds to proposal ids, and mappings are proposals like everything else — are what flip the SSSOM row to accepted. Confidence is never truth and no autonomous path asserts equivalence:

Logically equivalent with formal proof? → propose owl:equivalentClass
High-confidence equivalence?            → propose skos:exactMatch
Subject more general than object?       → skos:broadMatch
Subject more specific than object?      → skos:narrowMatch
Similar but not fully interchangeable?  → skos:closeMatch
Merely associated?                      → skos:relatedMatch

Critical: skos:exactMatch is TRANSITIVE. Avoid mapping chains that create unintended equivalences (A exactMatch B, B exactMatch C implies A exactMatch C).

Critical: Treat owl:sameAs as a last-resort identity assertion only when true identity is proven. One incorrect owl:sameAs can trigger transitive merges across multiple graphs and collapse distinct entities.

Step 5: Validate

# Validate SSSOM schema conformance
uv run sssom validate ontologies/{name}/mappings/{source}-to-{target}.sssom.tsv

Check:

  • Schema conformance (valid SSSOM TSV)
  • CURIE resolution (all prefixes in curie_map)
  • Entity existence (subjects/objects exist in source/target)
  • Predicate consistency (no contradictory predicates for same pair)
  • No self-mappings (subject ≠ object)
  • No duplicate mappings

Step 5.5: Clique Analysis (mandatory for exactMatch)

After validation, compute the transitive closure of skos:exactMatch and flag any clique larger than 3 terms for human review. One bad exactMatch link contaminates an entire clique.

# Inline clique detection: find terms reachable via exactMatch chains > 3
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

SELECT ?start ?mid ?end WHERE {
  ?start skos:exactMatch+ ?mid .
  ?mid skos:exactMatch+ ?end .
  FILTER(?start != ?end)
}
# Run against the mapping file (convert SSSOM to RDF first if needed)
robot query --input ontologies/{name}/mappings/{source}-to-{target}.sssom.ttl \
  --query sparql/clique-check.sparql --output clique-report.csv

For cross-domain mappings (source and target are in different domains), default to skos:relatedMatch or skos:closeMatch, not skos:exactMatch.

Step 6: Quality Report

Generate a quality assessment:

  • Predicate distribution (how many of each type)
  • Confidence distribution (histogram)
  • Source coverage (% of source terms mapped)
  • Target coverage (% of target terms mapped)
  • Potential conflicts (same subject mapped to multiple objects with exactMatch)
  • Clique analysis (transitive closure of exactMatch — flag cliques > 3)

Tool Commands

SSSOM operations

# Validate
uv run sssom validate ontologies/{name}/mappings/file.sssom.tsv

# Merge mapping sets
uv run sssom merge \
  set1.sssom.tsv set2.sssom.tsv \
  -o merged.sssom.tsv

# Deduplicate
uv run sssom dedupe merged.sssom.tsv -o final.sssom.tsv

# Convert to OWL (bridge ontology)
uv run sssom convert ontologies/{name}/mappings/file.sssom.tsv -o bridge.owl -O owl

Before publishing bridge ontologies, review any generated identity axioms:

  • Confirm whether conversion introduced owl:sameAs assertions.
  • Downgrade uncertain links to SKOS predicates before release.

Updating mappings for new ontology version

# Find obsoleted terms in target
uv run runoak -i sqlite:obo:{target} query \
  "PREFIX owl: <http://www.w3.org/2002/07/owl#> SELECT ?term WHERE { ?term owl:deprecated true }"

# Generate replacement KGCL
# For each obsoleted target with a replacement:
# delete mapping {subject} {predicate} {obsolete_target}
# create mapping {subject} {predicate} {replacement_target}

Outputs

This skill produces:

ArtifactLocationFormatDescription
Mapping fileontologies/{name}/mappings/{source}-to-{target}.sssom.tsvSSSOM TSVComplete mapping set with metadata
Quality reportontologies/{name}/mappings/{source}-to-{target}-qa.mdMarkdownQuality assessment with statistics
Human review queueontologies/{name}/mappings/{source}-to-{target}-review.tsvTSVLow-confidence pairs for expert review
KGCL changesontologies/{name}/mappings/{source}-to-{target}-changes.kgclKGCLMapping update changes
Bridge ontologyontologies/{name}/mappings/{source}-to-{target}-bridge.owlOWL/XMLOWL axioms from mappings (optional)

Handoff

Receives from: ontology-scout — target ontology identifiers, reuse recommendations

Passes to: ontology-validator — ontologies/{name}/mappings/*.sssom.tsv (equivalence-class rows only travel as ACCEPTED once the auditor-routed reuse proposal they correspond to has its ratification record under ontologies/{name}/governance/ratifications/; unratified equivalences stay PROPOSED and the validator treats them as non-assertions)

Handoff checklist:

  • SSSOM file passes sssom validate
  • All CURIEs resolve via curie_map
  • Every mapping has a mapping_justification (SEMAPV term)
  • Confidence scores present for all automated mappings
  • Every accepted equivalence row has a steward ratification record
  • Quality report generated and reviewed

SSSOM File Requirements

Every SSSOM file must include in its YAML header:

curie_map:
  # All prefixes used in subject_id and object_id
mapping_set_id: https://example.org/mappings/{source}-to-{target}
license: https://creativecommons.org/licenses/by/4.0/
subject_source: {source ontology IRI}
object_source: {target ontology IRI}

Every mapping row must include:

  • subject_id, subject_label
  • predicate_id
  • object_id, object_label
  • mapping_justification (SEMAPV term)
  • confidence (for automated mappings)

Anti-Patterns to Avoid

  • Mapping without context: Don't match by label alone. Consider definitions, parent classes, and domain context.
  • exactMatch overuse: Default to closeMatch when unsure. Upgrading later is safe; downgrading after reasoning has propagated equivalence is not.
  • sameAs overuse: Never use owl:sameAs for "close enough" mappings. Reserve it for strict identity only.
  • Ignoring transitivity: skos:exactMatch is transitive. Check that chains don't create unintended equivalences.
  • Missing justification: Every mapping needs a SEMAPV justification. semapv:LexicalMatching, semapv:ManualMappingCuration, semapv:SemanticSimilarityThresholdMatching.
  • Stale mappings: When source or target ontology is updated, mappings must be rechecked for obsoleted terms.

Error Handling

ErrorLikely CauseRecovery
sssom validate failsMissing required fields or invalid CURIEsFix curie_map, add missing justifications
Lexmatch produces no candidatesVocabularies use different naming conventionsTry synonym matching, broaden match rules
Transitive closure creates false equivalencesOver-use of exactMatchDowngrade to closeMatch for uncertain pairs
Target term is obsoletedTarget ontology was updatedFind replacement via obo:IAO_0100001 property

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.