From 26d9a143bb43b70351b98c3c529014f2be5b0a19 Mon Sep 17 00:00:00 2001 From: Jesper Friis Date: Sat, 29 Nov 2025 14:32:02 +0100 Subject: [PATCH] Improve annotation of ontologies --- ontopy/utils.py | 10 +++++++++- tools/ontoconvert | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ontopy/utils.py b/ontopy/utils.py index b47ad54c..5aa8ef40 100644 --- a/ontopy/utils.py +++ b/ontopy/utils.py @@ -34,6 +34,8 @@ if TYPE_CHECKING: from typing import Optional, Union + from ontopy import Ontology + # Preferred language PREFERRED_LANGUAGE = "en" @@ -857,7 +859,7 @@ def recur(o): return layout -def copy_annotation(onto, src, dst): +def copy_annotation(onto: "Ontology", src: str, dst: str): """In all classes and properties in `onto`, copy annotation `src` to `dst`. Arguments: @@ -865,6 +867,12 @@ def copy_annotation(onto, src, dst): src: Name of source annotation. dst: Name or IRI of destination annotation. Use IRI if the destination annotation is not already in the ontology. + + Example: + + copy_annotation( + onto, "elucidation", "http://www.w3.org/2000/01/rdf-schema#comment" + ) """ if onto.world[src]: src = onto.world[src] diff --git a/tools/ontoconvert b/tools/ontoconvert index 4d8df099..144eb907 100755 --- a/tools/ontoconvert +++ b/tools/ontoconvert @@ -191,7 +191,7 @@ def main(argv: list = None): action="store_true", help=( "Whether to annotate all entities with the base IRI of the source " - "ontology using `dcterms:source` relations. This is contextual " + "ontology using `rdfs:isDefinedBy` relations. This is contextual " "information that is otherwise lost when ontologies are inferred " "and/or squashed." ), @@ -274,7 +274,7 @@ def main(argv: list = None): if args.iri: onto.iri = args.iri - if args.base_iri: + if args.base_iri and args.base_iri != onto.base_iri: onto.base_iri = args.base_iri if args.annotate_source: