Note that the RDF syntax used in TopBraid is optional.  Queries can be saved as strings and there are various features to specify variables using a {?varName} syntax.

The SPIN RDF syntax is not intended for human use.  All queried are edited in SPARQL string syntax and convert to/from the SPIN RDF representation.

BTW, one advantage of representing queries in RDF, particularly from an editor perspective, is that models can be refactored without needing to modify queries.  Since query elements are RDF nodes, changing the model changes the query automatically and correctly.

-- Scott

On 5/31/12 8:45 PM, David Booth wrote:
[Resending, as my previous message never showed up.]

I would like to be able to write something like this:

  WHERE { ?s a ${CLASS} . }

and have ${CLASS} substituted in from an environment variable or other
parameter, but SPARQL does not currently provide anything like this, and
it's clearly beyond what the working group could put in SPARQL 1.1.  
So I'm wondering . . . 

What have others been using as a template language for SPARQL?  

I know TopQuadrant uses an RDF representation for SPARQL CONSTRUCT
queries in conjunction with SPIN, 
but it shreds the SPARQL query into tiny RDF pieces, which is rather
unfriendly for a human to read.  It would be much nicer to have
something like the above.

How are others handling the need to parameterize their SPARQL queries
like this?