Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note: identification based on name and identifier attributes may not be unique in datasets. In some cases, it is sufficient to add the context of the name or identifier but in some cases the referencing identifiers are not unique even within one reference set. E.g., Amlodipine and Amlodipine are both identified with ChEBI number "2669".

Query

prefix idmp-sub:    <https://spec.pistoiaalliance.org/idmp/ontology/ISO/ISO11238-Substances/>
prefix cmns-dsg:      <https://www.omg.org/spec/Commons/Designators/>
prefix cmns-txt:       <https://www.omg.org/spec/Commons/TextDatatype/>
prefix cmns-id:        <https://www.omg.org/spec/Commons/Identifiers/>
prefix rdf:         <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs:        <http://www.w3.org/2000/01/rdf-schema#>
prefix skos:        <http://www.w3.org/2004/02/skos/core#>

SELECT DISTINCT ?Substance
FROM <https://spec.pistoiaalliance.org/idmp/ontology>
FROM <https://data.pistoiaalliance.org/idmp/gsrs>
WHERE {
    # use any name or ID to find a substance. E.g., "Amlodipine" or "SUB05467MIG"
    BIND("Amlodipine" AS ?SubstanceInputReference )
    
    ?Substance rdf:type/rdfs:subClassOf* idmp-sub:Substance .

    OPTIONAL {
      ?SimpleLabelProperty rdfs:subPropertyOf* rdfs:label .
      ?Substance ?SimpleLabelProperty ?SubstanceLabel .
      FILTER(lcase(str(?SubstanceLabel)) = lcase(?SubstanceInputReference))
    }
    OPTIONAL {
      ?Substance cmns-dsg:hasName/cmns-txt:hasTextValue ?SubstanceName .
      FILTER(lcase(str(?SubstanceName)) = lcase(str(?SubstanceInputReference)))
    }
    OPTIONAL {
      ?Substance cmns-id:isIdentifiedBy/cmns-txt:hasTextValue ?SubstanceIdentifier .
      FILTER(lcase(str(?SubstanceIdentifier)) = lcase(str(?SubstanceInputReference)))
    }
    FILTER(bound(?SubstanceLabel) || bound(?SubstanceName) || bound(?SubstanceIdentifier))
}

Model Pattern for Identifiers

Image Removedin GSRS the ATC codes are listed under identifiers but the code "C09XA53" is classifying Amlodipine and also Aliskiren.

Model Pattern for Identifiers

Image Added


Test data

Amlodipine Example: https://github.com/edmcouncil/idmp/blob/master/EXT/Examples/AmlodipineExample.rdf

Query

https://github.com/edmcouncil/idmp/blob/master/etc/CQ/Example/cq0.sparql

Expected Query Result for Example Data