add cart choropleth column cross cube error file folder geo help home lock obs poi rdf remove search slice spreadsheet success table unlock warning

[this is a icon-] developer tool

SPARQL 1.1 Query: Results

Edit query
Query results
s p_blank o_blank
http://opendatacommunities.org/id/geography/administration/md/E08000005 http://www.w3.org/1999/02/22-rdf-syntax-ns#type geosparql: Geometry
http://opendatacommunities.org/id/geography/administration/md/E08000005 geosparql: asWKT MULTIPOLYGON (((-2.0268169942422034 53.62415209019713, -2.0293735345042134 53.62168780002098, -2.029990964828113 53.62050477479855, -2.0301657948256775 53.617657266899755, -2.032650642979391 53.61511115173824, -2.0328022910884087 53.61188076466197, -2.0313469342102155 53.610209284522355, -2.0348290807632474 53.604408243798815, -2.0355409951609174 53.60463456104674, -2.0365923307455986 53.60399338430758, -2.0355293230939213 53.60335554395738, -2.0358282356161945 53.60291677276501, -2.0423283241536394 53.60041769590848, -2.0485320127494564 53.59975649624776, -2.053897489096182 53.598370932407235, -2.0555161589010806 53.59748303249114, -2.0568819337500335 53.597384443933535, -2.0567636848592397 53.59709057796155, -2.0559538621666955 53.597145774236, -2.0550969015802076 53.59459262031213, -2.0598833351597423 53.592470854845104, -2.0673193318089282 53.59239230519263, -2.0676807667862733 53.59352187170104, -2.0700366087442132 53.59471147488217, -2.0698829502830005 53.59497673231937, -2.0810701304217463 53.595273458612695, -2.0839391044979396 53.59440498308688, -2.085477807299216 53.59544479356746, -2.0871584571406436 53.59568888708141, -2.088225620160568 53.59666421819769, -2.089086406002281 53.59640209475673, -2.0895638486956156 53.59713514986192, -2.090250239740148 53.597346784404785, -2.091153706235586 53.59729209347497, -2.092465370349072 53.596644833634734, -2.0927002013962066 53.5969286895203, -2.094317056566217 53.59634227407099, -2.0976647073961048 53.59607001080338, -2.0993955907070654 53.59707974169453, -2.099870067113548 53.59774356739646, -2.1015796089999474 53.5973403745901, -2.105610008589326 53.59762352048758, -2.106855810765269 53.59850417737365, -2.107338510237725 53.59936124863844, -2.10861750217454 53.59901585043901, -2.1106395576835846 53.59969259288206, -2.1125729792861163 53.598876502170306, -2.1117674443192165 53.59710024898716, -2.11271537209754 53.59275621195584, -2.1183562426942046 53.592608779015556, -2.1231737778341984 53.58984179209464, -2.122488375973476 53.58951353077117, -2.123020232814057 53.58899792338702, -2.124003928176364 53.58910832812274, -2.1258467716908918 53.586481855011066, -2.136719443892735 53.58306782078141, -2.1369150360849183 53.58328064876297, -2.1467573413415266 53.58373091471816, -2.1565883034830464 53.582271371320495, -2.152436417114758 53.57899956021757, -2.152097149339577 53.57624784441526, -2.1526298174153315 53.57568897169574, -2.152558386058352 53.574733610158766, -2.1518527975686035 53.57422304171973, -2.1509319195401657 53.56710813619533, -2.1537205097234633 53.56579679394761, -2.157239421032925 53.564825975853864, -2.1577929288751716 53.56427064503711, -2.1595044475279472 53.564532642381835, -2.163607831665854 53.563276814665976, -2.1659022427857217 53.56123873658016, -2.168150489230617 53.56016862434101, -2.168718664133411 53.55881600656516, -2.1704195565472784 53.558702167863416, -2.1711331565102245 53.558216636139434, -2.17199508293848 53.55821629594504, -2.172182177759024 53.55185500572679, -2.1717647859554186 53.5513037011658, -2.169943280082165 53.551367409811455, -2.1694423922228574 53.54614325517588, -2.170744368772361 53.544521714671916, -2.170720259965268 53.54378824043301, -2.1713299324082147 53.5437873672695, -2.1750406930379897 53.53976965351154, -2.1755479696478925 53.538370271712225, -2.1780165573502526 53.53732489493106, -2.179820369802998 53.534643617600175, -2.1860163820322778 53.52904334186232, -2.193815223962919 53.531614266729974, -2.2005850364784005 53.53174416592239, -2.2048013791716268 53.532608901981256, -2.2058144134940822 53.533069120644235, -2.206908445303296 53.534343572801234, -2.2069305299871274 53.53578440702892, -2.205651922316032 53.53688225339181, -2.2071263417411675 53.53817860265177, -2.207547119220178 53.53846460824769, -2.2085383419925724 53.53842684917759, -2.210923367680935 53.54075159834901, -2.2130670578833325 53.542141848941995, -2.2138207424013037 53.541985048499036, -2.214955512657551 53.54229400998375, -2.217696512862142 53.54239867259652, -2.217812012852461 53.54344737304327, -2.218727315742569 53.543890676465075, -2.2194618171685554 53.543823733169674, -2.2197080406308007 53.54326957607868, -2.2207853474864376 53.54265997126287, -2.227761690787735 53.54156471432545, -2.2288644510222704 53.540675439862156, -2.2335152797174365 53.540148677724254, -2.2341331062543097 53.53917852960799, -2.23723203819687 53.53884434473046, -2.236321676172533 53.54066361594657, -2.2343658277294742 53.541711888316556, -2.234166716641543 53.54334814198025, -2.2356407714021254 53.5473801314112, -2.2362649727209734 53.55106953808231, -2.2374129758958663 53.55364510194705, -2.241722651928693 53.55713561086899, -2.2365444662292377 53.559225910354705, -2.2371961549292614 53.55939804303704, -2.2378145318626395 53.56010965468063, -2.238397630940692 53.56016690074141, -2.2390584504065743 53.56089450583243, -2.2408715934792998 53.561166817315666, -2.2408631960907055 53.56155061641238, -2.2416316042998874 53.561291981549104, -2.241690561715508 53.56156781591206, -2.242626398403719 53.56152907708834, -2.244235649915427 53.56203008031527, -2.246492934120116 53.5615615995168, -2.247174088097491 53.561864001866496, -2.2481308072404023 53.56334961196859, -2.2471664357237096 53.563410916479334, -2.245863347675659 53.56546658110528, -2.2432934036408776 53.56778091114542, -2.2455266489956487 53.56858712840698, -2.245128662390377 53.57024806291867, -2.244027217395759 53.570143386647466, -2.243306765505459 53.57168815770976, -2.246693275636533 53.57366760499943, -2.250324211699231 53.57658302773963, -2.250680998359787 53.5784186058514, -2.2546065324700773 53.580984542219014, -2.254691658660689 53.582568995933784, -2.259242521416235 53.58525394393441, -2.2610655112511613 53.58473131968369, -2.265498173205693 53.58558715166535, -2.267613267794656 53.5844319023462, -2.267992125302611 53.58366439050064, -2.2677960428960184 53.58227788087412, -2.268487287973703 53.580776251202195, -2.269096096465683 53.58032092291907, -2.273336765855777 53.579300135114806, -2.2776388623993773 53.580101002821365, -2.2776348585838 53.58087666143635, -2.278743121965206 53.58150775742534, -2.2789552928929515 53.58206905091761, -2.280488573253579 53.58210499983354, -2.2806568600076083 53.582655610865004, -2.2814413053163554 53.58272744911076, -2.2823763787314175 53.58387218391548, -2.282585013838672 53.58639470558856, -2.2821309396988925 53.58694130268986, -2.2798887906869916 53.58573772251092, -2.2785847362649765 53.58544684473537, -2.2781075511397555 53.58568607768048, -2.278059324243729 53.587312248982265, -2.2787510194780007 53.588890778232205, -2.2768052433313577 53.59142999381854, -2.2754673135448074 53.591527434410544, -2.2719886988872067 53.59022312420787, -2.2701357084484513 53.5891450851804, -2.269320679768416 53.589978373316264, -2.269979823102258 53.59194619814566, -2.2662944315253224 53.59137200945072, -2.265517840145341 53.59160026708871, -2.264963468026035 53.592346593496934, -2.263985467559728 53.59250160403905, -2.259224330535393 53.59216598300123, -2.258384653956409 53.59369941750453, -2.258258238289115 53.595009269194996, -2.2555528480770968 53.597111180417414, -2.2528668365080735 53.59795633766319, -2.250475738558269 53.599117293321314, -2.247619931646595 53.599387511755054, -2.245569388088916 53.59911489271632, -2.2450811226023677 53.60012346193205, -2.2453590009954025 53.60139832217968, -2.24816781942475 53.60211874918269, -2.2491144763375255 53.6027504519164, -2.248970129388059 53.603374540668604, -2.2504676187418666 53.60489943082476, -2.2510057084441852 53.60719666417512, -2.2558881978307674 53.60608700345419, -2.259171844839251 53.606026914880744, -2.261809445927049 53.60657846173391, -2.263979508120495 53.60777723405742, -2.264413831162224 53.607626123479136, -2.266605493744539 53.609088171906706, -2.2688198124811274 53.61124759879702, -2.2694835302138796 53.61245683672638, -2.2717896408714617 53.61449819801781, -2.2690460412234175 53.616150131553475, -2.2668583622209266 53.615627484157436, -2.2672385507008017 53.6147880007502, -2.2664794872010052 53.61452272997239, -2.2605811415706074 53.61621740134508, -2.2606112985070235 53.616701844005384, -2.257919071061359 53.61644970235198, -2.259121701576977 53.61832115607301, -2.259237648489735 53.619240409324846, -2.2583808274105577 53.61978967172343, -2.25714348214133 53.619917239726846, -2.256771363833889 53.620381879834405, -2.2599566845519092 53.62061132103885, -2.2596293331090602 53.621723920038455, -2.2605832343805035 53.62195556206964, -2.260207447996774 53.622306912165485, -2.260464847798114 53.624327768843905, -2.261241812007823 53.62430001528894, -2.262999988055208 53.624995427142, -2.2625114181698702 53.62641758413679, -2.2638294764628593 53.62998477909331, -2.265449394910306 53.639428715185396, -2.267668897781591 53.64098322887093, -2.2672106398201706 53.64266690581009, -2.269590990908763 53.64400258228369, -2.269711110251362 53.644571282686876, -2.2690645502094973 53.64543113678898, -2.269867681338561 53.646120503226115, -2.2669746592950655 53.64840458564403, -2.2663741302839484 53.64912495513454, -2.2666464695140247 53.649606157676345, -2.2656239775851548 53.65061149941074, -2.262908900971715 53.65166908615926, -2.26144282065828 53.654107225817555, -2.260664452475436 53.65423840667202, -2.2595879608930844 53.655105344895915, -2.257296861550624 53.6552829086214, -2.253515589519429 53.65652237211578, -2.252725740071809 53.65751902122946, -2.247505302732487 53.661107200903864, -2.2458788137782792 53.663505939516504, -2.236576202656327 53.66699143529287, -2.233081115049265 53.6688309992086, -2.225825018756546 53.67075220036394, -2.224813707388805 53.66987144999365, -2.223638963630908 53.669838608000845, -2.221628987965556 53.66897766449429, -2.2177300369346273 53.66896505718326, -2.215997983453468 53.66707618930529, -2.2153380578457873 53.66706569814195, -2.215563119715678 53.66607840400979, -2.214842715551012 53.665190754476164, -2.2071629401778354 53.660718329659225, -2.2078997302739665 53.65945960467055, -2.206878486632744 53.65703184618625, -2.2036047778667736 53.655902222383766, -2.2044573555109155 53.656059003952635, -2.205229672522965 53.65433289278857, -2.1977386606958778 53.6520516649499, -2.196564270223593 53.65067125314553, -2.195418766723182 53.65061023127723, -2.1903455039115656 53.64916229504165, -2.1895854372275383 53.64800938954072, -2.1853427142703725 53.64814642246482, -2.1844755946119983 53.64843359616355, -2.182408338374864 53.64824168987909, -2.182531710621028 53.64740826532613, -2.181584429873117 53.646981003161564, -2.181075095817917 53.645684790435965, -2.1826963619894744 53.64559516364183, -2.1835283054050576 53.64523158865575, -2.1826746392795013 53.64440873470656, -2.1827076506526546 53.64295885228497, -2.181849790900349 53.64184297684792, -2.1809252108067674 53.641414686824525, -2.1804692428466153 53.64053361596779, -2.1818356826527103 53.640333861537336, -2.1853973505951427 53.63820805045566, -2.175685236052803 53.63946668922462, -2.1741039647889417 53.63928290990697, -2.173977077951893 53.63969122214115, -2.16135412864374 53.64135824027676, -2.1606000276681736 53.64828016382261, -2.163910749635561 53.65238685968704, -2.1639396401416784 53.65474985590871, -2.15502953224589 53.66423256716306, -2.1534527346694836 53.66886802112163, -2.1486020284698806 53.6744835788651, -2.1479517094951026 53.67855332330946, -2.1481379292490312 53.68199465579506, -2.1463280309061252 53.682216222032494, -2.144640977400007 53.679464287909106, -2.1435355702582806 53.67848232893422, -2.142257622488192 53.67799045849833, -2.141092184081497 53.67895805873446, -2.1397151385418103 53.68279399753112, -2.137918439612134 53.68386833056886, -2.1359853949439858 53.68446197496457, -2.1341270652565885 53.68571881766081, -2.1328540848503574 53.68438192948565, -2.129862732354983 53.68308824035317, -2.1276778232963776 53.6815419327314, -2.126878639935286 53.6795851877187, -2.126717551519759 53.67686551614624, -2.1262247398484746 53.67560230705348, -2.1249685149235464 53.67514068994483, -2.1253868079243645 53.674822971155095, -2.1180851244315173 53.67122979826253, -2.113562183295099 53.67114252916536, -2.0970398767615004 53.67261041934269, -2.096191356892378 53.67157839345433, -2.092906712036694 53.670145547422386, -2.0902868678118542 53.67095473143596, -2.0886818837921037 53.67067819041099, -2.0862640870266933 53.67111495300765, -2.086073414897389 53.671918670680775, -2.0851249483108227 53.672174631130055, -2.084330516249905 53.67307402218976, -2.0837609458967323 53.6759146722524, -2.0840580930447192 53.67764912788754, -2.083167332731212 53.67805967283575, -2.0804064778773714 53.67832843542456, -2.077531466664389 53.67742620958058, -2.075483013041319 53.677241431210014, -2.073398894212484 53.677494416965764, -2.0718014051931855 53.67818026875392, -2.0712469674358354 53.678848407986436, -2.0618197070330977 53.68282824941246, -2.0605795255692057 53.68267873635959, -2.056224342902737 53.683125834848404, -2.0555453634346383 53.6826479414565, -2.051242271957532 53.683676289167494, -2.0489020652537686 53.68021145276601, -2.052215819090436 53.67882141763012, -2.0544581702767637 53.67675220683391, -2.054841750547714 53.67485733360015, -2.0539781757887723 53.671927622405306, -2.0522026552082275 53.66943240005862, -2.0496772099975984 53.66879712139738, -2.0485242116477966 53.667674039897484, -2.0448349750389716 53.66545362050236, -2.0370956252065344 53.662327504332225, -2.0374296395228426 53.66190588548731, -2.0365179602503147 53.66107293492056, -2.0356416483269184 53.65909223742845, -2.0356947781971577 53.6576028598418, -2.0365870364981373 53.65529805254269, -2.0396099500687606 53.65192200153635, -2.0395411405391344 53.65104476038741, -2.0405273149365506 53.65090245573991, -2.0396797586253412 53.64896760085582, -2.040706471969001 53.64836234306934, -2.041591452106789 53.645351857329416, -2.041324372595754 53.64137204041991, -2.041143759356825 53.640830090734994, -2.036547767909913 53.63800121029663, -2.0299976713563535 53.63615416275277, -2.0290299373324916 53.63420937377442, -2.0297473644984985 53.630821522631464, -2.030985991673554 53.62904780057923, -2.0268169942422034 53.62415209019713)))
SPARQL API: The Basics

The most flexible way to access the data is by using SPARQL, a query language, analagous to SQL for relational databases, for retrieving and manipulating data from graph databases like ours. We support SPARQL 1.1 query syntax. Many online tutorials are available.

To submit a SPARQL query from your code, you issue an HTTP GET or POST to our endpoint:http://opendatacommunities.org/sparql, with the query itself as a url-encoded parameter called query.

For example, to run the following simple SPARQL query and get the results as JSON:

SELECT * WHERE {?s ?p ?o} LIMIT 10

Option 1: POST (recommended)

Issue a POST to the endpoint, with the query in the body, and an Accept header of sparql-results+json:

POST http://opendatacommunities.org/sparql HTTP/1.1
Host: opendatacommunities.org
Accept: application/sparql-results+json
Content-Type: application/x-www-form-urlencoded

query=SELECT+%2A+WHERE+%7B%3Fs+%3Fp+%3Fo%7D+LIMIT+10

Option 2: GET

Issue a GET to the following URL (note the .json extension - see the formats section for more detail on this):

GET http://opendatacommunities.org/sparql.json?query=SELECT+%2A+WHERE+%7B%3Fs+%3Fp+%3Fo%7D+LIMIT+10

Scroll down to the end of this page for examples of both of these methods in a few different languages.

Results formats

As with other aspects of our API, to get the data in different formats, you can use either (a) a format extension or (b) an HTTP Accept header. Available result formats depend on the type of SPARQL query. There are four main forms:

SELECT queries return tabular results, and the formats available reflect this:

Format Extensions Accept Headers
XML .xml application/xml,
application/sparql-results+xml
JSON .json application/json,
application/sparql-results+json
Text .txt, .text text/plain
CSV .csv text/csv

CONSTRUCT and DESCRIBE queries return graph data, so the results are available in the same formats as our resource APIs:

Format Extensions Accept Headers
RDF/XML .rdf application/rdf+xml
N-triples .nt, .txt, .text application/n-triples,
text/plain
Turtle .ttl text/turtle
JSON-LD .json application/ld+json,
application/json

ASK queries return a boolean result:

Format Extensions Accept Headers
XML .xml application/xml,
application/sparql-results+xml
JSON .json application/json,
application/sparql-results+json
Text .txt, .text text/plain
Results pagination

We accept page and per_page parameters for paginating the results of SELECT queries (we automatically modify your query to apply LIMIT and OFFSET clauses). For other query types (i.e. DESCRIBE, CONSTRUCT, ASK), pagination like this doesn’t make so much sense, so these parameters are ignored.

For requests made through the website (i.e. HTML format), the page size is defaulted to 20. For requests to our sparql endpoint for data formats (i.e. non-HTML), there will be no defaults for these parameters (i.e. results are unlimited. For performance reasons we generally advise LIMITing your query if possible).

Parameter Substitution

You can parameterise your SPARQL by including %{tokens} in your queries, and providing values for the tokens in the request parameters.

Note that the following tokens are reserved and cannot be used as parameters for substitution:

  • controller
  • action
  • page
  • per_page
  • id
  • commit
  • utf8
  • query
Cross Origin Resource Sharing

Our servers are configured to allow access from all domains. This means that if you’re writing JavaScript to request data from our server in to a web page hosted on another domain, your browser should check this header and allow it.

If you need to support very old browsers, you can additionally pass a callback parameter and the results will be wrapped in that function. For example:

http://opendatacommunities.org/sparql.json?callback=myCallbackFunction&query=SELECT+%2A+WHERE+%7B%3Fs+%3Fp+%3Fo%7D+LIMIT+10

This help topic on the jQuery website has more details.

Examples

Using cURL

Here’s a couple of examples running a query using the widely available cURL command line program.

Request the results as XML, using a POST:

curl -X POST -H "Accept: application/sparql-results+xml" -d "query=SELECT%20*%20WHERE%20%7B%3Fs%20%3Fp%20%3Fo%7D%20LIMIT%2010" http://opendatacommunities.org/sparql

Request the results as JSON, using a GET:

curl -X GET -H "Accept: application/sparql-results+json" http://opendatacommunities.org/sparql?query=SELECT%20*%20WHERE%20%7B%3Fs%20%3Fp%20%3Fo%7D%20LIMIT%2010

Using JavaScript

This example HTML page uses jQuery to issue a POST to our SPARQL endpoint, requesting the results as JSON.

<!DOCTYPE html>
<html>
<head>
	<script src='http://code.jquery.com/jquery-1.9.1.min.js'></script>
</head>
<body>
<script type='text/javascript'>

	var query = 'SELECT * WHERE {?s ?p ?o} LIMIT 10';
	var url = 'http://opendatacommunities.org/sparql.json';
	$.ajax({
		method: 'POST',
		dataType: 'json',
		url: url,
		data: {query: query},
		success: function(data) {
			alert('success: ' + data.results.bindings.length + ' results');
			console.log(data);
		}
	});
</script>
</body>
</html>