Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update wikidata data import #360

Merged
merged 3 commits into from
Jul 27, 2023
Merged

feat: update wikidata data import #360

merged 3 commits into from
Jul 27, 2023

Conversation

jsstevenson
Copy link
Member

@jsstevenson jsstevenson commented Jul 26, 2023

  • add GtoP xref
  • capture antibiotic terms
  • small performance improvement to query (aggregate aliases instead of making new rows for each one)
  • update test data

This is the updated query:

SELECT
  ?item ?itemLabel ?casRegistry ?pubchemCompound ?pubchemSubstance ?chembl ?rxnorm
  ?drugbank ?guideToPharmacology
  (GROUP_CONCAT(DISTINCT ?alias; separator=", ") AS ?aliases)
WHERE {
  { ?item (wdt:P31/(wdt:P279*)) wd:Q12140. }
  UNION
  { ?item (wdt:P366/(wdt:P279*)) wd:Q12140. }
  UNION
  { ?item (wdt:P31/(wdt:P279*)) wd:Q35456. }
  UNION
  { ?item wdt:P2868 wd:Q12187. }
  OPTIONAL {
    ?item skos:altLabel ?alias.
    FILTER((LANG(?alias)) = "en")
  }
  OPTIONAL {
    ?item p:P231 ?wds1.
    ?wds1 ps:P231 ?casRegistry.
  }
  OPTIONAL {
    ?item p:P662 ?wds2.
    ?wds2 ps:P662 ?pubchemCompound.
  }
  OPTIONAL {
    ?item p:P2153 ?wds3.
    ?wds3 ps:P2153 ?pubchemSubstance.
  }
  OPTIONAL {
    ?item p:P592 ?wds4.
    ?wds4 ps:P592 ?chembl.
  }
  OPTIONAL {
    ?item p:P3345 ?wds5.
    ?wds5 ps:P3345 ?rxnorm.
  }
  OPTIONAL {
    ?item p:P715 ?wds6.
    ?wds6 ps:P715 ?drugbank.
  }
    OPTIONAL {
        ?item p:P595 ?wds7.
        ?wds7 ps:P595 ?guideToPharmacology
    }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?item ?itemLabel ?casRegistry ?pubchemCompound ?pubchemSubstance ?chembl
  ?rxnorm ?drugbank ?guideToPharmacology

@jsstevenson jsstevenson added the priority:low Low priority label Jul 27, 2023
@jsstevenson jsstevenson marked this pull request as ready for review July 27, 2023 12:16
@jsstevenson jsstevenson merged commit c539748 into main Jul 27, 2023
12 checks passed
@jsstevenson jsstevenson deleted the wd-update branch July 27, 2023 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:low Low priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants