And I mean really for dummies. I wanted to extract some data but I seem to be getting it wrong. The data I get is from 3 linked database tables. Is there somewhere a guide that us less understanding folks can grasp? I tried the official guide and the example the wiki page I tried to get the results from to no avail

I tried it at Enipedia (, I wanted to get access to different tables including installation names-emissions for a specific year but also contact person and relevant info. Results I displayed the person but only as a link to somewhere else which I cannot use.

So this one has a different formatting for queries than the one I saw here:

Instead it is using an euets value for most.

I wanted to get the installation name, country, responsible, emissions for specific year.

Result I am getting (for some of them) is this - I do not know if you can see it:

If not this is my query:

PREFIX euets: <>
PREFIX rdfs: <>
SELECT ?country ?emissions2010 ?Person {
  ?installation euets:napInfo ?napInfo .
  ?installation rdfs:label ?name . 
  ?napInfo euets:periodYear ?year . 
  ?napInfo euets:calculatedEmissions ?emissions2010 .
  ?installation euets:countryCode ?country .
  ?installation euets:contactPerson ?Person.
} order by ?country ?emissions2010 ?Person

which you can run here:

I basically do not want to have the ones in charge appearing as hyperlinks but as text. I figure they are on a different database table. I tried to use the generic path but it does not work.

Basically i am trying to understand how the questions are formatted in a comprehensible manner.

I think I tried the cambridge site you are referring to, but I feel as though enipedia is using a different wording and it is true I am far from even being a basic user of SPARQL (seems quite interesting as a tool though).

Thanks and sorry if this questions is either incomprehensible or a bit messy

asked 16 Nov '12, 08:33

tsapos's gravatar image

accept rate: 0%

edited 16 Nov '12, 09:34

Jerven's gravatar image

Jerven ♦


A good book is Learning Sparql. Or see the sources in this question

In the meantime can you show us what you tried (e.g. query that did not work, as well as a data sample)

(16 Nov '12, 09:02) Jerven ♦ Jerven's gravatar image

What are you using to provide the SPARQL endpoint? What SPARQL queries have you tried?

Have any SPARQL queries worked eg. SELECT * WHERE { ?s ?p ?o. }

On a more general note is a nice tutorial. Its also worth playing with a public SPARQL endpoint rather than your own while you are getting to grips with SPARQL (less likely to be a problem with the endpoint, better documentation, easier to recreate problems etc. )

(16 Nov '12, 09:06) Sweet Burlap Sweet%20Burlap's gravatar image

When adding details add them to the question with edit instead of adding an answer.

(16 Nov '12, 09:17) Jerven ♦ Jerven's gravatar image
(16 Nov '12, 09:41) Sweet Burlap Sweet%20Burlap's gravatar image

@Jerven, ok got it. @Sweet Burlap, sstrange I used it some moments ago but it is indeed down. I would say the euets one as all the data I am looking into are related to euets.

(16 Nov '12, 09:47) tsapos tsapos's gravatar image

@Sweet Burlap basically I use the Tool and database can be down at times. they seem to be working now.

I tried some queries from the cambridge tool as well as the foaf string but I get no returning results. I can see the table of contents but it is not populated. Only the examples mentioned seem to be working. When I am changing the data even in the slightest I get no results

(19 Nov '12, 06:13) tsapos tsapos's gravatar image
showing 5 of 6 show 1 more comments

The documentation for the data set is here, and the query you need to use is the one below (run at You probably want to specify a value for LIMIT, otherwise you'll get about 60,000 results back.

PREFIX euets: <>
PREFIX rdfs: <>
select ?installationName ?country ?contactPerson ?account_holder ?emissions ?year where {
    ?installation rdfs:label ?installationName . 
    ?installation euets:countryCode ?country .     
    ?installation euets:contactPerson ?personInfo . 
    ?personInfo rdfs:label ?contactPerson . 
    ?installation euets:napInfo ?napInfo .
    ?napInfo euets:periodYear ?year . 
    ?napInfo euets:calculatedEmissions ?emissions .
    ?installation euets:account ?account . 
    ?account euets:AccountHolder ?account_holder .
} order by ?country ?installation ?year limit 100

What's also helpful is that we use Pubby as a front end for exploring the data, meaning that you can take a URL returned by a query, such as this one, copy/paste it into a web browser, and view the structure of the data. This helps you to see how the subjects, predicates and objects are connected together, which shows you the types of patterns you are able to specify in SPARQL queries.

The way I would suggest learning SPARQL would be to go back and forth between writing queries and checking the view we provide via the Pubby interface. For example, if you write a query to find the properties of a specific installation:

select * where {
<> ?x ?y .

You'll get the same data returned as if you just go to in your web browser. The next step is to figure out how to write queries that can traverse the links. As an example, the query below follows all of the euets:napInfo (National Allocation Plan) links for the same installation, and then prints out all of the properties and values associated with each of the objects. If you go back to the view provided by the Pubby interface, then you'll see that the query has returned data that is spread out over eight pages.

PREFIX euets: <>
select * where {
<> euets:napInfo ?napInfo .
?napInfo ?x ?y . 

Writing queries basically involves about figuring out how the data is linked together, and then specifying which of those links you want to follow.

permanent link

answered 20 Nov '12, 03:16

cbdavis's gravatar image

accept rate: 0%

1) SPARQL endpoint is unavailable at the moment. I cant complete my answer without SPARQL endpoint. I will have to closely look at ?emissions2010 or more precisely at euets:calculatedEmissions ontology structure.

2) You should rewrite query:

PREFIX euets: <>
PREFIX rdfs: <>
PREFIX foaf: <>

SELECT ?installationName ?countryName ?emissions2010 ?personName {
    # shorter version of your code
    ?installation euets:napInfo ?napInfo;
    rdfs:label ?installationName;
    euets:countryCode ?country;
    euets:contactPerson ?Person.
    ?napInfo euets:periodYear ?year;
    euets:calculatedEmissions ?emissions2010 .
    # to appear as a text add this code
    ?country rdfs:name ?countryName.
    ?Person foaf:name ?personName.  
} order by ?countryName ?emissions2010 ?PersonName
permanent link

answered 16 Nov '12, 16:56

Tom%C3%A1%C5%A1%20%C5%98eho%C5%99ek's gravatar image

Tomáš Řehořek
accept rate: 50%

edited 16 Nov '12, 17:06

yes I know, the tool is up and down (was most of the weekend). Used your proposal above and got no results as when I tried it some times. I get the table structure but no results in the tables. Tool is online now and you can try it.

(19 Nov '12, 05:53) tsapos tsapos's gravatar image

?country rdfs:name ?countryName. won't work - rdfs:name was prob originally intended to be rdfs:label, but the country codes aren't modelled with a label in any case.

?Person foaf:name ?personName. won't work as foaf:name isnt present in dataset, btu will work if foaf:name is replaced with rdfs:label

(pretty much impossible to get it perfect without endpoint/ontology ;-) )

(19 Nov '12, 12:44) Sweet Burlap Sweet%20Burlap's gravatar image


PREFIX euets: <>
PREFIX rdfs: <>
SELECT distinct * {
  ?installation euets:napInfo ?napInfo .
  ?installation rdfs:label ?name . 
  ?napInfo euets:periodYear ?year . 
  ?napInfo euets:calculatedEmissions ?emissions2010 .
  ?installation euets:countryCode ?country .
  ?installation euets:contactPerson ?Person.
  ?Person ?p ?o.

} order by ?country ?emissions2010 ?Person

The main change is the ?Person ?p ?o.

This will give us all the properties and values of the Person in Change (name, contact details etc,)

To integrate specific properties into the queries (giving all contact details in one result row. You can replace the ?Person ?p ?o with ?Person rdfs:label ?o. and ?Person euets:email ?o. etc. You might also want to put some of the less essential properties in an optional clause. This will mean that the dataset does not necessarily need that property in order to show the result set.


PREFIX euets: <>
PREFIX rdfs: <>
SELECT distinct * {
  ?installation euets:napInfo ?napInfo .
  ?installation rdfs:label ?name . 
  ?napInfo euets:periodYear ?year . 
  ?napInfo euets:calculatedEmissions ?emissions2010 .
  ?installation euets:countryCode ?country .
  ?installation euets:contactPerson ?Person.
  ?Person <> ?PersonName.
  ?Person euets:email ?email.
  ?Person euets:phoneNumber2 ?o.
} order by ?country ?emissions2010 ?Person
permanent link

answered 19 Nov '12, 12:01

Sweet%20Burlap's gravatar image

Sweet Burlap
accept rate: 19%

edited 19 Nov '12, 12:30

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 16 Nov '12, 08:33

question was seen: 2,280 times

last updated: 20 Nov '12, 03:16