Record
Procedure · Echocardiography · Meridian Health System · proc-echo-1
urn:uuid:86875af4-7cd3-86e8-84f4-3e774d5f2947
A record is one thing a source told the pod about, such as one hospital's note of a penicillin allergy. Its file says only what type it is. Each time the source sends it, a revision arrives: it carries a version, which is the content, and names the document it was derived from. A document whose bytes the pod keeps links to them.
Every section below is one question with only the rows about this record. The first lists the files of the pod that say something about it or name it. A Turtle link beside a thing opens the file it arrived in; a thing only ever named, or written by the build, has none.
Which file states each thing
The store loads each file twice: into the default graph, which the other questions read, and into a graph named by its address, which GRAPH ?file reads. A file states a thing when it says something about it, or names it as the value of a statement: a patient profile has no file of its own, so the files that name it are where it is stated. Named marks a row for a file that names the thing, and rebuilt a view or the labels, which the build writes. Files the build did not write come first, and among them the file a thing arrived in, if it has one.
Only the rows whose ?thing is this one.
5 rows
The query: queries/questions/pod/Which file states each thing.rq on GitHub
PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX pim: <http://www.w3.org/ns/pim/space#>
SELECT DISTINCT ?thing ?file ?named ?rebuilt
WHERE {
{ { SELECT DISTINCT ?file ?thing
WHERE {
?owner pim:storage ?root .
GRAPH ?file { ?thing ?property ?value }
FILTER (isIRI(?thing) && STRSTARTS(STR(?file), STR(?root)))
} }
BIND (false AS ?named)
BIND (EXISTS { ?file a cascade:View } AS ?rebuilt) }
UNION
{ { SELECT DISTINCT ?file ?thing
WHERE {
?owner pim:storage ?root .
GRAPH ?file { ?subject ?property ?thing }
FILTER (isIRI(?thing) && STRSTARTS(STR(?file), STR(?root)))
} }
BIND (true AS ?named)
BIND (EXISTS { ?file a cascade:View } AS ?rebuilt) }
}
ORDER BY ?thing ?rebuilt ?named ?file
The terms it uses: pim:storage, cascade:View.
Run it yourself, from the runtime's root:
npm run ask -- alex-rivera "pod/Which file states each thing"
It prints the rows for every thing; this block keeps those whose ?thing is
urn:uuid:86875af4-7cd3-86e8-84f4-3e774d5f2947.
Or in GraphDB, open the saved query pod/Which file states each thing in the repository alex-rivera.
Its revisions, in the order they arrived
A revision is one arrival: it carries a version, which is the content, and names the document it was derived from. A version seen before is named again, not copied, and Current marks the revision the views read. ?arrived is the pod's clock; ?observed is when the source was observed saying the revision's state, and ?changed the source's own change time, the two clocks the ladder ranks by; a pull's document says the instant its source answered as of (?answeredAsOf).
Only the rows whose ?record is this one.
| ?arrived | ?observed | ?changed | ?revision | ?current | ?previous | ?version | ?change | ?document | ?retrieved | ?answeredAsOf | ?hospital | ?transmitter | ?import | ?started |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2026-11-20 09:00 UTC | 2026-11-20 09:00 UTC | 2026-11-05 15:30 UTC | Revision · Echocardiography · proc-echo-1 · received 2026-11-20 | true | Procedure version · Echocardiography · completed · proc-echo-1 · first received 2026-11-20 | a new version | Document · Meridian Health System · Procedure/proc-echo-1 · retrieved 2026-11-20 Turtle | 2026-11-20 09:00 UTC | Meridian Health System | Apple Health | Apple Health export | 2026-11-20 09:00 UTC |
1 row
The query: queries/questions/record/Its revisions, in the order they arrived.rq on GitHub
PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX pav: <http://purl.org/pav/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?record ?recordLabel ?arrived ?observed ?changed ?revision ?revisionLabel ?current ?previous ?previousLabel
?version ?versionLabel ?change ?document ?documentLabel ?retrieved ?answeredAsOf ?hospital ?transmitter ?import
?importLabel ?started
WHERE {
{ SELECT ?version (MIN(?received) AS ?first)
WHERE { ?any cascade:version ?version ; prov:generatedAtTime ?received . }
GROUP BY ?version }
?revision cascade:revisionOf ?record ; cascade:version ?version ; prov:generatedAtTime ?arrived .
OPTIONAL { ?record cascade:currentRevision ?now }
BIND (COALESCE(?revision = ?now, false) AS ?current)
BIND (IF(?arrived = ?first, "a new version", "an earlier version again") AS ?change)
OPTIONAL { ?revision cascade:observedAsOf ?observed }
OPTIONAL { ?revision pav:lastUpdateOn ?changed }
OPTIONAL { ?revision rdfs:label ?revisionLabel }
OPTIONAL { ?record rdfs:label ?recordLabel }
OPTIONAL { ?version rdfs:label ?versionLabel }
OPTIONAL { ?revision prov:wasRevisionOf ?previous .
OPTIONAL { ?previous rdfs:label ?previousLabel } }
OPTIONAL { ?revision prov:wasDerivedFrom ?document .
OPTIONAL { ?document rdfs:label ?documentLabel }
OPTIONAL { ?document pav:retrievedOn ?retrieved }
OPTIONAL { ?document cascade:answeredAsOf ?answeredAsOf }
OPTIONAL { ?document prov:wasAttributedTo/(rdfs:label|pav:hasCurrentVersion/foaf:name) ?hospital }
OPTIONAL { ?document prov:wasGeneratedBy/prov:qualifiedAssociation ?sender .
?sender prov:hadRole ?transmitterRole ; prov:agent/rdfs:label ?transmitter
FILTER (?transmitterRole = cascade:TransmitterRole) } }
OPTIONAL { ?revision prov:wasGeneratedBy ?import .
OPTIONAL { ?import rdfs:label ?importLabel }
OPTIONAL { ?import prov:startedAtTime ?started } }
}
ORDER BY ?recordLabel ?record ?arrived ?revision ?document ?retrieved ?answeredAsOf ?hospital ?transmitter
The terms it uses: cascade:version, prov:generatedAtTime, cascade:revisionOf, cascade:currentRevision, cascade:observedAsOf, pav:lastUpdateOn, rdfs:label, prov:wasRevisionOf, prov:wasDerivedFrom, pav:retrievedOn, cascade:answeredAsOf, prov:wasAttributedTo, pav:hasCurrentVersion, prov:wasGeneratedBy, prov:hadRole, prov:agent, cascade:TransmitterRole, prov:startedAtTime.
Run it yourself, from the runtime's root:
npm run ask -- alex-rivera "record/Its revisions, in the order they arrived"
It prints the rows for every record; this block keeps those whose ?record is
urn:uuid:86875af4-7cd3-86e8-84f4-3e774d5f2947.
Or in GraphDB, open the saved query record/Its revisions, in the order they arrived in the repository alex-rivera.
What each version says
A version is named by a hash of its content, so two arrivals saying the same thing share one version. Each row is one statement of one version, as its file states it: the name and date the derivations copy onto it are left out.
Only the rows whose ?record is this one.
5 rows
The query: queries/questions/record/What each version says.rq on GitHub
PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?record ?recordLabel ?version ?versionLabel ?field ?value ?valueLabel
WHERE {
?revision cascade:revisionOf ?record ; cascade:version ?version .
?version ?field ?value .
FILTER (?field NOT IN (prov:specializationOf, rdfs:label, cascade:displayName, cascade:displayDate))
OPTIONAL { ?record rdfs:label ?recordLabel }
OPTIONAL { ?version rdfs:label ?versionLabel }
OPTIONAL { ?value rdfs:label ?valueLabel }
}
ORDER BY ?recordLabel ?record ?version ?field ?value
The terms it uses: cascade:revisionOf, cascade:version, prov:specializationOf, rdfs:label, cascade:displayName, cascade:displayDate.
Run it yourself, from the runtime's root:
npm run ask -- alex-rivera "record/What each version says"
It prints the rows for every record; this block keeps those whose ?record is
urn:uuid:86875af4-7cd3-86e8-84f4-3e774d5f2947.
Or in GraphDB, open the saved query record/What each version says in the repository alex-rivera.
What needs review: none. The question
Where each record a statement names is now
A statement is a judgment a matcher did not make: a person's, or a model's. For each record one names, a row says where that record is now, as Outcome: one when it is in an entry and every record the statement names that is in one is in that entry, split when the statement's records are in more than one, hidden when no entry holds it and Why gives each reason, in no entry when it is held, no entry has it and nothing left it out, not in the pod when it is not held. Held is a triple with the member as subject whose predicate no derivation here builds about a member (the Record type, the currentlySame family, entry and left-out links, revisions, lifecycles, exposure periods, current versions). What the pod types a member as decides nothing: a member that is no record, a profile an About statement names, is listed as any record is. A held member whose only stated triples use a derived predicate, a reference series with only its current version, reads not in the pod. A statement a person retracted or replaced is listed, with Counts false. On the entry's row, Other members are its other records, in order, and Grew by counts those the statement does not name; Other statements are the other statements naming a record of the entry, in order, and Merged with counts those naming a record this statement does not, a retracted or replaced one left out. An app sums Grew by and Merged with. A list holds its values separated by U+001F, and a list with nothing in it is unbound.
Only the rows whose ?record is this one.
| ?statement | ?counts | ?outcome | ?entry | ?why | ?otherMembers | ?grewBy | ?otherStatements | ?mergedWith |
|---|---|---|---|---|---|---|---|---|
| Erroneous · the patient · 2027-04-02 · Echocardiography Turtle | true | hidden | https://ns.cascadeprotocol.org/cascade#JudgedErroneous |
1 row
The query: queries/questions/record/Where each record a statement names is now.rq on GitHub
PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX pav: <http://purl.org/pav/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?statement ?statementLabel ?counts ?record ?recordLabel ?outcome ?entry ?entryLabel ?why
?otherMembers ?grewBy ?otherStatements ?mergedWith
# bound: ?record
WHERE {
{ SELECT DISTINCT ?statement ?statementLabel ?counts ?record ?recordLabel ?entry ?entryLabel
WHERE {
?statement a cascade:Judgment ; prov:hadMember ?record .
OPTIONAL { ?statement cascade:matcherRule ?rule }
FILTER (!BOUND(?rule))
OPTIONAL { ?statement cascade:countsUnderLens ?counted }
BIND (COALESCE(?counted, false) AS ?counts)
OPTIONAL { ?statement rdfs:label ?statementLabel }
OPTIONAL { ?record rdfs:label ?recordLabel }
OPTIONAL { GRAPH ?view { ?entry cascade:entryMember ?record }
OPTIONAL { ?entry rdfs:label ?entryLabel } }
} }
{ SELECT ?statement (COUNT(DISTINCT ?reached) AS ?entriesReached)
WHERE {
?statement prov:hadMember ?record .
OPTIONAL { ?statement prov:hadMember ?sibling .
GRAPH ?siblingView { ?reached cascade:entryMember ?sibling } }
}
GROUP BY ?statement }
{ SELECT ?statement ?record (GROUP_CONCAT(STR(?otherMember); separator="\u001F") AS ?others) (SUM(?grewFlag) AS ?grewCount)
WHERE {
{ SELECT DISTINCT ?statement ?record ?otherMember ?grewFlag
WHERE {
?statement prov:hadMember ?record .
OPTIONAL { GRAPH ?view { ?entry cascade:entryMember ?record , ?other }
FILTER (?other != ?record) }
BIND (IF(BOUND(?other), ?other, ?none) AS ?otherMember)
BIND (IF(!BOUND(?other) || EXISTS { ?statement prov:hadMember ?other }, 0, 1) AS ?grewFlag)
}
ORDER BY ?statement ?record ?otherMember }
}
GROUP BY ?statement ?record }
{ SELECT ?statement ?record (GROUP_CONCAT(STR(?otherStatement); separator="\u001F") AS ?statements) (SUM(?merges) AS ?mergedCount)
WHERE {
{ SELECT ?statement ?record ?otherStatement (MAX(?unnamed) AS ?merges)
WHERE {
{ SELECT DISTINCT ?statement ?record ?otherStatement ?unnamed
WHERE {
?statement prov:hadMember ?record .
OPTIONAL { GRAPH ?view { ?entry cascade:entryMember ?record , ?member }
?otherStatement prov:hadMember ?member .
?otherStatement cascade:countsUnderLens true .
FILTER (?otherStatement != ?statement)
FILTER NOT EXISTS { ?otherStatement cascade:matcherRule ?otherRule } }
BIND (IF(!BOUND(?otherStatement) || EXISTS { ?statement prov:hadMember ?member }, 0, 1) AS ?unnamed)
} }
}
GROUP BY ?statement ?record ?otherStatement
ORDER BY ?statement ?record ?otherStatement }
}
GROUP BY ?statement ?record }
{ SELECT ?record (COUNT(?reason) AS ?reasonCount) (GROUP_CONCAT(STR(?reason); separator="\u001F") AS ?reasons)
WHERE {
{ SELECT DISTINCT ?record ?reason
WHERE {
?statement prov:hadMember ?record .
OPTIONAL { ?record cascade:leftOutFor/cascade:leftOutReason ?reason }
}
ORDER BY ?record ?reason }
}
GROUP BY ?record }
BIND (IF(STRLEN(?reasons) > 0, ?reasons, ?none) AS ?why)
BIND (IF(STRLEN(?others) > 0, ?others, ?none) AS ?otherMembers)
BIND (IF(BOUND(?entry), ?grewCount, ?none) AS ?grewBy)
BIND (IF(STRLEN(?statements) > 0, ?statements, ?none) AS ?otherStatements)
BIND (IF(BOUND(?entry), ?mergedCount, ?none) AS ?mergedWith)
BIND (IF(BOUND(?entry), IF(?entriesReached > 1, "split", "one"),
IF(?reasonCount > 0, "hidden",
IF(EXISTS { ?record ?held ?value
FILTER (?held NOT IN (cascade:currentlySame, cascade:currentlyDifferent, cascade:currentlySameOrganization,
cascade:inEntry, cascade:leftOutFor, cascade:subject, cascade:recordKind,
cascade:statusOnlyFromDocuments, cascade:currentRevision, cascade:currentRevisionCandidate,
cascade:laterInAncestryThan, cascade:judgedBefore, cascade:judgedBeforeRevisionOfSameRecord,
cascade:revisionJudgedErroneousBy, cascade:observationTimeDiscountedBy, cascade:lapsed,
cascade:currentVersionStatusLifecycle, cascade:currentVersionStatusLifecycleStep,
cascade:medicationExposureStart, cascade:medicationExposureEnd, cascade:medicationExposureOngoing,
pav:hasCurrentVersion)
&& !(?held = <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> && ?value = cascade:Record)) },
"in no entry", "not in the pod"))) AS ?outcome)
}
ORDER BY ?statement ?recordLabel ?record
The terms it uses: cascade:Judgment, prov:hadMember, cascade:matcherRule, cascade:countsUnderLens, rdfs:label, cascade:entryMember, cascade:leftOutFor, cascade:currentlySame, cascade:currentlyDifferent, cascade:currentlySameOrganization, cascade:inEntry, cascade:subject, cascade:recordKind, cascade:statusOnlyFromDocuments, cascade:currentRevision, cascade:currentRevisionCandidate, cascade:laterInAncestryThan, cascade:judgedBefore, cascade:judgedBeforeRevisionOfSameRecord, cascade:revisionJudgedErroneousBy, cascade:observationTimeDiscountedBy, cascade:lapsed, cascade:currentVersionStatusLifecycle, cascade:currentVersionStatusLifecycleStep, cascade:medicationExposureStart, cascade:medicationExposureEnd, cascade:medicationExposureOngoing, pav:hasCurrentVersion, cascade:Record.
Run it yourself, from the runtime's root:
npm run ask -- alex-rivera "record/Where each record a statement names is now"
It prints the rows for every record; this block keeps those whose ?record is
urn:uuid:86875af4-7cd3-86e8-84f4-3e774d5f2947.
Or in GraphDB, open the saved query record/Where each record a statement names is now in the repository alex-rivera.
Which entry shows it: none. The question
Which judgments name it
A judgment names records as its members: that two are the same, that they differ, or that one is wrong. Rows come in the order a person made the judgments, after a matcher's judgments, which carry no time. Counts says whether one counts under the lens the pod was built with; one that does not was retracted, replaced by a judgment not itself retracted, made with a reference table since replaced, or asserted with a rule query no current rule list runs.
Only the rows whose ?record is this one.
| ?made | ?judgment | ?verdict | ?counts |
|---|---|---|---|
| 2027-04-02 20:00 UTC | Erroneous · the patient · 2027-04-02 · Echocardiography Turtle | erroneous cascade:Erroneous | true |
1 row
The query: queries/questions/record/Which judgments name it.rq on GitHub
PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?record ?recordLabel ?made ?judgment ?judgmentLabel ?verdict ?counts
WHERE {
?record a cascade:Record .
?judgment a cascade:Judgment ; prov:hadMember ?record .
OPTIONAL { ?judgment prov:generatedAtTime ?made }
OPTIONAL { ?judgment cascade:verdict ?verdict }
OPTIONAL { ?judgment cascade:countsUnderLens ?counted }
BIND (COALESCE(?counted, false) AS ?counts)
OPTIONAL { ?record rdfs:label ?recordLabel }
OPTIONAL { ?judgment rdfs:label ?judgmentLabel }
}
ORDER BY ?recordLabel ?record ?made ?judgment
The terms it uses: cascade:Record, cascade:Judgment, prov:hadMember, prov:generatedAtTime, cascade:verdict, cascade:countsUnderLens, rdfs:label.
Run it yourself, from the runtime's root:
npm run ask -- alex-rivera "record/Which judgments name it"
It prints the rows for every record; this block keeps those whose ?record is
urn:uuid:86875af4-7cd3-86e8-84f4-3e774d5f2947.
Or in GraphDB, open the saved query record/Which judgments name it in the repository alex-rivera.
Why it is in no view
A record no entry joins is hidden, never deleted. Each reason the derivations left it out for is a row, with the thing that reason rests on, where there is one.
Only the rows whose ?record is this one.
| ?why | ?because |
|---|---|
cascade:JudgedErroneous | Erroneous · the patient · 2027-04-02 · Echocardiography Turtle |
1 row
The query: queries/questions/record/Why it is in no view.rq on GitHub
PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?record ?recordLabel ?why ?because ?becauseLabel
WHERE {
?record a cascade:Record ; cascade:leftOutFor ?leftOut .
?leftOut cascade:leftOutReason ?why .
OPTIONAL { ?leftOut cascade:leftOutBecauseOf ?because }
OPTIONAL { ?leftOut cascade:leftOutBecauseOf ?because . ?because rdfs:label ?becauseLabel }
OPTIONAL { ?record rdfs:label ?recordLabel }
}
ORDER BY ?why ?recordLabel ?record ?because
The terms it uses: cascade:Record, cascade:leftOutFor, cascade:leftOutReason, cascade:leftOutBecauseOf, rdfs:label.
Run it yourself, from the runtime's root:
npm run ask -- alex-rivera "record/Why it is in no view"
It prints the rows for every record; this block keeps those whose ?record is
urn:uuid:86875af4-7cd3-86e8-84f4-3e774d5f2947.
Or in GraphDB, open the saved query record/Why it is in no view in the repository alex-rivera.