Record
Note or document · Vital signs · Kestrel Harbor Hospital · received 2025-05-05
urn:uuid:3ddc6393-6294-871f-8f14-d3e477d085de
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.
9 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 -- priya-natarajan "pod/Which file states each thing"
It prints the rows for every thing; this block keeps those whose ?thing is
urn:uuid:3ddc6393-6294-871f-8f14-d3e477d085de.
Or in GraphDB, open the saved query pod/Which file states each thing in the repository priya-natarajan.
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.
3 rows
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 -- priya-natarajan "record/Its revisions, in the order they arrived"
It prints the rows for every record; this block keeps those whose ?record is
urn:uuid:3ddc6393-6294-871f-8f14-d3e477d085de.
Or in GraphDB, open the saved query record/Its revisions, in the order they arrived in the repository priya-natarajan.
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.
22 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 -- priya-natarajan "record/What each version says"
It prints the rows for every record; this block keeps those whose ?record is
urn:uuid:3ddc6393-6294-871f-8f14-d3e477d085de.
Or in GraphDB, open the saved query record/What each version says in the repository priya-natarajan.
What needs review
Records whose current revision the source's change time did not decide, for a person to look at: the confession that current is derived and never stored. A record is listed once for each other candidate it holds at another version, beside its current revision (?revision, the state shown) and that candidate (?otherRevision, a state not shown): the clocks fell to the observation time, and the shown one was "observed later", or to the least IRI, with "no basis", which is also the reason where a ClockDiscounted leaves either carrying no observation time. A candidate a later live pull of the same source follows in ancestry is not listed: ancestry orders the two. A record is also listed for each Before of its revisions that a cycle of Befores cancels, with the two revisions it orders. Either is fixed by one Before. A finding that a source reported older states is listed as one line, ?finding, saying how many of the records that went back are not yet answered and the last date the source reported later states, expanding to each record, with its current revision and the revision holding the older state, until a person files a Before between that revision and one the source contradicted, or an acknowledgement of that kind naming the record, the document of the older state and the document of every state of the record the finding says it contradicts, each of which answers that record (two people's acknowledgements each naming some of those documents do not add up). A finding that a writer's clock was behind is listed with each revision it names, until a person files an acknowledgement of that kind naming the act that generated the revision, or discounts the act's clock.
Only the rows whose ?record is this one.
2 rows
The query: queries/questions/record/What needs review.rq on GitHub
PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX oa: <http://www.w3.org/ns/oa#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?record ?recordLabel ?needs ?finding ?revision ?revisionLabel ?otherRevision ?otherRevisionLabel
# bound: ?record
WHERE {
{ { SELECT ?record ?otherRevision
WHERE {
?record cascade:currentRevisionCandidate ?otherRevision .
FILTER NOT EXISTS { ?later cascade:laterInAncestryThan ?otherRevision }
} }
?record cascade:currentRevision ?revision .
?revision cascade:version ?version ; cascade:observedAsOf ?seen .
?otherRevision cascade:version ?otherVersion ; cascade:observedAsOf ?otherSeen .
FILTER (?otherVersion != ?version)
OPTIONAL { ?revision cascade:observationTimeDiscountedBy ?discount }
OPTIONAL { ?otherRevision cascade:observationTimeDiscountedBy ?otherDiscount }
BIND (IF(?seen > ?otherSeen && !BOUND(?discount) && !BOUND(?otherDiscount), "observed later", "no basis") AS ?needs)
OPTIONAL { ?record rdfs:label ?recordLabel }
OPTIONAL { ?revision rdfs:label ?revisionLabel }
OPTIONAL { ?otherRevision rdfs:label ?otherRevisionLabel } }
UNION
{ ?revision cascade:judgedBeforeRevisionOfSameRecord ?otherRevision ; cascade:revisionOf ?record .
FILTER EXISTS { ?otherRevision cascade:judgedBeforeRevisionOfSameRecord+ ?revision }
FILTER (STR(?revision) < STR(?otherRevision) || !EXISTS { ?otherRevision cascade:judgedBeforeRevisionOfSameRecord ?revision })
BIND ("Befores that form a cycle" AS ?needs)
OPTIONAL { ?record rdfs:label ?recordLabel }
OPTIONAL { ?revision rdfs:label ?revisionLabel }
OPTIONAL { ?otherRevision rdfs:label ?otherRevisionLabel } }
UNION
{ { { SELECT ?finding (COUNT(?older) AS ?wentBack)
WHERE {
?finding oa:hasBody cascade:SourceReportedOlderStates ; oa:hasTarget ?older .
FILTER NOT EXISTS {
?older cascade:judgedBefore|^cascade:judgedBefore ?answered .
?finding cascade:contradictedEarlierRevision ?answered .
}
MINUS {
{ SELECT ?finding ?older
WHERE {
{ SELECT ?finding ?older ?wentBack ?olderDocument
WHERE {
?finding oa:hasBody cascade:SourceReportedOlderStates ; oa:hasTarget ?older .
?older cascade:revisionOf ?wentBack ; prov:wasDerivedFrom ?olderDocument
} }
{ SELECT ?finding ?wentBack ?contradictedDocument
WHERE {
?finding oa:hasBody cascade:SourceReportedOlderStates ; cascade:contradictedEarlierRevision ?contradicted .
?contradicted cascade:revisionOf ?wentBack ; prov:wasDerivedFrom ?contradictedDocument
} }
?acknowledgement cascade:countsUnderLens true ; cascade:verdict cascade:Acknowledged ;
cascade:answersWarningOfKind cascade:SourceReportedOlderStates ;
prov:hadMember ?wentBack , ?olderDocument .
OPTIONAL { ?acknowledgement prov:hadMember ?contradictedDocument . BIND (?contradictedDocument AS ?named) }
}
GROUP BY ?finding ?older ?acknowledgement
HAVING (COUNT(DISTINCT ?named) = COUNT(DISTINCT ?contradictedDocument)) }
}
}
GROUP BY ?finding }
FILTER (BOUND(?finding)) }
{ { SELECT ?finding (MAX(?reported) AS ?lastReported)
WHERE {
?finding oa:hasBody cascade:SourceReportedOlderStates ; cascade:contradictedEarlierRevision ?earlier .
?earlier cascade:observedAsOf ?reported .
}
GROUP BY ?finding }
FILTER (BOUND(?finding)) }
?finding oa:hasTarget ?otherRevision .
?otherRevision cascade:revisionOf ?record .
?record cascade:currentRevision ?revision .
FILTER NOT EXISTS {
?otherRevision cascade:judgedBefore|^cascade:judgedBefore ?contradicted .
?finding cascade:contradictedEarlierRevision ?contradicted .
}
MINUS {
{ SELECT ?finding ?otherRevision
WHERE {
{ SELECT ?finding ?otherRevision ?wentBack ?olderDocument
WHERE {
?finding oa:hasBody cascade:SourceReportedOlderStates ; oa:hasTarget ?otherRevision .
?otherRevision cascade:revisionOf ?wentBack ; prov:wasDerivedFrom ?olderDocument
} }
{ SELECT ?finding ?wentBack ?contradictedDocument
WHERE {
?finding oa:hasBody cascade:SourceReportedOlderStates ; cascade:contradictedEarlierRevision ?contradicted .
?contradicted cascade:revisionOf ?wentBack ; prov:wasDerivedFrom ?contradictedDocument
} }
?acknowledgement cascade:countsUnderLens true ; cascade:verdict cascade:Acknowledged ;
cascade:answersWarningOfKind cascade:SourceReportedOlderStates ;
prov:hadMember ?wentBack , ?olderDocument .
OPTIONAL { ?acknowledgement prov:hadMember ?contradictedDocument . BIND (?contradictedDocument AS ?named) }
}
GROUP BY ?finding ?otherRevision ?acknowledgement
HAVING (COUNT(DISTINCT ?named) = COUNT(DISTINCT ?contradictedDocument)) }
}
BIND (CONCAT("this source reports ", STR(?wentBack), IF(?wentBack = 1, " record", " records"),
" at states older than it reported on ", SUBSTR(STR(?lastReported), 1, 10)) AS ?needs)
OPTIONAL { ?record rdfs:label ?recordLabel }
OPTIONAL { ?revision rdfs:label ?revisionLabel }
OPTIONAL { ?otherRevision rdfs:label ?otherRevisionLabel } }
UNION
{ ?finding oa:hasBody cascade:ClockBehind ; oa:hasTarget ?revision ; cascade:writerClockBehindByAtLeastDays ?days .
?revision cascade:revisionOf ?record ; prov:wasGeneratedBy ?act .
MINUS { ?acknowledgement cascade:countsUnderLens true ; cascade:verdict cascade:Acknowledged ;
cascade:answersWarningOfKind cascade:ClockBehind ; prov:hadMember ?act }
FILTER NOT EXISTS { ?revision cascade:observationTimeDiscountedBy ?discount }
BIND (CONCAT("this writer's clock was at least ", STR(?days), IF(?days = 1, " day", " days"), " behind") AS ?needs)
OPTIONAL { ?record rdfs:label ?recordLabel }
OPTIONAL { ?revision rdfs:label ?revisionLabel } }
}
ORDER BY ?needs ?finding ?recordLabel ?record ?revision ?otherRevision
The terms it uses: cascade:currentRevisionCandidate, cascade:laterInAncestryThan, cascade:currentRevision, cascade:version, cascade:observedAsOf, cascade:observationTimeDiscountedBy, rdfs:label, cascade:judgedBeforeRevisionOfSameRecord, cascade:revisionOf, oa:hasBody, oa:hasTarget, cascade:judgedBefore, cascade:contradictedEarlierRevision, prov:wasDerivedFrom, cascade:countsUnderLens, cascade:verdict, cascade:Acknowledged, cascade:answersWarningOfKind, prov:hadMember, cascade:writerClockBehindByAtLeastDays, prov:wasGeneratedBy.
Run it yourself, from the runtime's root:
npm run ask -- priya-natarajan "record/What needs review"
It prints the rows for every record; this block keeps those whose ?record is
urn:uuid:3ddc6393-6294-871f-8f14-d3e477d085de.
Or in GraphDB, open the saved query record/What needs review in the repository priya-natarajan.
Where each record a statement names is now: none. The question
Which entry shows it
A record is shown in at most one entry, in the view of its kind. The entry joins it with every record judged to be the same thing. A record in no entry is hidden, and Not shown says why.
Only the rows whose ?record is this one.
| ?entry | ?view |
|---|---|
| Note or document entry · Vital signs · 2025-05-05T17:42:33Z | clinical/notes-and-documents.ttl page |
1 row
The query: queries/questions/record/Which entry shows it.rq on GitHub
PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?record ?recordLabel ?entry ?entryLabel ?view
WHERE {
{ SELECT ?entry ?entryLabel
WHERE { { SELECT DISTINCT ?entry WHERE { GRAPH ?shownIn { ?entry cascade:entryMember ?member } } }
OPTIONAL { ?entry rdfs:label ?entryLabel } } }
GRAPH ?view { ?entry cascade:entryMember ?record }
?record a cascade:Record .
OPTIONAL { ?record rdfs:label ?recordLabel }
}
ORDER BY ?recordLabel ?record ?entry
The terms it uses: cascade:entryMember, rdfs:label, cascade:Record.
Run it yourself, from the runtime's root:
npm run ask -- priya-natarajan "record/Which entry shows it"
It prints the rows for every record; this block keeps those whose ?record is
urn:uuid:3ddc6393-6294-871f-8f14-d3e477d085de.
Or in GraphDB, open the saved query record/Which entry shows it in the repository priya-natarajan.
Which judgments name it: none. The question
Why it is in no view: none. The question