Can I use ASK in a subquery?

I have found several examples of subqueries, but I cannot find any doing an ASK statement. I have been unsuccessful in getting my queries to work as I expect and am wondering if I am trying to do the impossible.

I have found subquery examples here:

http://www.cambridgesemantics.com/2008/09/sparql-by-example/#%2845%29

http://virtuoso.openlinksw.com/presentations/SPARQL_Tutorials/SPARQL_Tutorials_Part_2/SPARQL_Tutorials_Part_2.html#%281%29

Can I use ASK in a subquery?

Having a look at the SPARQL 1.1 grammar, it seems not. The only production for sub-queries is SELECT.

Why not use the (NOT) EXISTS operator in combination with AS?


An example for AS as requested. AS is just used to assign a new variable with a value for an expression, allowing you to re-use the value for the expression elsewhere.

Here it's used in combination with BIND to find a person who has at least one sister, or at least one brother, but not both.

PREFIX ...
SELECT ?s
WHERE
{
  BIND ( EXISTS { ?s ex:sister ?sister } AS ?hasSis ))
  BIND ( EXISTS { ?s ex:brother ?bro } AS ?hasBro ))
  FILTER (?hasSis != ?hasBro)
}

You can also use AS in subqueries (see example here), FILTER expressions, etc. ... anywhere you want to bind the evaluation of an expression as a new variable.

As signified states you should be using EXISTS to do this e.g.

SELECT *
WHERE
{
  ?s ?p ?o .
  FILTER(EXISTS { ?s a  ?type })
}