Query Structure
A SPARQL query has a specific structure that is set out in sections:

Prefixes
The first section, often called the "prefixes", declares the vocabularies used in the query. Vocabularies are a key feature of RDF data and SPARQL and work as follows:
RDF data is built on common or standard definitions of concepts that are organised into vocabularies on a specific category, such as business organisations, personal relationship information, location, finance, and in this case, public procurement. Once a particular vocabulary is published, other entities who find the concept definitions appropriate, adopt the use of the vocabulary. All vocabularies used must be declared in the prefixes section of the query so everyone knows which definitions are being used.
Not only do query constructors need to list the vocabularies in a query, they also typically give each one a short abbreviation or "prefix". This is so that from then on in the query, the prefix can be used instead of typing the full name of the vocabulary each time you refer to it. Some of the adopted vocabularies in public procurement queries are:
person="http://www.w3.org/ns/person#"
org="http://www.w3.org/ns/org#"
foaf="http://xmlns.com/foaf/0.1/"
skos="http://www.w3.org/2004/02/skos/core#"
The prefix before the = sign is the abbreviation of the URI after the = sign.
More information regarding the vocabularies used in public procurement can be found on the EU Vocabularies website.
Data fields required
The second section lists all the fields (terms/ concepts) that you want the query to return. Each field here becomes a column in the results. These could be the contents of a field, or the contents of a variable that is defined in the next section.
Specifying the data
The third section is used to specify data based on semantic connections between the fields specified above, and any other concepts used to arrive at the exact field desired, plus any filters or criteria the query constructor wants to apply to them.
Going back to names and numbers used as in the example on the how to query page, filters or criteria could be to find names that don’t have a number, so that the person querying can find the missing data and add it, or it could be to find the names and numbers in a specific location, or of a particular age group.
Running the query
Once the query is completed, it can be run in one or more of the methods described in "Connecting to TED open data".