Skip to content
Alpha: see what works today →
Menu

Derivation

excluded-for-their-patient

A record about no one known to be the subject is left out of every view, and the reason rests on the patient profile its current version names: a person's About stands against a counting NotAbout over the profile, which holds it back for review; or a counting NotAbout names the profile; or no counting About ties the profile to the subject. A person's About stands against a NotAbout for its subject unless a counting NotAbout of the same maker was made after it. A record whose current version names no patient, or that has no current version, is left out for that.

The query

PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX pav: <http://purl.org/pav/>
PREFIX prov: <http://www.w3.org/ns/prov#>

CONSTRUCT { ?record cascade:leftOutFor ?leftOut . ?leftOut cascade:leftOutReason ?reason ; cascade:leftOutBecauseOf ?profile }
WHERE {
  { { SELECT DISTINCT ?profile ?reason
      WHERE {
        ?denial cascade:countsUnderLens true ; cascade:verdict cascade:NotAbout ; prov:hadMember ?profile .
        OPTIONAL {
          ?opposed cascade:countsUnderLens true ; cascade:verdict ?opposedVerdict ; prov:hadMember ?profile ;
                   cascade:subject ?s .
          ?against cascade:countsUnderLens true ; cascade:verdict ?againstVerdict ; prov:hadMember ?profile ;
                   cascade:subject ?s ; prov:wasAttributedTo ?by ; prov:generatedAtTime ?made .
          ?by a ?byKind .
          MINUS {
            ?outranking cascade:countsUnderLens true ; cascade:verdict ?outrankingVerdict ; prov:hadMember ?profile ;
                        cascade:subject ?s ; prov:wasAttributedTo ?by ; prov:generatedAtTime ?later .
            ?against cascade:verdict ?againstAgainVerdict ; prov:hadMember ?profile ; cascade:subject ?s ;
                     prov:wasAttributedTo ?by ; prov:generatedAtTime ?made .
            FILTER (?later > ?made && ?outrankingVerdict = cascade:NotAbout && ?againstAgainVerdict = cascade:About)
          }
          FILTER (?opposedVerdict = cascade:NotAbout && ?againstVerdict = cascade:About && ?byKind = prov:Person)
        }
        BIND (IF(BOUND(?against), cascade:PatientProfileJudgedBothAboutAndNotAbout, cascade:PatientProfileJudgedNotAbout)
              AS ?reason)
      } }
    ?record pav:hasCurrentVersion/cascade:patient ?profile ; a cascade:Record .
    FILTER NOT EXISTS { ?record cascade:subject [] }
    BIND (IRI(CONCAT("urn:cascade:left-out:", SHA256(CONCAT(STR(?record), " ", STR(?reason), " ", STR(?profile))))) AS ?leftOut) }
  UNION
  { ?record a cascade:Record .
    FILTER NOT EXISTS { ?record cascade:subject [] }
    OPTIONAL { ?record pav:hasCurrentVersion/cascade:patient ?profile }
    MINUS { ?denial cascade:countsUnderLens true ; cascade:verdict cascade:NotAbout ; prov:hadMember ?profile }
    BIND (IF(BOUND(?profile), cascade:PatientProfileNotClaimed, cascade:NoPatient) AS ?reason)
    BIND (IRI(CONCAT("urn:cascade:left-out:",
                     SHA256(CONCAT(STR(?record), " ", STR(?reason), COALESCE(CONCAT(" ", STR(?profile)), ""))))) AS ?leftOut) }
}

Terms it reads

cascade:About · cascade:NoPatient · cascade:NotAbout · cascade:PatientProfileJudgedBothAboutAndNotAbout · cascade:PatientProfileJudgedNotAbout · cascade:PatientProfileNotClaimed · cascade:Record · cascade:countsUnderLens · cascade:leftOutBecauseOf · cascade:leftOutFor · cascade:leftOutReason · cascade:subject · cascade:verdict · pav:hasCurrentVersion · prov:Person · prov:generatedAtTime · prov:hadMember · prov:wasAttributedTo

Rules and decision notes that name it

No rule or decision note writes its path.

queries/derivations/excluded-for-their-patient.rq on GitHub ↗