fluree history
Show change history for an entity.
Usage
fluree history <ENTITY> [OPTIONS]
Arguments
| Argument | Description |
|---|---|
<ENTITY> | Entity IRI (compact or full) |
Options
| Option | Description |
|---|---|
-l, --ledger <LEDGER> | Ledger name (defaults to active ledger) |
--from <TIME> | Start of time range (default: 1). t:<N> (transaction number), t:latest or latest, time:<ISO-8601> (commit event time), recorded:<ISO-8601> (the wall-clock time the commit was recorded), or commit:<hex-prefix>. A bare transaction number, ISO-8601 timestamp or commit prefix also works; a commit prefix must be at least 6 characters in either spelling; a bare integer is read as a transaction number, so use commit:<prefix> to force an all-digit prefix. |
--to <TIME> | End of time range (default: latest). Same spellings as --from. |
-p, --predicate <PRED> | Filter to specific predicate |
--format <FORMAT> | Output format: json, table, or csv (default: table) |
--remote <NAME> | Execute against a remote server (e.g. origin) |
Description
Shows the change history for a specific entity across transactions. Each change shows:
t- Transaction numberop- Operation:+(assert) or-(retract) in table/CSV output;true/falsein JSONpredicate- The property that changed (if not filtered)value- The value asserted or retracted
The argument is an entity IRI, not a query. This command builds the
underlying history query for you; to write your own history query — across
multiple subjects, with filters, or in SPARQL — use
fluree query with from and to, as shown in
Cookbook: Time Travel.
History requires a local commit chain. On a tracked ledger it is
unavailable locally; pass --remote <name> to query the upstream.
Prefix Expansion
Entity IRIs can use stored prefixes:
# First, add a prefix
fluree prefix add ex http://example.org/
# Then use compact IRI
fluree history ex:alice
Or use the full IRI:
fluree history http://example.org/alice
Examples
# Show all changes to an entity
fluree history ex:alice
# Show changes in JSON format
fluree history ex:alice --format json
# Filter to specific predicate
fluree history ex:alice -p ex:name
# Show changes in a time range
fluree history ex:alice --from 1 --to 5
# Tagged spellings mean the same thing.
fluree history ex:alice --from t:1 --to t:5
fluree history ex:alice --from t:1 --to latest
# Query specific ledger
fluree history ex:alice --ledger production
Output
Table (default)
┌───┬────┬─────────────────────────────────┬─────────────┐
│ t │ op │ predicate │ value │
├───┼────┼─────────────────────────────────┼─────────────┤
│ 1 │ + │ http://example.org/name │ Alice │
│ 1 │ + │ http://example.org/age │ 30 │
│ 2 │ - │ http://example.org/name │ Alice │
│ 2 │ + │ http://example.org/name │ Alice Smith │
└───┴────┴─────────────────────────────────┴─────────────┘
JSON
[
{"?t": 1, "?op": true, "?p": "http://example.org/name", "?v": "Alice"},
{"?t": 1, "?op": true, "?p": "http://example.org/age", "?v": 30},
{"?t": 2, "?op": false, "?p": "http://example.org/name", "?v": "Alice"},
{"?t": 2, "?op": true, "?p": "http://example.org/name", "?v": "Alice Smith"}
]
CSV
t,op,predicate,value
1,+,http://example.org/name,Alice
1,+,http://example.org/age,30
2,-,http://example.org/name,Alice
2,+,http://example.org/name,Alice Smith