External identifiers¶
An external identifier consists of an extensible scheme string, an opaque value, and an optional qualifier. Multiple identifiers, including multiple values from one scheme, may be attached to an object.
Core validation is intentionally small: text must be non-empty, bounded, and free of NUL characters so every public language boundary can transport it. PostProject preserves unknown schemes and values exactly. Applications may opt into a scheme-specific validator when they need to verify syntax; storing an identifier never triggers a registry or network lookup.
Identifiers may target assets, representations, resources, or activities. An activity identifier names the operation itself, such as a render-farm job or workflow task; it is distinct from the optional identifier of the agent that performed the activity.
Scheme identifiers are strings rather than a closed enum so new standards and application namespaces do not require an ABI redesign. The small built-in registry currently describes:
Scheme |
Stored value |
Local check |
|---|---|---|
|
the UMID namespace-specific hex value |
SMPTE ST 2029 lexical form |
|
the ISAN namespace-specific value |
RFC 4246 lexical form |
|
the EIDR prefix and suffix, such as |
RFC 7972 lexical form |
|
application-owned opaque text |
generic limits only |
These are opt-in syntax hints, not a closed allow-list. Checks do not normalize case, validate registry assignment, verify every standard checksum, or contact a network service. See SMPTE ST 2029, RFC 4246, and RFC 7972 for the authoritative formats.
Across public surfaces¶
This example attaches an application identifier and performs the corresponding exact lookup:
static pp_error_code_t tag_camera_serial(pp_production_t *production,
const pp_asset_id_t *asset_id,
pp_error_t **error) {
pp_object_ref_t target;
pp_error_code_t reference_status = pp_object_ref_from_asset(*asset_id, &target, error);
if (reference_status != PP_OK) return reference_status;
pp_transaction_t *transaction = NULL;
pp_external_identifier_set_t *attached = NULL;
pp_object_ref_set_t *matches = NULL;
pp_error_code_t status =
pp_production_begin_edit(production, NULL, NULL, &transaction, error);
if (status == PP_OK) {
status = pp_transaction_add_external_identifier(
transaction, &target, "com.example.camera.serial", "A-0007", NULL,
error);
}
if (status == PP_OK) {
pp_commit_receipt_t commit_receipt;
status = pp_transaction_commit(transaction, &commit_receipt, error);
}
if (status == PP_OK) {
status = pp_production_external_identifiers(production, &target,
&attached, error);
}
if (status == PP_OK) {
status = pp_production_find_by_external_identifier(
production, "com.example.camera.serial", "A-0007", NULL, &matches,
error);
}
if (status == PP_OK) {
printf("identifiers: %llu, matching objects: %llu\n",
(unsigned long long)pp_external_identifier_set_count(attached),
(unsigned long long)pp_object_ref_set_count(matches));
}
pp_object_ref_set_release(matches);
pp_external_identifier_set_release(attached);
pp_transaction_release(transaction);
return status;
}
void tag_camera_serial(postproject::Production &production,
const postproject::AssetId &asset_id) {
const postproject::ObjectRef target = postproject::ObjectRef::asset(asset_id);
const postproject::ExternalIdentifier identifier{
"com.example.camera.serial", "A-0007", std::nullopt};
auto transaction = production.edit().value();
transaction.addExternalIdentifier(target, identifier).value();
transaction.commit().value();
const auto attached = production.externalIdentifiers(target).value();
const auto matches =
production.findByExternalIdentifier(identifier.scheme, identifier.value).value();
require(attached.size() == 1 && matches == std::vector{target},
"identifier lookup");
}
def tag_camera_serial(production: Production, asset_id: AssetId) -> None:
identifier = ExternalIdentifier("com.example.camera.serial", "A-0007")
with production.edit() as transaction:
transaction.add_external_identifier(AssetRef(asset_id), identifier)
transaction.commit()
attached = production.external_identifiers[AssetRef(asset_id)]
matches = production.objects_by_external_identifier[
identifier.scheme, identifier.value
]
assert attached == (identifier,)
assert matches == (AssetRef(asset_id),)
fn tag_camera_serial(production: &mut SqliteProduction, asset_id: AssetId) -> Result<()> {
let target = ObjectRef::Asset(asset_id);
let identifier = ExternalIdentifier::new(
IdentifierScheme::new("com.example.camera.serial")?,
"A-0007",
None,
)?;
{
let mut transaction = production.begin_transaction()?;
transaction.add_external_identifier(target, &identifier)?;
transaction.commit()?;
}
let attached = production.external_identifiers(target)?;
let matches = production.find_by_external_identifier(
identifier.scheme(),
identifier.value(),
identifier.qualifier(),
)?;
assert_eq!(attached, vec![identifier]);
assert_eq!(matches, vec![target]);
Ok(())
}
postproject identifier add production.pproj asset "$ASSET_ID" \
com.example.camera.serial A-0007
postproject identifier list production.pproj asset "$ASSET_ID"
postproject identifier find production.pproj com.example.camera.serial A-0007
Removal names the exact scheme, value, and qualifier; other attachments on the same object stay in place:
static pp_error_code_t replace_identifiers(pp_production_t *production,
const pp_asset_id_t *asset_id,
uint64_t *out_remaining,
pp_error_t **error) {
pp_object_ref_t target;
pp_error_code_t reference_status = pp_object_ref_from_asset(*asset_id, &target, error);
if (reference_status != PP_OK) return reference_status;
pp_transaction_t *transaction = NULL;
pp_external_identifier_set_t *identifiers = NULL;
pp_object_ref_set_t *matches = NULL;
pp_read_session_t *view = NULL;
pp_error_code_t status =
pp_production_begin_edit(production, NULL, NULL, &transaction, error);
if (status == PP_OK) {
status = pp_transaction_add_external_identifier(transaction, &target,
"com.example.camera.serial",
"A-0007", NULL, error);
}
if (status == PP_OK) {
/* Unknown schemes and qualifiers round-trip verbatim. */
status = pp_transaction_add_external_identifier(
transaction, &target, "com.example.mam.id", "MAM-42", "staging", error);
}
if (status == PP_OK) {
pp_commit_receipt_t commit_receipt;
status = pp_transaction_commit(transaction, &commit_receipt, error);
}
pp_transaction_release(transaction);
transaction = NULL;
if (status == PP_OK) {
status = pp_production_read_session(production, &view, error);
}
if (status == PP_OK) {
status = pp_read_session_external_identifiers(view, &target,
&identifiers, error);
}
for (uint64_t i = 0;
status == PP_OK && i < pp_external_identifier_set_count(identifiers);
++i) {
const char *scheme, *value, *qualifier;
status = pp_external_identifier_set_get(identifiers, i, &scheme, &value,
&qualifier, error);
if (status == PP_OK) {
printf("%s = %s%s%s\n", scheme, value, qualifier != NULL ? " / " : "",
qualifier != NULL ? qualifier : "");
}
}
if (status == PP_OK) {
status = pp_read_session_find_by_external_identifier(
view, "com.example.mam.id", "MAM-42", "staging", &matches, error);
}
for (uint64_t i = 0; status == PP_OK && i < pp_object_ref_set_count(matches);
++i) {
pp_object_ref_t object;
status = pp_object_ref_set_get(matches, i, &object, error);
if (status == PP_OK) {
printf("found object of kind %u\n", object.kind);
}
}
/* Removal names the exact scheme, value, and qualifier. */
if (status == PP_OK) {
status = pp_read_session_begin_edit(view, NULL, &transaction, error);
}
pp_read_session_release(view);
if (status == PP_OK) {
status = pp_transaction_remove_external_identifier(
transaction, &target, "com.example.mam.id", "MAM-42", "staging", error);
}
if (status == PP_OK) {
pp_commit_receipt_t commit_receipt;
status = pp_transaction_commit(transaction, &commit_receipt, error);
}
pp_external_identifier_set_release(identifiers);
identifiers = NULL;
if (status == PP_OK) {
status = pp_production_external_identifiers(production, &target,
&identifiers, error);
}
if (status == PP_OK) {
*out_remaining = pp_external_identifier_set_count(identifiers);
}
pp_external_identifier_set_release(identifiers);
pp_object_ref_set_release(matches);
pp_transaction_release(transaction);
return status;
}
std::vector<postproject::ExternalIdentifier>
replace_reel_name(postproject::Production &production,
const postproject::AssetId &asset_id) {
const postproject::ObjectRef target = postproject::ObjectRef::asset(asset_id);
const postproject::ExternalIdentifier reel{"com.example.reel", "A001",
std::nullopt};
const postproject::ExternalIdentifier serial{"com.example.camera.serial",
"A-0007", std::string("body")};
auto attach = production.edit().value();
attach.addExternalIdentifier(target, reel).value();
attach.addExternalIdentifier(target, serial).value();
attach.commit().value();
auto view = production.readSession().value();
for (const auto &identifier : view.externalIdentifiers(target).value()) {
std::cout << identifier.scheme << " = " << identifier.value << '\n';
}
for (const auto &match :
view.findByExternalIdentifier(reel.scheme, reel.value,
reel.qualifier).value()) {
std::cout << "reel A001 names object kind "
<< static_cast<std::uint32_t>(match.kind()) << '\n';
}
// Removal needs the exact scheme, value, and qualifier that were attached.
auto detach = view.edit().value();
detach.removeExternalIdentifier(target, reel).value();
detach.commit().value();
return production.externalIdentifiers(target).value();
}
def replace_tape_identifier(
production: Production, asset_id: AssetId
) -> tuple[ExternalIdentifier, ...]:
serial = ExternalIdentifier("com.example.camera.serial", "A-0007")
tape = ExternalIdentifier("com.example.tape", "T-0012", qualifier="reel")
with production.edit() as transaction:
transaction.add_external_identifier(AssetRef(asset_id), serial)
transaction.add_external_identifier(AssetRef(asset_id), tape)
transaction.commit()
with production.read_session() as view:
for identifier in view.external_identifiers(AssetRef(asset_id)):
print(
f"{identifier.scheme}: {identifier.value} ({identifier.qualifier or '-'})"
)
# A qualifier restricts the lookup to identifiers with exactly that qualifier.
key = (tape.scheme, tape.value, "reel")
for target in view.find_by_external_identifier(*key):
print(f"tape {tape.value} identifies {target}")
# Removal matches the exact scheme, value, and qualifier.
with view.edit() as transaction:
transaction.remove_external_identifier(AssetRef(asset_id), tape)
transaction.commit()
return production.external_identifiers[AssetRef(asset_id)]
fn replace_reel_identifier(
production: &mut SqliteProduction,
asset_id: AssetId,
) -> Result<postproject_core::CommitReceipt> {
let target = ObjectRef::Asset(asset_id);
let reel = ExternalIdentifier::new(IdentifierScheme::new("com.example.reel")?, "R-12", None)?;
let serial = ExternalIdentifier::new(
IdentifierScheme::new("com.example.camera.serial")?,
"A-0007",
Some("body".to_owned()),
)?;
{
let mut transaction = production.begin_transaction()?;
transaction.add_external_identifier(target, &reel)?;
transaction.add_external_identifier(target, &serial)?;
transaction.commit()?;
}
let view = production.read_session()?;
for identifier in view.read().external_identifiers(target)? {
println!(
"{} = {} ({:?})",
identifier.scheme().as_str(),
identifier.value(),
identifier.qualifier()
);
}
for object in
view.read()
.find_by_external_identifier(reel.scheme(), reel.value(), reel.qualifier())?
{
println!("tagged with reel R-12: {object:?}");
}
let base = view.decision_base();
drop(view);
let mut transaction = production.begin_edit(base)?;
transaction.remove_external_identifier(target, &reel)?;
transaction.commit()
}
postproject identifier add knowledge.pproj asset "$ASSET_ID" \
com.example.camera.serial A-0007
postproject identifier add knowledge.pproj asset "$ASSET_ID" \
com.example.tape B-0112 --qualifier reel
BASE=$(postproject --json inspect knowledge.pproj | jq -r .decision_base)
postproject identifier list knowledge.pproj asset "$ASSET_ID"
postproject identifier find knowledge.pproj com.example.camera.serial A-0007
# A qualifier restricts the lookup to identifiers with exactly that qualifier.
postproject identifier find knowledge.pproj com.example.tape B-0112 \
--qualifier reel
# Removal matches the exact scheme, value, and qualifier.
postproject --decision-base "$BASE" identifier remove knowledge.pproj asset "$ASSET_ID" \
com.example.tape B-0112 --qualifier reel