Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion ontopy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
if TYPE_CHECKING:
from typing import Optional, Union

from ontopy import Ontology


# Preferred language
PREFERRED_LANGUAGE = "en"
Expand Down Expand Up @@ -857,14 +859,20 @@ 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:
onto: Ontology to work on.
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]
Expand Down
4 changes: 2 additions & 2 deletions tools/ontoconvert
Original file line number Diff line number Diff line change
Expand Up @@ -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."
),
Expand Down Expand Up @@ -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:
Expand Down