Package org.incenp.linkml.schema
Class DefaultSchemaResolver
- java.lang.Object
-
- org.incenp.linkml.schema.DefaultSchemaResolver
-
- All Implemented Interfaces:
ISchemaResolver
public class DefaultSchemaResolver extends Object implements ISchemaResolver
The schema resolver that implements the default behaviour for resolvingimportsdeclarations within a LinkML schema.If the name to resolve contains a colon, this resolver assumes it is a relative file name, and attempts to find it on the local file system. Otherwise, it assumes the name is a URI pointing to a remote resource.
Of note, this resolver automatically and silently redirects the
https://w3id.org/linkml/types.yamlschema name to a version that is embedded with the LinkML-Java runtime. That schema is expected to be imported in virtually all LinkML schemas, so we don’t want to have to always fetch it from a remote server.
-
-
Constructor Summary
Constructors Constructor Description DefaultSchemaResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ISchemaSourceresolve(String name, String base)Resolves the given schema name into a schema source object.
-
-
-
Method Detail
-
resolve
public ISchemaSource resolve(String name, String base) throws InvalidSchemaException
Description copied from interface:ISchemaResolverResolves the given schema name into a schema source object.- Specified by:
resolvein interfaceISchemaResolver- Parameters:
name- The name of the schema to resolve. Of note, if the name was originally provided as a Curie, this method will receive the expanded form of the original name.base- The base location from which to resolve relative names.- Returns:
- A
ISchemaSourceobject that can be used to access the content of the schema. - Throws:
InvalidSchemaException- If the name cannot be resolved into a schema source.
-
-