From 07956c1888ef5b9f9228e7513a286f3d744ec839 Mon Sep 17 00:00:00 2001 From: Damien Goutte-Gattat Date: Thu, 20 Aug 2026 19:30:29 +0100 Subject: [PATCH] Adds an alias-based type designator resolver. This commit lays the groundwork for allowing resolution of type designators using a custom set of aliases. It introduces a new ITypeDesignatorResolver interface, and breaks down the existing TypeDesignatorResolver class into two parts: * a new DefaultTypeDesignatorResolver class, which implements the core logic to resolve designators using only informations from class annotations; * the TypeDesignatorResolver class (what is left of it), which relies on the new DefaultTypeDesignatorResolver to resolve single-valued designators and builds on top of that to deal with multi-valued designators (the idea is that the logic to deal with multi-valued designators should always be the same, regardless of which internal resolver is used to resolve a single designator). Then, it adds a new AliasTypeDesignatorResolver class, which uses a custom map (to be set by client code) of aliases to perform type designator resolution. The system is not fully designed -- not sure yet about the best way to plug the alias-based resolver into the ConverterContext object. --- .../core/AliasTypeDesignatorResolver.java | 122 ++++++++++++++++++ .../core/DefaultTypeDesignatorResolver.java | 92 +++++++++++++ .../linkml/core/ITypeDesignatorResolver.java | 76 +++++++++++ .../linkml/core/TypeDesignatorResolver.java | 105 +++------------ .../core/AliasTypeDesignatorResolverTest.java | 74 +++++++++++ .../core/TypeDesignatorResolverTest.java | 6 +- 6 files changed, 382 insertions(+), 93 deletions(-) create mode 100644 core/src/main/java/org/incenp/linkml/core/AliasTypeDesignatorResolver.java create mode 100644 core/src/main/java/org/incenp/linkml/core/DefaultTypeDesignatorResolver.java create mode 100644 core/src/main/java/org/incenp/linkml/core/ITypeDesignatorResolver.java create mode 100644 core/src/test/java/org/incenp/linkml/core/AliasTypeDesignatorResolverTest.java diff --git a/core/src/main/java/org/incenp/linkml/core/AliasTypeDesignatorResolver.java b/core/src/main/java/org/incenp/linkml/core/AliasTypeDesignatorResolver.java new file mode 100644 index 0000000..28e7cad --- /dev/null +++ b/core/src/main/java/org/incenp/linkml/core/AliasTypeDesignatorResolver.java @@ -0,0 +1,122 @@ +/* + * LinkML-Java - LinkML library for Java + * Copyright © 2026 Damien Goutte-Gattat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * (1) Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * (2) Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * (3) Neither the name of the copyright holder nor the names its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY + * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +package org.incenp.linkml.core; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.HashMap; +import java.util.Map; + +/** + * A type designator resolver that uses pre-registered “aliases” to resolve + * designator values. + */ +public class AliasTypeDesignatorResolver implements ITypeDesignatorResolver { + + private Map> aliasMap = new HashMap<>(); + private Map reverseMap = new HashMap<>(); + + /** + * Registers an alias for a given class. + *

+ * The alias must be unique for all classes that share a given designator slot + * – that is, for all classes that are descendants of the class that defines the + * slot (including that class). + *

+ * Of note, a class may have more than one alias, in which + * {@link #getDesignator(ClassInfo)} will return the last registered one. + * + * @param klass The class for which to register an alias. + * @param alias The alias to register. + */ + public void registerAlias(ClassInfo klass, String alias) { + ClassInfo root = klass.getDesignatorBase(); + if ( root == null ) { + // Don't think it is worth it to throw an exception... just ignore. + return; + } + + Map classAliases = aliasMap.get(root); + if ( classAliases == null ) { + classAliases = new HashMap<>(); + aliasMap.put(root, classAliases); + } + classAliases.put(alias, klass); + reverseMap.put(klass, alias); + } + + @Override + public ClassInfo resolve(String designator, ClassInfo base) throws LinkMLRuntimeException { + ClassInfo root = base.getDesignatorBase(); + if ( root == null ) { + throw new LinkMLRuntimeException(String.format(NO_DESIGNATOR, base.getName())); + } + + Map classAliases = aliasMap.get(root); + if ( classAliases == null ) { + return null; + } + + ClassInfo ci = classAliases.get(designator); + if ( ci != null && (ci == base || ci.getParents().contains(base)) ) { + return ci; + } + + return null; + } + + @Override + public Object getDesignator(ClassInfo klass) throws LinkMLRuntimeException { + Slot designatorSlot = klass.getTypeDesignatorSlot(); + if ( designatorSlot == null ) { + throw new LinkMLInternalError(String.format(NO_DESIGNATOR, klass.getName())); + } + + String alias = reverseMap.get(klass); + if ( alias == null ) { + return null; + } + + if ( designatorSlot.getInnerType().equals(URI.class) ) { + try { + return new URI(alias); + } catch ( URISyntaxException e ) { + throw new LinkMLInternalError(String.format(INVALID_CLASS_URI, klass.getName())); + } + } else { + return alias; + } + } +} diff --git a/core/src/main/java/org/incenp/linkml/core/DefaultTypeDesignatorResolver.java b/core/src/main/java/org/incenp/linkml/core/DefaultTypeDesignatorResolver.java new file mode 100644 index 0000000..bf12486 --- /dev/null +++ b/core/src/main/java/org/incenp/linkml/core/DefaultTypeDesignatorResolver.java @@ -0,0 +1,92 @@ +/* + * LinkML-Java - LinkML library for Java + * Copyright © 2026 Damien Goutte-Gattat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * (1) Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * (2) Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * (3) Neither the name of the copyright holder nor the names its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY + * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +package org.incenp.linkml.core; + +import java.net.URI; +import java.net.URISyntaxException; + +/** + * The “default” type designator resolver. + *

+ * This class implements the base logic, using only the informations available + * from the annotated LinkML classes, to handle type designators. + */ +public class DefaultTypeDesignatorResolver implements ITypeDesignatorResolver { + + @Override + public ClassInfo resolve(String designator, ClassInfo base) throws LinkMLRuntimeException { + // Lookup by URI + ClassInfo ci = ClassInfo.get(designator); + if ( ci == null ) { + // Look up by class name; we assume that all derived classes will live in the + // same Java package as the base class. + String pkgName = base.getType().getPackage().getName(); + try { + ci = ClassInfo.get(Class.forName(pkgName + "." + designator)); + } catch ( ClassNotFoundException e ) { + } + } + + if ( ci != null && (ci == base || ci.getParents().contains(base)) ) { + return ci; + } + + return null; + } + + @Override + public Object getDesignator(ClassInfo klass) throws LinkMLRuntimeException { + Slot designatorSlot = klass.getTypeDesignatorSlot(); + if ( designatorSlot == null ) { + throw new LinkMLInternalError(String.format(NO_DESIGNATOR, klass.getName())); + } + + if ( designatorSlot.getInnerType().equals(URI.class) ) { + try { + return new URI(klass.getURI()); + } catch ( NullPointerException | URISyntaxException e ) { + throw new LinkMLInternalError(String.format(INVALID_CLASS_URI, klass.getName())); + } + } else if ( designatorSlot.isCurieTyped() ) { + String uri = klass.getURI(); + if ( uri == null ) { + throw new LinkMLInternalError(String.format(INVALID_CLASS_URI, klass.getName())); + } + return uri; + } else { + return klass.getName(); + } + } +} diff --git a/core/src/main/java/org/incenp/linkml/core/ITypeDesignatorResolver.java b/core/src/main/java/org/incenp/linkml/core/ITypeDesignatorResolver.java new file mode 100644 index 0000000..bdff116 --- /dev/null +++ b/core/src/main/java/org/incenp/linkml/core/ITypeDesignatorResolver.java @@ -0,0 +1,76 @@ +/* + * LinkML-Java - LinkML library for Java + * Copyright © 2026 Damien Goutte-Gattat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * (1) Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * (2) Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * (3) Neither the name of the copyright holder nor the names its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY + * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +package org.incenp.linkml.core; + +/** + * An interface that provides the logic for resolving the value of a type + * designator slot into a class, or conversely to obtain an appropriate type + * designator value for a class. + */ +public interface ITypeDesignatorResolver { + + public static final String NO_DESIGNATOR = "Type '%s' has no designator slot"; + public final static String INVALID_CLASS_URI = "Missing or invalid class URI for type '%s'"; + + /** + * Resolves a single type designator into a LinkML class. + * + * @param designator The type designator value. + * @param base The base LinkML class. This would typically be the class + * that defines the type designator slot, though it could also + * be any class below it. + * @return The {@link ClassInfo} object representing the designated class, or + * null if the designator could not be resolved into a + * descendant of the base class (or the base + * class itself). + * @throws LinkMLRuntimeException If any error occurs during the resolution + * attempt. + */ + public ClassInfo resolve(String designator, ClassInfo base) throws LinkMLRuntimeException; + + /** + * Gets a single value that designates the provided class. + * + * @param klass The {@link ClassInfo} object representing the class to + * designate. + * @return The designator value. Depending on the type designator slot in the + * class, it can be a URI, a string representing the URI in short form, + * or a string representing the class name. + * @throws LinkMLRuntimeException If the given class has no type designator + * slot, or if any error occurs when attempting + * to find the correct designator value. + */ + public Object getDesignator(ClassInfo klass) throws LinkMLRuntimeException; +} diff --git a/core/src/main/java/org/incenp/linkml/core/TypeDesignatorResolver.java b/core/src/main/java/org/incenp/linkml/core/TypeDesignatorResolver.java index bd5c22e..fa8e0fe 100644 --- a/core/src/main/java/org/incenp/linkml/core/TypeDesignatorResolver.java +++ b/core/src/main/java/org/incenp/linkml/core/TypeDesignatorResolver.java @@ -34,8 +34,6 @@ package org.incenp.linkml.core; -import java.net.URI; -import java.net.URISyntaxException; import java.util.ArrayList; import java.util.List; @@ -43,42 +41,13 @@ * A helper object to (1) resolve type designator values into a LinkML class and * (2) obtain the type designator for a LinkML class. */ -public class TypeDesignatorResolver { +public class TypeDesignatorResolver implements ITypeDesignatorResolver { - private final static String NO_DESIGNATOR = "Type '%s' has no designator slot"; - private final static String INVALID_CLASS_URI = "Missing or invalid class URI for type '%s'"; + private ITypeDesignatorResolver innerResolver = new DefaultTypeDesignatorResolver(); - /** - * Resolves a single type designator into a LinkML class. - * - * @param designator The type designator value; it can be a class name or a - * class URI. - * @param base The base LinkML class. This would typically be the class - * that defines the type designator slot, though it could also - * be any class below it. - * @return The {@link ClassInfo} object representing the designated class, or - * null if the designator could not be resolved into a - * descendant of the base class (or the base - * class itself). - */ - public ClassInfo resolve(String designator, ClassInfo base) { - // Look up by URI - ClassInfo ci = ClassInfo.get(designator); - if ( ci == null ) { - // Look up by class name; we assume that all derived classes will live in the - // same Java package as the base class. - String pkgName = base.getType().getPackage().getName(); - try { - ci = ClassInfo.get(Class.forName(pkgName + "." + designator)); - } catch ( ClassNotFoundException e ) { - } - } - - if ( ci != null && (ci == base || ci.getParents().contains(base)) ) { - return ci; - } - - return null; + @Override + public ClassInfo resolve(String designator, ClassInfo base) throws LinkMLRuntimeException { + return innerResolver.resolve(designator, base); } /** @@ -89,8 +58,7 @@ public ClassInfo resolve(String designator, ClassInfo base) { * designators for different classes at the same hierarchical level is * undefined. * - * @param designators The type designator values; each value can be a class name - * or a class URI. + * @param designators The type designator values. * @param base The base LinkML class. This would typically be the class * that defines the type designator slot, though it could * also be any class below it. @@ -98,8 +66,10 @@ public ClassInfo resolve(String designator, ClassInfo base) { * designated class, or null if none of the designator * values could be resolved into a descendant of the base * class (or the base class itself). + * @exception LinkMLRuntimeException If any error occurs during the resolution + * attempt. */ - public ClassInfo resolve(List designators, ClassInfo base) { + public ClassInfo resolve(List designators, ClassInfo base) throws LinkMLRuntimeException { int length = -1; ClassInfo ci = null; for ( String designator : designators ) { @@ -116,26 +86,9 @@ public ClassInfo resolve(List designators, ClassInfo base) { return ci; } - /** - * Gets a single value that designates the provided class. - * - * @param klass The {@link ClassInfo} object representing the class to - * designate. - * @return The designator value. Depending on the type designator slot in the - * class, it can be a URI, a string representing the URI in short form, - * or a string representing the class name. - * @throws LinkMLRuntimeException If the given class has no type designator - * slot, or if the type designator slot is typed - * as a URI or CURIE and the class has no known - * URI. - */ + @Override public Object getDesignator(ClassInfo klass) throws LinkMLRuntimeException { - Slot designatorSlot = klass.getTypeDesignatorSlot(); - if ( designatorSlot == null ) { - throw new LinkMLInternalError(String.format(NO_DESIGNATOR, klass.getName())); - } - - return getDesignator(klass, designatorSlot); + return innerResolver.getDesignator(klass); } /** @@ -149,48 +102,20 @@ public Object getDesignator(ClassInfo klass) throws LinkMLRuntimeException { * either class URIs, strings representing shortened class URIs, or * class names, depending on the type designator slot. * @throws LinkMLRuntimeException If the given class has no type designator - * slot, or if the type designator slot is typed - * as a URI or CURIE and the class (or one of its - * ancestors) has no known URI. + * slot, or if any error occurs when attempting + * to find the correct designator values. */ public List getDesignators(ClassInfo klass) throws LinkMLRuntimeException { - Slot designatorSlot = klass.getTypeDesignatorSlot(); - if ( designatorSlot == null ) { - throw new LinkMLInternalError(String.format(NO_DESIGNATOR, klass.getName())); - } - List designators = new ArrayList<>(); List parents = klass.getParents(); for ( int i = parents.size() - 1; i >= 0; i-- ) { ClassInfo parent = parents.get(i); if ( parent.hasTypeDesignator() ) { - designators.add(getDesignator(parent, designatorSlot)); + designators.add(innerResolver.getDesignator(parent)); } } - designators.add(getDesignator(klass, designatorSlot)); + designators.add(innerResolver.getDesignator(klass)); return designators; } - - /* - * Helper method to get a single designator value of the appropriate type - * expected by the designator slot. - */ - private Object getDesignator(ClassInfo klass, Slot designatorSlot) throws LinkMLRuntimeException { - if ( designatorSlot.getInnerType().equals(URI.class) ) { - try { - return new URI(klass.getURI()); - } catch ( NullPointerException | URISyntaxException e ) { - throw new LinkMLInternalError(String.format(INVALID_CLASS_URI, klass.getName())); - } - } else if ( designatorSlot.isCurieTyped() ) { - String uri = klass.getURI(); - if ( uri == null ) { - throw new LinkMLInternalError(String.format(INVALID_CLASS_URI, klass.getName())); - } - return uri; - } else { - return klass.getName(); - } - } } diff --git a/core/src/test/java/org/incenp/linkml/core/AliasTypeDesignatorResolverTest.java b/core/src/test/java/org/incenp/linkml/core/AliasTypeDesignatorResolverTest.java new file mode 100644 index 0000000..282b494 --- /dev/null +++ b/core/src/test/java/org/incenp/linkml/core/AliasTypeDesignatorResolverTest.java @@ -0,0 +1,74 @@ +/* + * LinkML-Java - LinkML library for Java + * Copyright © 2026 Damien Goutte-Gattat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * (1) Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * (2) Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * (3) Neither the name of the copyright holder nor the names its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY + * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +package org.incenp.linkml.core; + +import org.incenp.linkml.core.samples.base.BaseCurieSelfDesignatedClass; +import org.incenp.linkml.core.samples.base.BaseSelfDesignatedClass; +import org.incenp.linkml.core.samples.base.DerivedCurieSelfDesignatedClass; +import org.incenp.linkml.core.samples.base.DerivedSelfDesignatedClass; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class AliasTypeDesignatorResolverTest { + + private AliasTypeDesignatorResolver resolver = new AliasTypeDesignatorResolver(); + + @Test + void testAliasResolution() throws LinkMLRuntimeException { + ClassInfo derivedCurieClass = ClassInfo.get(DerivedCurieSelfDesignatedClass.class); + resolver.registerAlias(derivedCurieClass, "derived"); + + ClassInfo derivedStringClass = ClassInfo.get(DerivedSelfDesignatedClass.class); + resolver.registerAlias(derivedStringClass, "derived"); + + Assertions.assertEquals(derivedCurieClass, + resolver.resolve("derived", ClassInfo.get(BaseCurieSelfDesignatedClass.class))); + + Assertions.assertEquals(derivedStringClass, + resolver.resolve("derived", ClassInfo.get(BaseSelfDesignatedClass.class))); + } + + @Test + void testReverseResolution() throws LinkMLRuntimeException { + ClassInfo derivedCurieClass = ClassInfo.get(DerivedCurieSelfDesignatedClass.class); + resolver.registerAlias(derivedCurieClass, "derived"); + + ClassInfo derivedStringClass = ClassInfo.get(DerivedSelfDesignatedClass.class); + resolver.registerAlias(derivedStringClass, "derived"); + + Assertions.assertEquals("derived", resolver.getDesignator(derivedCurieClass)); + Assertions.assertEquals("derived", resolver.getDesignator(derivedStringClass)); + } +} diff --git a/core/src/test/java/org/incenp/linkml/core/TypeDesignatorResolverTest.java b/core/src/test/java/org/incenp/linkml/core/TypeDesignatorResolverTest.java index 39c128c..6a93ed7 100644 --- a/core/src/test/java/org/incenp/linkml/core/TypeDesignatorResolverTest.java +++ b/core/src/test/java/org/incenp/linkml/core/TypeDesignatorResolverTest.java @@ -53,7 +53,7 @@ public class TypeDesignatorResolverTest { TypeDesignatorResolver resolver = new TypeDesignatorResolver(); @Test - void testResolveSingleDesignator() { + void testResolveSingleDesignator() throws LinkMLRuntimeException { ClassInfo base = ClassInfo.get(BaseSelfDesignatedClass.class); ClassInfo resolved = resolver.resolve("DerivedSelfDesignatedClass", base); Assertions.assertEquals(resolved, ClassInfo.get(DerivedSelfDesignatedClass.class)); @@ -66,14 +66,14 @@ void testResolveSingleDesignator() { } @Test - void testResolveSingleURIDesignator() { + void testResolveSingleURIDesignator() throws LinkMLRuntimeException { ClassInfo base = ClassInfo.get(BaseURISelfDesignatedClass.class); ClassInfo resolved = resolver.resolve(TEST_NS + "DerivedURISelfDesignatedClass", base); Assertions.assertEquals(resolved, ClassInfo.get(DerivedURISelfDesignatedClass.class)); } @Test - void testResolveMultivaluedDesignator() { + void testResolveMultivaluedDesignator() throws LinkMLRuntimeException { ClassInfo base = ClassInfo.get(BaseSelfDesignatedClass.class); ClassInfo resolved = null; List designators = new ArrayList<>();