Named question about pod
What was seen more than once
Each entry that holds more than one record, once for each place its records came from: how many of its records came from that place, and from how many places they came. A record's place is read from its current revision: a hospital that wrote or keeps the document it was derived from, by its label or its organization record's current name, or, when it has none, the label of the import or session that generated it. A place is told apart by that text alone: a hospital with two names is two places, and a hospital and an import that share a name are one. A record with two hospitals counts at each, so an entry's records can add up to more than it holds; a record with no hospital and no labelled import or session is given no place, and is not counted in places. Entries seen at more than one place come first.
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 ?entry ?entryLabel ?place (COUNT(DISTINCT ?record) AS ?records) ?places
WHERE {
{ SELECT ?entry (COUNT(DISTINCT ?somewhere) AS ?places)
WHERE {
?member a cascade:Record ; ^cascade:entryMember ?entry ; cascade:currentRevision ?memberRevision .
OPTIONAL { ?memberRevision prov:wasGeneratedBy/rdfs:label ?memberImportLabel }
OPTIONAL { ?memberRevision prov:wasDerivedFrom/prov:wasAttributedTo/(rdfs:label|pav:hasCurrentVersion/foaf:name) ?memberHospital }
BIND (COALESCE(?memberHospital, ?memberImportLabel) AS ?somewhere)
}
GROUP BY ?entry
HAVING (COUNT(DISTINCT ?member) > 1) }
?record ^cascade:entryMember ?entry ; cascade:currentRevision ?revision .
OPTIONAL { ?entry rdfs:label ?entryLabel }
OPTIONAL { ?revision prov:wasGeneratedBy/rdfs:label ?importLabel }
OPTIONAL { ?revision prov:wasDerivedFrom/prov:wasAttributedTo/(rdfs:label|pav:hasCurrentVersion/foaf:name) ?hospital }
BIND (COALESCE(?hospital, ?importLabel) AS ?place)
}
GROUP BY ?entry ?entryLabel ?place ?places
ORDER BY DESC(?places) ?entryLabel ?entry ?place
Terms it reads
cascade:Record · cascade:currentRevision · cascade:entryMember · pav:hasCurrentVersion · prov:wasDerivedFrom · prov:wasGeneratedBy · rdfs:label
Rules and decision notes that name it
No rule or decision note writes its path.
Its rows on Alex Rivera's pod
10 rows, as Alex Rivera's explorer shows them.
| entry | place | records | places |
|---|---|---|---|
| Allergy entry · Penicillin | Larkspur Valley Health | 2 | 2 |
| Allergy entry · Penicillin | Meridian Health System | 1 | 2 |
| Allergy entry · Sulfamethoxazole | Larkspur Valley Health | 2 | 2 |
| Allergy entry · Sulfamethoxazole | Meridian Health System | 1 | 2 |
| Condition entry · Essential hypertension · 2021-04-02 | Larkspur Valley Health | 2 | 2 |
| Condition entry · Essential hypertension · 2021-04-02 | Meridian Health System | 1 | 2 |
| Immunization entry · Influenza, injectable, quadrivalent, preservative free · 2025-10-15 | Larkspur Valley Health | 2 | 2 |
| Immunization entry · Influenza, injectable, quadrivalent, preservative free · 2025-10-15 | Meridian Health System | 1 | 2 |
| Condition entry · Asthma · 2008-09-01 | Larkspur Valley Health | 2 | 1 |
| Procedure entry · Colonoscopy · 2026-08-19 | Larkspur Valley Health | 2 | 1 |
queries/questions/pod/What was seen more than once.rq on GitHub ↗