Sets and classes

From Discovery Data Service
Revision as of 07:57, 7 July 2021 by DavidStables (talk | contribs) (DavidStables moved page Value sets to Sets and classes)
Jump to navigation Jump to search
Value set package

A value set definition, and it's run time counterpart- value set transitive closure  , is a set of class expressions collected together for a particular business purpose.

There are a range of purposes for a value set. Examples range from defining a data set according to a set of recorded concepts, indicating the expected range of a property in a health record, or testing the presence of a feature in a patient record. 

Value sets are one of the main 5 packages within the common information model.


Value set class and language

Value set class

A value set class is best conceptualised in UML terms as a package whose elements are class expressions.

All value sets and the class expressions use concepts from the semantic ontology and the following shows the relationship between the two.

The main difference between a value set expression and its syntactically equivalent class definition in the ontology is the way the value set is used. Within an ontology the class expression is normally used as part of an axiom for use in reasoning. Within a query a value set is used to test the value of a concept in a record. Within a data model, a value set is used as a range of allowable or preferred values for a particular property where the values do not belong to one class.



A value set class definition looks very much like a semantic ontology class expression,  in that it uses similar grammar and syntax. In fact a value set can also be defined in OWL2 language.

In this example a non hospital face to face consultation value set is defined as

"is a type of GP consultation value set, and has members which are (on premise encounters, excluding hospital outpatients)

Discovery syntax

Firstly the value set is semantically defined in the semantic ontology
{ "Class":{
  "iri": ":VSET_NonHospFaceToFace",
  "name": ":face to face consultations excluding hospital outpatients",
  "SubClassOf": {"Class":":VSET_GPConsultations"}}                             // The value set is a subclass of a set of value sets about GP consultations

Then the value set is defined in the value set class
{"ValueSet":{
  "iri": "VSET_NonHospFaceToFace",
  "Member":[{                                               
     "Intersection": [                                          // AND                                       
         {"Class": ":CM_OnPremiseEncounter"},
         {"Negation": { "Class": ":DM_HospitalOpdEntry"}}]}}]}]}}       // BUT NOT...


OWL2 functional syntax

SubClassOf(:VSET_EncFaceToFaceOnPrem
   ObjectIntersectionOf(:VSET_GPConsultations 
          ObjectSomeValuesFrom(:CM_hasMember 
              ObjectIntersectionOf(:CM_OnPremiseEncounter :ObjectComplementOf(:DM_HospOpdEntry))))


Expression constraint language

^ :VSET_EncFactToFaceOnPrem             // this is the query instruction to find concepts defined by the value set

<< :CM_OnPremiseEncounter MINUS :DH_HospOpdEntry     //This is the definition of the value set


Value set definition vs ontology axiom

As discussed above, the main difference between an ontological axiom and a value set definition is their purpose and the way they are used.

Members of a value set set may or may not shared similar properties and therefore may be semantically diverse.  Nevertheless each member of a value set is a class expression with semantic meaning. Each member is used to define a set of concepts so that a subsumption test can be applied to the care record concept instances.

To put this another way, a value set has members, and each member of the value set is a set of members subsumed by that member!

From the above, it can be seen that value set definition expressions may use complex class expressions. In some cases this expression may already be part of a class definition. For example, a pre-coordinated named class "Home visit" would be a subclass of a Consultation with the care setting of home. Whether expressions in value sets are complex and simple depend entirely on convenience. However, value set editorial policy would encourage value set authors to use pre-defined classes as the ontology is the best place for these to be maintained.

The other main difference is in the logic applied at the point of query, or more accurately the difference between reasoning and query. When using the value set at run time to undertake subsumption testing of other concepts,  a value set query uses a closed world assumption  when handling negation, both in respect of the ontology sub-classes and the care record instances. In a pure OWL2 ontology reasoner, which uses the open world assumption, an expression that uses exclusion will often return no subsumed concept. This is because in the open world, it may be undecidable whether a particular concepts should be excluded or not, unless the ontology author had specifically made sure that the concept was disjoint or negated by some other logic.

Value set expressions are often referred to as expression constraints. In Snomed-CT expression constraint language is essentially the same grammar as the Discovery value set class expression as shown above with ECL being a more succinct representation, but Discovery having broader logic. 

Value set transitive closure

For those operating large scale queries using relational databases, it could be normal practice to use a value set transitive closure table, or list.

The value set generator API supports the means by which a value set definition can return a set of all known concepts in the ontology that are  subsumed by the definition, applying the transitive properties to generate the closure list.