Versions Compared

Key

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

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)

Note: identification based on name and identifier attributes may not be unique. 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".

SPARQL 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 {
    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))
}