Skip to content

Instantly share code, notes, and snippets.

@egonw
Created February 12, 2023 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save egonw/9852f49a179e9aeb24e4cbf1be3a6ca8 to your computer and use it in GitHub Desktop.
Save egonw/9852f49a179e9aeb24e4cbf1be3a6ca8 to your computer and use it in GitHub Desktop.
note to self #Scholia #chemistry
# tool: scholia
#defaultView:Graph
PREFIX target: <http://www.wikidata.org/entity/Q211171>
SELECT ?class ?classLabel ?otherclass ?otherclassLabel ?rgb WITH {
SELECT DISTINCT ?class ?otherclass ?rgb WHERE {
{ VALUES ?class_ { target: }
{ ?otherclass_ wdt:P279 ?class_ . BIND( "3182BD" AS ?rgb) BIND(?class_ AS ?class) BIND(?otherclass_ AS ?otherclass) }
UNION
{ ?otherclass_ wdt:P31 ?class_ . BIND( "E6550D" AS ?rgb) BIND(?class_ AS ?class) BIND(?otherclass_ AS ?otherclass) }
UNION
{ ?otherclass_ wdt:P279 ?otherclass2 . ?otherclass2 wdt:P279 ?class_ . BIND( "3182BD" AS ?rgb) BIND(?otherclass2 AS ?class) BIND(?otherclass_ AS ?otherclass) }
UNION
{ ?otherclass_ wdt:P31 ?otherclass2 . ?otherclass2 wdt:P279 ?class_ . BIND( "E6550D" AS ?rgb) BIND(?otherclass2 AS ?class) BIND(?otherclass_ AS ?otherclass) }
}
UNION
{ VALUES ?otherclass_ { target: }
?otherclass_ wdt:P279 ?class_ . BIND(?class_ AS ?class) BIND(?otherclass_ AS ?otherclass)
}
} LIMIT 500
} AS %result
WHERE {
INCLUDE %result
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment