File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -1213,6 +1213,9 @@ def get_uri(
1213
1213
elif isinstance (e , SlotDefinition ):
1214
1214
uri = e .slot_uri
1215
1215
e_name = underscore (e .name )
1216
+ elif isinstance (e , EnumDefinition ):
1217
+ uri = e .enum_uri
1218
+ e_name = e .name
1216
1219
elif isinstance (e , TypeDefinition ):
1217
1220
uri = e .uri
1218
1221
e_name = underscore (e .name )
Original file line number Diff line number Diff line change 12
12
from linkml_runtime .linkml_model .meta import (
13
13
ClassDefinition ,
14
14
ClassDefinitionName ,
15
+ EnumDefinition ,
15
16
Example ,
16
17
Prefix ,
17
18
SchemaDefinition ,
@@ -517,6 +518,9 @@ def test_imports(schema_view_with_imports: SchemaView) -> None:
517
518
assert view .get_uri ("TestClass" , use_element_type = True ) == "core:class/TestClass"
518
519
assert view .get_uri ("name" , use_element_type = True ) == "core:slot/name"
519
520
521
+ assert view .get_uri ("OrganismType" ) == "ks:OrganismType"
522
+ assert view .get_uri ("OrganismType" , use_element_type = True ) == "ks:enum/OrganismType"
523
+
520
524
assert view .get_uri ("string" ) == "xsd:string"
521
525
522
526
# dynamic enums
@@ -988,6 +992,8 @@ def test_uris_without_default_prefix() -> None:
988
992
view = SchemaView (schema_definition )
989
993
view .add_class (ClassDefinition (name = "TestClass" , from_schema = "https://example.org/another#" ))
990
994
view .add_slot (SlotDefinition (name = "test_slot" , from_schema = "https://example.org/another#" ))
995
+ view .add_enum (EnumDefinition (name = "tEsT_enum" , from_schema = "https://example.org/another#" ))
991
996
992
997
assert view .get_uri ("TestClass" , imports = True ) == "https://example.org/test#TestClass"
993
998
assert view .get_uri ("test_slot" , imports = True ) == "https://example.org/test#test_slot"
999
+ assert view .get_uri ("tEsT_enum" , imports = True ) == "https://example.org/test#tEsT_enum"
You can’t perform that action at this time.
0 commit comments