Editor

class pyomexmeta.Editor(editor_ptr: ctypes.c_longlong)

Primary interface for creating new, modifying existing or deleting annotations from an rdf graph

__init__(editor_ptr: ctypes.c_longlong)

Editor constructor.

Most users should not use the constructor directly but instead use the creator method RDF.to_editor(). This ensures that the necessary references to the parent RDF object (and existing namespaces etc) are properly passed to the Editor class.

Parameters

editor_ptr – A pointer (a ctypes c_int64) that points to an Editor object in memory

See Also

RDF.to_editor()

__weakref__

list of weak references to the object (if defined)

add_creator(creator)pyomexmeta.pyomexmeta.Editor

Add model level annotation “creator” to the rdf graph

add_curator(curator)pyomexmeta.pyomexmeta.Editor

Add model level annotation “curator” to the rdf graph

add_date_created(date_created)pyomexmeta.pyomexmeta.Editor

Add model level annotation “date created” to the rdf graph

add_description(description)pyomexmeta.pyomexmeta.Editor

Add model level annotation “description” to the rdf graph

add_energy_diff(energy_diff: pyomexmeta.pyomexmeta.EnergyDiff)None

Adds a EnergyDiff to the relevant RDF graph (the one that created this Editor).

Users do not normally call this method themselves, because the preferred user interface is to use the context manager for EnergyDiff. If the context manager for EnergyDiff is not used to create the EnergyDiff object, then this method must be called to add the EnergyDiff object to the relevant RDF object See Examples.

Parameters

energy_diff – An instance of EnergyDiff to add to the model

See also

EnergyDiff

Returns: None

add_namespace(namespace: str, prefix: str)None

Add a new namespace to the RDF graph.

Parameters
  • namespace – The full uri for the namespace

  • prefix – The prefix that may be used instead of the full uri

Returns: None

Examples

>>> rdf = RDF()
>>> editor = rdf.to_editor("<insert xml here>")
>>> editor.add_namespace("http://fantasticalNamespace", "fanta")
add_parent_model(parent_model)pyomexmeta.pyomexmeta.Editor

Add model level annotation “parent model” to the rdf graph

add_personal_information(personal_information: pyomexmeta.pyomexmeta.PersonalInformation)None

Adds a PersonalInformation to the relevant RDF graph (the one that created this Editor).

Users do not normally call this method themselves, because the preferred user interface is to use the context manager for PersonalInformation. If the context manager for PersonalInformation is not used to create the PersonalInformation object, then this method must be called to add the PersonalInformation object to the relevant RDF object See Examples.

Parameters

personal_information – An instance of PersonalInformation to add to the model

Returns: None

add_physical_entity(physical_entity: pyomexmeta.pyomexmeta.PhysicalEntity)None

Adds a PhysicalEntity to the relevant RDF graph (the one that created this Editor).

Users do not normally call this method themselves, because the preferred user interface is to use the context manager for PhysicalEntity. If the context manager for PhysicalEntity is not used to create the PhysicalEntity object, then this method must be called to add the PhysicalEntity object to the relevant RDF object See Examples.

Parameters

physical_entity – An instance of PhysicalEntity to add to the model

See also

PhysicalEntity

Returns: None

add_physical_process(physical_process: pyomexmeta.pyomexmeta.PhysicalProcess)None

Adds a PhysicalProcess to the relevant RDF graph (the one that created this Editor).

Users do not normally call this method themselves, because the preferred user interface is to use the context manager for PhysicalProcess. If the context manager for PhysicalProcess is not used to create the PhysicalProcess object, then this method must be called to add the PhysicalProcess object to the relevant RDF object See Examples.

Parameters

physical_process – An instance of PhysicalProcess to add to the model

See also

PhysicalProcess

Returns: None

add_physical_property(property: pyomexmeta.pyomexmeta.PhysicalProperty)None

Adds a PhysicalProperty to the relevant RDF graph (the one that created this Editor).

Composite annotations usually create their own PhysicalProperty but this method gives users the option to add one manually.

Users do not normally call this method themselves, because the preferred user interface is to use the context manager for PhysicalProperty. If the context manager for PhysicalProperty is not used to create the PhysicalProperty object, then this method must be called to add the PhysicalProperty object to the relevant RDF object See Examples.

Parameters

property – An instance of PhysicalProperty to add to the model

See also

PhysicalProperty

Returns: None

add_pubmed(pubmed)pyomexmeta.pyomexmeta.Editor

Add model level annotation “pubmed” to the rdf graph

add_singular_annotation(singular_annotation: pyomexmeta.pyomexmeta.SingularAnnotation)None

Adds a SingularAnnotation, which represents a single Triple. The SingularAnnotation is added to the RDF graph that created this Editor object.

Users can add arbitrary singular annotations to an RDF graph.

Users do not normally call this method themselves, because the preferred user interface is to use the context manager for SingularAnnotation. If the context manager for SingularAnnotation is not used to create the SingularAnnotation object, then this method must be called to add the SingularAnnotation object to the relevant RDF object See Examples.

Parameters

singular_annotation – An instance of SingularAnnotation to add to the model

Returns: None

add_taxon(taxon)pyomexmeta.pyomexmeta.Editor

Add model level annotation “taxon” to the rdf graph

check_valid_metaid(id: str)None

Convenience method for checking whether the metaid id is valid for this RDF graph

delete()

clean up resources used by this Editor object

get_metaids()List[str]

Return a list of available metaids for current xml model

get_xml()str

Returns the xml currently being edited by this Editor

new_energy_diff()pyomexmeta.pyomexmeta.EnergyDiff

Create a new EnergyDiff object.

This is a context manager, i.e. designed to be used inside a with block. Doing so, automatically adds this EnergyDiff to the relevant RDF object. Use without a context manager requires users to manually add the EnergyDiff to the RDF using add_energy_diff()

See also

EnergyDiff

Returns

EnergyDiff

new_personal_information()pyomexmeta.pyomexmeta.PersonalInformation

Create a new PersonalInformation object.

This is a context manager, i.e. designed to be used inside a with block. Doing so, automatically adds this PersonalInformation to the relevant RDF object. Use without a context manager requires users to manually add the PersonalInformation to the RDF using add_personal_information()

Returns

PersonalInformation

new_physical_entity()pyomexmeta.pyomexmeta.PhysicalEntity

Create a new PhysicalEntity object.

This is a context manager, i.e. designed to be used inside a with block. Doing so, automatically adds this PhysicalEntity to the relevant RDF object. Use without a context manager requires users to manually add the PhysicalEntity to the RDF using add_physical_entity()

See also

PhysicalEntity

Returns

PhysicalEntity

new_physical_process()pyomexmeta.pyomexmeta.PhysicalProcess

Create a new PhysicalProcess object.

This is a context manager, i.e. designed to be used inside a with block. Doing so, automatically adds this PhysicalProcess to the relevant RDF object. Use without a context manager requires users to manually add the PhysicalProcess to the RDF using add_physical_process()

See also

PhysicalProcess

Returns

PhysicalProcess

new_physical_property()pyomexmeta.pyomexmeta.PhysicalProperty

Create a new EnergyDiff object

new_singular_annotation()pyomexmeta.pyomexmeta.SingularAnnotation

Create a new SingularAnnotation object.

This is a context manager, i.e. designed to be used inside a with block. Doing so, automatically adds this SingularAnnotation to the relevant RDF object. Use without a context manager requires users to manually add the SingularAnnotation to the RDF using add_singular_annotation()

Returns

SingularAnnotation

remove_energy_diff(energy_diff_ptr: ctypes.c_longlong)None

Remove a EnergyDiff from the RDF graph. Does nothing if not exists

remove_personal_information(personal_information_ptr: ctypes.c_longlong)None

Remove a PersonalInformation from the RDF graph. Does nothing if not exists

remove_physical_entity(physical_entity_ptr: ctypes.c_longlong)None

Remove a PhysicalEntity from the RDF graph. Does nothing if not exists

remove_physical_process(physical_process_ptr: ctypes.c_longlong)None

Remove a PhysicalProcess from the RDF graph. Does nothing if not exists

remove_single_annotation(single_annotaiton_ptr: ctypes.c_longlong)None

Remove a SingularAnnotation from the RDF graph. Does nothing if not exists