コード例: curl
SELECT ?virus ?virusLabel ?gene ?geneLabel ?count WITH {
SELECT ?virus ?gene (COUNT(DISTINCT ?work) AS ?count) WHERE {
?virus wdt:P171+ wd:Q57751738 .
?work wdt:P921 ?virus, ?gene .
?gene wdt:P703 wd:Q15978631 .
{ ?gene wdt:P31 wd:Q7187 } UNION { ?gene wdt:P31 wd:Q8054 }
} GROUP BY ?virus ?gene
} AS %ARTICLES WHERE {
INCLUDE %ARTICLES
SERVICE wikibase:label { bd:serviceParam wikibase:language "ja,en". }
}
ORDER BY DESC(?count) ?virus ?gene
curl -s https://raw.githubusercontent.com/egonw/SARS-CoV-2-Queries/master/sparql/humanInteractionCounts.rq | sed 's+<lang/>+ja+' > humanInteractionCounts.rq
curl -H "Accept: text/tab-separated-values" -G https://query.wikidata.org/bigdata/namespace/wdq/sparql --data-urlencode query@humanInteractionCounts.rq
本SPARQLクエリはCC0ライセンスで利用可能です。