Skip to main content

Suggest relationships and pick predicates

Version: V2
View Markdown

Build a relationship picker that proposes a recording’s artist using the Creation Profile and the predicate registry.

Prompt for your agentPropose relationships for a person to review
Goal: suggest relationships for a recording and present them for a person to review.
Read https://docs.intuition.systems/docs/build/suggest-relationships.md, https://docs.intuition.systems/docs/concepts/predicates.md and https://docs.intuition.systems/docs/reference/predicates.md.
Use exact package versions from https://docs.intuition.systems/intuition-release.json and public entry points only.
Input: a recording atom ID and candidate target atoms whose classifications my app has already checked.
Use the recording Creation Profile to choose the relationship, and resolve its predicate from the registry.
Reject a target whose classification does not fit the relationship, and say why.
Output each proposal as subject, predicate and object IDs in order, with its triple ID, labeled as a proposal.
Do not create triples or send transactions.
Report the checks you actually ran and anything you could not verify.

Paste this into your coding agent. It points the agent at the Markdown version of each page and leaves every signature to you.

Before you start​

Start with a recording atom ID and a candidate target atom whose classification your application has checked. The example derives both IDs from synthetic payloads. Read classifications and predicates.

For your own project, follow Install the packages. To run the offline example, install its locked dependencies from the documentation repository root with Node.js 22.21.0.

npm ci --prefix examples/v2 --ignore-scripts

Steps​

1. Read the recording’s recommendations​

Look up the selected key in musicRecordingCreationProfile.relationships. Each entry describes the subject classification, predicate and expected objects. For byArtist, the recording is the subject. An artist goes in the object slot. A picker can display the predicate label and suggest targets classified as a music group or a person.

2. Check the target and resolve the predicate​

This picker handles classification hints. It omits a recommendation when the key is absent or the candidate’s classification falls outside those hints. After checking the target, resolve the profile’s predicate ID through the registry and keep the registered spelling, ID and status together.

import { musicRecordingCreationProfile } from '@0xintuition/classifications/creation/music-recording';
import { getPredicateById, getPredicateId } from '@0xintuition/predicates';
import type { Hex } from 'viem';

export function suggestRelationship(
recordingId: Hex,
key: string,
target: { id: Hex; classification: string },
) {
const relation = musicRecordingCreationProfile.relationships.find(
(entry) => entry.predicate.key === key,
);
if (!relation) return { reason: 'No profile recommendation' };
const allowed = relation.expectedObjects.some(
(hint) =>
hint.kind === 'classification' && hint.slug === target.classification,
);
if (!allowed)
return { reason: 'Target falls outside the recommended classifications' };
const predicate = getPredicateById(relation.predicate.id);
if (!predicate || predicate.key !== key)
return { reason: 'Unknown predicate' };
return {
subjectId: recordingId,
predicateId: getPredicateId(predicate.key),
objectId: target.id,
label: predicate.name,
status: predicate.status,
};
}

3. Present the proposed relationship​

Display the recording, “by artist,” and the selected group for review. The registry’s proposed status describes the predicate vocabulary. The application still needs to verify that this particular group performed this recording and that the terms exist before it submits a claim.

Check the result​

node examples/v2/predicate-picker/src/suggest-relationships.ts

For the group, the helper prints the recording ID as subject, the group ID as object, the label by artist, and status proposed. The predicate ID is 0x13d5d4ad6ae3a4e1b5043141b6ce4633c2df4646eaefc9e45eba899c45ce235b. The album yields “Target falls outside the recommended classifications.” An empty key yields “No profile recommendation.”

Build creation forms, recording relationship definitions, and predicate registry lookups.

Applies to V2 · @0xintuition/predicates 0.1.1 · @0xintuition/classifications 0.1.1