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/nmd/E07000107 http://www.w3.org/1999/02/22-rdf-syntax-ns#type geosparql: Geometry
http://opendatacommunities.org/id/geography/administration/nmd/E07000107 geosparql: asWKT MULTIPOLYGON (((0.3154371617350541 51.46489220249921, 0.3145057489050225 51.46210000954343, 0.3134382361632164 51.46083237337565, 0.3137091479226915 51.46026763266367, 0.3127750793531936 51.45896409065628, 0.3106565142314018 51.453045205929364, 0.3177153750689176 51.45193817178361, 0.3196790725421479 51.451237434004575, 0.3202969869434022 51.45030789096376, 0.3193096563153416 51.44948654222098, 0.3198008395075728 51.44889683639318, 0.3192788923621641 51.44700421417678, 0.3215213932933423 51.44695262252783, 0.3217198934003389 51.446722936185324, 0.3216786648844195 51.44622369476901, 0.3205459517848686 51.44537017281977, 0.3214264910211513 51.44561984574958, 0.3225197061535242 51.4450703472696, 0.3235358184184853 51.44317332488894, 0.3262987090546335 51.44280285325726, 0.3259882951923526 51.439893353941194, 0.323607036770296 51.43541884504903, 0.3236781974028374 51.43200360067091, 0.3249068204934159 51.43038743918535, 0.3252044193928491 51.42922138182875, 0.3265644272477578 51.42897501609851, 0.3280394948986153 51.42773971492369, 0.332664696050202 51.42579242150884, 0.3305935526664974 51.42099351346007, 0.3312418607833723 51.420759356192036, 0.3310548523581706 51.414709751882675, 0.3320631546054772 51.41183065344734, 0.3343797267578005 51.40886353952861, 0.3340846708606404 51.406345912958244, 0.3351412042511779 51.40238675789495, 0.335065635157693 51.39932333735095, 0.3365274003142017 51.39894975845658, 0.3371527675177172 51.39906045699921, 0.3377008654317674 51.399773452758325, 0.3388559206524137 51.39950135618947, 0.338358195058715 51.398142457993586, 0.3387084037678996 51.39635665659251, 0.3437339313674416 51.39547735679151, 0.3445944274670297 51.39341151384883, 0.342601420913312 51.391235443574395, 0.3410040000633969 51.39117018751375, 0.3398408076774938 51.390686261219095, 0.3357031855590112 51.38996659169943, 0.3345907801389866 51.38946352913069, 0.3351663291893323 51.388230849767, 0.3363970741236212 51.38759116481497, 0.3370393165372474 51.38767095736707, 0.336649980441273 51.38654463569698, 0.331979530699732 51.38732387670998, 0.3255657898047291 51.388905626218595, 0.2932400549838864 51.397976750197664, 0.2840158160372958 51.39961837290281, 0.2774597466714409 51.40158503291357, 0.2797560628553565 51.40285974449002, 0.2784784809795378 51.40452223724072, 0.2775784322890384 51.40692467553787, 0.2748657011806527 51.40745765546613, 0.2740261284580485 51.4070863685791, 0.2727330111950776 51.40757186753481, 0.2721672086036505 51.406743839862656, 0.269098923564072 51.407419247830525, 0.2588105831607033 51.40780064616253, 0.2457164314967367 51.407712420633004, 0.2460584335819426 51.40650436603856, 0.2454841732412002 51.406492896682145, 0.2456158789932913 51.40542562028528, 0.2445739755568801 51.403969784668, 0.2429817312276115 51.402928332811605, 0.2418666524403802 51.401003487522814, 0.2401784154473512 51.40114285752914, 0.2410059489666752 51.39957121543021, 0.2401552177409007 51.398373398962015, 0.2405179280220841 51.397616470355565, 0.2388525338303026 51.3970754285626, 0.2382453666863199 51.39630008629781, 0.235606322864207 51.39666073909367, 0.2334550698524137 51.396353745755036, 0.2326707607754105 51.395893903681305, 0.2274845783982176 51.395166121807925, 0.2236273790466865 51.39566563689679, 0.21931582232828 51.39557117626236, 0.2157855822758318 51.39617482176125, 0.2138402087409494 51.39608033675897, 0.2128123361796654 51.39676343642198, 0.2120964828339688 51.396588153684, 0.2088824509501767 51.39704446773975, 0.207504258451403 51.39684469193495, 0.2069227845418977 51.39721985262247, 0.2071633557746424 51.400005888330035, 0.206830741652075 51.40241423950191, 0.2127102111897347 51.40274936890675, 0.2135016976305805 51.40484961867348, 0.211373009177324 51.40495364767965, 0.2109903158036533 51.4074528601392, 0.2058174886541358 51.40968263698398, 0.2049644250453437 51.412245522063905, 0.205278123074124 51.41320546810646, 0.2032180722596061 51.41379102324873, 0.2007518175374004 51.4157411960706, 0.1997316215372064 51.41797533843822, 0.1825827342814403 51.41579414245743, 0.1780520701141966 51.415513341483305, 0.1649034339433826 51.410994316843734, 0.1663316381121894 51.4107547572634, 0.1655886880288989 51.40824055625654, 0.1639073004691733 51.40841456765812, 0.1634617188206076 51.406804065018434, 0.1614278957102767 51.407156356149166, 0.1596671769917655 51.40784530485439, 0.1598612732352042 51.40827075168848, 0.1593554264258566 51.4083699791058, 0.1560697622194873 51.408738047143956, 0.1529063612040032 51.40870900657497, 0.1537440456084694 51.411265595190464, 0.1497258349599975 51.411658633855744, 0.1491338619722202 51.41243565673337, 0.1511281710064812 51.415063734473314, 0.151029453773749 51.41761594938767, 0.1540681891233661 51.41776241353382, 0.1546105597371586 51.41847014818798, 0.1511328004536189 51.42043066008489, 0.1529776373901335 51.421980442254664, 0.153491352656226 51.42360411195126, 0.1532927838624612 51.42531638889364, 0.1537374302323814 51.427523275637405, 0.1552745099872622 51.428975198443055, 0.1558489120566311 51.43087653434984, 0.1586059908768542 51.43012704832807, 0.1590594455107358 51.43022478180412, 0.1598110819973176 51.42920283664645, 0.1606692132223421 51.42967447892766, 0.1638969148450471 51.42893237220831, 0.1638055040923089 51.42860941649313, 0.1643020497365822 51.42858496364451, 0.1655636287496726 51.43034850423928, 0.1661834734840464 51.43028220667032, 0.166667348426369 51.431295742979536, 0.1660694496767733 51.4314300542989, 0.1668190263884516 51.4319467222723, 0.1665043533386263 51.43405333111717, 0.1669973826054738 51.435625181130554, 0.1686880592194204 51.437479737523525, 0.170523967817629 51.440815449732256, 0.172827934246251 51.4432449433912, 0.1727703205697376 51.44303105026238, 0.1737794685221217 51.442979073777714, 0.1759911045757675 51.44200545751289, 0.1786988034146585 51.443476784434885, 0.1795495131839872 51.443117443138824, 0.1808610605502921 51.44352287799065, 0.1810579873690278 51.44418198763677, 0.1836291152812415 51.44480408020578, 0.1842508717989984 51.444654941339735, 0.187438063245115 51.446874304840584, 0.1876172942554062 51.44869745553703, 0.1884078741151847 51.44861616789085, 0.1888239245507602 51.44912993381795, 0.1909851806668451 51.44878738475562, 0.1917204601197046 51.45067835089644, 0.1929928682321949 51.451701397146905, 0.1938193695083304 51.451947641402285, 0.1941540514921659 51.451663482976684, 0.1949213263995533 51.45181544025692, 0.1950274282222201 51.452137198859745, 0.1954821611994521 51.452015402631105, 0.1958634224144855 51.45237066531475, 0.1959590171656357 51.45178341699147, 0.1979884088989061 51.45184166578253, 0.199109409111627 51.452138091355266, 0.1996941687553422 51.45271428411612, 0.200206617047593 51.452595881964555, 0.2013595026888297 51.453850338376945, 0.2020007350350373 51.45410450036884, 0.2026934860821828 51.4539322636296, 0.2033256341455964 51.454327828930246, 0.2038083732613239 51.45598243512677, 0.2025469156605307 51.456150980786944, 0.2030371966035629 51.457975043514516, 0.2030807377121115 51.457970104570705, 0.2035140933356301 51.45806089275322, 0.2031118899362458 51.45825292026157, 0.2031202394892211 51.45828398166168, 0.2035903667361833 51.45835889644128, 0.2034536262702168 51.45880752024204, 0.204852132293121 51.4598963928207, 0.2058201918477563 51.46000049102015, 0.2077909628221723 51.461371650860045, 0.2103520433544884 51.46208599326765, 0.2107896955244753 51.45898683468996, 0.2124756375348894 51.45729581826939, 0.2121380848727955 51.455911878555916, 0.2115042164651662 51.45551464355292, 0.213095739805101 51.45383620282268, 0.2146496457491203 51.45305052734407, 0.2129627251430265 51.45483782340231, 0.2123301880216321 51.45506200112706, 0.2129286915748454 51.45710920127402, 0.2112952115441429 51.45920123259278, 0.2107617102193675 51.46427706476317, 0.211046058388592 51.46473843542469, 0.2106685441247381 51.465417334262455, 0.2118163223449691 51.46780489875175, 0.2114963431070472 51.46907805131364, 0.2118840191608514 51.469323449576656, 0.2104243074874922 51.46977811558683, 0.2092191557292179 51.470880933563805, 0.2121833889772657 51.472922193163, 0.2120388675177729 51.474786472306306, 0.2125038532412614 51.475378429984126, 0.216288648504194 51.47627548741488, 0.2169565969279971 51.476893264821264, 0.2174052599350258 51.47788930244793, 0.2169864705431347 51.478310897284906, 0.2172302991609088 51.47950774832986, 0.2201361373590309 51.47952650173775, 0.2273904749515685 51.475860960227, 0.2289183768939516 51.47565383513246, 0.2356099378721403 51.47184377508593, 0.2381475279177521 51.469997648885226, 0.2386563066832483 51.47003739198753, 0.2391715079597352 51.469502357453464, 0.2397056718066538 51.46950114687159, 0.2396420282227335 51.46858417656447, 0.2410430859217312 51.46796834919434, 0.2421150869898016 51.46813040901783, 0.248957675684878 51.46512245650186, 0.2495533053665266 51.46482144985609, 0.2498403302424374 51.46389505051408, 0.2530115598513951 51.46256971228975, 0.2541374200233392 51.46221982343251, 0.2549137647908085 51.4626068773596, 0.2556244563056501 51.46253834049048, 0.2560874246143227 51.4620878778049, 0.2608635412426706 51.46076290223011, 0.2623777870037786 51.459185091987116, 0.2664111993261637 51.45688408637895, 0.2673805278917991 51.45593721731466, 0.2742645924539898 51.45377501094897, 0.2764911863176437 51.45356902742002, 0.278567763936753 51.45347203579551, 0.2789025328901084 51.453142676065305, 0.279229324033203 51.45351849601308, 0.2814731348352565 51.45388942139873, 0.2814266212776922 51.45356207781476, 0.2825139180567972 51.453862861628195, 0.2829086739293253 51.45360967104067, 0.2847005840739388 51.45363684122782, 0.2913371536276123 51.454745602881424, 0.2928913178358984 51.45562711195621, 0.2942368622428644 51.455877768906305, 0.2974059532751522 51.45767097945376, 0.2999241870527699 51.45796693260977, 0.3007612227982274 51.45909713723573, 0.3003289024031219 51.45940330000104, 0.301736843625498 51.46039125217111, 0.3020706191760841 51.46111466522234, 0.3035621369358902 51.461172607503215, 0.3038376492301684 51.46181198753405, 0.3045368148872842 51.46183062317689, 0.3044339911735977 51.462218443425236, 0.3053582575052509 51.46247636093933, 0.3057267516887811 51.463216441396604, 0.3067282654013086 51.4634925965444, 0.3063855099570214 51.463603712104444, 0.3072762004370269 51.46479213057951, 0.3079798986795461 51.464985113004346, 0.3088226735813899 51.46425268115512, 0.3100058903230639 51.46402070561344, 0.3100252411049056 51.46366150838588, 0.3103151282829721 51.4639291868254, 0.3110154647316585 51.46374180701355, 0.3103129761252997 51.46445434194005, 0.3103008240578912 51.46424422539879, 0.3096076474576132 51.46437388113959, 0.3088519314436497 51.464747575094385, 0.3095607916637664 51.4653280006697, 0.3093132381822136 51.4651297282399, 0.3091241072835703 51.46534749108106, 0.3092904952350285 51.46647645384603, 0.3103899193290719 51.46654921358214, 0.3099182073279611 51.46695964582458, 0.3115527688813386 51.46688061605597, 0.3126754522031697 51.46647446289511, 0.3142122277391204 51.46588655720378, 0.3153685813395774 51.46495087506402, 0.3154371617350541 51.46489220249921)))
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>