Skip to content

Instantly share code, notes, and snippets.

View egonw's full-sized avatar
💭
I don't want a status.

Egon Willighagen egonw

💭
I don't want a status.
View GitHub Profile
@egonw
egonw / citoPubs.rq
Created April 8, 2024 05:13
CiTO nanopublications
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix np: <http://www.nanopub.org/nschema#>
prefix npa: <http://purl.org/nanopub/admin/>
prefix npx: <http://purl.org/nanopub/x/>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix dct: <http://purl.org/dc/terms/>
select ?np ?label ?subj ?citationrel ?obj ?date where {
graph npa:graph {
?np npa:hasValidSignatureForPublicKey ?pubkey .
@egonw
egonw / inosc.rq
Created March 21, 2024 07:25
INOSC - International Network of Open Science & Scholarship Communities
#defaultView:Map
SELECT ?osc ?oscLabel ?location WHERE {
?osc wdt:P1344 wd:Q104785223 .
{
?osc wdt:P625 ?location .
} UNION {
?osc wdt:P159 / wdt:P625 ?location .
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
@egonw
egonw / foo.groovy
Created March 17, 2024 13:47
Script to convert https://nanocommons.github.io/specifications/nanomile/ content (somewhat cleaned up) to ERM Identifier DB content
new File("/tmp/foo.tsv").eachLine { line ->
fields = line.split('\t')
nanomileid = fields[0]
ermid = fields[1]
ermidShort = ermid.split(':')[1]
content = """---
title: "Material: ${ermidShort}"
type: ChemicalSubstance
id: ${ermidShort}
tag: ${ermid}
@egonw
egonw / createBridgeDbMappings.groovy
Created March 13, 2024 20:35
Code for the new WikiPathways website to convert datanodes.tsv into WikiPathways RDF triples
@Grab(group='org.bridgedb', module='org.bridgedb.bio', version='3.1.1')
import java.util.ArrayList
import java.util.List
import java.util.Map
import java.util.HashMap
import java.nio.file.Path
import java.nio.file.Files
@egonw
egonw / falseStatements.rq
Created December 29, 2023 18:14
Wikidata statements with a retracted article as reference
SELECT DISTINCT ?entity ?entityLabel ?propertyLabel ?valueLabel ?retracted ?retractedLabel WITH {
SELECT DISTINCT ?entity ?p ?statement ?retracted WHERE {
?retracted wdt:P31 wd:Q45182324 .
?entity ?p ?statement .
?statement prov:wasDerivedFrom / pr:P248 ?retracted .
}
} AS %STATEMENTS WHERE {
INCLUDE %STATEMENTS
?p ^wikibase:claim ?property .
?statement ?ps ?value .
@egonw
egonw / output.txt
Created September 30, 2023 11:39
Pathways without tags
Pathways without any tag: 74. Details:
http://classic.wikipathways.org/instance/WP3104_r118203 'Mevalonate pathway (Arabidopsis thaliana)'
http://classic.wikipathways.org/instance/WP3029_r118242 'Vitamin E biosynthesis (Arabidopsis thaliana)'
http://classic.wikipathways.org/instance/WP3113_r118262 'Gibberellin biosynthesis III (early C-13 hydroxylation) (Arabidopsis thaliana)'
http://classic.wikipathways.org/instance/WP3024_r116502 'Formation of ternary complex, then 43S complex (Oryza sativa)'
http://classic.wikipathways.org/instance/WP3066_r118243 'Glutamine biosynthesis I (Arabidopsis thaliana)'
http://classic.wikipathways.org/instance/WP3083_r118610 'Gamma-glutamyl cycle (Zea mays)'
http://classic.wikipathways.org/instance/WP3003_r118295 'Cap-dependent translation initiation (Oryza sativa)'
http://classic.wikipathways.org/instance/WP3087_r118265 'GDP-L-fucose biosynthesis I from GDP-D-mannose (Arabidopsis thaliana)'
http://classic.wikipathways.org/instance/WP3035_r118280 'IAA biosynthesis VI via i
@egonw
egonw / listReferences.rq
Created August 26, 2023 12:34
List all references for an item
PREFIX target: <http://www.wikidata.org/entity/Q76>
SELECT DISTINCT ?source ?sourceLabel WHERE {
VALUES ?refType { pr:P248 pr:P854 }
target: ?propp ?statement .
?statement prov:wasDerivedFrom ?reference .
?reference ?refType ?source .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
@egonw
egonw / query.rq
Created August 10, 2023 06:47
This is the query behind https://w.wiki/5bpq
SELECT DISTINCT ?np ?chembl WHERE {
?np wdt:P703 [] ; wdt:P592 ?chembl .
}
@egonw
egonw / README.md
Last active April 2, 2023 06:40
2023 stuff for CiTO annotations, related to https://scholia.toolforge.org/work/Q117357537

2023 stuff for CiTO annotations

Some files related to some data curation I did yesterday to add some 200~ish CiTO annotations to Wikidata. The data is CCZero, from https://doi.org/10.5281/zenodo.6885109

There are two files here:

  • cits_cleaned.csv derived from the cits.csv from the Zenodo data
  • quickstatements.groovy that takes cits_cleaned.csv as input and creates QuickStatements
{
"@context": "https://schema.org/",
"@type": "CreativeWork",
"name": "PC_DUSTINESS Template",
"description": "The Dustiness with small drum data entry template is published at 10.2787/505397 under CC BY-SA 4.0 license.",
"license": "https://creativecommons.org/licenses/by-sa/4.0/",
"keywords": "dustiness, NM-110, NM-200",
"url": "https://search.data.enanomapper.net/projects/enanomapper/datatemplates/pchem/index.html?template=PC_DUSTINESS",
"archivedAt": "http://dx.doi.org/10.2787/505397",
"provider": {