Skip to content
Alpha: see what works today →
Menu

Named question about profile

Whose it is counted as

About judgments say whose a patient profile is, and only one that counts is believed, while no counting NotAbout over the profile for that subject outranks it. Each row is one hospital whose records name the profile, with how many of them it sent. Records naming a profile no counting About judgment claims, or a counting NotAbout denies, stay out of every view.

The query

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 ?profile ?profileLabel ?subject ?subjectLabel ?counts ?about ?aboutLabel ?hospital ?records
WHERE {
  { SELECT ?profile ?hospital (COUNT(DISTINCT ?record) AS ?records)
    WHERE {
      { { SELECT DISTINCT ?document ?hospital
          WHERE { ?document prov:wasAttributedTo/(rdfs:label|pav:hasCurrentVersion/foaf:name) ?hospital } }
        ?revision prov:wasDerivedFrom ?document ; cascade:version ?version .
        ?version cascade:patient ?profile ; prov:specializationOf ?record . }
      UNION
      { ?version cascade:patient ?profile ; prov:specializationOf ?record .
        MINUS { ?revision cascade:version ?version ;
                          prov:wasDerivedFrom/prov:wasAttributedTo/(rdfs:label|pav:hasCurrentVersion/foaf:name) ?hospital } } }
    GROUP BY ?profile ?hospital
    HAVING (BOUND(?profile)) }
  ?about a cascade:Judgment ; cascade:verdict cascade:About ; prov:hadMember ?profile ; cascade:subject ?subject .
  OPTIONAL { ?about cascade:countsUnderLens ?counted }
  BIND (COALESCE(?counted, false) && !EXISTS { ?denial cascade:countsUnderLens true ; cascade:verdict cascade:NotAbout ;
                                                       prov:hadMember ?profile ; cascade:subject ?subject }
        AS ?counts)
  OPTIONAL { ?profile rdfs:label ?profileLabel }
  OPTIONAL { ?subject rdfs:label ?subjectLabel }
  OPTIONAL { ?about rdfs:label ?aboutLabel }
}
ORDER BY ?profileLabel ?profile ?aboutLabel ?about ?hospital

Terms it reads

cascade:About · cascade:Judgment · cascade:NotAbout · cascade:countsUnderLens · cascade:patient · cascade:subject · cascade:verdict · cascade:version · pav:hasCurrentVersion · prov:hadMember · prov:specializationOf · prov:wasAttributedTo · prov:wasDerivedFrom · rdfs:label

Rules and decision notes that name it

No rule or decision note writes its path.

Its rows on Alex Rivera's pod

4 rows, as Alex Rivera's explorer shows them.

profilesubjectcountsabouthospitalrecords
Patient profile · Larkspur Valley Health · first received 2026-10-14The person this pod is abouttrueAbout · the patient · 2026-10-14 · a patient profileLarkspur Valley Health6
Patient profile · Larkspur Valley Health · first received 2027-03-18The person this pod is abouttrueAbout · the patient · 2027-03-18 · a patient profileLarkspur Valley Health6
Patient profile · Meridian Health System · first received 2026-09-01The person this pod is abouttrueAbout · the patient · 2026-09-01 · a patient profileMeridian Health System10
Patient profile · Meridian Health System · first received 2027-02-10The person this pod is aboutfalseAbout · the patient · 2027-02-10 · a patient profileMeridian Health System3

queries/questions/profile/Whose it is counted as.rq on GitHub ↗