Skip to content
Alpha: see what works today →
Menu

Named question about record

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.

The query

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

Terms it reads

cascade:Judgment · cascade:Record · cascade:countsUnderLens · cascade:currentRevision · cascade:currentRevisionCandidate · cascade:currentVersionStatusLifecycle · cascade:currentVersionStatusLifecycleStep · cascade:currentlyDifferent · cascade:currentlySame · cascade:currentlySameOrganization · cascade:entryMember · cascade:inEntry · cascade:judgedBefore · cascade:judgedBeforeRevisionOfSameRecord · cascade:lapsed · cascade:laterInAncestryThan · cascade:leftOutFor · cascade:matcherRule · cascade:medicationExposureEnd · cascade:medicationExposureOngoing · cascade:medicationExposureStart · cascade:observationTimeDiscountedBy · cascade:recordKind · cascade:revisionJudgedErroneousBy · cascade:statusOnlyFromDocuments · cascade:subject · pav:hasCurrentVersion · prov:hadMember · rdfs:label

Rules and decision notes that name it

No rule or decision note writes its path.

Its rows on Alex Rivera's pod

The first 10 of 16 rows, as Alex Rivera's explorer shows them. Every row of every question is in answers.json.

statementcountsrecordoutcomeentryotherMembersgrewByotherStatementsmergedWithwhy
Different · the patient · 2026-12-02 · ColonoscopytrueProcedure · Colonoscopy · Larkspur Valley Health · px-55120splitProcedure entry · Colonoscopy · 2026-08-19urn:uuid:cfe67786-af77-8fb0-8c99-3d9faedcf1821urn:uuid:faa481eb-9e1a-419f-8c94-fc8aa41fbf3b1
Different · the patient · 2026-12-02 · ColonoscopytrueProcedure · Colonoscopy · Meridian Health System · proc-colonoscopy-1splitProcedure entry · Colonoscopy · 2025-02-180urn:uuid:faa481eb-9e1a-419f-8c94-fc8aa41fbf3b0
Same · the patient · 2026-12-02 · SulfamethoxazoletrueAllergy · Sulfamethoxazole · Larkspur Valley Health · al-8237462oneAllergy entry · Sulfamethoxazoleurn:uuid:5a16d5f4-34b0-8fb6-9f5c-59b37aa6d4dc; urn:uuid:828f3452-da1d-83e7-9fd4-23f49d35584810
Same · the patient · 2026-12-02 · SulfamethoxazoletrueAllergy · Sulfamethoxazole · Meridian Health System · alg-sulfa-1oneAllergy entry · Sulfamethoxazoleurn:uuid:828f3452-da1d-83e7-9fd4-23f49d355848; urn:uuid:b0492421-a1b7-8de4-817e-8940bf97f7df10
Erroneous · the patient · 2027-04-02 · EchocardiographytrueProcedure · Echocardiography · Meridian Health System · proc-echo-1hiddencascade:JudgedErroneous
About · the patient · 2027-02-10 · a patient profilefalsePatient profile · Meridian Health System · first received 2027-02-10in no entry
About · the patient · 2026-10-14 · a patient profiletruePatient profile · Larkspur Valley Health · first received 2026-10-14onePatient entryurn:uuid:7883c5a4-6c61-837c-9bf7-dbe1b37d89ff; urn:uuid:d461e692-842c-8a30-a8ba-940a908c8cab2urn:uuid:b82b9123-c123-47d2-8d4b-8f9fe8fa7d50; urn:uuid:e2cd46af-7537-46d3-8109-f6a014c1ac192
About · the patient · 2026-09-01 · a patient profiletruePatient profile · Meridian Health System · first received 2026-09-01onePatient entryurn:uuid:5056e058-324f-8c70-b69b-fb27a061cdc5; urn:uuid:d461e692-842c-8a30-a8ba-940a908c8cab2urn:uuid:953a882a-8b6c-4099-81be-dfd291c84aad; urn:uuid:e2cd46af-7537-46d3-8109-f6a014c1ac192
Same · the patient · 2026-12-02 · Acute bronchitisfalseCondition · Acute bronchitis · Meridian Health System · cond-bronch-1splitCondition entry · Acute bronchitis · 2026-08-1200
Same · the patient · 2026-12-02 · Acute bronchitisfalseCondition · Asthma · Larkspur Valley Health · pr-30018splitCondition entry · Asthma · 2008-09-01urn:uuid:fdf1589d-bc02-8c0f-8874-4d377574cc8d10

queries/questions/record/Where each record a statement names is now.rq on GitHub ↗