@prefix cito: <http://purl.org/spar/cito/> .
@prefix ex: <https://bigcat-um.github.io/sparql-examples/WikiPathways/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <https://schema.org/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix spex: <https://purl.expasy.org/sparql-examples/ontology#> .

ex:067 a sh:SPARQLExecutable,
       sh:SPARQLSelectExecutable ;
    rdfs:label "Pathway Count per Ontology Term"@en ;
    rdfs:comment "Counts the pathways tagged with each ontology term. Pathways can be tagged with terms from the Pathway, Cell Line and Disease ontologies; wp:ontologyTag covers all of them, as well as the curation and community tags."@en ;
    sh:prefixes _:sparql_examples_prefixes ;
    sh:select """PREFIX wp: <http://vocabularies.wikipathways.org/wp#>

SELECT DISTINCT ?pwOntologyTerm (count(?pwOntologyTerm) as ?pathwayCount)
WHERE {
  ?pathwayRDF wp:ontologyTag ?pwOntologyTerm .
}
GROUP BY ?pwOntologyTerm
ORDER BY DESC(?pathwayCount)""" ;
    schema:target <https://sparql.wikipathways.org/sparql> ;
    schema:keywords "ontology", "counts" ;
    cito:usesMethodIn <https://www.wikipathways.org/sparql.html> .
