Submit Feedback/Bug Report

myExperiment Logo How To SPARQL

            Back to Contents Page

9. Troubleshooting

When trying to execute a query you may get one or more warning/error messages. If you are using the query form with HTML Table results these messages will be shown in a red box just above the query text box. E.g.

parser warning: Variable q was selected but is unused in the query. at line 1

If you request raw SPARQL results XML these messages will appear as within a comment tag <!-- --> in the XML itself. Usually between the head and results tags.

<?xml version="1.0"?>
<sparql xmlns="">
    <variable name="q"/>
<!-- parser warning: Variable q was selected but is unused in the query. at line 1 -->

Generally these messages are fairly self explanatory but here are some tips for how you might go about resolving them.

8.1. Syntax Errors

Error messages are generally syntactical errors in the query itself. Commonly this is because the the clauses have not be defined in the right order. Thtype of error message you receive may look something like this:

parser error: syntax error, unexpected WHERE, expecting AS at line 6

Below is a rough guide for how the clauses that have been described in this tutorial should be ordered. (Other ordering may work):


A second common syntactical error is to fail to put a dot between triples in the WHERE clause. This is why it is often good practice to start a new line for each triple and ident appropriately when using the semi-colon (;) operator. E.g.

PREFIX dcterms: <>
PREFIX mebase: <>
PREFIX meannot: <>
PREFIX mecontrib: <>
PREFIX rdf: <>
SELECT DISTINCT ?workflow ?ct_title
  ?workflow rdf:type mecontrib:Workflow ;
    mebase:has-content-type ?ct .
  ?ct dcterms:title ?ct_title .
  ?rating rdf:type meannot:Rating ;
    mebase:annotates ?workflow ;
    meannot:rating-score ?score
  FILTER (?score >= 4)

SPARQL queries often use several levels of parentheses either curly parentheses {} in WHERE, OPTIONAL and UNION clauses or round parentheses () in FILTER clauses. If you get an error message like the one below you should check that all your parentheses pair up.

parser error: syntax error, unexpected $end, expecting '}' at line 11

8.2. Complexity Warnings

If you run a query that is fairly complex (e.g. lots of triples, many OPTIONAL / UNION clauses, complicated FILTER clauses, etc.) and is expected to return quite a lot of results, you may receive a complexity warning message like the one below:

warning: hit complexity limit 8 times, increasing soft limit may give more results

Usually you will receive a number of results but the query engine cannot guarantee it has returned all of them. This can usually be resolved by increasing the Soft Limit to 5%, 10%, 20%, etc. until you cease to get this warning message. Sometimes you may receive a complexity warning because there is a semantic error in your query, such as typo for one of your variable names which means your triples don't link together in the way you intended.

8.3. Parser Warnings

Parser warnings like the one shown at the top of this page, mean that the query was syntactically correct and able to execute but there may be some mistake in your query causing you not to get the results you expected. The error message below is a classic example of where a variable name in the SELECT clause does not match up with a variable in the WHERE clause:

parser warning: Variable nmae was selected but is unused in the query. at line 1

            Back to Contents Page