entity_management.base¶
Base simulation entities
Functions
|
decorator to simplify creation of classes that have args and kwargs |
|
Overload of __getattribute__ to trigger instantiation of Nexus object if the attribute is NotInstantiated |
Classes
Blank node. |
|
|
Brain location. |
|
Derivation. |
|
Utility class making derived classed immutable. |
Represents collapsed/lazy loaded entity having type and id. |
|
|
Ontology term such as brain region or species |
|
External resource representations, this can be a file or a folder on gpfs |
|
Subject. |
|
Shapeless data. |
- class entity_management.base.BrainLocation(*, brainRegion)¶
Bases:
BlankNodeBrain location.
- Parameters:
brainRegion (OntologyTerm) – Brain region ontology term.
- class entity_management.base.Frozen¶
Bases:
objectUtility class making derived classed immutable. Use evolve method to introduce changes.
- evolve(**changes)¶
Create new instance of the frozen(immutable) object with changes applied.
- Parameters:
changes – Keyword changes in the new copy, should be a subset of class constructor(__init__) keyword arguments.
- Returns:
New instance of the same class with changes applied.
- class entity_management.base.Identifiable¶
Bases:
FrozenRepresents collapsed/lazy loaded entity having type and id. Access to any attributes will load the actual entity from nexus and forward property requests to that entity.
- as_json_ld(include_rev=False)¶
Get json-ld representation of the Entity Return json with added json-ld properties such as @context and @type
- clone(**changes)¶
Create new instance of the frozen(immutable) object with changes applied.
Note: A clone is stripped of its id if present.
- Parameters:
changes – Keyword changes in the new copy, should be a subset of class constructor(__init__) keyword arguments.
- Returns:
New instance of the same class with changes applied.
- deprecate(sync_index=False, use_auth=None)¶
Mark entity as deprecated. Deprecated entities are not possible to retrieve by name.
- Parameters:
use_auth (str) – OAuth token in case access is restricted. Token should be in the format for the authorization header: Bearer VALUE.
- evolve(**changes)¶
Create new instance of the frozen(immutable) object with changes applied.
- Parameters:
changes – Keyword changes in the new copy, should be a subset of class constructor(__init__) keyword arguments.
- Returns:
New instance of the same class with changes applied.
- classmethod from_id(resource_id, *, on_no_result=None, cross_bucket=False, resolve_context=False, base=None, org=None, proj=None, use_auth=None, **kwargs)¶
Load entity from resource id.
- Parameters:
resource_id (str) – id of the entity to load.
on_no_result (Callable) – A function to be called when no result found. It will receive resource_id as a first argument.
cross_bucket (bool) – Use the resolvers instead of the resources endpoint. Default False.
resolve_context (bool) – Resolve ontological term curies using the resource’s context. Default False.
kwargs – Keyword arguments which will be forwarded to
on_no_resultfunction.use_auth (str) – OAuth token in case access is restricted. Token should be in the format for the authorization header: Bearer VALUE.
- classmethod from_url(url, *, resolve_context=False, base=None, org=None, proj=None, use_auth=None)¶
Load entity from url.
- Parameters:
url (str) – Full url to the entity in nexus.
_selfcontent is a valid full URL.resolve_context (bool) – Resolve ontological term curies using the resource’s context. Default False.
use_auth (str) – OAuth token in case access is restricted. Token should be in the format for the authorization header: Bearer VALUE.
- classmethod get_constrained_url(base=None, org=None, proj=None)¶
Get schema constrained url.
- get_id()¶
Retrieve _id property.
- get_rev()¶
Retrieve _rev property.
- get_url()¶
Retrieve URL of the nexus entity.
- Returns:
Content of the
_selfproperty.
- classmethod list_by_schema(**kwargs)¶
List all instances belonging to the schema this type defines.
- Parameters:
changes – Keyword changes in the new copy, should be a subset of class constructor(__init__) keyword arguments.
- Returns:
New instance of the same class with changes applied.
- publish(*, resource_id=None, sync_index=False, base=None, org=None, proj=None, use_auth=None, include_rev=False)¶
Create or update entity in nexus. Makes a remote call to nexus instance to persist entity attributes.
- Parameters:
- Returns:
New instance of the same class with revision updated.
- class entity_management.base.OntologyTerm(*, url, label=None)¶
Bases:
FrozenOntology term such as brain region or species
- class entity_management.base.QuantitativeValue(*, value, unitText=None, unitCode=None)¶
Bases:
FrozenExternal resource representations, this can be a file or a folder on gpfs
- class entity_management.base.Subject(*, species=None, strain=None)¶
Bases:
BlankNodeSubject.
- Parameters:
name (str) – Subject name.
species (OntologyTerm) – Species ontology term.
strain (OntologyTerm) – Strain ontology term.
- class entity_management.base.Unconstrained(*, json)¶
Bases:
IdentifiableShapeless data.
- Parameters:
json (dict) – python dictionary which will be seralized into json.
- entity_management.base.attributes(attr_dict=None, repr=True)¶
decorator to simplify creation of classes that have args and kwargs
- entity_management.base.custom_getattr(obj, name)¶
Overload of __getattribute__ to trigger instantiation of Nexus object if the attribute is NotInstantiated