owmeta_core.identifier_mixin module¶
- class owmeta_core.identifier_mixin.IdMixin(ident=None, key=None, *args, direct_key=None, **kwargs)[source]¶
Bases:
objectMixin that provides common identifier logic
- Attributes
hashfunfunctionReturns a sha224 hash object; optionally initialized with a string
- rdf_namespace
rdflib.namespace.Namespace The namespace for identifiers created
- direct_keybool
Whether to make a key directly, just adding the string onto the namespace or indirectly by hashing the key before joining with the namespace.
- defined_augment()[source]¶
This fuction must return False if
identifier_augment()would raise anIdentifierMissingException. Override it when defining a non-standard identifier for subclasses of DataObjects.
- hashfun()¶
Returns a sha224 hash object; optionally initialized with a string
- identifier_augment()[source]¶
Override this method to define an identifier in lieu of one explicity set.
One must also override
defined_augment()to return True whenever this method could return a valid identifier.IdentifierMissingExceptionshould be raised if an identifier cannot be generated by this method.- Raises
- classmethod make_identifier(data)[source]¶
Makes an identifier based on this class’
rdf_namespaceby calling__str__on the data and passing to the class’hashfun.If the
__str__for data’s type doesn’t function as an identifier, you should use eithermake_identifier_direct()or overrideidentifier_augment()anddefined_augment()
- classmethod make_identifier_direct(string)[source]¶
Make identifier by using the
quote’d value ofkeyappended to therdf_namespacevalue
- property identifier¶
The identifier