apis_core.utils.rdf#
Module Contents#
Classes#
Functions#
Look at the value of object and return the parsed value. If the value starts and ens with angle brackets, we interpret it as and transform it to an URI. If the value is simple text we interpret it as an curie and we expand it using the graphs namespace manager. Otherwise we simply return the value |
|
Load a tomlfile either from a path or from the directory triple_configs in any of the app directories. |
|
Check if a file contains a config that matches this graph and if so, return the config as dict. Otherwise return False |
|
Build a SPARQL query with language preferences. |
|
Data#
API#
- apis_core.utils.rdf.logger = 'getLogger(...)'#
- apis_core.utils.rdf.resolve(obj, graph)[source]#
Look at the value of object and return the parsed value. If the value starts and ens with angle brackets, we interpret it as and transform it to an URI. If the value is simple text we interpret it as an curie and we expand it using the graphs namespace manager. Otherwise we simply return the value
- apis_core.utils.rdf.load_path(path: str | pathlib.Path) dict[source]#
Load a tomlfile either from a path or from the directory triple_configs in any of the app directories.
- apis_core.utils.rdf.graph_matches_config(graph: rdflib.Graph, configfile: pathlib.Path) dict[source]#
Check if a file contains a config that matches this graph and if so, return the config as dict. Otherwise return False
- apis_core.utils.rdf.build_sparql_query(curie: str) str[source]#
Build a SPARQL query with language preferences.
- Args:
- curie: predicate to filter on as defined in the toml.
needs to include the predicate and optionally a lang tag to filter for separated with a comma. Eg βwdt:P122,enβ.
- Returns:
A SPARQL query string