Skip to content
Alpha · We're looking for development partners. Build with us →
Menu

Judgment

Same · the patient · 2025-05-20 · Claritin 10 MG Oral Tablet

urn:uuid:6f0c8d52-3b1e-4a97-9d24-e5a7c1b08f36

A judgment is a decision about records or patient profiles: that two are the same, that they differ, that one is wrong, or whose a profile is. A machine or a person makes it. It is never edited; a later judgment supersedes or retracts it.

Every section below is one question with only the rows about this judgment. 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.

2 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:6f0c8d52-3b1e-4a97-9d24-e5a7c1b08f36.

Or in GraphDB, open the saved query pod/Which file states each thing in the repository priya-natarajan.

What needs review: none. The question

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.

Only the rows whose ?judgment is this one.

?counts?happened?by
true

1 row

The query: queries/questions/judgment/Whether it counts.rq on GitHub
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

The terms it uses: cascade:Judgment, cascade:countsUnderLens, rdfs:label, dct:replaces, prov:invalidated, prov:wasDerivedFrom, prov:specializationOf, cascade:ReferenceSeries, prov:wasRevisionOf, cascade:membersJoinedByCurrentTableVersion, cascade:assertedJudgment, cascade:assertedUnderRuleListVersion, pav:hasCurrentVersion, cascade:rowOfRuleListVersion, cascade:matcherRule, cascade:queryHash.

Run it yourself, from the runtime's root:

npm run ask -- priya-natarajan "judgment/Whether it counts"

It prints the rows for every judgment; this block keeps those whose ?judgment is urn:uuid:6f0c8d52-3b1e-4a97-9d24-e5a7c1b08f36.

Or in GraphDB, open the saved query judgment/Whether it counts in the repository priya-natarajan.

Who judged what

Everything each judgment says: when a person made it, by whom and in what role, its verdict, what it names, the reason given, any judgment it replaces, and, for a matcher judgment, each rule list version it is asserted under, since a matcher judgment carries no time; and each person's retraction, an activity, with the judgment it invalidated and no verdict. A judgment is never edited; a later one replaces it, or a retraction takes it back.

Only the rows whose ?judgment is this one.

2 rows

The query: queries/questions/judgment/Who judged what.rq on GitHub
PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT ?judgment ?judgmentLabel ?made ?verdict ?author ?authorLabel ?role ?member ?memberLabel ?reason
       ?replaces ?replacesLabel ?retracts ?retractsLabel ?assertedUnder
WHERE {
  { ?judgment a cascade:Judgment ; prov:wasAttributedTo ?author .
    OPTIONAL { ?judgment prov:generatedAtTime ?made }
    OPTIONAL { ?judgment rdfs:label ?judgmentLabel }
    OPTIONAL { ?author rdfs:label ?authorLabel }
    OPTIONAL { ?judgment cascade:verdict ?verdict }
    OPTIONAL { ?judgment prov:wasGeneratedBy/prov:qualifiedAssociation [ prov:agent ?author ; prov:hadRole ?role ] }
    OPTIONAL { ?judgment prov:hadMember ?member .
               OPTIONAL { ?member rdfs:label ?memberLabel } }
    OPTIONAL { ?judgment dct:description ?reason }
    OPTIONAL { ?judgment dct:replaces ?replaces .
               OPTIONAL { ?replaces rdfs:label ?replacesLabel } }
    OPTIONAL { ?assertion cascade:assertedJudgment ?judgment ; cascade:assertedUnderRuleListVersion ?assertedUnder } }
  UNION
  { ?judgment a prov:Activity ; prov:invalidated ?retracts ; prov:wasAssociatedWith ?author .
    OPTIONAL { ?judgment prov:startedAtTime ?made }
    OPTIONAL { ?judgment rdfs:label ?judgmentLabel }
    OPTIONAL { ?author rdfs:label ?authorLabel }
    OPTIONAL { ?judgment prov:qualifiedAssociation [ prov:agent ?author ; prov:hadRole ?role ] }
    OPTIONAL { ?judgment dct:description ?reason }
    OPTIONAL { ?retracts rdfs:label ?retractsLabel } }
}
ORDER BY ?made ?judgmentLabel ?judgment ?memberLabel ?member ?role ?replaces ?retracts ?assertedUnder

The terms it uses: cascade:Judgment, prov:wasAttributedTo, prov:generatedAtTime, rdfs:label, cascade:verdict, prov:wasGeneratedBy, prov:agent, prov:hadRole, prov:hadMember, dct:description, dct:replaces, cascade:assertedJudgment, cascade:assertedUnderRuleListVersion, prov:Activity, prov:invalidated, prov:wasAssociatedWith, prov:startedAtTime, prov:qualifiedAssociation.

Run it yourself, from the runtime's root:

npm run ask -- priya-natarajan "judgment/Who judged what"

It prints the rows for every judgment; this block keeps those whose ?judgment is urn:uuid:6f0c8d52-3b1e-4a97-9d24-e5a7c1b08f36.

Or in GraphDB, open the saved query judgment/Who judged what in the repository priya-natarajan.