Help:WikiPathways SPARQL queries
From WikiPathways
(Difference between revisions)
(→Example queries) |
(→Datasource oriented queries) |
||
| Line 77: | Line 77: | ||
| [http://sparqlbin.com/#87818e56a8c9de7c1d40ff2340ccfa82 Execute] | | [http://sparqlbin.com/#87818e56a8c9de7c1d40ff2340ccfa82 Execute] | ||
| * | | * | ||
| + | |- | ||
| + | | Return the pathways with Chembl compounds | ||
| + | |<pre>SELECT DISTINCT ?datasource ?pathway | ||
| + | WHERE { | ||
| + | ?concept dcterms:isPartOf ?pathway . | ||
| + | ?concept dc:source ?datasource . | ||
| + | ?concept dc:source "ChEMBL compound"^^xsd:string . | ||
| + | |||
| + | } | ||
| + | |[http://sparqlbin.com/#ab33283c4842259baf89745ef4aa1fa1 Execute] | ||
|- | |- | ||
|} | |} | ||
Revision as of 11:28, 19 October 2012
On sparql.wikipathways.org wikipathways content is replicated. Currently this SPARQL endpoint is being developed, with very irregular updates.
Contents |
Prefixes
Below are example queries. For readability we have omitted the prefixes. We use the following prefixes: (Not complete yet)
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX schema: <http://schema.org/>
Example queries
Queries with a * requires a bit more time for results.
Pathway oriented queries
| Get the species currently in WikiPathways with their respective URI's | SELECT DISTINCT ?organism ?label
WHERE {
?concept wp:organism ?organism .
?organism rdfs:label ?label .
}
| Execute |
| List pathways and their species |
SELECT DISTINCT ?title ?label
WHERE {
?pathway dc:title ?title .
?pathway wp:organism ?organism .
?organism rdfs:label ?label .
}
| Execute |
Datasource oriented queries
| Get all datasource currently captured in WikiPathways | select distinct ?datasource count(?datasource) as ?numberEntries
WHERE {
?concept dc:source ?datasource
}
| Execute | |
| Get the number of entries per datasource in WikiPathways | SELECT DISTINCT ?datasource
WHERE {
?concept dc:source ?datasource
}
| Execute | |
| Count the identifiers per data source |
SELECT DISTINCT ?datasource ?identifier count(?identifier) AS ?numberEntries
WHERE {
?concept dc:source ?datasource .
?concept dc:identifier ?identifier
}
| Execute | * |
| Count the identifiers per data source and order them from high to low |
SELECT DISTINCT ?datasource ?identifier count(?identifier) AS ?numberEntries
WHERE {
?concept dc:source ?datasource .
?concept dc:identifier ?identifier
}
ORDER BY DESC(?numberEntries)
| Execute | * |
| Return the pathways with Chembl compounds | SELECT DISTINCT ?datasource ?pathway
WHERE {
?concept dcterms:isPartOf ?pathway .
?concept dc:source ?datasource .
?concept dc:source "ChEMBL compound"^^xsd:string .
}
|[http://sparqlbin.com/#ab33283c4842259baf89745ef4aa1fa1 Execute]
|-
|}
=== Curators oriented queries ===
{|
|-
|Extract contributors
|<pre>SELECT DISTINCT ?contributor
WHERE {
?pathway dc:contributor ?contributor
}
| Execute | |
| Extract the amount of pathways edited per contributor | SELECT DISTINCT ?contributor, count(?pathway) as ?pathwaysEdited
WHERE {
?pathway dc:contributor ?contributor
}
ORDER BY DESC(?pathwaysEdited)
| Execute | |
| find the pathways a user have edited so far. Change the name in the query | SELECT DISTINCT ?pathway, ?pathwayLabel
WHERE {
?pathway dc:contributor wpuser:Andra .
?pathway dc:contributor ?contributor .
?pathway rdfs:label ?pathwayLabel .
}
| Execute |

