— title: “Ontology Module for TVB-O” author: Leon Martin.
This module provides a set of functions to interact with the ontology of TVB-O. It includes functions to:
Functions
add_spaces_around_math_chars
Insert spaces around mathematical operator characters in a string.
compare_models
Compares two TVB models based on their parameters or another specified metric.
contains_math_char
Check whether a string contains a mathematical operator character.
create_acronym
Generate a unique upper-case acronym from a camel-case name.
disintersection
Computes the unique elements of two lists.
extract_most_common
Return the most frequently occurring item across several result lists.
filter_cls_list
Filters out classes from a list that have a specific ancestor.
find_best_fuzzy_match
Find the best fuzzy match for a target string in a list of strings, prioritizing strings that start with the target followed by an underscore.
find_variables
Finds a variable in a TVB model.
find_version
Retrieves the package version from the __init__.py file.
get_all_annotations
Collect all distinct values of an annotation property across every class.
get_class_annotation_properties
Return the annotation properties of an ontology class.
get_class_data_properties
Return the data properties of an ontology class.
get_class_object_properties
Return the object properties of an ontology class.
get_class_properties
Collect the label, identifier, annotation, and object properties of a class.
get_coupling_function
Retrieve a coupling-function class by its label or a synonym.
get_coupling_functions
Return all coupling-function classes keyed by their label.
get_def
Retrieve the description or definition of a class based on the specified mode.
get_default_values
Retrieves the default values for a given TVB model’s parameters.
get_definition
Retrieves the definition for a given ontology class.
get_info
Build a formatted text summary of an ontology class with its definition and references.
get_integrator
Retrieve the ontology class for a named integration method.
get_model
Retrieves a specific TVB-O model using its label.
get_model_acronym
Retrieves the acronym for a given TVB model.
get_model_arguments
Retrieves the arguments for a given TVB model.
get_model_coefficients
Retrieves the coefficients for a given TVB model.
get_model_conditionals
Retrieve the conditional derived variables for a given TVB model.
get_model_constants
Retrieve the constants for a given TVB model.
get_model_coupling_terms
Retrieves the coupling terms for a given TVB model.
get_model_cvars
Retrieves the cvars (coupling variables) for a given TVB model.
get_model_derivatives
Retrieves the derivatives for a given TVB model.
get_model_functions
Retrieves the functions for a given TVB model.
get_model_parameters
Retrieves the parameters for a given TVB model.
get_model_statevariables
Retrieves the state variables for a given TVB model.
get_model_suffix
Retrieves the suffix for a given TVB model, based on its acronym.
get_model_variables
Retrieves the variables for a given TVB model.
get_model_vois
Retrieve the variables of interest (VOIs) for a given TVB model.
get_models
Retrieves all TVB-O models of a given type.
get_object_properties
Collect the object-property relationships of an ontology class.
get_onto
Return the loaded TVB-O ontology object.
get_parameters_by_catalogue
Retrieves parameters for a given TVB model, based on a specified parameter catalogue.
get_property_annotation
Retrieves annotations for a given ontology class and property.
get_range
Retrieves the range for a given ontology variable.
get_sorted_dict
Creates a dictionary from a list of ontology classes. The dictionary’s keys are the class labels and its values are the class objects. The dictionary is sorted alphabetically based on its keys.
get_subclass_list
Retrieves subclasses for a given ontology class, up to a specified depth.
get_subclasses
Retrieves the subclasses for a given TVB-O class.
get_superclasses
Retrieves the superclasses for a given TVB-O class.
get_type
Retrieves the type of a TVB class for a given entity.
hangident
Indent a string by a specified amount.
import_model
Import a model from metadata into the ontology.
intersection
Computes the intersection of two lists.
join_set
Join the unique elements of an iterable into a comma-separated string.
ontology_info
Summarize the contents of the TVB-O ontology as component counts.
render_using_iri
Renders the ontology objects using their IRIs.
render_using_label
Renders the ontology objects using their labels.
replace_suffix
Strip the model-specific suffix from an ontology class’s label.
resolve_class
The ontology class name refers to, by IRI fragment or by label.
search_all
Search the ontology by label, synonym, and symbol and return the best match.
search_class
Searches for an ontology class using a given label.
search_in_model
Search a model’s descendant classes by label or definition for a search string.
select_variables
Selects variables from a list based on a given property.
wrap_text
Pretty print a string with automatic line breaks at specified intervals, while preserving existing new lines.
add_spaces_around_math_chars
ontology.owl.add_spaces_around_math_chars(s)
Insert spaces around mathematical operator characters in a string.
Parameters
s
The string to reformat.
required
Returns
str
The string with a space added on each side of every +, -, *, /,
str
or = that is not already surrounded by whitespace.
compare_models
ontology.owl.compare_models(model1, model2, by= 'ParameterCatalogue' )
Compares two TVB models based on their parameters or another specified metric.
Parameters
model1
owlready2.ThingClass or str
The first TVB model for comparison.
required
model2
owlready2.ThingClass or str
The second TVB model for comparison.
required
by
str
The metric to use for comparison. Default is “ParameterCatalogue”.
'ParameterCatalogue'
Returns
pd.DataFrame
pandas.DataFrame: A dataframe comparing the two TVB models based on the specified metric.
contains_math_char
ontology.owl.contains_math_char(s)
Check whether a string contains a mathematical operator character.
Parameters
s
The string to inspect.
required
Returns
bool
True if s contains any of +, -, *, /, =, or ^.
create_acronym
ontology.owl.create_acronym(text)
Generate a unique upper-case acronym from a camel-case name.
Letters are taken from each capitalised word, extending the acronym until it no longer collides with an existing acronym in the ontology.
Parameters
text
The camel-case text (e.g. a model name) to build an acronym from.
required
Returns
str
An upper-case acronym that is unique among existing ontology acronyms.
disintersection
ontology.owl.disintersection(lst1, lst2)
Computes the unique elements of two lists.
Parameters
lst1
list
The first list.
required
lst2
list
The second list.
required
Returns
list
list
The elements that are unique to each list.
filter_cls_list
ontology.owl.filter_cls_list(cls_list, by)
Filters out classes from a list that have a specific ancestor.
Parameters
cls_list
list
The list of classes to be filtered.
required
by
owlready2.ThingClass
The ancestor class to filter by.
required
Returns
list
list[owlready2.ThingClass]
The filtered list of classes.
find_best_fuzzy_match
ontology.owl.find_best_fuzzy_match(target, cls_list)
Find the best fuzzy match for a target string in a list of strings, prioritizing strings that start with the target followed by an underscore.
Parameters
target
str
The target string to match.
required
cls_list
list of str
The list of strings to search.
required
Returns
str
owlready2.ThingClass
The string from the list that best matches the target.
find_variables
ontology.owl.find_variables(
var,
model,
type = 'all' ,
include_synonyms= False ,
find_best_match= True ,
)
Finds a variable in a TVB model.
Parameters
var
str
The variable to find.
required
model
owlready2.ThingClass or str
The TVB model to search in.
required
type
str
The type of variable to find. Default is “all”.
'all'
include_synonyms
bool
If True, includes synonyms in the search. Default is False.
False
find_best_match
bool
If True, finds the best fuzzy match if multiple matches are found. Default is True.
True
Returns
owlready2.ThingClass | None
owlready2.ThingClass or None: The found variable class, or None if not found.
find_version
ontology.owl.find_version()
Retrieves the package version from the __init__.py file.
Returns
str
str
The version of the TVBO package.
Raises
RuntimeError
If the version cannot be found in the __init__.py file.
get_all_annotations
ontology.owl.get_all_annotations(prop)
Collect all distinct values of an annotation property across every class.
Parameters
prop
The name of the annotation property to gather.
required
Returns
list[str]
A list of the unique annotation values found across all ontology classes.
get_class_annotation_properties
ontology.owl.get_class_annotation_properties(cls)
Return the annotation properties of an ontology class.
Parameters
cls
The ontology class, or its label string to look up in the ontology.
required
Returns
The annotation_properties mapping for the class.
get_class_data_properties
ontology.owl.get_class_data_properties(cls)
Return the data properties of an ontology class.
Parameters
cls
The ontology class, or its label string to look up in the ontology.
required
Returns
The data_properties entry for the class.
get_class_object_properties
ontology.owl.get_class_object_properties(cls)
Return the object properties of an ontology class.
Parameters
cls
The ontology class, or its label string to look up in the ontology.
required
Returns
The list of object-property relationships for the class.
get_class_properties
ontology.owl.get_class_properties(cls)
Collect the label, identifier, annotation, and object properties of a class.
Parameters
cls
The ontology class, or its label string to look up in the ontology.
required
Returns
A dictionary with the class’s label, identifier,
annotation_properties, and object_properties.
get_coupling_function
ontology.owl.get_coupling_function(label= 'Linear' , verbose= True )
Retrieve a coupling-function class by its label or a synonym.
Parameters
label
The label (or synonym) of the coupling function to retrieve.
'Linear'
verbose
If True, print the valid coupling functions when the label is not found.
True
Returns
owlready2.ThingClass | None
The matching coupling-function class, or None if it is not found.
get_coupling_functions
ontology.owl.get_coupling_functions()
Return all coupling-function classes keyed by their label.
Returns
dict[str, owlready2.ThingClass]
A dictionary mapping each coupling function’s label to its ontology class.
get_def
ontology.owl.get_def(cls, mode= 'short' )
Retrieve the description or definition of a class based on the specified mode.
This function fetches either a short description or a long definition of the given class. If the requested type (short or long) is not available, it attempts to fetch the other type.
Parameters
cls : class The class for which the description or definition is being retrieved. mode : str, optional The mode specifying the type of text to retrieve: ‘short’ for a brief description or ‘long’ for a detailed definition. The default is ‘short’.
Returns:
str The description or definition of the class. If neither is available, it returns None.
get_default_values
ontology.owl.get_default_values(NMM, tvb_name= False , class_as_key= False )
Retrieves the default values for a given TVB model’s parameters.
Parameters
NMM
owlready2.ThingClass or str
The TVB model to retrieve the default values for.
required
tvb_name
bool
If True, uses the TVB name for the parameter. Default is False.
False
Returns
dict
dict[str, float | bool | int]
A dictionary of parameter names and their default values.
get_definition
ontology.owl.get_definition(tvbo_class)
Retrieves the definition for a given ontology class.
Parameters
tvbo_class
owlready2.ThingClass or str
The ontology class to retrieve the definition for.
required
Returns
str
str
The definition for the given ontology class.
get_info
ontology.owl.get_info(cls)
Build a formatted text summary of an ontology class with its definition and references.
A class states as much of itself as it carries. 776 of the ontology’s 1516 classes have no definition and 13 have no label; reading either unconditionally is what made this raise AttributeError on more than half of them. The IRI fragment stands in for a missing label, and a missing definition simply leaves that section out. definition and has_reference are annotation properties TVB-O declares, so a class from an imported ontology — owl:Thing among them — does not carry the properties at all, let alone empty ones.
Parameters
cls
The ontology class, or a string naming it by IRI fragment or by label.
required
Returns
str
A multi-line string with the class label as a heading, its wrapped
str
definition when it has one, and a references section when it has references.
Raises
KeyError
If a string names no class in the ontology.
get_integrator
ontology.owl.get_integrator(integration_method= 'Heun' )
Retrieve the ontology class for a named integration method.
Parameters
integration_method
The label of the integration method to look up.
'Heun'
Returns
owlready2.ThingClass
The matching integration-method class, or None if none is found. When
owlready2.ThingClass
several match, the first is returned (with a message printed).
get_model
ontology.owl.get_model(label= 'JansenRit' , model_type= 'NMM' , verbose= False )
Retrieves a specific TVB-O model using its label.
Parameters
label
str
The label of the model to retrieve. Default is “JansenRit”.
'JansenRit'
model_type
str
The type of model to retrieve. Default is “NMM”.
'NMM'
Returns
owlready2.ThingClass
owlready2.ThingClass: The ontology class for the specified model.
get_model_acronym
ontology.owl.get_model_acronym(NMM)
Retrieves the acronym for a given TVB model.
Parameters
NMM
owlready2.ThingClass or str
The TVB model to retrieve the acronym for.
required
Returns
str
str | None
The acronym for the given TVB model.
get_model_arguments
ontology.owl.get_model_arguments(NMM)
Retrieves the arguments for a given TVB model.
Parameters
NMM
owlready2.ThingClass or str
The TVB model to retrieve the arguments for.
required
Returns
dict
dict[str, owlready2.ThingClass]
A dictionary of argument labels and their corresponding ontology class objects.
get_model_coefficients
ontology.owl.get_model_coefficients(NMM)
Retrieves the coefficients for a given TVB model.
Parameters
NMM
owlready2.ThingClass or str
The TVB model to retrieve the coefficients for.
required
Returns
dict
dict[str, owlready2.ThingClass]
A dictionary of coefficient labels and their corresponding ontology class objects.
get_model_conditionals
ontology.owl.get_model_conditionals(NMM)
Retrieve the conditional derived variables for a given TVB model.
Parameters
NMM
The TVB model to retrieve the conditionals for, or its label string.
required
Returns
dict[str, owlready2.ThingClass]
A dictionary mapping each suffix-stripped conditional label to its
dict[str, owlready2.ThingClass]
ontology class object.
get_model_constants
ontology.owl.get_model_constants(NMM, return_as_dict= True )
Retrieve the constants for a given TVB model.
Parameters
NMM
The TVB model to retrieve the constants for, or its label string.
required
return_as_dict
If True, sort and key the constants by their label before suffix stripping.
True
Returns
dict[str, owlready2.ThingClass] | list[owlready2.ThingClass]
A dictionary mapping each suffix-stripped constant label to its ontology
dict[str, owlready2.ThingClass] | list[owlready2.ThingClass]
class object.
get_model_coupling_terms
ontology.owl.get_model_coupling_terms(
NMM,
only_global= True ,
return_as_dict= True ,
)
Retrieves the coupling terms for a given TVB model.
Parameters
NMM
owlready2.ThingClass or str
The TVB model to retrieve the coupling terms for.
required
Returns
dict
dict[str, owlready2.ThingClass] | list[owlready2.ThingClass]
A dictionary of coupling term labels and their corresponding ontology class objects.
get_model_cvars
ontology.owl.get_model_cvars(NMM, return_as_dict= True )
Retrieves the cvars (coupling variables) for a given TVB model.
Parameters
NMM
owlready2.ThingClass or str
The TVB model to retrieve the cvars for.
required
Returns
list
dict[str, owlready2.ThingClass] | list[owlready2.ThingClass]
The cvars for the given TVB model.
get_model_derivatives
ontology.owl.get_model_derivatives(NMM, return_as_dict= True )
Retrieves the derivatives for a given TVB model.
Parameters
NMM
owlready2.ThingClass or str
The TVB model to retrieve the derivatives for.
required
Returns
dict
dict[str, owlready2.ThingClass] | list[owlready2.ThingClass]
A dictionary of derivative labels and their corresponding ontology class objects.
get_model_functions
ontology.owl.get_model_functions(NMM)
Retrieves the functions for a given TVB model.
Parameters
NMM
owlready2.ThingClass or str
The TVB model to retrieve the functions for.
required
Returns
dict
dict[str, owlready2.ThingClass]
A dictionary of function labels and their corresponding ontology class objects.
get_model_parameters
ontology.owl.get_model_parameters(NMM, return_as_dict= True )
Retrieves the parameters for a given TVB model.
Parameters
NMM
owlready2.ThingClass or str
The TVB model to retrieve the parameters for.
required
Returns
dict
dict[str, owlready2.ThingClass] | list[owlready2.ThingClass]
A dictionary of parameter labels and their corresponding ontology class objects.
get_model_statevariables
ontology.owl.get_model_statevariables(NMM, return_as_dict= True )
Retrieves the state variables for a given TVB model.
Parameters
NMM
owlready2.ThingClass or str
The TVB model to retrieve the state variables for.
required
return_as_dict
bool
If True, returns the state variables as a dictionary. Default is True.
True
Returns
dict
dict[str, owlready2.ThingClass] | list[owlready2.ThingClass]
A dictionary of state variable labels and their corresponding ontology class objects.
get_model_suffix
ontology.owl.get_model_suffix(NMM)
Retrieves the suffix for a given TVB model, based on its acronym.
Parameters
NMM
owlready2.ThingClass or str
The TVB model to retrieve the suffix for.
required
Returns
str
str
The suffix for the given TVB model.
get_model_variables
ontology.owl.get_model_variables(NMM)
Retrieves the variables for a given TVB model.
Parameters
NMM
owlready2.ThingClass or str
The TVB model to retrieve the variables for.
required
Returns
list
list[owlready2.ThingClass]
The list of variables for the given TVB model.
get_model_vois
ontology.owl.get_model_vois(model)
Retrieve the variables of interest (VOIs) for a given TVB model.
Combines the model’s default VOIs with any extra VOIs listed on the model, spacing out operator-based expressions.
Parameters
model
The TVB model to retrieve the VOIs for, or its label string.
required
Returns
tuple[str]
A sorted tuple of unique VOI names, falling back to the model’s state
tuple[str]
variables when no VOIs are defined.
get_models
ontology.owl.get_models(model_type= 'NMM' , from_df= False )
Retrieves all TVB-O models of a given type.
Parameters
model_type
str
The type of model to retrieve. Default is “NMM”.
'NMM'
from_df
bool
If True, retrieves models from a dataframe. Default is False.
False
Returns
dict
dict[str, owlready2.ThingClass]
A dictionary of model labels and their corresponding ontology class objects.
get_object_properties
ontology.owl.get_object_properties(ontology_class, include_restriction= True )
Collect the object-property relationships of an ontology class.
Parameters
ontology_class
The ontology class to inspect.
required
include_restriction
If True, include owl:someValuesFrom-style restriction relationships.
True
Returns
A list of single-key dictionaries mapping each property name (or
"is_a") to its target value.
get_onto
Return the loaded TVB-O ontology object.
Returns
owlready2.namespace.Ontology
The loaded owlready2 ontology backing this module.
get_parameters_by_catalogue
ontology.owl.get_parameters_by_catalogue(NMM, param_key)
Retrieves parameters for a given TVB model, based on a specified parameter catalogue.
Parameters
NMM
owlready2.ThingClass or str
The TVB model to retrieve parameters for.
required
param_key
str
The parameter catalogue to use for retrieving parameters.
required
Returns
pd.DataFrame
pandas.DataFrame: A dataframe of parameters, their definitions, and their categories.
get_property_annotation
ontology.owl.get_property_annotation(tvbo_class, property )
Retrieves annotations for a given ontology class and property.
Parameters
tvbo_class
owlready2.ThingClass or str
The ontology class to retrieve annotations for.
required
property
str
The property to retrieve annotations for.
required
Returns
list
list[owlready2.ThingClass]
The annotations for the given ontology class and property.
get_range
ontology.owl.get_range(variable, return_array= False )
Retrieves the range for a given ontology variable.
Parameters
variable
owlready2.ThingClass or str
The ontology variable to retrieve the range for.
required
return_array
bool
If True, returns the range as an array. Default is False.
False
Returns
tuple | np.ndarray
tuple or numpy.ndarray: The range for the given ontology variable.
get_sorted_dict
ontology.owl.get_sorted_dict(class_list)
Creates a dictionary from a list of ontology classes. The dictionary’s keys are the class labels and its values are the class objects. The dictionary is sorted alphabetically based on its keys.
Parameters
class_list
list
The list of ontology classes.
required
Returns
dict
dict
A sorted dictionary of class labels and their corresponding class objects.
get_subclass_list
ontology.owl.get_subclass_list(cls, level= 1 , exclude_cls= None )
Retrieves subclasses for a given ontology class, up to a specified depth.
Parameters
cls
owlready2.ThingClass
The ontology class to retrieve subclasses for.
required
level
int
The depth to retrieve subclasses up to. Default is 1.
1
exclude_cls
owlready2.ThingClass
A class to exclude from the results. Default is None.
None
Returns
list
list[owlready2.ThingClass]
The list of subclasses for the given ontology class.
get_subclasses
ontology.owl.get_subclasses(tvbo_class, recursive= False )
Retrieves the subclasses for a given TVB-O class.
Parameters
tvbo_class
owlready2.ThingClass
The TVB-O class to retrieve subclasses for.
required
recursive
bool
If True, retrieves subclasses recursively. Default is False.
False
Returns
list
list[owlready2.ThingClass]
The list of subclasses for the given TVB-O class.
get_superclasses
ontology.owl.get_superclasses(tvbo_class)
Retrieves the superclasses for a given TVB-O class.
Parameters
tvbo_class
owlready2.ThingClass
The TVB-O class to retrieve superclasses for.
required
Returns
list
list[owlready2.ThingClass]
The list of superclasses for the given TVB-O class.
get_type
Retrieves the type of a TVB class for a given entity.
Parameters
c
owlready2.ThingClass
The TVB class instance.
required
Returns
str
owlready2.ThingClass
The type of the TVB entity.
hangident
ontology.owl.hangident(text, indent= 4 )
Indent a string by a specified amount.
Parameters
text
str
The text to be indented.
required
indent
int
The amount to indent the text by.
4
import_model
ontology.owl.import_model(model_metadata, model_name= None )
Import a model from metadata into the ontology.
Creates ontology subclasses for state variables, parameters, derived variables, and output transforms.
Parameters
model_metadata
Union[str, dict, tvbo_datamodel.Dynamics, tvbo_datamodel.SimulationExperiment]
A Dynamics, SimulationExperiment, dict, or path to a YAML file.
required
model_name
str | None
Name to use for the created ontology class.
None
Returns
owlready2.ThingClass
owlready2.entity.ThingClass: The created ontology model class.
intersection
ontology.owl.intersection(lst1, lst2)
Computes the intersection of two lists.
Parameters
lst1
list
The first list.
required
lst2
list
The second list.
required
Returns
list
list
The intersection of the two given lists.
join_set
Join the unique elements of an iterable into a comma-separated string.
Parameters
a
The iterable of strings whose distinct values are joined.
required
Returns
A comma-separated string of the distinct elements.
ontology_info
ontology.owl.ontology_info(print_info= True , return_info= False , return_df= False )
Summarize the contents of the TVB-O ontology as component counts.
Parameters
print_info
If True, print the base IRI and a count of each component group.
True
return_info
If True, return the collected components as a Bunch.
False
return_df
If True, return the component counts as a pandas.DataFrame.
False
Returns
A Bunch of component lists when return_info is set, or a count
DataFrame indexed by component name when return_df is set; otherwise
nothing is returned.
render_using_iri
ontology.owl.render_using_iri(entity)
Renders the ontology objects using their IRIs.
Parameters
entity
owlready2.entity
The ontology class or entity to be rendered.
required
Returns
str
str
The IRI of the given ontology entity.
render_using_label
ontology.owl.render_using_label(entity)
Renders the ontology objects using their labels.
Parameters
entity
owlready2.entity
The ontology class or entity to be rendered.
required
Returns
str
str
The label of the given ontology entity.
replace_suffix
ontology.owl.replace_suffix(cls)
Strip the model-specific suffix from an ontology class’s label.
The suffix is derived from the acronyms of the class’s neural-mass-model, coupling, or data-type ancestors.
Parameters
cls
The ontology class, or its label string to look up in the ontology.
required
Returns
str
The class label with any matching ancestor suffix removed. The original
str
label (or string) is returned when no suffix matches.
resolve_class
ontology.owl.resolve_class(name)
The ontology class name refers to, by IRI fragment or by label.
onto[...] resolves a fragment only within the ontology’s own IRI, so every class reached through an import — Annotation, Space, the UBERON and NCBITaxon terms — is invisible to it. The imported classes are searched here too.
Both lookups are exact. The ontology’s own label_search matches loosely, which is right for a search box and wrong for resolving a name: it answers 'Annotation' with 'annotation criteria application', a different class, with no sign that it guessed. A name that matches nothing raises rather than yielding None for the caller to fail on later.
Raises
KeyError
If no class carries that IRI fragment or that exact label.
search_all
ontology.owl.search_all(search_term, from_class= None , case_sensitive= False )
Search the ontology by label, synonym, and symbol and return the best match.
Parameters
search_term
The prefix to search for.
required
from_class
Restrict the search to this class’s descendants; if None, search all ontology classes.
None
case_sensitive
If True, perform a case-sensitive search.
False
Returns
owlready2.ThingClass | None
The class matching across the most search dimensions, or None if
owlready2.ThingClass | None
nothing matches.
search_class
ontology.owl.search_class(label)
Searches for an ontology class using a given label.
Parameters
label
str
The label to search for, with regex support.
required
Returns
owlready2.ThingClass | owlready2.triplelite._SearchList
owlready2.ThingClass or owlready2.triplelite._SearchList:
owlready2.ThingClass | owlready2.triplelite._SearchList
The ontology class(es) that match the given label.
search_in_model
ontology.owl.search_in_model(search_str, model, wildcards= True )
Search a model’s descendant classes by label or definition for a search string.
Parameters
search_str
The text to search for.
required
model
owlready2.ThingClass
The TVB model to search within, or its label string.
required
wildcards
If True, wrap search_str in * wildcards; otherwise append the model’s suffix to the search string.
True
Returns
owlready2.ThingClass | list[owlready2.ThingClass] | None
The single matching class when exactly one is found, None when none
owlready2.ThingClass | list[owlready2.ThingClass] | None
match, or the list of matching classes otherwise.
select_variables
ontology.owl.select_variables(variables, property )
Selects variables from a list based on a given property.
Parameters
variables
list
The list of variables to select from.
required
property
str
The property to use for selecting variables.
required
Returns
list
list[owlready2.ThingClass]
The selected variables.
wrap_text
ontology.owl.wrap_text(text, line_length= 100 , line_breaks= ' \n ' )
Pretty print a string with automatic line breaks at specified intervals, while preserving existing new lines.
Parameters
text
str
The text to be printed.
required
line_length
int
The maximum length of each line.
100