schema_salad.runtime
Shared code for parsers generated by the Python codegen.
See --codegen=python & python_codegen.
Attributes
Classes
Class that holds the state of loading a SALAD document. |
|
Mark classes than have a save() and fromDoc() function. |
Functions
|
Take a type of value, and extracts the value as a string. |
|
Normalize type names to schema-salad types. |
|
Parse error messages from several loaders into one error message. |
|
Convert an object to a JSON/YAML friendly dictionary. |
|
Save and set $namespaces, $schemas, $base and any other metadata fields at the top level. |
|
Transform a file path into a URL with file scheme. |
|
Expand short forms into full URLs using the given namespace dictionary. |
|
Convert any URI to a relative one, obeying the scoping rules. |
|
Compute the shortname of a fully qualified identifier. |
Module Contents
- class schema_salad.runtime.LoadingOptions(fetcher=None, namespaces=None, schemas=None, fileuri=None, copyfrom=None, original_doc=None, addl_metadata=None, baseuri=None, idx=None, imports=None, includes=None, no_link_check=None, container=None)
Class that holds the state of loading a SALAD document.
- Parameters:
fetcher (schema_salad.fetcher.Fetcher | None)
fileuri (str | None)
copyfrom (LoadingOptions | None)
original_doc (Any | None)
baseuri (str | None)
idx (IdxType | None)
no_link_check (bool | None)
container (str | None)
- namespaces: Final[collections.abc.MutableMapping[str, str]]
- schemas: Final[collections.abc.MutableSequence[str]]
- addl_metadata: Final[collections.abc.MutableMapping[str, Any]]
- fetcher: Final[schema_salad.fetcher.Fetcher]
- cache: Final[schema_salad.utils.CacheType]
- property graph: rdflib.Graph
Generate a merged rdflib.Graph from all entries in self.schemas.
- Return type:
- class schema_salad.runtime.Saveable
Mark classes than have a save() and fromDoc() function.
- classmethod fromDoc(_doc, baseuri, loadingOptions, docRoot=None)
- Abstractmethod:
- Parameters:
_doc (Any)
baseuri (str)
loadingOptions (LoadingOptions)
docRoot (str | None)
- Return type:
Self
Construct this object from the result of yaml.load().
- schema_salad.runtime.SaveableType
- type schema_salad.runtime.save_type = None | MutableMapping[str, Any] | MutableSequence[Any] | int | float | bool | str
- schema_salad.runtime.extract_type(val_type)
Take a type of value, and extracts the value as a string.
- schema_salad.runtime.convert_typing(val_type)
Normalize type names to schema-salad types.
- schema_salad.runtime.parse_errors(error_message)
Parse error messages from several loaders into one error message.
- schema_salad.runtime.save(val, top=True, base_url='', relative_uris=True)
Convert an object to a JSON/YAML friendly dictionary.
- schema_salad.runtime.save_with_metadata(val, valLoadingOpts, top=True, base_url='', relative_uris=True)
Save and set $namespaces, $schemas, $base and any other metadata fields at the top level.
- Parameters:
val (Any)
valLoadingOpts (LoadingOptions)
top (bool)
base_url (str)
relative_uris (bool)
- Return type:
- schema_salad.runtime.file_uri(path, split_frag=False)
Transform a file path into a URL with file scheme.
- schema_salad.runtime.prefix_url(url, namespaces)
Expand short forms into full URLs using the given namespace dictionary.
- schema_salad.runtime.save_relative_uri(uri, base_url, scoped_id, ref_scope, relative_uris)
Convert any URI to a relative one, obeying the scoping rules.
- schema_salad.runtime.shortname(inputid)
Compute the shortname of a fully qualified identifier.