A set of SPARQL examples that are used in different TGX resources
License: https://www.gnu.org/licenses/gpl-3.0
Uses method in: https://github.com/WDscholia/scholia/tree/master/scholia/app/templates/protein_cointeracting-proteins.sparql
Protein aspect: cointeracting proteins
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX target: <http://www.wikidata.org/entity/Q21109365>
SELECT
?count
?protein ?proteinLabel (CONCAT("/protein/", SUBSTR(STR(?protein), 32)) AS ?proteinUrl)
?species ?speciesLabel (CONCAT("/taxon/", SUBSTR(STR(?species), 32)) AS ?speciesUrl)
?chemicals
WITH {
SELECT
(COUNT(?chemical) AS ?count)
?protein
(GROUP_CONCAT(?chemical_label; separator=" // ") AS ?chemicals)
WHERE {
target: wdt:P129 ?chemical .
FILTER (target: != ?protein)
?protein wdt:P129 ?chemical .
?chemical rdfs:label ?chemical_label FILTER(lang(?chemical_label) = "en")
}
GROUP BY ?protein
} AS %result
WHERE {
INCLUDE %result
OPTIONAL { ?protein wdt:P703 ?species . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
}
ORDER BY DESC(?count)
LIMIT 500
graph TD