DavidStables (talk | contribs) No edit summary |
DavidStables (talk | contribs) No edit summary |
||
Line 10: | Line 10: | ||
* << subsumption qualifier used to indicate descendants or Self of against an identifier <<sct:29857009 means the snomed concept identifier of 29857009 and any of its subtypes. | * << subsumption qualifier used to indicate descendants or Self of against an identifier <<sct:29857009 means the snomed concept identifier of 29857009 and any of its subtypes. | ||
* '<' used to indicate 'descendants of but not including self' against an identifier <sct:29857009 would mean its subtypes but not itself | * '<' used to indicate 'descendants of but not including self' against an identifier <sct:29857009 would mean its subtypes but not itself | ||
* '>>' used to indicate 'Ancestors of including self; against an identifier >>sct: 29857009 would mean all concepts that are ancestors of chest pain | * '>>' used to indicate 'Ancestors of including self; against an identifier >>sct:29857009 would mean all concepts that are ancestors of chest pain | ||
* '|' '|' used as a short cut to indicate the name of a concept or entity sct:29857009|Chest pain | | * '|' '|' used as a short cut to indicate the name of a concept or entity sct:29857009|Chest pain | | ||
=== Identifiers === | |||
Query definitions include reference to a data model types, properties, concepts or sets. Identifiers are represented as RDF IRIs in both the full or prefixed form. For example: | |||
http://snomed.info/sct# and sct: 29857009 may be equivalent where the query contains a prefix list | |||
===Boolean operators=== | ===Boolean operators=== |
Revision as of 16:34, 11 March 2023
These pages describe the IM Query grammar conventions and meanding. The formal IMQ Grammar can be accessed in ABNF form at https://github.com/endeavourhealth-discovery/IMDirectory/blob/develop/im_library/src/antlr4/grammars/ECL.g4
Symbol conventions
A small set of symbols are used to represent meaningful language tokens. These are:
- '{' and '}' Used for clauses to differentiate the content from other similar clauses, as well as to indicate graph traversal. It is used in the same way as { } is used in Json to represent and object
- ',' comma used to indicate a list entry number 2 or more. the language does not require brackets to show a list
- '@' used as an identifier qualifier to indicate a type. @im:Concept indicates that this refers to instances of type im:concept
- '^' used as an identifier qualifier to indicate a set. ^xx/;RegisteredPatients means the set of registered patients, used mostly in referencing base populations or value /reference sets
- << subsumption qualifier used to indicate descendants or Self of against an identifier <<sct:29857009 means the snomed concept identifier of 29857009 and any of its subtypes.
- '<' used to indicate 'descendants of but not including self' against an identifier <sct:29857009 would mean its subtypes but not itself
- '>>' used to indicate 'Ancestors of including self; against an identifier >>sct:29857009 would mean all concepts that are ancestors of chest pain
- '|' '|' used as a short cut to indicate the name of a concept or entity sct:29857009|Chest pain |
Identifiers
Query definitions include reference to a data model types, properties, concepts or sets. Identifiers are represented as RDF IRIs in both the full or prefixed form. For example:
http://snomed.info/sct# and sct: 29857009 may be equivalent where the query contains a prefix list
Boolean operators
The boolean operators 'and' , 'or' and 'not' can operate in either the from or where clause, using the "bool" predicate. 'and' is the same as an intersection (all must be true), or is a union (at least one true) and 'not' is a union (Any may be true). Further nesting can resolve boolean combinations (e.g. not/and)
Example boolean operators. Select Expand to show:
{"where" : {
"bool" : "and",
"where" : [ { "id" : "age",
"operator" : ">=",
"value" : 18,
"unit" : "year"},
{"id" : "statedGender",
"in" : [ {"@id" : "im:905031000252103",
"name" : "Male (stated gender)" } ] } ] }