eb: EverBetter pod store vocabulary

Namespace https://w3id.org/everbetter/ns#, prefix eb:. Formats: Turtle (source), JSON-LD, context /contexts/v1.jsonld.

@prefix eb:      <https://w3id.org/everbetter/ns#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .
@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
@prefix sh:      <http://www.w3.org/ns/shacl#> .
@prefix ldp:     <http://www.w3.org/ns/ldp#> .
@prefix acp:     <http://www.w3.org/ns/solid/acp#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix fhir:    <http://hl7.org/fhir/> .

# Source of truth for https://w3id.org/everbetter/ns#.
# vocab/ns.jsonld must hold the same triples; main_test.go checks it.

<https://w3id.org/everbetter/ns#> a owl:Ontology ;
  dcterms:title "EverBetter pod store vocabulary" ;
  dcterms:description "Terms that describe how an EverBetter Solid Server (EBSS) pod stores data: shared data classes, encryption tiers, registered apps, the record catalog, access rules and logs. Clinical meaning comes from FHIR R5 RDF, LOINC and UCUM." ;
  owl:versionInfo "0.1.0" .

# ---- Classes ----

eb:CommonClass a owl:Class ;
  rdfs:label "Common class" ;
  rdfs:comment "A kind of data shared across apps. Each has one container under data/common/." .

eb:Registry a owl:Class ;
  rdfs:label "Registry" ;
  rdfs:comment "The ontology map of one pod: the common classes the pod declares." .

eb:RegisteredApp a owl:Class ;
  rdfs:label "Registered app" ;
  rdfs:comment "An app known to the pod, keyed by its bundle ID." .

eb:EncryptionTier a owl:Class ;
  rdfs:label "Encryption tier" ;
  rdfs:comment "How a resource is protected at rest." .

eb:CatalogEntry a owl:Class ;
  rdfs:label "Catalog entry" ;
  rdfs:comment "One record's class, record date, writing app and last commit." .

eb:AccessRule a owl:Class ;
  rdfs:label "Access rule" ;
  rdfs:comment "A canonical sharing rule, rendered as ACP or WAC." .

eb:LogEntry a owl:Class ;
  rdfs:label "Log entry" ;
  rdfs:comment "One logged read, write, query or access change on a pod." .

# ---- Encryption tiers ----

eb:ServerManaged a eb:EncryptionTier ;
  rdfs:label "Server-managed" ;
  rdfs:comment "Encrypted at rest. The server decrypts on read and can index it." .

eb:ZeroKnowledge a eb:EncryptionTier ;
  rdfs:label "Zero-knowledge" ;
  rdfs:comment "Encrypted by the client. The server can neither read nor index it." .

eb:Plaintext a eb:EncryptionTier ;
  rdfs:label "Plaintext" ;
  rdfs:comment "Not encrypted. Must hold no PHI." .

# ---- Common class properties ----

eb:rdfType a owl:ObjectProperty ;
  rdfs:label "RDF type" ;
  rdfs:comment "The rdf:type every record of this class carries, e.g. fhir:Observation." ;
  rdfs:domain eb:CommonClass ;
  rdfs:range rdfs:Class .

eb:code a owl:DatatypeProperty ;
  rdfs:label "code" ;
  rdfs:comment "Terminology code as system|code, e.g. http://loinc.org|29463-7." ;
  rdfs:domain eb:CommonClass ;
  rdfs:range xsd:string .

eb:container a owl:DatatypeProperty ;
  rdfs:label "container" ;
  rdfs:comment "Pod-relative container path, e.g. data/common/observations/body-weight/." ;
  rdfs:domain eb:CommonClass ;
  rdfs:range xsd:string .

eb:shape a owl:ObjectProperty ;
  rdfs:label "shape" ;
  rdfs:comment "The SHACL shape every record of this class must satisfy." ;
  rdfs:domain eb:CommonClass ;
  rdfs:range sh:NodeShape .

eb:encryption a owl:ObjectProperty ;
  rdfs:label "encryption" ;
  rdfs:comment "The encryption tier of every record of this class." ;
  rdfs:domain eb:CommonClass ;
  rdfs:range eb:EncryptionTier .

eb:timeSeries a owl:DatatypeProperty ;
  rdfs:label "time series" ;
  rdfs:comment "True when records are named by timestamp." ;
  rdfs:domain eb:CommonClass ;
  rdfs:range xsd:boolean .

eb:datePath a owl:ObjectProperty ;
  rdfs:label "date path" ;
  rdfs:comment "Predicate path from a record's primary subject to its record date, e.g. ( fhir:effective fhir:v )." ;
  rdfs:domain eb:CommonClass ;
  rdfs:range rdf:List .

# ---- Catalog and ACP context attributes ----

eb:class a owl:ObjectProperty ;
  rdfs:subPropertyOf acp:attribute ;
  rdfs:label "class" ;
  rdfs:comment "A record's data type. Also an ACP context and matcher attribute." ;
  rdfs:domain [ a owl:Class ; owl:unionOf ( eb:CatalogEntry acp:Context acp:Matcher ) ] ;
  rdfs:range rdfs:Class .

eb:recordDate a owl:DatatypeProperty ;
  rdfs:subPropertyOf acp:attribute ;
  rdfs:label "record date" ;
  rdfs:comment "A record's date, read through its class's eb:datePath. Also an ACP context attribute." ;
  rdfs:domain [ a owl:Class ; owl:unionOf ( eb:CatalogEntry acp:Context ) ] ;
  rdfs:range xsd:dateTime .

eb:requestTime a owl:DatatypeProperty ;
  rdfs:subPropertyOf acp:attribute ;
  rdfs:label "request time" ;
  rdfs:comment "The server clock at the time of a request. An ACP context attribute." ;
  rdfs:domain acp:Context ;
  rdfs:range xsd:dateTime .

eb:app a owl:ObjectProperty ;
  rdfs:label "app" ;
  rdfs:comment "The registered app that wrote the record." ;
  rdfs:domain eb:CatalogEntry ;
  rdfs:range eb:RegisteredApp .

eb:commit a owl:DatatypeProperty ;
  rdfs:label "commit" ;
  rdfs:comment "The sha256 of the data commit that last changed the record." ;
  rdfs:domain eb:CatalogEntry ;
  rdfs:range xsd:string .

# ---- Registered app properties ----

eb:bundleId a owl:DatatypeProperty, owl:FunctionalProperty ;
  rdfs:label "bundle ID" ;
  rdfs:comment "The app's reverse-DNS bundle ID, e.g. com.example.stepquest." ;
  rdfs:domain eb:RegisteredApp ;
  rdfs:range xsd:string .

eb:folder a owl:ObjectProperty, owl:FunctionalProperty ;
  rdfs:label "folder" ;
  rdfs:comment "The app's private container, data/apps/<uuid>/, where uuid is the UUIDv5 of the bundle ID." ;
  rdfs:domain eb:RegisteredApp ;
  rdfs:range ldp:Container .

eb:clientId a owl:ObjectProperty ;
  rdfs:label "client ID" ;
  rdfs:comment "A Solid-OIDC client_id allowed to act as this app." ;
  rdfs:domain eb:RegisteredApp ;
  rdfs:range rdfs:Resource .

eb:reads a owl:ObjectProperty ;
  rdfs:label "reads" ;
  rdfs:comment "A common class the app may read." ;
  rdfs:domain eb:RegisteredApp ;
  rdfs:range eb:CommonClass .

eb:writes a owl:ObjectProperty ;
  rdfs:label "writes" ;
  rdfs:comment "A common class the app may write." ;
  rdfs:domain eb:RegisteredApp ;
  rdfs:range eb:CommonClass .

eb:firstParty a owl:DatatypeProperty ;
  rdfs:label "first party" ;
  rdfs:comment "True when EverBetter publishes the app." ;
  rdfs:domain eb:RegisteredApp ;
  rdfs:range xsd:boolean .

# ---- Provenance on any record ----

eb:recordedBy a owl:ObjectProperty ;
  rdfs:label "recorded by" ;
  rdfs:comment "The client_id of the app that wrote the record." ;
  rdfs:domain rdfs:Resource ;
  rdfs:range rdfs:Resource .

# ---- Common classes ----
# Clinical records use FHIR R5 RDF, LOINC codes and UCUM units.

eb:BodyWeight a eb:CommonClass ;
  rdfs:label "Body weight" ;
  rdfs:comment "A body weight reading, stored as a FHIR R5 Observation with LOINC 29463-7 and a UCUM unit of kg, g or [lb_av]." ;
  eb:rdfType fhir:Observation ;
  eb:code "http://loinc.org|29463-7" ;
  eb:container "data/common/observations/body-weight/" ;
  eb:encryption eb:ServerManaged ;
  eb:timeSeries true ;
  eb:datePath ( fhir:effective fhir:v ) .