R6 Ballot (2nd Draft)

Publish-box (todo)

Graphdefinition.shex

FHIR Infrastructure Work GroupMaturity Level: N/AStandards Status: InformativeCompartments: No defined compartments

Raw ShEx

ShEx statement for graphdefinition

PREFIX fhir: <http://hl7.org/fhir/> 
PREFIX fhirvs: <http://hl7.org/fhir/ValueSet/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 

IMPORT <id.shex>
IMPORT <uri.shex>
IMPORT <code.shex>
IMPORT <string.shex>
IMPORT <Coding.shex>
IMPORT <boolean.shex>
IMPORT <integer.shex>
IMPORT <dateTime.shex>
IMPORT <markdown.shex>
IMPORT <canonical.shex>
IMPORT <Identifier.shex>
IMPORT <UsageContext.shex>
IMPORT <ContactDetail.shex>
IMPORT <DomainResource.shex>
IMPORT <CodeableConcept.shex>
IMPORT <BackboneElement.shex>


start=@<GraphDefinition> AND {fhir:nodeRole [fhir:treeRoot]}

# Definition of a graph of resources
<GraphDefinition> EXTENDS @<DomainResource> CLOSED {   

    a [fhir:GraphDefinition]?;
    fhir:nodeRole [fhir:treeRoot]?;

    fhir:url @<uri>?;                       # Canonical identifier for this 
                                            # graph definition, represented as a 
                                            # URI (globally unique) 
    fhir:identifier @<OneOrMore_Identifier>?;  # Additional identifier for the 
                                            # GraphDefinition (business 
                                            # identifier) 
    fhir:version @<string>?;                # Business version of the graph 
                                            # definition 
    fhir:versionAlgorithm @<string>  OR 
    			@<Coding>  ?;  # How to compare versions
    fhir:name @<string>;                    # Name for this graph definition 
                                            # (computer friendly) 
    fhir:title @<string>?;                  # Name for this graph definition 
                                            # (human friendly) 
    fhir:status @<code> AND
    	{fhir:v @fhirvs:publication-status};  # draft | active | retired | unknown
    fhir:experimental @<boolean>?;          # For testing purposes, not real 
                                            # usage 
    fhir:date @<dateTime>?;                 # Date last changed
    fhir:publisher @<string>?;              # Name of the publisher/steward 
                                            # (organization or individual) 
    fhir:contact @<OneOrMore_ContactDetail>?;  # Contact details for the publisher
    fhir:description @<markdown>?;          # Natural language description of 
                                            # the graph definition 
    fhir:useContext @<OneOrMore_UsageContext>?;  # The context that the content is 
                                            # intended to support 
    fhir:jurisdiction @<OneOrMore_CodeableConcept>?;  # Intended jurisdiction for graph 
                                            # definition (if applicable) 
    fhir:purpose @<markdown>?;              # Why this graph definition is 
                                            # defined 
    fhir:copyright @<markdown>?;            # Use and/or publishing restrictions
    fhir:copyrightLabel @<string>?;         # Copyright holder and year(s)
    fhir:start @<id>?;                      # Starting Node
    fhir:node @<OneOrMore_GraphDefinition.node>?;  # Potential target for the link
    fhir:link @<OneOrMore_GraphDefinition.link>?;  # Links this graph makes rules about
}  

# Potential target for the link
<GraphDefinition.node> EXTENDS @<BackboneElement> CLOSED {   
    fhir:nodeId @<id>;                      # Internal ID - target for link 
                                            # references 
    fhir:description @<string>?;            # Why this node is specified
    fhir:type @<code> AND
    	{fhir:v @fhirvs:version-independent-all-resource-types};  # Type of resource this link refers 
                                            # to 
    fhir:profile @<canonical>?;             # Profile for the target resource
}  

# Links this graph makes rules about
<GraphDefinition.link> EXTENDS @<BackboneElement> CLOSED {   
    fhir:description @<string>?;            # Why this link is specified
    fhir:min @<integer>?;                   # Minimum occurrences for this link
    fhir:max @<string>?;                    # Maximum occurrences for this link
    fhir:sourceId @<id>;                    # Source Node for this link
    fhir:path @<string>?;                   # Path in the resource that contains 
                                            # the link 
    fhir:sliceName @<string>?;              # Which slice (if profiled)
    fhir:targetId @<id>;                    # Target Node for this link
    fhir:params @<string>?;                 # Criteria for reverse lookup
    fhir:compartment @<OneOrMore_GraphDefinition.link.compartment>?;  # Compartment Consistency Rules
}  

# Compartment Consistency Rules
<GraphDefinition.link.compartment> EXTENDS @<BackboneElement> CLOSED {   
    fhir:use @<code> AND
    	{fhir:v @fhirvs:graph-compartment-use};  # where | requires
    fhir:rule @<code> AND
    	{fhir:v @fhirvs:graph-compartment-rule};  # identical | matching | different | 
                                            # custom 
    fhir:code @<code> AND
    	{fhir:v @fhirvs:compartment-type};  # Patient | Encounter | 
                                            # RelatedPerson | Practitioner | 
                                            # Device | EpisodeOfCare 
    fhir:expression @<string>?;             # Custom rule, as a FHIRPath 
                                            # expression 
    fhir:description @<string>?;            # Documentation for FHIRPath 
                                            # expression 
}  

#---------------------- Cardinality Types (OneOrMore) -------------------

<OneOrMore_Identifier> CLOSED {
    rdf:first @<Identifier>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Identifier> 
}

<OneOrMore_ContactDetail> CLOSED {
    rdf:first @<ContactDetail>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_ContactDetail> 
}

<OneOrMore_UsageContext> CLOSED {
    rdf:first @<UsageContext>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_UsageContext> 
}

<OneOrMore_CodeableConcept> CLOSED {
    rdf:first @<CodeableConcept>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_CodeableConcept> 
}

<OneOrMore_GraphDefinition.node> CLOSED {
    rdf:first @<GraphDefinition.node>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_GraphDefinition.node> 
}

<OneOrMore_GraphDefinition.link> CLOSED {
    rdf:first @<GraphDefinition.link>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_GraphDefinition.link> 
}

<OneOrMore_GraphDefinition.link.compartment> CLOSED {
    rdf:first @<GraphDefinition.link.compartment>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_GraphDefinition.link.compartment> 
}

#---------------------- Value Sets ------------------------

# Which type a compartment definition describes.
fhirvs:compartment-type ["Patient" "Encounter" "RelatedPerson" "Practitioner" "Device" "EpisodeOfCare"]

# How a compartment must be linked.
fhirvs:graph-compartment-rule ["identical" "matching" "different" "custom"]

# Defines how a compartment rule is used.
fhirvs:graph-compartment-use ["where" "requires"]

# The lifecycle status of an artifact.
fhirvs:publication-status ["draft" "active" "retired" "unknown"]

# Current and past FHIR resource types (deleted or renamed), including abstract types
fhirvs:version-independent-all-resource-types ["Account" "ActivityDefinition" "ActorDefinition" "AdministrableProductDefinition" "AdverseEvent" "AllergyIntolerance" "Appointment" "AppointmentResponse" "ArtifactAssessment" "AuditEvent" "Basic" "Binary" "BiologicallyDerivedProduct" "BiologicallyDerivedProductDispense" "BodyStructure" "Bundle" "CanonicalResource" "CapabilityStatement" "CarePlan" "CareTeam" "ChargeItem" "ChargeItemDefinition" "Citation" "Claim" "ClaimResponse" "ClinicalImpression" "ClinicalUseDefinition" "CodeSystem" "Communication" "CommunicationRequest" "CompartmentDefinition" "Composition" "ConceptMap" "Condition" "ConditionDefinition" "Consent" "Contract" "Coverage" "CoverageEligibilityRequest" "CoverageEligibilityResponse" "DetectedIssue" "Device" "DeviceAlert" "DeviceAssociation" "DeviceDefinition" "DeviceDispense" "DeviceMetric" "DeviceRequest" "DeviceUsage" "DiagnosticReport" "DocumentReference" "DomainResource" "Encounter" "EncounterHistory" "Endpoint" "EnrollmentRequest" "EnrollmentResponse" "EpisodeOfCare" "EventDefinition" "Evidence" "EvidenceReport" "EvidenceVariable" "ExampleScenario" "ExplanationOfBenefit" "FamilyMemberHistory" "Flag" "FormularyItem" "GenomicStudy" "Goal" "GraphDefinition" "Group" "GuidanceResponse" "HealthcareService" "ImagingSelection" "ImagingStudy" "Immunization" "ImmunizationEvaluation" "ImmunizationRecommendation" "ImplementationGuide" "Ingredient" "InsurancePlan" "InsuranceProduct" "InventoryItem" "InventoryReport" "Invoice" "Library" "Linkage" "List" "Location" "ManufacturedItemDefinition" "Measure" "MeasureReport" "Medication" "MedicationAdministration" "MedicationDispense" "MedicationKnowledge" "MedicationRequest" "MedicationStatement" "MedicinalProductDefinition" "MessageDefinition" "MessageHeader" "MetadataResource" "MolecularDefinition" "MolecularSequence" "NamingSystem" "NutritionIntake" "NutritionOrder" "NutritionProduct" "Observation" "ObservationDefinition" "OperationDefinition" "OperationOutcome" "Organization" "OrganizationAffiliation" "PackagedProductDefinition" "Parameters" "Patient" "PaymentNotice" "PaymentReconciliation" "Permission" "Person" "PlanDefinition" "Practitioner" "PractitionerRole" "Procedure" "Provenance" "Questionnaire" "QuestionnaireResponse" "RegulatedAuthorization" "RelatedPerson" "RequestOrchestration" "Requirements" "ResearchStudy" "ResearchSubject" "Resource" "RiskAssessment" "Schedule" "SearchParameter" "ServiceRequest" "Slot" "Specimen" "SpecimenDefinition" "StructureDefinition" "StructureMap" "Subscription" "SubscriptionStatus" "SubscriptionTopic" "Substance" "SubstanceDefinition" "SubstanceNucleicAcid" "SubstancePolymer" "SubstanceProtein" "SubstanceReferenceInformation" "SubstanceSourceMaterial" "SupplyDelivery" "SupplyRequest" "Task" "TerminologyCapabilities" "TestPlan" "TestReport" "TestScript" "Transport" "ValueSet" "VerificationResult" "VisionPrescription" "BodySite" "CatalogEntry" "Conformance" "DataElement" "DeviceComponent" "DeviceUseRequest" "DeviceUseStatement" "DiagnosticOrder" "DocumentManifest" "EffectEvidenceSynthesis" "EligibilityRequest" "EligibilityResponse" "ExpansionProfile" "ImagingManifest" "ImagingObjectSelection" "Media" "MedicationOrder" "MedicationUsage" "MedicinalProduct" "MedicinalProductAuthorization" "MedicinalProductContraindication" "MedicinalProductIndication" "MedicinalProductIngredient" "MedicinalProductInteraction" "MedicinalProductManufactured" "MedicinalProductPackaged" "MedicinalProductPharmaceutical" "MedicinalProductUndesirableEffect" "Order" "OrderResponse" "ProcedureRequest" "ProcessRequest" "ProcessResponse" "ReferralRequest" "RequestGroup" "ResearchDefinition" "ResearchElementDefinition" "RiskEvidenceSynthesis" "Sequence" "ServiceDefinition" "SubstanceSpecification" "InsuranceProduct"]


Usage note: every effort has been made to ensure that the ShEx files are correct and useful, but they are not a normative part of the specification.