Hi,

There is a property proposal to store a SPARQL query equivalent to a category:
https://www.wikidata.org/wiki/Wikidata:Property_proposal/Wikidata_SPARQL_query_equivalent

I have some doubts about the appropriate datatype. I guess it depends on future plans/community preferences. 

My ideal scenario would be a datatype "SPARQL query" that would store the plain text and it would be collapsed in the user interface. Users would be able to expand the code or just run it directly. Additionally, queries could be qualified with qualifiers TBD, that would allow to query existing queries, or define how frequently the cached query should be updated. 

If that would be too much work, then the datatype "string" or a short/long URL to the query seem also valid options.

What are your thoughts on the issue?

Cheers,
Micru