@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/tools/OperationDefinition/ValueSet-compare> a fhir:OperationDefinition ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:id [ fhir:v "ValueSet-compare"] ; # 
  fhir:language [ fhir:v "es"] ; # 
  fhir:text [
     fhir:status [ fhir:v "generated" ] ;
     fhir:div [ fhir:v "<div xml:lang=\"es\" lang=\"es\"><hr/><p><b>Spanish</b></p><hr/><p class=\"res-header-id\"><b>Generated Narrative: OperationDefinition ValueSet-compare</b></p><a name=\"es-ValueSet-compare\"> </a><a name=\"es-hcValueSet-compare\"> </a><p>URL: [base]/ValueSet/$compare</p><p>URL: [base]/ValueSet/[id]/$compare</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>thisUrl</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R5/datatypes.html#uri\">uri</a></td><td/><td><div><p>The canonical URL of the first value set ('this'), which the server resolves. Used at the type level as an alternative to thisValueSet. Not used at the instance level, where the value set in the request URL is 'this'.</p>\n</div></td></tr><tr><td>IN</td><td>thisValueSet</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R5/valueset.html\">ValueSet</a></td><td/><td><div><p>The first value set ('this'), supplied inline. Used at the type level as an alternative to thisUrl. Not used at the instance level.</p>\n</div></td></tr><tr><td>IN</td><td>otherUrl</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R5/datatypes.html#uri\">uri</a></td><td/><td><div><p>The canonical URL of the second value set ('other'), which the server resolves. An alternative to otherValueSet.</p>\n</div></td></tr><tr><td>IN</td><td>otherValueSet</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R5/valueset.html\">ValueSet</a></td><td/><td><div><p>The second value set ('other'), supplied inline. An alternative to otherUrl.</p>\n</div></td></tr><tr><td>IN</td><td>valueSetVersion</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R5/datatypes.html#string\">string</a></td><td/><td><div><p>The business version to use when resolving a value set supplied by URL.</p>\n</div></td></tr><tr><td>IN</td><td>tx-resource</td><td/><td>0..*</td><td><a href=\"http://hl7.org/fhir/R5/resource.html\">Resource</a></td><td/><td><div><p>Additional code systems and value sets the server may need in order to perform the comparison — for example, code systems referenced by the value sets but not otherwise known to the server. These may also be supplied via the terminology cache; see the $cache-control operation.</p>\n</div></td></tr><tr><td>IN</td><td>version-policy</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R5/datatypes.html#code\">code</a></td><td/><td><div><p>Controls whether code system versions are significant when comparing membership:</p>\n<ul>\n<li><code>always</code> — versions always matter: a code counts as the same member in both value sets only if its code system version matches on both sides;</li>\n<li><code>as-needed</code> — (the default) versions matter only where they need to: when either code system declares versionNeeded = true, or where a filter is involved (a filter such as is-a can select different codes in different versions, so the version always matters there);</li>\n<li><code>never</code> — versions never matter: codes are compared by system and code alone, ignoring version. The caller takes responsibility for this, including where filters are present.</li>\n</ul>\n<p>If omitted, <code>as-needed</code> applies.</p>\n</div></td></tr><tr><td>IN</td><td>diagnostics</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R5/datatypes.html#boolean\">boolean</a></td><td/><td><div><p>If true, the server includes the diagnostic output parameters (performed-expansion, common-codes, missing-codes, extra-codes) where it can. Diagnostics are best-effort and may be omitted.</p>\n</div></td></tr><tr><td>OUT</td><td>result</td><td/><td>1..1</td><td><a href=\"http://hl7.org/fhir/R5/datatypes.html#code\">code</a></td><td/><td><div><p>The relationship between the first value set ('this') and the second ('other'), stated from the perspective of 'this':</p>\n<ul>\n<li><code>same</code> — both value sets contain the same codes;</li>\n<li><code>subset</code> — every code in 'this' is in 'other', and 'other' has more;</li>\n<li><code>superset</code> — every code in 'other' is in 'this', and 'this' has more;</li>\n<li><code>overlapping</code> — each value set contains codes the other does not, but they share some codes;</li>\n<li><code>disjoint</code> — the value sets share no codes;</li>\n<li><code>empty</code> — both value sets are empty;</li>\n<li><code>indeterminate</code> — the server cannot determine the relationship (e.g. a value set has no compose, an expansion is unclosed or infinite, an expansion failed, or the definitions are too complex to compare). The <code>message</code> parameter explains why.</li>\n</ul>\n</div></td></tr><tr><td>OUT</td><td>message</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R5/datatypes.html#string\">string</a></td><td/><td><div><p>A human-readable explanation of the result, suitable for display. Always present for <code>indeterminate</code> and <code>empty</code>, where it gives the reason.</p>\n</div></td></tr><tr><td>OUT</td><td>performed-expansion</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R5/datatypes.html#boolean\">boolean</a></td><td/><td><div><p>Present when diagnostics were requested: true if the server expanded the value sets to determine the result, false if it decided from the definitions alone.</p>\n</div></td></tr><tr><td>OUT</td><td>common-codes</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R5/datatypes.html#string\">string</a></td><td/><td><div><p>Present when diagnostics were requested and the value sets are not identical: a comma-separated list of codes present in both value sets.</p>\n</div></td></tr><tr><td>OUT</td><td>missing-codes</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R5/datatypes.html#string\">string</a></td><td/><td><div><p>Present when diagnostics were requested: a comma-separated list of codes present in the first value set ('this') but not the second ('other').</p>\n</div></td></tr><tr><td>OUT</td><td>extra-codes</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R5/datatypes.html#string\">string</a></td><td/><td><div><p>Present when diagnostics were requested: a comma-separated list of codes present in the second value set ('other') but not the first ('this').</p>\n</div></td></tr></table></div>"^^rdf:XMLLiteral ]
  ] ; # 
  fhir:extension ( [
     fhir:url [ fhir:v "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm"^^xsd:anyURI ] ;
     fhir:value [
       a fhir:integer ;
       fhir:v 1
     ]
  ] [
     fhir:url [ fhir:v "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg"^^xsd:anyURI ] ;
     fhir:value [
       a fhir:code ;
       fhir:v "fhir"
     ]
  ] [
     fhir:url [ fhir:v "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status"^^xsd:anyURI ] ;
     fhir:value [
       a fhir:code ;
       fhir:v "informative" ;
       fhir:extension ( [
         fhir:url [ fhir:v "http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom"^^xsd:anyURI ] ;
         fhir:value [
           a fhir:canonical ;
           fhir:v "http://hl7.org/fhir/tools/ImplementationGuide/hl7.fhir.uv.tools"^^xsd:anyURI ;
           fhir:link <http://hl7.org/fhir/tools/ImplementationGuide/hl7.fhir.uv.tools>
         ]
       ] )
     ]
  ] ) ; # 
  fhir:url [ fhir:v "http://hl7.org/fhir/tools/OperationDefinition/ValueSet-compare"^^xsd:anyURI] ; # 
  fhir:identifier ( [
     fhir:system [ fhir:v "urn:ietf:rfc:3986"^^xsd:anyURI ] ;
     fhir:value [ fhir:v "urn:oid:2.16.840.1.113883.4.642.40.1.33.2" ]
  ] ) ; # 
  fhir:version [ fhir:v "1.1.2"] ; # 
  fhir:name [ fhir:v "ValueSetCompare"] ; # 
  fhir:title [ fhir:v "ValueSet Comparison"] ; # 
  fhir:status [ fhir:v "active"] ; # 
  fhir:kind [ fhir:v "operation"] ; # 
  fhir:experimental [ fhir:v false] ; # 
  fhir:date [ fhir:v "2026-06-19T17:30:50+00:00"^^xsd:dateTime] ; # 
  fhir:publisher [ fhir:v "HL7 International / FHIR Infrastructure"] ; # 
  fhir:contact ( [
     fhir:telecom ( [
       fhir:system [ fhir:v "url" ] ;
       fhir:value [ fhir:v "http://www.hl7.org/Special/committees/fiwg" ]
     ] )
  ] ) ; # 
  fhir:description [ fhir:v "Determine the set relationship between the memberships of two value sets: whether they contain the same codes, whether one is a subset or superset of the other, whether they overlap, or whether they are disjoint. The comparison is over what the value sets *mean* (the set of codes each includes), not over the structure of the ValueSet resources.\n\nThe two value sets are referred to as 'this' and 'other'. At the type level (`POST /ValueSet/$compare`), supply each one as either an inline resource (`thisValueSet` / `otherValueSet`) or as a canonical URL the server resolves (`thisUrl` / `otherUrl`). At the instance level (`POST /ValueSet/[id]/$compare`), the value set addressed in the URL is 'this', and only 'other' need be supplied.\n\nThe server decides from the value set definitions (the `compose`) wherever it can — this is cheap and exact, and is version-aware. Where the definitions are too complex to compare directly, it expands both value sets and compares the resulting code lists. Either way the answer is reported in the `result` output parameter. When the relationship cannot be established — for example a value set has no `compose`, an expansion is unclosed or infinite, an expansion fails, or the definitions combine in ways the server cannot soundly reason about — the result is `indeterminate` rather than a guess.\n\nIf the `diagnostics` parameter is true, the server additionally reports the codes that differ (`common-codes`, `missing-codes`, `extra-codes`) and whether it had to expand the value sets to reach its conclusion (`performed-expansion`). This operation does not change server state."] ; # 
  fhir:jurisdiction ( [
     fhir:coding ( [
       fhir:system [ fhir:v "http://unstats.un.org/unsd/methods/m49/m49.htm"^^xsd:anyURI ] ;
       fhir:code [ fhir:v "001" ]
     ] )
  ] ) ; # 
  fhir:affectsState [ fhir:v false] ; # 
  fhir:code [ fhir:v "compare"] ; # 
  fhir:resource ( [ fhir:v "ValueSet"] ) ; # 
  fhir:system [ fhir:v false] ; # 
  fhir:type [ fhir:v true] ; # 
  fhir:instance [ fhir:v true] ; # 
  fhir:parameter ( [
     fhir:name [ fhir:v "thisUrl" ] ;
     fhir:use [ fhir:v "in" ] ;
     fhir:min [ fhir:v 0 ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "The canonical URL of the first value set ('this'), which the server resolves. Used at the type level as an alternative to thisValueSet. Not used at the instance level, where the value set in the request URL is 'this'." ] ;
     fhir:type [ fhir:v "uri" ]
  ] [
     fhir:name [ fhir:v "thisValueSet" ] ;
     fhir:use [ fhir:v "in" ] ;
     fhir:min [ fhir:v 0 ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "The first value set ('this'), supplied inline. Used at the type level as an alternative to thisUrl. Not used at the instance level." ] ;
     fhir:type [ fhir:v "ValueSet" ]
  ] [
     fhir:name [ fhir:v "otherUrl" ] ;
     fhir:use [ fhir:v "in" ] ;
     fhir:min [ fhir:v 0 ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "The canonical URL of the second value set ('other'), which the server resolves. An alternative to otherValueSet." ] ;
     fhir:type [ fhir:v "uri" ]
  ] [
     fhir:name [ fhir:v "otherValueSet" ] ;
     fhir:use [ fhir:v "in" ] ;
     fhir:min [ fhir:v 0 ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "The second value set ('other'), supplied inline. An alternative to otherUrl." ] ;
     fhir:type [ fhir:v "ValueSet" ]
  ] [
     fhir:name [ fhir:v "valueSetVersion" ] ;
     fhir:use [ fhir:v "in" ] ;
     fhir:min [ fhir:v 0 ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "The business version to use when resolving a value set supplied by URL." ] ;
     fhir:type [ fhir:v "string" ]
  ] [
     fhir:name [ fhir:v "tx-resource" ] ;
     fhir:use [ fhir:v "in" ] ;
     fhir:min [ fhir:v 0 ] ;
     fhir:max [ fhir:v "*" ] ;
     fhir:documentation [ fhir:v "Additional code systems and value sets the server may need in order to perform the comparison — for example, code systems referenced by the value sets but not otherwise known to the server. These may also be supplied via the terminology cache; see the $cache-control operation." ] ;
     fhir:type [ fhir:v "Resource" ]
  ] [
     fhir:name [ fhir:v "version-policy" ] ;
     fhir:use [ fhir:v "in" ] ;
     fhir:min [ fhir:v 0 ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "Controls whether code system versions are significant when comparing membership:\n* `always` — versions always matter: a code counts as the same member in both value sets only if its code system version matches on both sides;\n* `as-needed` — (the default) versions matter only where they need to: when either code system declares versionNeeded = true, or where a filter is involved (a filter such as is-a can select different codes in different versions, so the version always matters there);\n* `never` — versions never matter: codes are compared by system and code alone, ignoring version. The caller takes responsibility for this, including where filters are present.\n\nIf omitted, `as-needed` applies." ] ;
     fhir:type [ fhir:v "code" ]
  ] [
     fhir:name [ fhir:v "diagnostics" ] ;
     fhir:use [ fhir:v "in" ] ;
     fhir:min [ fhir:v 0 ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "If true, the server includes the diagnostic output parameters (performed-expansion, common-codes, missing-codes, extra-codes) where it can. Diagnostics are best-effort and may be omitted." ] ;
     fhir:type [ fhir:v "boolean" ]
  ] [
     fhir:name [ fhir:v "result" ] ;
     fhir:use [ fhir:v "out" ] ;
     fhir:min [ fhir:v 1 ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "The relationship between the first value set ('this') and the second ('other'), stated from the perspective of 'this':\n* `same` — both value sets contain the same codes;\n* `subset` — every code in 'this' is in 'other', and 'other' has more;\n* `superset` — every code in 'other' is in 'this', and 'this' has more;\n* `overlapping` — each value set contains codes the other does not, but they share some codes;\n* `disjoint` — the value sets share no codes;\n* `empty` — both value sets are empty;\n* `indeterminate` — the server cannot determine the relationship (e.g. a value set has no compose, an expansion is unclosed or infinite, an expansion failed, or the definitions are too complex to compare). The `message` parameter explains why." ] ;
     fhir:type [ fhir:v "code" ]
  ] [
     fhir:name [ fhir:v "message" ] ;
     fhir:use [ fhir:v "out" ] ;
     fhir:min [ fhir:v 0 ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "A human-readable explanation of the result, suitable for display. Always present for `indeterminate` and `empty`, where it gives the reason." ] ;
     fhir:type [ fhir:v "string" ]
  ] [
     fhir:name [ fhir:v "performed-expansion" ] ;
     fhir:use [ fhir:v "out" ] ;
     fhir:min [ fhir:v 0 ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "Present when diagnostics were requested: true if the server expanded the value sets to determine the result, false if it decided from the definitions alone." ] ;
     fhir:type [ fhir:v "boolean" ]
  ] [
     fhir:name [ fhir:v "common-codes" ] ;
     fhir:use [ fhir:v "out" ] ;
     fhir:min [ fhir:v 0 ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "Present when diagnostics were requested and the value sets are not identical: a comma-separated list of codes present in both value sets." ] ;
     fhir:type [ fhir:v "string" ]
  ] [
     fhir:name [ fhir:v "missing-codes" ] ;
     fhir:use [ fhir:v "out" ] ;
     fhir:min [ fhir:v 0 ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "Present when diagnostics were requested: a comma-separated list of codes present in the first value set ('this') but not the second ('other')." ] ;
     fhir:type [ fhir:v "string" ]
  ] [
     fhir:name [ fhir:v "extra-codes" ] ;
     fhir:use [ fhir:v "out" ] ;
     fhir:min [ fhir:v 0 ] ;
     fhir:max [ fhir:v "1" ] ;
     fhir:documentation [ fhir:v "Present when diagnostics were requested: a comma-separated list of codes present in the second value set ('other') but not the first ('this')." ] ;
     fhir:type [ fhir:v "string" ]
  ] ) . # 

# -------------------------------------------------------------------------------------

