Submit Feedback/Bug Report

myExperiment Logo How To SPARQL

                    Back to Contents Page

3. SELECT

After adding your prefixes most SPARQL queries start with a SELECT, although queries can start with ASK, DESCRIBE or CONSTRUCT but these will not be discussed here. The purpose of the SELECT is very similar to it's use in SQL. It allows you to define which variables in your query you want values returned for. Like SQL you can list these individually or use an asterisk (*) to specify that you want values return for each variable. E.g.

PREFIX mebase: <http://rdf.myexperiment.org/ontologies/base/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?a ?text
WHERE {
  ?a rdf:type mebase:Announcement .
  ?a mebase:text ?text
}
[Run]
[Hide Example Results]
atext
http://www.myexperiment.org/announcements/6

myExperiment is discussed by Jim Hendler in his article Reinventing Academic Publishing, Part 3 in IEEE Intelligent Systems January/February 2008, page 2-3.

http://www.myexperiment.org/announcements/29

A new project to link the myExperiment system with two existing electronic laboratory notebook (ELN) systems developed in Southampton, currently in use in several departments, has been announced today (June 11, 2009). By integrating these ELNs with myExperiment we will pave the way for longer term takeup in the experimental laboratory science communities, including Chemistry, Physics, Biology and Engineering.

The project will commence in July 2009 and will be led by Prof Jeremy Frey, who is based in the School of Chemistry at Southampton and is one of the partners in the myGrid Platform.

For more info please see http://wiki.myexperiment.org/index.php/MyExperimentalScience

-- Dave

http://www.myexperiment.org/announcements/14

We're pleased to announce that we've remodelled the myexperiment wiki to support the myExperiment developer community.

There is now a Developers' section where those of you developing over the API can share information about your projects.  It currently includes Google gadgets, the Taverna plugin, workflows for Facebook and the Java API.  This section also carries information about people running their own myExperiments, and myExperiment developer documentation.

The other information is now organised into Users, News and About. Previously you needed a wiki account to get at anything other than the main page, but now everything is publicly available, so you won't need to use your old accounts.

 

We’re really keen that everyone working over the API uses the wiki, if only to list who you are and what you’re doing – then all the developers will be able to help out as the community grows.

To get an account so that you can contribute content to the Developer pages please email Don Cruickshank on dgc@ecs.soton.ac.uk

http://www.myexperiment.org/announcement/3

In true 'perpetual beta' fashion, we continue our updates and additions to myExperiment:

  • In the user profile page, you can now see how many times a user has been credited for Workflows and Files in myExperiment. You can also see these credited items directly in the new "Creditations" tab, when viewing a user's profile.
  • Clearer statistics in the Workflow, File and User pages.
  • Improved layout for the Workflow and File pages.

Feedback always welcome!

http://www.myexperiment.org/announcement/25

Our paper "Software Design for Empowering Scientists", which discusses the design principles of Taverna and myExperiment, has appeared in the January/February 2009 issue of IEEE Software ("Developing Scientific Software, Part 2"). The article is available to subscribers on http://www2.computer.org/portal/web/csdl/doi/10.1109/MS.2009.22 and the preprint is available on http://eprints.ecs.soton.ac.uk/15032/  The full reference is

De Roure, D. and Goble, C. Software Design for Empowering Scientists, IEEE Software, Volume 26, Issue 1, Jan-Feb 2009, pages 88-95. Digital Object Identifier 10.1109/MS.2009.22

Also, myExperiment, along with OpenWetWare and nanoHub, feature in the article "Research intelligence - Log on to a global laboratory" in the January 1st issue of THE (Times Higher Education) , written by Sarah Collinson and Zoe Corbyn.  You can find the article on http://www.timeshighereducation.co.uk/story.asp?sectioncode=26&storycode=404834

...and Happy New Year to all our users!

-- Dave

Is the same query as:

PREFIX mebase: <http://rdf.myexperiment.org/ontologies/base/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT *
WHERE {
  ?a rdf:type mebase:Announcement .
  ?a mebase:text ?text
}
[Run]
[Hide Example Results]
atext
http://www.myexperiment.org/announcements/6

myExperiment is discussed by Jim Hendler in his article Reinventing Academic Publishing, Part 3 in IEEE Intelligent Systems January/February 2008, page 2-3.

http://www.myexperiment.org/announcements/29

A new project to link the myExperiment system with two existing electronic laboratory notebook (ELN) systems developed in Southampton, currently in use in several departments, has been announced today (June 11, 2009). By integrating these ELNs with myExperiment we will pave the way for longer term takeup in the experimental laboratory science communities, including Chemistry, Physics, Biology and Engineering.

The project will commence in July 2009 and will be led by Prof Jeremy Frey, who is based in the School of Chemistry at Southampton and is one of the partners in the myGrid Platform.

For more info please see http://wiki.myexperiment.org/index.php/MyExperimentalScience

-- Dave

http://www.myexperiment.org/announcements/14

We're pleased to announce that we've remodelled the myexperiment wiki to support the myExperiment developer community.

There is now a Developers' section where those of you developing over the API can share information about your projects.  It currently includes Google gadgets, the Taverna plugin, workflows for Facebook and the Java API.  This section also carries information about people running their own myExperiments, and myExperiment developer documentation.

The other information is now organised into Users, News and About. Previously you needed a wiki account to get at anything other than the main page, but now everything is publicly available, so you won't need to use your old accounts.

 

We’re really keen that everyone working over the API uses the wiki, if only to list who you are and what you’re doing – then all the developers will be able to help out as the community grows.

To get an account so that you can contribute content to the Developer pages please email Don Cruickshank on dgc@ecs.soton.ac.uk

http://www.myexperiment.org/announcement/3

In true 'perpetual beta' fashion, we continue our updates and additions to myExperiment:

  • In the user profile page, you can now see how many times a user has been credited for Workflows and Files in myExperiment. You can also see these credited items directly in the new "Creditations" tab, when viewing a user's profile.
  • Clearer statistics in the Workflow, File and User pages.
  • Improved layout for the Workflow and File pages.

Feedback always welcome!

http://www.myexperiment.org/announcement/25

Our paper "Software Design for Empowering Scientists", which discusses the design principles of Taverna and myExperiment, has appeared in the January/February 2009 issue of IEEE Software ("Developing Scientific Software, Part 2"). The article is available to subscribers on http://www2.computer.org/portal/web/csdl/doi/10.1109/MS.2009.22 and the preprint is available on http://eprints.ecs.soton.ac.uk/15032/  The full reference is

De Roure, D. and Goble, C. Software Design for Empowering Scientists, IEEE Software, Volume 26, Issue 1, Jan-Feb 2009, pages 88-95. Digital Object Identifier 10.1109/MS.2009.22

Also, myExperiment, along with OpenWetWare and nanoHub, feature in the article "Research intelligence - Log on to a global laboratory" in the January 1st issue of THE (Times Higher Education) , written by Sarah Collinson and Zoe Corbyn.  You can find the article on http://www.timeshighereducation.co.uk/story.asp?sectioncode=26&storycode=404834

...and Happy New Year to all our users!

-- Dave


3.1. DISTINCT

It is not uncommon that the sets of results will return duplicates. If you don't want duplicates you can append DISTINCT after SELECT.

Without DISTINCT

annotator_name
Don Cruickshank
Franck Tanoh
Franck Tanoh
Franck Tanoh
    

With DISTINCT

annotator_name
Don Cruickshank
Franck Tanoh

3.2. COUNT

As of SPARQL 1.1 it has been possible to apply mathematical functions to selected variables. The most straightforward of these is COUNT. The example below is a way of founding out how many public workflows myExperiment has without requiring any post-processing.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX mecontrib: <http://rdf.myexperiment.org/ontologies/contributions/>

SELECT (COUNT(?workflow) AS ?no_workflows)
WHERE {
  ?workflow rdf:type mecontrib:Workflow
}
[Run]
[Hide Example Results]
no_workflows
1255

3.3. SUM

Another common mathematical function now available is SUM, which like COUNT works in the same way as it does in SQL. The following example gives a sum of the downloads of all workflows owned by the user with the ID 43.

total_downloaded
29382

3.4. AVG

The SUM example above is probably not very useful if you want to know how popular a user's workflows are, as it is dependent on how many they have. A better way might be to work out th average number of downloads for a user's workflows. This can be found using the AVG function.

average_downloads
367.2749999999999970618

3.5. MAX and MIN

As well as knowing the average you might want to know the most and least times a workflow that belongs to a user has been downloaded. This can be achieved using the MAX and MIN functions.

max_downloadedmin_downloaded
32501

These examples of the use of mathematical functions in the SELECT clause are quite basic and return just a single row of results. The GROUP BY function allows aggregation on a particular subject so you could give a league table of users by the total number of downloads for their workflows.

                    Back to Contents Page