ahvn.ukf.base module

Universal Knowledge Framework (UKF) base module.

This module provides the core BaseUKF model and a small set of utility functions used throughout the UKF implementation:

  • Tag helpers: parsing, grouping and membership checks (tag_s, tag_v, tag_t, ptags, gtags, has_tag)

  • Relation helpers: check relation entries (has_related)

  • Versioning helper: next_ver

  • Default no-op trigger/composer helpers used as safe defaults

The data model is implemented with Pydantic and is intended to represent a piece of knowledge with rich metadata, provenance, tagging and simple relationship modelling. Most public functions and methods in this module use Google-style docstrings describing arguments, return values and raised exceptions.

ahvn.ukf.base.default_trigger(kl, **kwargs)[source]

Default trigger used as a noop predicate.

The default trigger always returns True and can be used as a safe placeholder when no custom trigger function is supplied.

Parameters:
  • kl (BaseUKF) – Knowledge object being evaluated (unused).

  • **kwargs – Additional context parameters (ignored).

Returns:

Always True.

Return type:

bool

ahvn.ukf.base.default_composer(kl, **kwargs)[source]

Default content composer that returns the raw content string.

This function is intended as a safe default for the content_composers mapping.

Parameters:
  • kl (BaseUKF) – Knowledge object to compose (only kl.content is used).

  • **kwargs – Additional composition parameters (ignored).

Returns:

The content attribute of kl.

Return type:

str

class ahvn.ukf.base.BaseUKF(*, name, notes='', short_description='', description='', type='general', version='v0.1.0', version_notes='', variant='default', variant_notes='', content='', content_resources=<factory>, content_composers=<factory>, source='unknown', parents=<factory>, creator='unknown', owner='unknown', workspace='unknown', collection='general', tags=<factory>, synonyms=<factory>, triggers=<factory>, priority=0, related=<factory>, auths=<factory>, timefluid=False, timestamp=<factory>, last_verified=<factory>, expiration=-1, inactive_mark=False, metadata=<factory>, profile=<factory>)[source]

Bases: BaseModel

Base model for knowledge items in the Universal Knowledge Framework (UKF).

This Pydantic model provides a comprehensive structure for representing knowledge units with detailed metadata, content management, provenance tracking, and relationship modeling. Each attribute includes comprehensive descriptions to guide users unfamiliar with UKF in correctly filling knowledge records from source documents and information.

The model is organized into logical sections:

Metadata: Core identification and classification fields (name, type, version, etc.) Content: The actual knowledge and supporting structured data Provenance: Origin tracking and ownership information Retrieval: Search, classification, and access control attributes Relationships: Connections to other knowledge items and permissions Lifecycle: Time-sensitive attributes for expiration and deprecation System: Extensible fields for application-specific data and runtime statistics

All field descriptions include practical examples and clear guidance on appropriate values, making this model self-documenting for users creating knowledge items from documents, conversations, or other information sources.

For detailed attribute guidance, refer to the comprehensive field descriptions in the model definition below.

Parameters:
type_default: ClassVar[str] = 'general'
tags_default: ClassVar[Set[str]] = {}
name: UKFMediumTextType
notes: UKFMediumTextType
short_description: UKFMediumTextType
description: UKFMediumTextType
type: UKFShortTextType
version: UKFShortTextType
version_notes: UKFMediumTextType
variant: UKFShortTextType
variant_notes: UKFMediumTextType
content: UKFLongTextType
content_resources: UKFJsonType
content_composers: UKFJsonType
source: UKFShortTextType
parents: UKFJsonType
creator: UKFShortTextType
owner: UKFShortTextType
workspace: UKFShortTextType
collection: UKFShortTextType
tags: UKFTagsType
synonyms: UKFSynonymsType
triggers: UKFJsonType
priority: UKFIntegerType
related: UKFRelatedType
auths: UKFAuthsType
timefluid: UKFBooleanType
timestamp: UKFTimestampType
last_verified: UKFTimestampType
expiration: UKFDurationType
inactive_mark: UKFBooleanType
metadata: UKFJsonType
profile: UKFJsonType
id_field: ClassVar[str] = 'id'
external_fields: ClassVar[Tuple[str]] = ('name', 'notes', 'short_description', 'description', 'type', 'version', 'version_notes', 'variant', 'variant_notes', 'content', 'content_resources', 'content_composers', 'source', 'parents', 'creator', 'owner', 'workspace', 'collection', 'tags', 'synonyms', 'triggers', 'priority', 'related', 'auths', 'timefluid', 'timestamp', 'last_verified', 'expiration', 'inactive_mark', 'metadata', 'profile')
internal_fields: ClassVar[Tuple[str]] = ('_id', '_content_hash', '_slots', '_type')
property_fields: ClassVar[Tuple[str]] = ('id', 'id_str', 'content_hash', 'content_hash_str', 'expiration_timestamp', 'is_inactive', 'is_active')
identity_hash_fields: ClassVar[Tuple[str]] = ('type', 'name', 'version', 'variant', 'source', 'creator', 'owner', 'workspace', 'collection', 'tags', 'timefluid')
content_hash_fields: ClassVar[Tuple[str]] = ('content', 'content_resources')
set_fields: ClassVar[Tuple[str]] = ('tags', 'synonyms', 'related', 'auths')
json_func_fields: ClassVar[Tuple[str]] = ('content_composers', 'triggers')
json_data_fields: ClassVar[Tuple[str]] = ('content_resources', 'parents', 'metadata', 'profile')
model_config = {'validate_assignment': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

__init__(**data)[source]

Initialize BaseUKF and set the _type discriminator.

classmethod model_validate(obj, *, strict=None, from_attributes=None, context=None, polymorphic=True)[source]

Validate a pydantic model instance with optional polymorphic deserialization.

This override of Pydantic’s model_validate adds polymorphic deserialization support. When polymorphic=True (default), the method checks the ‘type’ field and returns the appropriate UKFT subclass from the registry.

Parameters:
  • obj (Any) – The object to validate (dict, model instance, etc.)

  • strict (Optional[bool]) – Whether to strictly validate the object

  • from_attributes (Optional[bool]) – Whether to extract data from object attributes

  • context (Optional[Dict[str, Any]]) – Additional context for validation

  • polymorphic (bool) – If True (default), use registry for polymorphic deserialization. If False, use the class on which this method is called.

Returns:

Validated model instance of the appropriate UKFT subclass.

Return type:

BaseUKF

Examples

>>> data = {"name": "test", "type": "knowledge", ...}
>>> # Polymorphic - returns KnowledgeUKFT
>>> obj1 = BaseUKF.model_validate(data)
>>> # Non-polymorphic - returns BaseUKF
>>> obj2 = BaseUKF.model_validate(data, polymorphic=False)
serialize_tags(tags)[source]
Return type:

List[str]

Parameters:

tags (Set[str])

serialize_synonyms(synonyms)[source]
Return type:

List[str]

Parameters:

synonyms (Set[str])

serialize_related(related)[source]

Notice that the related is reversed: Since Set does not support Dict (relation_resources) as items, the relation tuples should actually be deserialized (str -> json) during serialize_related (export from Python object to JSON).

Return type:

List[Tuple[int, str, int, Optional[int], Optional[Dict[str, Any]]]]

Parameters:

related (Set[Tuple[int, str, int, int | None, str | None]])

serialize_auths(auths)[source]
Return type:

List[Tuple[str, str]]

Parameters:

auths (Set[Tuple[str, str]])

serialize_triggers(triggers)[source]
Return type:

Dict[str, Dict]

Parameters:

triggers (Dict[str, Callable])

classmethod validate_triggers(value)[source]

Validate and deserialize triggers.

serialize_content_composers(composers)[source]
Return type:

Dict[str, Dict]

Parameters:

composers (Dict[str, Callable])

classmethod validate_content_composers(value)[source]

Validate and deserialize content composers.

serialize_timestamp(dt)[source]
Return type:

str

Parameters:

dt (datetime)

serialize_last_verified(dt)[source]
Return type:

str

Parameters:

dt (datetime)

serialize_expiration(value)[source]
Return type:

int

Parameters:

value (timedelta)

serialize_expiration_timestamp(dt)[source]
Return type:

str

Parameters:

dt (datetime)

classmethod deserialize_tags(value)[source]

Backward compatibility method - validation is now handled by UKFTagsType.

Return type:

Set[str]

Parameters:

value (Iterable[str])

classmethod deserialize_synonyms(value)[source]

Backward compatibility method - validation is now handled by UKFSynonymsType.

Return type:

Set[str]

Parameters:

value (Iterable[str])

classmethod deserialize_related(value)[source]

Backward compatibility method - validation is now handled by UKFRelatedType.

Return type:

Set

Parameters:

value (Iterable)

classmethod deserialize_auths(value)[source]

Backward compatibility method - validation is now handled by UKFAuthsType.

Return type:

Set

Parameters:

value (Iterable)

classmethod deserialize_triggers(value)[source]

Backward compatibility method - deserialize function dictionaries.

Return type:

Dict[str, Callable]

classmethod deserialize_content_composers(value)[source]

Backward compatibility method - deserialize function dictionaries.

Return type:

Dict[str, Callable]

classmethod schema()[source]
Return type:

Dict[str, Any]

property id: int

Compute a deterministic integer identifier for the item.

The identifier is computed by hashing a selection of identity fields (see :pyattr:`identity_hash_fields`) and cached on the instance. The cached value is cleared by _resetinternal_fields() when needed.

Returns:

Integer hash value derived from identity fields.

Return type:

int

property id_str: str

Return the id value formatted as a zero-padded string.

Uses fmt_hash to produce a fixed-width, human-safe string representation of the integer id.

Returns:

Zero-padded string version of :pyattr:`id`.

Return type:

str

property content_hash: int

Compute a hash of the content-related fields for change detection.

The hash covers :pyattr:`content` and :pyattr:`content_resources` and is cached on the instance. Cache is invalidated by _resetinternal_fields().

Returns:

Integer hash representing the content state.

Return type:

int

property content_hash_str: str

Return the content hash formatted as a zero-padded string.

Returns:

String representation produced by fmt_hash for

:pyattr:`content_hash`.

Return type:

str

property expiration_timestamp: datetime

Compute the UTC timestamp when the item expires.

If :pyattr:`expiration` is negative the function returns a distant future sentinel (year 2500) indicating no automatic expiration.

Returns:

UTC datetime when the item becomes expired.

Return type:

datetime.datetime

property slots: Dict[str, Set[str]]

Return a mapping from tag slots to their set of values.

Parses :pyattr:`tags` and groups values by slot name (the left-hand side of a [SLOT:value] tag). The result is cached in the private attribute :pyattr:`_slots` for efficiency.

Returns:

Mapping of slot name to set of values.

Return type:

Dict[str, Set[str]]

has_tag(slot, operator='ANY_OF', value=None)[source]

Check whether this item’s tags satisfy a named condition for slot.

This is a convenience wrapper around the module-level has_tag() that uses this instance’s :pyattr:`tags` set.

Parameters:
  • slot (str) – Tag slot to check.

  • operator (TagOperator) – Operator to apply (see module-level has_tag() for supported operators).

  • value (Optional[Union[Iterable, str, Any]]) – Values to compare against for non-unary operators.

Returns:

True if the condition holds for this item’s tags.

Return type:

bool

has_related(subject_id=None, relation=None, object_id=None, relation_id=None, related_to_id=None)[source]

Return True if any relation on this item satisfies the provided filters.

This is a thin wrapper around the module-level has_related() that operates on :pyattr:`related`.

Parameters:
  • subject_id (Optional[Union[int, Iterable[int]]]) – Filter for subject id(s).

  • relation (Optional[Union[str, Iterable[str]]]) – Filter for relation name(s).

  • object_id (Optional[Union[int, Iterable[int]]]) – Filter for object id(s).

  • relation_id (Optional[Union[int, Iterable[int]]]) – Filter for relation id(s).

  • related_to_id (Optional[Union[int, Iterable[int]]]) – Matches when either subject or object id is included in this set.

Returns:

True when a matching relation exists.

Return type:

bool

property is_inactive: bool

Return True when the item is considered inactive.

An item is inactive when either :pyattr:`inactive_mark` is True or the current UTC time is past the value returned by :pyattr:`expiration_timestamp` (when expiration is enabled).

Returns:

True when the item is inactive.

Return type:

bool

property is_active: bool

Return True when the item is active (not inactive).

Returns:

Negation of :pyattr:`is_inactive`.

Return type:

bool

set_composer(name, composer)[source]

Add or update a content composer in :pyattr:`content_composers`.

Parameters:
  • name (str) – Name of the composer.

  • composer (Callable) – Callable that takes a BaseUKF instance and returns a string representation.

Raises:

ValueError – If name is empty or composer is not callable.

update_composers(composers=None)[source]

Update multiple content composers in :pyattr:`content_composers`.

Parameters:

composers (Optional[Dict[str, Callable]]) – Mapping of composer names to callables. If None, no changes are made.

Raises:

ValueError – If any name is empty or any composer is not callable.

text(composer='default', **kwargs)[source]

Return a text representation produced by a composer.

The composer parameter may be a callable or the name of a composer in :pyattr:`content_composers`. If composer is not found the raw :pyattr:`content` string is returned. Any exceptions raised by a composer are logged and the raw content is returned as a fallback.

Parameters:
  • composer (Optional[Union[str, Callable]]) – Composer name or callable.

  • **kwargs – Passed through to the composer callable.

Returns:

Composed or raw textual representation.

Return type:

str

__eq__(other)[source]

Equality comparison using :pyattr:`id`.

Two instances are considered equal when they are instances of the same class and their computed :pyattr:`id` values are identical.

Parameters:

other (Any) – Object to compare.

Returns:

True when objects represent the same knowledge id.

Return type:

bool

__lt__(other)[source]

Ordering comparison used for sorting by priority.

The implementation treats higher :pyattr:`priority` values as “less” to allow reverse-priority ordering when using Python’s default ascending sort.

Parameters:

other (BaseUKF) – Other item to compare.

Returns:

True when this item should sort before other.

Return type:

bool

__hash__()[source]

Return a hash derived from :pyattr:`id`.

Returns:

Integer hash value.

Return type:

int

__str__()[source]

Return a compact multi-line human readable representation.

The representation shows a truncated content preview and a short form of the string id.

Returns:

Readable summary of the object.

Return type:

str

__repr__()[source]

Return the same value as __str__() for interactive display.

Return type:

str

to_dict()[source]

Serialize the model to a plain dictionary for storage or transport.

Returns:

Dictionary serialization excluding internal fields.

Return type:

Dict[str, Any]

classmethod from_dict(data, *, polymorphic=True)[source]

Create a BaseUKF instance from a dictionary.

This method supports polymorphic deserialization: if the type field in the data matches a registered UKFT class in HEAVEN_UR, an instance of that specific subclass will be returned instead of a generic BaseUKF.

Parameters:
  • data (Dict[str, Any]) – Dictionary produced by to_dict() or an external source.

  • polymorphic (bool) – If True (default), use registry to return the appropriate subclass. If False, use the class on which this method is called.

Returns:

Validated model instance of the appropriate UKFT subclass.

Return type:

BaseUKF

Examples

>>> data = {"name": "test", "type": "knowledge", ...}
>>> obj = BaseUKF.from_dict(data)  # Returns KnowledgeUKFT
>>> obj2 = BaseUKF.from_dict(data, polymorphic=False)  # Returns BaseUKF
classmethod from_ukf(ukf, *, polymorphic=True, override_type=False)[source]

Create a BaseUKF instance from another instance.

This method supports polymorphic deserialization: if the source UKF’s type matches a registered UKFT class in HEAVEN_UR, an instance of that specific subclass will be returned.

Parameters:
  • ukf (BaseUKF) – Instance of the same or a derived class.

  • polymorphic (bool) – If True (default), use registry to return the appropriate subclass. If False, use the class on which this method is called, allowing intentional type conversion (e.g., upcasting PromptUKFT to ResourceUKFT). Usually, this is used when loading unknown types from storage.

  • override_type (bool) – If True and polymorphic=False, override the ‘type’ field to match the target class. Useful for true downcasting where you want to change the type field. Notice that type is part of the UKF identity, so overriding it will also change the computed id, making this a different knowledge item, which could be undesired in some scenarios. Usually, this is used when defining new sub-type UKFTs. If polymorphic=True, this parameter is ignored.

Returns:

Validated model instance of the appropriate UKFT subclass.

Return type:

BaseUKF

Examples

>>> prompt = PromptUKFT(name="test", ...)
>>> # Preserve original type
>>> copy1 = BaseUKF.from_ukf(prompt)
>>> # copy1.type == "prompt" and type(copy1) == PromptUKFT
>>> # Intentional downcast to parent type (keeps original type field)
>>> resource = ResourceUKFT.from_ukf(prompt, polymorphic=False)
>>> # resource.type == "prompt" and type(resource) == ResourceUKFT
>>> # True downcast with type field override
>>> resource2 = ResourceUKFT.from_ukf(prompt, polymorphic=False, override_type=True)
>>> # resource2.type == "resource" and type(resource2) == ResourceUKFT
get(key_path, default=None)[source]

Retrieve a nested value from the BaseUKF’s content_resources using a dot-separated key path.

Parameters:
  • key_path (str) – Dot-separated path to the desired value (e.g., “level1.level2.key”).

  • default (Any) – Value to return if the key path does not exist.

Returns:

The value found at the specified key path, or the default if not found.

Return type:

Any

set(key_path, value)[source]

Set a nested value in the BaseUKF’s content_resources using a dot-separated key path.

Parameters:
  • key_path (str) – Dot-separated path to set the value (e.g., “level1.level2.key”).

  • value (Any) – The value to set at the specified key path.

Returns:

True if the value was set successfully, False otherwise.

Return type:

bool

unset(key_path)[source]

Remove a nested value from the BaseUKF’s content_resources using a dot-separated key path.

Parameters:

key_path (str) – Dot-separated path to the value to remove (e.g., “level1.level2.key”).

Returns:

True if the value was removed successfully, False otherwise.

Return type:

bool

setdef(key_path, value)[source]

Set a nested value in the BaseUKF’s content_resources only if the key path does not already exist.

Parameters:
  • key_path (str) – Dot-separated path to set the value (e.g., “level1.level2.key”).

  • value (Any) – The value to set at the specified key path.

Returns:

True if the value was set successfully, False if the key path already exists.

Return type:

bool

set_inactive()[source]

Mark the item as inactive by setting :pyattr:`inactive_mark` to True.

unset_inactive()[source]

Clear the manual inactive flag by setting :pyattr:`inactive_mark` to False.

set_active()[source]

Mark the item as active by setting :pyattr:`inactive_mark` to False.

set_trigger(name, trigger)[source]

Add or update a trigger callable in :pyattr:`triggers`.

Parameters:
  • name (str) – Name of the trigger.

  • trigger (Callable) – Callable that takes a BaseUKF instance and returns a boolean.

update_triggers(triggers=None)[source]

Merge new trigger callables into the :pyattr:`triggers` mapping.

Parameters:

triggers (Optional[Dict[str, Callable]]) – Mapping of name to callable to add or update. If None, no changes are made.

eval_triggers(triggers=None, contexts=None, aggregate='ALL')[source]

Evaluate one or more named triggers with optional context.

Parameters:
  • triggers (List[str], optional) – Names of triggers to eval_triggers. If None or empty, an empty result is returned (or True when aggregated as described below).

  • contexts (Optional[Dict], optional) – Mapping from trigger name to a context dict passed as keyword arguments to the trigger.

  • aggregate (Literal["ANY", "ALL", False]) – If False the function returns a dictionary of individual boolean results. If "ALL" the function returns True only if all evaluated triggers return True. If "ANY" the function returns True when any trigger returns True.

Returns:

Individual results or an aggregated boolean depending on aggregate.

Return type:

Union[Dict[str, bool], bool]

eval_filter(filter=None, **kwargs)[source]

Evaluate whether this BaseUKF object satisfies a KLOp expression.

This method evaluates filter conditions in-memory by checking the object’s field values against the filter criteria. It supports all KLOp operators and handles both parsed JSON IR expressions and KLOp objects.

Parameters:
  • filter (Union[Dict[str, Any], KLOp, None]) – Either a parsed KLOp.expr() dict or None. If None, only kwargs are used.

  • **kwargs – Additional field constraints that are ANDed with the filter.

Returns:

True if the object satisfies all filter conditions, False otherwise.

Return type:

bool

Example

>>> ukf = BaseUKF(name="test", priority=50, status="active")
>>> ukf.eval_filter(priority=50)  # Simple equality
True
>>> ukf.eval_filter(priority=KLOp.GT(40))  # Comparison operator
True
>>> ukf.eval_filter(priority=KLOp.BETWEEN(0, 100), status="active")  # Combined
True
>>> from ahvn.utils.klop import KLOp
>>> expr = KLOp.expr(priority=KLOp.GT(40))
>>> ukf.eval_filter(expr)  # Using parsed expression
True
clone(**updates)[source]

Return a deep-copied model updated with updates.

The returned instance has internal caches reset so identity and content hashes are recomputed on demand.

Parameters:

**updates – Field values to override in the cloned instance. For dict/list/set fields, use upd_<field> to update items instead of overwriting. Typical fields that support this are :pyattr:`tags`, :pyattr:`synonyms`, :pyattr:`related`, :pyattr:`auths`, :pyattr:`triggers`, :pyattr:`content_composers`, :pyattr: content_resources, :pyattr:`metadata`, etc.

Returns:

New instance with the requested updates applied.

Return type:

BaseUKF

derive(**updates)[source]

Create a derived item with incremented version and provenance.

The derived copy has its :pyattr:`version` bumped using next_ver(), :pyattr:`source` set to "derived" and the original id recorded in :pyattr:`parents`.

Parameters:

**updates – Additional field updates to apply to the derived item. For dict/list/set fields, use upd_<field> to update items instead of overwriting. Typical fields that support this are :pyattr:`tags`, :pyattr:`synonyms`, :pyattr:`related`, :pyattr:`auths`, :pyattr:`triggers`, :pyattr:`content_composers`, :pyattr: content_resources, :pyattr:`metadata`, etc.

Returns:

Derived instance.

Return type:

BaseUKF

link(kl, dir='object', rel='related', rel_kid=None, relation_resources=None, inv_link=False)[source]

Add a lightweight relation between this item and kl.

Relation tuples are inserted into :pyattr:`related` using the serialized form for relation_resources. The dir parameter controls whether this item is the subject, object or both.

Parameters:
  • kl (BaseUKF) – Target knowledge item.

  • dir (Literal["subject","object","both"]) – Direction of the relation where "object" means self -> kl.

  • rel (str) – Relation name.

  • rel_kid (Optional[int]) – Optional relation id.

  • relation_resources (Optional[Any]) – Additional relation metadata.

  • inv_link (bool) – When True also add reciprocal entries on kl.

obj_ids(rel=None)[source]

Return object ids for relations where this item is the subject.

Parameters:

rel (Optional[str]) – If provided, only relations matching this relation name are included.

Returns:

Sequence of object ids.

Return type:

List[str]

sub_ids(rel=None)[source]

Return subject ids for relations where this item is the object.

Parameters:

rel (Optional[str]) – Optional relation name filter.

Returns:

Sequence of subject ids.

Return type:

List[str]

grant(user_id, authority)[source]

Grant an authority by adding [user:authority] tag.

Parameters:
  • user_id (int) – User identifier.

  • authority (str) – Permission or role string.

revoke(user_id, authority)[source]

Remove an authority by removing [user:authority] tag.

Parameters:
  • user_id (int) – User identifier.

  • authority (str) – Permission or role string.

has_authority(user_id, authority)[source]

Return True when [user:authority] tag is present.

Parameters:
  • user_id (int) – User identifier.

  • authority (str) – Authority string.

Returns:

True if the authority is granted to the user.

Return type:

bool

add_synonyms(synonyms)[source]

Append new synonyms into the :pyattr:`synonyms` set.

Parameters:

synonyms (Iterable[str]) – Iterable of synonym strings to add.

Return type:

None

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

Return type:

None

remove_synonyms(synonyms)[source]

Remove synonyms from the :pyattr:`synonyms` set.

Parameters:

synonyms (Iterable[str]) – Iterable of synonym strings to remove.

Return type:

None

signed(system=False, verified=True, **kwargs)[source]

Sign the knowledge item with default provenance information.

Parameters:
  • system (bool) – Whether the knowledge is created by the system. Defaults to False.

  • verified (bool) – Whether the knowledge is verified as accurate. Defaults to True.

  • **kwargs – Additional provenance fields to override. Specifically the following kwargs are set: - source: set to the provided source, or “system” if system is True, or existing source, or “user” if existing source is “unknown” - creator: set to the provided creator, or “system” if system is True, or existing creator, or current user id from HEAVEN_CM if existing creator is “unknown” - owner: set to the provided owner, or “system” if system is True, or existing owner, or current user id from HEAVEN_CM if existing owner is “unknown” - workspace: set to the provided workspace, or existing workspace - inactive_mark: set to the provided inactive_mark, or not verified - last_verified: set to the provided last_verified, or current UTC time without microseconds if verified is True, or existing last_verified

Returns:

A cloned knowledge item with updated provenance fields.

Return type:

BaseUKF