Functions:
-
import_attr_from_model–Import a Python module's attribute from a model object.
-
import_attr_from_node–Import a Python module's attribute from an RDF graph using importlib
-
load_py_module_attr–Load relevant attributes of a
ModuleAttributenode into a model object.
import_attr_from_model
import_attr_from_model(model)
Import a Python module's attribute from a model object.
Assuming load_py_module_attr was already called on the object.
Parameters:
-
model(ModelBase) –Model object containing relevant info for a
ModuleAttribute
Returns:
-
Any–The module attribute, e.g. class or function
Source code in src/rdf_utils/models/python.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
import_attr_from_node
import_attr_from_node(graph, uri)
Import a Python module's attribute from an RDF graph using importlib
Parameters:
-
graph(Graph) –RDF graph to load relevant info
-
uri(URIRef | str) –URI of the
ModuleAttributenode
Returns:
-
Any–The module attribute, e.g. class or function
Source code in src/rdf_utils/models/python.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
load_py_module_attr
load_py_module_attr(graph, model, quiet=True, **kwargs)
Load relevant attributes of a ModuleAttribute node into a model object.
Parameters:
-
graph(Graph) –RDF graph to load relevant info.
-
model(ModelBase) –The model object.
-
quiet(bool, default:True) –If True won't raise an exception
Raises:
-
RuntimeError–if not quiet and model object does not have
ModuleAttributetype
Source code in src/rdf_utils/models/python.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |