cyb/src/features/ipfs/Drive/cozo_presets.json

{
  "display brain entities": "::relations",
  "display brain columns": "::columns particle",
  "ipfs: list pins": "?[cid, type] := *pin{cid, type}",
  "particle: pin | ls": [
    "r[cid,  pin] := *particle{cid}, not *pin{cid: cid, type}, pin=0",
    "r[cid, pin] := *particle{cid}, *pin{cid: cid, type}, pin=1",
    "?[pinned, cid, mime, text, size] := r[cid, pinned], *particle{cid:cid, mime, text, size}",
    ":order -size"
  ],
  "particle: filter": "?[cid, text] := *particle{cid, mime, text, blocks, size, size_local, type}, mime=\"text/plain\"",
  "particle: stats": "?[mime, sum(size), count(mime), sum(blocks)] := *particle{mime, blocks, size}\r\n :order -sum(size)\r\n:limit 10",
  "link: stats": [
    "r[from, count(to), side] := *link{from, to}, side=\"from\"",
    "r[to, count(from), side] := *link{from, to}, side=\"to\"",
    "?[side, lnk, cnt] := r[lnk, cnt, side]",
    ":order -cnt"
  ],
  "link: history": [
    "pf[mime, text, from, to, direction, timestamp] := *link{from, to,timestamp}, *particle{cid: from, text, mime}, direction='from'",
    "pf[mime, text, from, to, direction, timestamp] := *link{from, to, timestamp}, *particle{cid: to, text, mime}, direction='to'",
    "?[timestamp, direction, text, mime, from, to] := pf[mime, text, from, to, direction, timestamp]",
    ":order -timestamp"
  ],
  "tx: list with trim": [
    "?[type, v_trim, success, t] := *transaction{type, value, success, timestamp}, v_trim = from_substrings(slice(chars(dump_json(value)),0, 100)),  t = format_timestamp(timestamp/1000)",
    ":order -t"
  ],
  "tx: parse delegations": [
    "?[a, d, timestamp] := *transaction{type, value, timestamp}, type = 'cosmos.staking.v1beta1.MsgDelegate', a_ = get(value,'amount'), a = get(a_, 'amount'), d = get(a_, 'denom')",
    ":order -timestamp"
  ],
  "tx: parse cyberlinks": [
    "?[from, to, t] := *transaction{type, value, timestamp}, type = 'cyber.graph.v1beta1.MsgCyberlink', links = get(value, 'links'), l_ = get(links, 0), from =get(l_,'from'), to =get(l_,'to'), t = format_timestamp(timestamp/1000)",
    ":order -t"
  ],
  "sense": [
    "ss_tweets[last_id, id, meta, last_cid] := *sync_status{entry_type,id, last_id, meta}, last_cid =get(get(meta, 'last_id', json('{}')),'cid', ''), starts_with(last_id, 'Qm'), entry_type=3",
    "p_tweets[last_id, id, meta, text, mime] :=  ss_tweets[last_id, id, meta, last_cid], *particle{cid: last_cid, text, mime}",
    "p_tweets[last_id, id, meta, empty, empty] := ss_tweets[last_id, id, meta, last_cid],  not *particle{cid: last_cid, text, mime}, empty=''",
    "p_tweets_meta[last_id, id, m] :=  p_tweets[last_id, id, meta, text, mime], m= concat(meta, json_object('last_id', json_object('text', text, 'mime', mime, 'meta_type', 3.2)))",
    "p_tweets_meta[last_id, id, m] := *sync_status{entry_type, id, unread_count, timestamp_update, timestamp_read, last_id, meta}, m= concat(meta, json_object( 'meta_type', 3.1)), not starts_with(last_id, 'Qm'), entry_type=3",
    "ss_particles[last_id, id, meta] := *sync_status{entry_type,id, last_id, meta}, entry_type=2",
    "p_last[last_id, id, meta, text, mime] := ss_particles[last_id, id, meta], *particle{cid: last_id, text, mime}",
    "p_last[last_id, id, meta, empty, empty] := ss_particles[last_id, id, meta], not *particle{cid: last_id, text, mime}, empty=''",
    "p_id[last_id, id, meta, text, mime] :=  ss_particles[last_id, id, meta], *particle{cid: id, text, mime}",
    "p_id[last_id, id, meta, empty, empty] := ss_particles[last_id, id, meta], not *particle{cid: id, text, mime}, empty=''",
    "p_last_meta[last_id, id, m] :=  p_last[last_id, id, meta, text, mime], m= concat(meta, json_object('last_id', json_object('text', text, 'mime', mime)))",
    "p_all[last_id, id, m] :=  p_id[last_id, id, meta, text, mime], p_last_meta[last_id, id, meta_prev], m= concat(meta, meta_prev, json_object('id', json_object('text', text, 'mime', mime), 'meta_type', 2))",
    "ss_trans[last_id, id, m] := *sync_status{entry_type,id, last_id, meta}, entry_type=1, *transaction{hash: last_id, value, type}, m= concat(meta, json_object('value', value, 'type', type, 'meta_type', 1))",
    "?[entry_type, id, unread_count, timestamp_update, timestamp_read, last_id, meta] := *sync_status{entry_type, id, unread_count, timestamp_update, timestamp_read, last_id}, p_all[last_id, id, meta] or ss_trans[last_id, id, meta] or p_tweets_meta[last_id, id, meta]",
    ":order -timestamp_update"
  ],
  "[sys]config": "?[key, group_key, value] := *config{key, group_key, value}",
  "[sys] sync queue": [
    "?[id, status, job_type, data, priority] := *sync_queue{id, status, priority, job_type, data}",
    ":order status, -priority"
  ]
}

Synonyms

pussy-ts/src/features/ipfs/Drive/cozo_presets.json

Neighbours