icat.entities — Provide classes corresponding to the ICAT schema

Provide the classes corresponding to the entities in the ICAT schema.

The classes representing the entities in the ICAT schema are dynamically created based on the entity information queried from the ICAT server. The classes are derived from the abstract base class icat.entity.Entity. They override the class attributes icat.entity.Entity.BeanName, icat.entity.Entity.Constraint, icat.entity.Entity.InstAttr, icat.entity.Entity.InstRel, icat.entity.Entity.InstMRel, icat.entity.Entity.AttrAlias, and icat.entity.Entity.SortAttrs as appropriate.

Furthermore, custom methods are added to a few selected entity classes.

Changed in version 0.17.0: create the entity classes dynamically.

class icat.entities.GroupingMixin

Bases: object

Mixin class to define custom methods for Grouping objects.

addUsers(users)

Add users to the group.

getUsers(attribute=None)

Get the users in the group. If attribute is given, return the corresponding attribute for all users in the group, otherwise return the users.

class icat.entities.InstrumentMixin

Bases: object

Mixin class to define custom methods for Instrument objects.

addInstrumentScientists(users)

Add instrument scientists to the instrument.

getInstrumentScientists(attribute=None)

Get instrument scientists of the instrument. If attribute is given, return the corresponding attribute for all users related to the instrument, otherwise return the users.

class icat.entities.InvestigationMixin

Bases: object

Mixin class to define custom methods for Investigation objects.

addInstrument(instrument)

Add an instrument to the investigation.

addKeywords(keywords)

Add keywords to the investigation.

addInvestigationUsers(users, role='Investigator')

Add investigation users.

class icat.entities.Investigation44Mixin

Bases: InvestigationMixin

Mixin class to define custom methods for Investigation objects for ICAT version 4.4.0 and later.

addInvestigationGroup(group, role=None)

Add an investigation group.

icat.entities.getTypeMap(client)

Generate a type map for the client.

Query the ICAT server about the entity classes defined in the schema and their attributes and relations. Generate corresponding Python classes representing these entities. The Python classes are based on icat.entity.Entity.

Parameters:

client (icat.client.Client) – a client object configured to connect to an ICAT server.

Returns:

a mapping of type names from the ICAT web service description to the corresponding Python classes. This mapping may be used as icat.client.Client.typemap for the client object.

Return type:

dict