Skip to content
Alpha: see what works today →
Menu

Named question about judgment

Whether it counts

Each judgment has one row saying whether it counts under the lens the pod was built with, and one more row for each thing that happened to it: a later judgment replaced it, a retraction invalidated it or one of its assertions, the reference table it was made with has a newer version whose rows do not join its members as its rule reads them (M7), or the rule list its matcher judgment was asserted under has a current version whose rule runs another query, the version naming what did it. Only judgments that count shape the views.

The query

PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX dct: <http://purl.org/dc/terms/>
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 ?judgment ?judgmentLabel ?counts ?happened ?by ?byLabel
WHERE {
  { ?judgment a cascade:Judgment .
    OPTIONAL { ?judgment cascade:countsUnderLens ?counted }
    BIND (COALESCE(?counted, false) AS ?counts)
    OPTIONAL { ?judgment rdfs:label ?judgmentLabel } }
  UNION
  { ?by dct:replaces ?judgment .
    BIND ("replaced" AS ?happened)
    OPTIONAL { ?judgment cascade:countsUnderLens ?counted }
    BIND (COALESCE(?counted, false) AS ?counts)
    OPTIONAL { ?judgment rdfs:label ?judgmentLabel }
    OPTIONAL { ?by rdfs:label ?byLabel } }
  UNION
  { { SELECT DISTINCT ?by ?judgment
      WHERE { ?by prov:invalidated|prov:invalidated/cascade:assertedJudgment ?judgment } }
    ?judgment a cascade:Judgment .
    BIND ("retracted" AS ?happened)
    OPTIONAL { ?judgment cascade:countsUnderLens ?counted }
    BIND (COALESCE(?counted, false) AS ?counts)
    OPTIONAL { ?judgment rdfs:label ?judgmentLabel }
    OPTIONAL { ?by rdfs:label ?byLabel } }
  UNION
  { ?judgment a cascade:Judgment ; prov:wasDerivedFrom ?replaced .
    ?replaced prov:specializationOf/a cascade:ReferenceSeries .
    ?by prov:wasRevisionOf ?replaced .
    FILTER NOT EXISTS {
      ?replaced prov:specializationOf/pav:hasCurrentVersion ?now .
      ?judgment cascade:membersJoinedByCurrentTableVersion ?now
    }
    BIND ("made under a reference version since replaced" AS ?happened)
    OPTIONAL { ?judgment cascade:countsUnderLens ?counted }
    BIND (COALESCE(?counted, false) AS ?counts)
    OPTIONAL { ?judgment rdfs:label ?judgmentLabel }
    OPTIONAL { ?by rdfs:label ?byLabel } }
  UNION
  { { SELECT DISTINCT ?judgment ?by
      WHERE {
        ?assertion cascade:assertedJudgment ?judgment ; cascade:assertedUnderRuleListVersion ?asserted .
        ?asserted prov:specializationOf ?ruleList .
        ?ruleList pav:hasCurrentVersion ?by .
        FILTER (?by != ?asserted)
        MINUS {
          SELECT DISTINCT ?judgment ?by
          WHERE {
            { SELECT DISTINCT ?by ?rule ?hash
              WHERE { ?pinning pav:hasCurrentVersion ?by .
                      ?currentRow cascade:rowOfRuleListVersion ?by ; cascade:matcherRule ?rule ; cascade:queryHash ?hash } }
            ?anyRow cascade:matcherRule ?rule ; cascade:queryHash ?hash ; cascade:rowOfRuleListVersion ?anyVersion .
            ?anyAssertion cascade:assertedUnderRuleListVersion ?anyVersion ; cascade:assertedJudgment ?judgment .
            ?judgment cascade:matcherRule ?rule .
          }
        }
      } }
    BIND ("its rule runs another query since" AS ?happened)
    OPTIONAL { ?judgment cascade:countsUnderLens ?counted }
    BIND (COALESCE(?counted, false) AS ?counts)
    OPTIONAL { ?judgment rdfs:label ?judgmentLabel }
    OPTIONAL { ?by rdfs:label ?byLabel } }
}
ORDER BY ?judgmentLabel ?judgment ?happened ?by

Terms it reads

cascade:Judgment · cascade:ReferenceSeries · cascade:assertedJudgment · cascade:assertedUnderRuleListVersion · cascade:countsUnderLens · cascade:matcherRule · cascade:membersJoinedByCurrentTableVersion · cascade:queryHash · cascade:rowOfRuleListVersion · dct:replaces · pav:hasCurrentVersion · prov:invalidated · prov:specializationOf · prov:wasDerivedFrom · prov:wasRevisionOf · 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 22 rows, as Alex Rivera's explorer shows them. Every row of every question is in answers.json.

judgmentcountshappenedby
About · the patient · 2026-09-01 · a patient profiletrue
About · the patient · 2026-10-14 · a patient profiletrue
About · the patient · 2027-02-10 · a patient profilefalse
About · the patient · 2027-02-10 · a patient profilefalseretractedRetraction · the patient · 2027-04-02 · of About · a patient profile
About · the patient · 2027-03-18 · a patient profiletrue
Different · the patient · 2026-12-02 · Colonoscopytrue
Different · the patient · 2027-04-02 · Colonoscopytrue
Erroneous · the patient · 2027-04-02 · Echocardiographytrue
Same · Cascade matcher · 128da4fd · Asthmatrue
Same · Cascade matcher · 30cdc218 · Influenza, seasonaltrue

queries/questions/judgment/Whether it counts.rq on GitHub ↗