Tag a content node by its ID. Use the locate command first to find node IDs, then tag to annotate them. Tags can include values and confidence scores, and return a tagUuid for linking to data attributes.
Usage
kdx document tag <file.kddb> --node-id <id> --name <tag-name> [flags]
Flags
| Flag | Description | Default |
|---|
--node-id N | ID of the node to tag (required) | |
--name | Tag name (required) | |
--value | Tag value | |
--confidence | Confidence score (0.0-1.0) | 1.0 |
Examples
Basic Tagging
kdx document tag invoice.kddb --node-id 245 --name "invoice/amount"
{
"nodeId": 245,
"tag": "invoice/amount",
"status": "tagged",
"tagId": 1,
"tagUuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
Tag with Value and Confidence
kdx document tag invoice.kddb --node-id 245 --name "invoice/amount" \
--value "$1,234.56" --confidence 0.95
{
"nodeId": 245,
"tag": "invoice/amount",
"status": "tagged",
"value": "$1,234.56",
"tagId": 1,
"tagUuid": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
}
Workflow: Locate, Tag, Create Data
# 1. Find the amount node
kdx document locate invoice.kddb --pattern "\\$[\\d,]+\\.\\d{2}" --type word --max 1
# Output: {"nodeId":245,"matchText":"$1,234.56",...}
# 2. Tag the node
kdx document tag invoice.kddb --node-id 245 --name "invoice/total"
# Output: {"tagUuid":"a1b2c3d4-..."}
# 3. Create data object
kdx document data create invoice.kddb --path "INVOICE"
# Output: {"id":1,"path":"INVOICE"}
# 4. Set attribute linked to tag
kdx document data set-attribute invoice.kddb \
--object-id 1 --tag "total" --value "1234.56" --type CURRENCY \
--tag-uuid "a1b2c3d4-..."
The tagUuid in the output is essential for linking data attributes back to their source nodes. Save it for use with data set-attribute --tag-uuid.
The tag command writes to the document file. It opens the KDDB in write mode automatically.