Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

The query below retrieves substances which have the input <SubstanceInputReference> as a name or identifier (case insensitive) using the generic property patterns.

In the example uses "Amlodipine" as a substance reference, but other references such as the following will also match the correct substance:

  • "3,5-PYRIDINEDICARBOXYLIC ACID, 2-((2-AMINOETHOXY)METHYL)-4-(2-CHLOROPHENYL)-1,4-DIHYDRO-6-METHYL-, 3-ETHYL 5-METHYL ESTER, (+/-)-"
  • "HGP-0904"
  • "88150-42-9" (a CAS number)
  • “SUB05467MIG” (EV code)

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., in GSRS the ATC codes are listed under identifiers but the code "C09XA53" is classifying Amlodipine and also Aliskiren.

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


  • No labels