MivotInstance¶
- class pyvo.mivot.writer.MivotInstance(dmtype, *, dmrole=None, dmid=None)[source]¶
- Bases: - object- API for building <INSTANCE> elements of MIVOT annotation step by step. - This class provides methods for incremental construction of a MIVOT instance. It builds <INSTANCE> elements that can contain <ATTRIBUTE>, <INSTANCE>, and <REFERENCE>. Support for <COLLECTION> elements is not yet implemented. - The main features are: - Model-agnostic: The implementation is independent of any specific data model. 
- Syntax validation: Ensures basic MIVOT syntax rules are followed. 
- Context-agnostic: Ignores context-dependent syntax rules. 
 - Attributes:
- _dmtypestring
- Instance type (class VO-DML ID) 
- _dmrolestring
- Role played by the instance in the context where it is used (given by the VO-DML serialization of the model) 
- _dmidstring
- Free identifier of the instance 
 
 - Parameters:
- dmtypestr
- dmtype of the INSTANCE (mandatory) 
- dmrolestr, optional
- dmrole of the INSTANCE 
- dmidstr, optional
- dmid of the INSTANCE 
 
- Raises:
- MappingError
- If - dmtypeis not provided
 
 - Attributes Summary - Methods Summary - add_attribute([dmtype, dmrole, value, unit])- Add an <ATTRIBUTE> element to the instance. - add_collection(dmrole, mivot_instances)- to be documented - add_instance(mivot_instance)- Add a nested <INSTANCE> element to the instance. - add_reference([dmrole, dmref])- Add a <REFERENCE> element to the instance. - Build and serialize the <INSTANCE> element as a string. - Attributes Documentation - dmid¶
 - Methods Documentation - add_attribute(dmtype=None, dmrole=None, *, value=None, unit=None)[source]¶
- Add an <ATTRIBUTE> element to the instance. - Parameters:
- dmtypestr
- dmtype of the ATTRIBUTE (mandatory) 
- dmrolestr
- dmrole of the ATTRIBUTE (mandatory) 
- valuestr or numerical, optional
- ID of the column to set the attribute value. If ref is a string starting with a * or is numerical, it is considered as a value (* stripped) as a ref otherwise 
- unitstr, optional
- Unit of the attribute 
 
- Raises:
- MappingError
- If - dmtypeor- dmroleis not provided, or if both- refand- valueare not defined
 
 
 - add_instance(mivot_instance)[source]¶
- Add a nested <INSTANCE> element to the instance. - Parameters:
- mivot_instanceMivotInstance
- INSTANCE to be added 
 
- Raises:
- MappingError
- If - mivot_instanceis not of type- MivotInstance