If the LOINC Ontology has been loaded in a relational database using a model that complies with the RF2 specification for tables and column names, the content can be accessed using SQL queries in line with the examples below. To Set up SNOMED CT in a relational database, please follow the guidance and instructions provided in the SQL Practical Guide.
Get all members of the reference set
The reference set used in this example is:
635111010000100 |Logical Observation Identifiers Names and Codes Orderable Reference Set (foundation metadata concept)|
for example
Returns the ids of all the concepts or descriptions that are the members of the reference set.
Test if a concept is a member of the reference set
The concept used in this example is: 141951010000102 |Mass concentration of neopterin in urine at point in time (observable entity)|
for example
Returns:
0 : if the candidate component is not in the reference set.
1 : If the candidate component is a member of the reference set
Some types or reference set can include the same component more than once, so any value greater than zero indicate the component is a member of the references set.
SELECT referencedComponentId FROM snap_refset_simple WHERE active=1 AND refsetId=[refsetId];SELECT referencedComponentId FROM snap_refset_simple WHERE active=1 AND refsetId=635111010000100;SELECT count(referencedComponentId) FROM snap_refset_simple WHERE active=1 AND refsetId=[refsetId] AND referencedComponentId=[candidateComponentId];SELECT count(referencedComponentId) FROM snap_refset_simple WHERE active=1 AND refsetId=635111010000100 AND referencedComponentId=141951010000102;