is_valid_identifier

is_valid_identifier(prefix, identifier)[source]

Check that an identifier strictly matches a prefix’s local unique identifier pattern.

Parameters
  • prefix (str) – The prefix in the CURIE

  • identifier (str) – The identifier in the CURIE

Return type

Optional[bool]

Returns

Whether this identifier passes validation

See also

The is_known_identifier() performs normalization before checking validity

>>> is_valid_identifier("chebi", "1234")
True
>>> is_valid_identifier("chebi", "ABCD")
False
>>> is_valid_identifier("chebi", "CHEBI:12345")
False