@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

# - resource -------------------------------------------------------------------

<http://hl7.org/fhir/OperationDefinition/PlanDefinition-apply> a fhir:OperationDefinition ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:id [ fhir:v "PlanDefinition-apply"] ; # 
  fhir:text [
     fhir:status [ fhir:v "generated" ] ;
     fhir:div [ fhir:v "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: OperationDefinition PlanDefinition-apply</b></p><a name=\"PlanDefinition-apply\"> </a><a name=\"hcPlanDefinition-apply\"> </a><p>URL: [base]/PlanDefinition/$apply</p><p>URL: [base]/PlanDefinition/[id]/$apply</p><h3>Parameters</h3><table class=\"grid\"><tr><td><b>Use</b></td><td><b>Name</b></td><td><b>Scope</b></td><td><b>Cardinality</b></td><td><b>Type</b></td><td><b>Binding</b></td><td><b>Documentation</b></td></tr><tr><td>IN</td><td>planDefinition</td><td>type</td><td>0..1</td><td><a href=\"plandefinition.html\">PlanDefinition</a></td><td/><td><div><p>The plan definition to be applied. If the operation is invoked at the instance level, this parameter is not allowed; if the operation is invoked at the type level, this parameter is required, or a url (and optionally version) must be supplied</p>\n</div></td></tr><tr><td>IN</td><td>url</td><td>type</td><td>0..1</td><td><a href=\"datatypes.html#canonical\">canonical</a> (<a href=\"plandefinition.html\" title=\"http://hl7.org/fhir/StructureDefinition/PlanDefinition\">PlanDefinition</a>)</td><td/><td><div><p>The url of the plan definition to be applied. If the operation is invoked at the instance level, this parameter is not allowed; if the operation is invoked at the type level, this parameter (and optionally the version), or the planDefinition parameter must be supplied</p>\n</div></td></tr><tr><td>IN</td><td>version</td><td>type</td><td>0..1</td><td><a href=\"datatypes.html#string\">string</a></td><td/><td><div><p>The version of the plan definition to be applied. If the operation is invoked at the instance level, this parameter is not allowed; if the operation is invoked at the type level, this parameter may only be used if the url parameter is supplied.</p>\n</div></td></tr><tr><td>IN</td><td>subject</td><td/><td>1..*</td><td><a href=\"datatypes.html#string\">string</a><br/>(<a href=\"search.html#reference\">reference</a>)</td><td/><td><div><p>The subject(s) that is/are the target of the plan to be applied. The subject may be a Patient, Practitioner, Organization, Location, Device, or Group. Subjects provided in this parameter will be resolved as the subject of the PlanDefinition based on the type of the subject. If multiple subjects of the same type are provided, the behavior is implementation-defined</p>\n</div></td></tr><tr><td>IN</td><td>encounter</td><td/><td>0..1</td><td><a href=\"datatypes.html#string\">string</a><br/>(<a href=\"search.html#reference\">reference</a>)</td><td/><td><div><p>The encounter in context, if any</p>\n</div></td></tr><tr><td>IN</td><td>practitioner</td><td/><td>0..1</td><td><a href=\"datatypes.html#string\">string</a><br/>(<a href=\"search.html#reference\">reference</a>)</td><td/><td><div><p>The practitioner applying the plan definition</p>\n</div></td></tr><tr><td>IN</td><td>organization</td><td/><td>0..1</td><td><a href=\"datatypes.html#string\">string</a><br/>(<a href=\"search.html#reference\">reference</a>)</td><td/><td><div><p>The organization applying the plan definition</p>\n</div></td></tr><tr><td>IN</td><td>userType</td><td/><td>0..1</td><td><a href=\"datatypes.html#CodeableConcept\">CodeableConcept</a></td><td/><td><div><p>The type of user initiating the request, e.g. patient, healthcare provider, or specific type of healthcare provider (physician, nurse, etc.)</p>\n</div></td></tr><tr><td>IN</td><td>userLanguage</td><td/><td>0..1</td><td><a href=\"datatypes.html#CodeableConcept\">CodeableConcept</a></td><td/><td><div><p>Preferred language of the person using the system</p>\n</div></td></tr><tr><td>IN</td><td>userTaskContext</td><td/><td>0..1</td><td><a href=\"datatypes.html#CodeableConcept\">CodeableConcept</a></td><td/><td><div><p>The task the system user is performing, e.g. laboratory results review, medication list review, etc. This information can be used to tailor decision support outputs, such as recommended information resources</p>\n</div></td></tr><tr><td>IN</td><td>setting</td><td/><td>0..1</td><td><a href=\"datatypes.html#CodeableConcept\">CodeableConcept</a></td><td/><td><div><p>The current setting of the request (inpatient, outpatient, etc.)</p>\n</div></td></tr><tr><td>IN</td><td>settingContext</td><td/><td>0..1</td><td><a href=\"datatypes.html#CodeableConcept\">CodeableConcept</a></td><td/><td><div><p>Additional detail about the setting of the request, if any</p>\n</div></td></tr><tr><td>OUT</td><td>return</td><td/><td>0..*</td><td><a href=\"bundle.html\">Bundle</a></td><td/><td><div><p>A Bundle for each input subject that is the result of applying the plan definition to that subject. Note that even though there is a single parameter named return of type Bundle, it is a multi-cardinality parameter, and so will still be returned using a Parameters resource, as described in the general operations framework (https://hl7.org/fhir/R4/operations.html#response).</p>\n</div></td></tr></table><div><p>The result of this operation is a Bundle for each subject, where the Bundle contains Request resources that are the direct result of applying the PlanDefinition to that subject. The Bundle will have entries for each of the applicable actions in the PlanDefinition based on evaluating the applicability condition in context, and producing Request resources based on the definition element for each applicable action.</p>\n<p>For each applicable action, the definition is applied as described in the $apply operation of the ActivityDefinition resource, and the resulting resource is added as an entry to the Bundle. The resulting Bundle may be any combination of Request resources, including CarePlan, RequestOrchestration, and individual Request resources such as ServiceRequest and MedicationRequest.</p>\n<p>Note that to preserve the structure of the PlanDefinition, systems may choose to return the results in a RequestOrchestration. In this case, the individual request resources will have an intent of <code>option</code>, meaning the their intent is governed by the RequestOrchestraiont.</p>\n<p>If the ActivityDefinition includes library references, those libraries will be available to the evaluated expressions. If those libraries have parameters, those parameters will be bound by name to the parameters given to the operation. In addition, parameters to the $apply operation are available within dynamicValue expressions as context variables, accessible by the name of the parameter, prefixed with a percent (%) symbol.</p>\n<p>For a more detailed description, refer to the PlanDefinition and ActivityDefinition resource documentation. Note that result of this operation is transient (i.e. none of the resources created by the operation are persisted in the server, they are all returned as entries in the result Bundle(s)). The result effectively represents a proposed set of activities, and it is up to the caller to determine whether and how those activities are actually carried out and/or persisted.</p>\n</div></div>"^^rdf:XMLLiteral ]
  ] ; # 
  fhir:extension ( [
     fhir:url [
       fhir:v "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm"^^xsd:anyURI ;
       fhir:l <http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm>
     ] ;
     fhir:value [
       a fhir:Integer ;
       fhir:v 3
     ]
  ] [
     fhir:url [
       fhir:v "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status"^^xsd:anyURI ;
       fhir:l <http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status>
     ] ;
     fhir:value [
       a fhir:Code ;
       fhir:v "normative"
     ]
  ] [
     fhir:url [
       fhir:v "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg"^^xsd:anyURI ;
       fhir:l <http://hl7.org/fhir/StructureDefinition/structuredefinition-wg>
     ] ;
     fhir:value [
       a fhir:Code ;
       fhir:v "cds"
     ]
  ] ) ; # 
  fhir:url [
     fhir:v "http://hl7.org/fhir/OperationDefinition/PlanDefinition-apply"^^xsd:anyURI ;
     fhir:l <http://hl7.org/fhir/OperationDefinition/PlanDefinition-apply>
  ] ; # 
  fhir:version [ fhir:v "6.0.0-ballot4"] ; # 
  fhir:name [ fhir:v "Apply"] ; # 
  fhir:title [ fhir:v "Apply"] ; # 
  fhir:status [ fhir:v "active"] ; # 
  fhir:kind [ fhir:v "operation"] ; # 
  fhir:experimental [ fhir:v false] ; # 
  fhir:date [ fhir:v "2026-06-25T05:29:09+00:00"^^xsd:dateTime] ; # 
  fhir:publisher [ fhir:v "HL7 International / Clinical Decision Support"] ; # 
  fhir:contact ( [
     fhir:telecom ( [
       fhir:system [ fhir:v "url" ] ;
       fhir:value [ fhir:v "http://hl7.org/fhir" ]
     ] [
       fhir:system [ fhir:v "email" ] ;
       fhir:value [ fhir:v "fhir@lists.hl7.org" ]
     ] )
  ] [
     fhir:telecom ( [
       fhir:system [ fhir:v "url" ] ;
       fhir:value [ fhir:v "http://www.hl7.org/Special/committees/dss" ]
     ] )
  ] ) ; # 
  fhir:description [ fhir:v "The apply operation applies a PlanDefinition to a given subject or group of subjects, instantiating applicable actions and returning the results as bundles of request resources."] ; # 
  fhir:jurisdiction ( [
     fhir:coding ( [
       fhir:system [
         fhir:v "http://unstats.un.org/unsd/methods/m49/m49.htm"^^xsd:anyURI ;
         fhir:l <http://unstats.un.org/unsd/methods/m49/m49.htm>
       ] ;
       fhir:code [ fhir:v "001" ] ;
       fhir:display [ fhir:v "World" ]
     ] )
  ] ) ; # 
  fhir:affectsState [ fhir:v false] ; # 
  fhir:code [ fhir:v "apply"] ; # 
  fhir:comment [ fhir:v "The result of this operation is a Bundle for each subject, where the Bundle contains Request resources that are the direct result of applying the PlanDefinition to that subject. The Bundle will have entries for each of the applicable actions in the PlanDefinition based on evaluating the applicability condition in context, and producing Request resources based on the definition element for each applicable action.\n\nFor each applicable action, the definition is applied as described in the $apply operation of the ActivityDefinition resource, and the resulting resource is added as an entry to the Bundle. The resulting Bundle may be any combination of Request resources, including CarePlan, RequestOrchestration, and individual Request resources such as ServiceRequest and MedicationRequest.\n\nNote that to preserve the structure of the PlanDefinition, systems may choose to return the results in a RequestOrchestration. In this case, the individual request resources will have an intent of `option`, meaning the their intent is governed by the RequestOrchestraiont.\n\nIf the ActivityDefinition includes library references, those libraries will be available to the evaluated expressions. If those libraries have parameters, those parameters will be bound by name to the parameters given to the operation. In addition, parameters to the $apply operation are available within dynamicValue expressions as context variables, accessible by the name of the parameter, prefixed with a percent (%) symbol.\n\nFor a more detailed description, refer to the PlanDefinition and ActivityDefinition resource documentation. Note that result of this operation is transient (i.e. none of the resources created by the operation are persisted in the server, they are all returned as entries in the result Bundle(s)). The result effectively represents a proposed set of activities, and it is up to the caller to determine whether and how those activities are actually carried out and/or persisted."] ; # 
  fhir:resource ( [
     fhir:v "PlanDefinition"^^xsd:anyURI ;
     fhir:l fhir:PlanDefinition
  ] ) ; # 
  fhir:system [ fhir:v false] ; # 
  fhir:type [ fhir:v true] ; # 
  fhir:instance [ fhir:v true] ; # 
  fhir:parameter ( [
     fhir:name [ fhir:v "planDefinition" ] ;
     fhir:use [ fhir:v "in" ] ;
     fhir:scope ( [ fhir:v "type" ] ) ;
     fhir:min [ fhir:v "0"^^xsd:nonNegativeInteger ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "The plan definition to be applied. If the operation is invoked at the instance level, this parameter is not allowed; if the operation is invoked at the type level, this parameter is required, or a url (and optionally version) must be supplied" ] ;
     fhir:type [
       fhir:v "PlanDefinition"^^xsd:anyURI ;
       fhir:l fhir:PlanDefinition
     ]
  ] [
     fhir:name [ fhir:v "url" ] ;
     fhir:use [ fhir:v "in" ] ;
     fhir:scope ( [ fhir:v "type" ] ) ;
     fhir:min [ fhir:v "0"^^xsd:nonNegativeInteger ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "The url of the plan definition to be applied. If the operation is invoked at the instance level, this parameter is not allowed; if the operation is invoked at the type level, this parameter (and optionally the version), or the planDefinition parameter must be supplied" ] ;
     fhir:type [
       fhir:v "canonical"^^xsd:anyURI ;
       fhir:l fhir:canonical
     ] ;
     fhir:targetProfile ( [
       fhir:v "http://hl7.org/fhir/StructureDefinition/PlanDefinition"^^xsd:anyURI ;
       fhir:l <http://hl7.org/fhir/StructureDefinition/PlanDefinition>
     ] )
  ] [
     fhir:name [ fhir:v "version" ] ;
     fhir:use [ fhir:v "in" ] ;
     fhir:scope ( [ fhir:v "type" ] ) ;
     fhir:min [ fhir:v "0"^^xsd:nonNegativeInteger ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "The version of the plan definition to be applied. If the operation is invoked at the instance level, this parameter is not allowed; if the operation is invoked at the type level, this parameter may only be used if the url parameter is supplied." ] ;
     fhir:type [
       fhir:v "string"^^xsd:anyURI ;
       fhir:l fhir:string
     ]
  ] [
     fhir:name [ fhir:v "subject" ] ;
     fhir:use [ fhir:v "in" ] ;
     fhir:min [ fhir:v "1"^^xsd:nonNegativeInteger ] ;
     fhir:max [ fhir:v "*" ] ;
     fhir:documentation [ fhir:v "The subject(s) that is/are the target of the plan to be applied. The subject may be a Patient, Practitioner, Organization, Location, Device, or Group. Subjects provided in this parameter will be resolved as the subject of the PlanDefinition based on the type of the subject. If multiple subjects of the same type are provided, the behavior is implementation-defined" ] ;
     fhir:type [
       fhir:v "string"^^xsd:anyURI ;
       fhir:l fhir:string
     ] ;
     fhir:searchType [ fhir:v "reference" ]
  ] [
     fhir:name [ fhir:v "encounter" ] ;
     fhir:use [ fhir:v "in" ] ;
     fhir:min [ fhir:v "0"^^xsd:nonNegativeInteger ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "The encounter in context, if any" ] ;
     fhir:type [
       fhir:v "string"^^xsd:anyURI ;
       fhir:l fhir:string
     ] ;
     fhir:searchType [ fhir:v "reference" ]
  ] [
     fhir:name [ fhir:v "practitioner" ] ;
     fhir:use [ fhir:v "in" ] ;
     fhir:min [ fhir:v "0"^^xsd:nonNegativeInteger ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "The practitioner applying the plan definition" ] ;
     fhir:type [
       fhir:v "string"^^xsd:anyURI ;
       fhir:l fhir:string
     ] ;
     fhir:searchType [ fhir:v "reference" ]
  ] [
     fhir:name [ fhir:v "organization" ] ;
     fhir:use [ fhir:v "in" ] ;
     fhir:min [ fhir:v "0"^^xsd:nonNegativeInteger ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "The organization applying the plan definition" ] ;
     fhir:type [
       fhir:v "string"^^xsd:anyURI ;
       fhir:l fhir:string
     ] ;
     fhir:searchType [ fhir:v "reference" ]
  ] [
     fhir:name [ fhir:v "userType" ] ;
     fhir:use [ fhir:v "in" ] ;
     fhir:min [ fhir:v "0"^^xsd:nonNegativeInteger ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "The type of user initiating the request, e.g. patient, healthcare provider, or specific type of healthcare provider (physician, nurse, etc.)" ] ;
     fhir:type [
       fhir:v "CodeableConcept"^^xsd:anyURI ;
       fhir:l fhir:CodeableConcept
     ]
  ] [
     fhir:name [ fhir:v "userLanguage" ] ;
     fhir:use [ fhir:v "in" ] ;
     fhir:min [ fhir:v "0"^^xsd:nonNegativeInteger ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "Preferred language of the person using the system" ] ;
     fhir:type [
       fhir:v "CodeableConcept"^^xsd:anyURI ;
       fhir:l fhir:CodeableConcept
     ]
  ] [
     fhir:name [ fhir:v "userTaskContext" ] ;
     fhir:use [ fhir:v "in" ] ;
     fhir:min [ fhir:v "0"^^xsd:nonNegativeInteger ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "The task the system user is performing, e.g. laboratory results review, medication list review, etc. This information can be used to tailor decision support outputs, such as recommended information resources" ] ;
     fhir:type [
       fhir:v "CodeableConcept"^^xsd:anyURI ;
       fhir:l fhir:CodeableConcept
     ]
  ] [
     fhir:name [ fhir:v "setting" ] ;
     fhir:use [ fhir:v "in" ] ;
     fhir:min [ fhir:v "0"^^xsd:nonNegativeInteger ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "The current setting of the request (inpatient, outpatient, etc.)" ] ;
     fhir:type [
       fhir:v "CodeableConcept"^^xsd:anyURI ;
       fhir:l fhir:CodeableConcept
     ]
  ] [
     fhir:name [ fhir:v "settingContext" ] ;
     fhir:use [ fhir:v "in" ] ;
     fhir:min [ fhir:v "0"^^xsd:nonNegativeInteger ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "Additional detail about the setting of the request, if any" ] ;
     fhir:type [
       fhir:v "CodeableConcept"^^xsd:anyURI ;
       fhir:l fhir:CodeableConcept
     ]
  ] [
     fhir:name [ fhir:v "return" ] ;
     fhir:use [ fhir:v "out" ] ;
     fhir:min [ fhir:v "0"^^xsd:nonNegativeInteger ] ;
     fhir:max [ fhir:v "*" ] ;
     fhir:documentation [ fhir:v "A Bundle for each input subject that is the result of applying the plan definition to that subject. Note that even though there is a single parameter named return of type Bundle, it is a multi-cardinality parameter, and so will still be returned using a Parameters resource, as described in the general operations framework (https://hl7.org/fhir/R4/operations.html#response)." ] ;
     fhir:type [
       fhir:v "Bundle"^^xsd:anyURI ;
       fhir:l fhir:Bundle
     ]
  ] ) . # 

# -------------------------------------------------------------------------------------

