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://statistics.gov.scot/id/statistical-geography/S12000041 http://www.w3.org/1999/02/22-rdf-syntax-ns#type geosparql: Geometry
http://statistics.gov.scot/id/statistical-geography/S12000041 geosparql: asWKT POLYGON ((-3.372138120624809 56.874626531882456, -3.3690186003870006 56.875469402915975, -3.366295692847653 56.87863927619488, -3.367109966842219 56.881842277218134, -3.360915005586017 56.88410212494534, -3.3539310103464772 56.883854584071386, -3.3487344906442433 56.886983481348025, -3.3487638656118093 56.889620045440104, -3.3444011931705564 56.89108664543273, -3.338469862660286 56.89437569733347, -3.337061563074171 56.89585076610097, -3.3216174615334317 56.89550744462281, -3.315406936685242 56.89723057056189, -3.311144934042671 56.89718555281029, -3.3092970457173005 56.89903325467043, -3.3021683564462196 56.89988934448228, -3.299303766485459 56.90179239484576, -3.297872566374447 56.904790098824925, -3.2916140427410028 56.90567704390727, -3.2848543004584583 56.907278472282286, -3.286083419378142 56.90959280629552, -3.2833644706161995 56.91267543083585, -3.291098100924964 56.925456741552686, -3.2891922999226018 56.92736310347855, -3.2842469988203082 56.92856842354767, -3.278459049716981 56.92772482892993, -3.2764639968232565 56.92463666581715, -3.2719400895472064 56.92350142616463, -3.2723713891983928 56.9221763737736, -3.2699362149421076 56.91988764503637, -3.265894506528616 56.91987026644261, -3.2615960830132686 56.921737541890224, -3.256332186366906 56.9198230464776, -3.240974395120234 56.91813919880657, -3.235121009421452 56.91821963623004, -3.228325728195864 56.916633452210824, -3.2242572536935796 56.91378048799161, -3.2206808870278523 56.91340222875178, -3.212219069507082 56.91077134595227, -3.2035227113290725 56.90897322144407, -3.1994494229315955 56.90614196285461, -3.1914852451187556 56.904596532852274, -3.1864206876364913 56.904114630631575, -3.1836068322059328 56.90574048360091, -3.1798141637560597 56.90575928533276, -3.1769887674556085 56.902074572912575, -3.174166259370871 56.9005559414045, -3.1735140295015616 56.90567400794763, -3.1671906572729767 56.90799720936917, -3.1596233605331 56.90651340852756, -3.147611481506334 56.90303968968013, -3.1435232614991895 56.899824874385004, -3.1392735931443982 56.89775699286437, -3.139048890465934 56.89361281413235, -3.134775965864967 56.89020180778094, -3.1306336903230427 56.888375162269284, -3.120336960905105 56.88845894818582, -3.116601488696313 56.891987272182426, -3.113204546610315 56.893396605269295, -3.10851876704861 56.89397733786151, -3.106925393742467 56.89560408965334, -3.1086758022990195 56.897061980977995, -3.1093422557158292 56.90043399858903, -3.11235571284511 56.90321921723077, -3.108853718290514 56.90804788301488, -3.1110150903355835 56.911981606779335, -3.1104885328337297 56.91941610388172, -3.09461328923834 56.932358353915596, -3.093904036484492 56.93423323459546, -3.0986511285019063 56.94533618264123, -3.0958261143474974 56.945697866002035, -3.093886812041246 56.95020230803168, -3.089917024563976 56.949936006936404, -3.0836346393365845 56.95070938775762, -3.0824389555011407 56.95483437787949, -3.083168516124787 56.95844404757225, -3.0718351182361436 56.96032503034761, -3.069506656571095 56.96170599737892, -3.066932790744039 56.96054666571385, -3.0597557741342998 56.96290304613749, -3.058376475659082 56.96414103568174, -3.048037190272673 56.96345543924448, -3.0460362073603484 56.965116309038116, -3.0389254031161204 56.96697228675552, -3.0355956931707415 56.96700439028366, -3.0297562989770475 56.96996792815584, -3.0263384291964757 56.97278551400847, -3.023849405190294 56.971103421157906, -3.018589642063062 56.96913851090854, -3.0072682169329332 56.96682698923488, -3.00141523965309 56.96844166522575, -2.998679799199129 56.97071396728055, -2.9941194179374713 56.968091128137445, -2.9817997923668744 56.968089554760056, -2.9761380951908047 56.968578618111316, -2.973643853702914 56.969748014643926, -2.9674715955435143 56.96959374032887, -2.9540772759702665 56.96681285140649, -2.9471355403235813 56.96839735336336, -2.944673131276413 56.97378376189504, -2.930485692354921 56.972174158249004, -2.924074985886939 56.97236098017735, -2.916234184931114 56.97560337560899, -2.910242463513994 56.97579979848128, -2.9129569435161176 56.98164820637265, -2.9095961799263175 56.983027400923305, -2.9053728730572757 56.983251220176285, -2.8997889970335726 56.98573957943157, -2.8924263562450214 56.98681642986278, -2.8839153537197157 56.98564158814383, -2.8745681629617823 56.9803575060367, -2.8666728487438444 56.98045286731788, -2.8613799486086724 56.97888584970229, -2.857977054604513 56.974359053028806, -2.8510848313546373 56.9725779463066, -2.8408368299467113 56.973675857689145, -2.837060080869601 56.975812370250836, -2.8331635314203836 56.97701966339902, -2.833696978577213 56.972915082453824, -2.830325293434558 56.9699864179741, -2.8245059538680652 56.96194859034641, -2.8173240316056605 56.96215748213446, -2.8027526567804615 56.9582765726786, -2.7905387620505704 56.9572763825529, -2.7872504167456316 56.957678911346036, -2.783228725553016 56.956823752268186, -2.7728390457324648 56.95970475884603, -2.765666799514518 56.95997349207148, -2.752673255959159 56.95371445923725, -2.74921037784076 56.95033494753899, -2.7462166629152596 56.948609990235326, -2.741374503428 56.94938808275393, -2.7361101519545348 56.94419608940919, -2.734583202198142 56.94177049242908, -2.734537100713461 56.93901277645149, -2.7287439229071753 56.93353528767995, -2.7287386590631715 56.9307369156726, -2.7246838029600076 56.925841930432235, -2.718859417454561 56.923256871636056, -2.713610026938575 56.92451322504216, -2.7103067146410185 56.92444672161656, -2.7071750831942647 56.92260037558903, -2.7009269180477737 56.921418283429034, -2.6924726973498103 56.91684781341374, -2.6867489985028508 56.91507816203832, -2.679949313819042 56.90875048612785, -2.681450223086132 56.907304894346744, -2.6787320755852213 56.90320520410803, -2.6800124641289025 56.90048075679028, -2.682394844963655 56.89833413868703, -2.6795773192273664 56.894149595450116, -2.681177530795443 56.89097864883517, -2.6811462445196605 56.888360119892155, -2.6693020694654668 56.89050388747895, -2.662413989418065 56.888959488483245, -2.6611454152866663 56.88544006795287, -2.6626896109748723 56.87115692528265, -2.665215089000468 56.860857189181225, -2.665965975524848 56.8593663661165, -2.67172998563511 56.8587039377613, -2.667765207389912 56.8502643747657, -2.671108787486846 56.848646458877916, -2.6712616378688847 56.846379970358164, -2.667447772425612 56.845146297269686, -2.670550781323322 56.842291722002564, -2.665900762218842 56.83806647682904, -2.666166484010221 56.83466830604111, -2.6584110799733547 56.82989233971397, -2.6578468648939277 56.82874456165746, -2.650774408902181 56.82222083347939, -2.649992346825951 56.81490222293644, -2.6529000883753797 56.811811984108814, -2.6504004605687252 56.810193523030996, -2.643789261471018 56.81213962961236, -2.6336603684719737 56.809991372628595, -2.630749596426596 56.80811684888079, -2.6270963010047215 56.80049994211294, -2.62520354316317 56.79804249922424, -2.61717693252425 56.79301745967836, -2.615857676795185 56.787740633403, -2.6168411458592025 56.78403544190297, -2.6156748319404173 56.78327843439156, -2.605379480701983 56.782508676407915, -2.5981812910488737 56.78412634157707, -2.5947202203159727 56.78716047248657, -2.589409596113838 56.78825300361451, -2.58054491575089 56.78605935616168, -2.5732546130928857 56.786149751324935, -2.5687518117732484 56.78560527472721, -2.5585594476166427 56.78700964774558, -2.552587225566236 56.78559083115559, -2.545107005254867 56.781731960714865, -2.5385967271319854 56.7822930096039, -2.53083342337093 56.78523788783512, -2.5227252694497166 56.78241892853594, -2.518748178126342 56.779686507422156, -2.5154998566313087 56.77551091539061, -2.5075651002560866 56.77402251672029, -2.5026924726562374 56.77011553275795, -2.492376697381044 56.76632957669642, -2.4838114807525495 56.765085637593685, -2.4779534938287724 56.76159832392352, -2.47478089191937 56.7552994129472, -2.4720699346832635 56.75338720927076, -2.4669639729158637 56.75164111376285, -2.463435240859774 56.74819017360226, -2.45977610544577 56.747141887313596, -2.4547828963859364 56.74837212240123, -2.449567098008616 56.75140053109848, -2.4446992378320296 56.75169919383725, -2.4362146195853343 56.7510509265354, -2.4285016358746154 56.75279541090062, -2.4227529411660895 56.755213627185576, -2.4273685877854536 56.749941512550585, -2.4298835191768595 56.74622446972309, -2.432019306684585 56.74470151974603, -2.4363473505052555 56.73810767334212, -2.4404726090433666 56.73093043054437, -2.4463377375157243 56.71847514462835, -2.4476680597954235 56.71136428755496, -2.4485555275430815 56.7100332273251, -2.435242147884978 56.701748981877486, -2.437825611995543 56.69908068561991, -2.441859189757403 56.693378826645755, -2.438657379855912 56.69154666566189, -2.4378676237020085 56.68905563511228, -2.4399782362343507 56.68610595154636, -2.4481229944433966 56.6823144911806, -2.4460408112371126 56.680563895364685, -2.451759883617956 56.678249647801806, -2.4585736284454938 56.67730389047524, -2.45972518528115 56.676043707474946, -2.4636676622316265 56.67561406278271, -2.4668784767341876 56.67382503420782, -2.466251131528804 56.67033449020451, -2.4696567788529564 56.67075566152221, -2.471866304539967 56.672198136415055, -2.4791486187393126 56.67216942085982, -2.4830014830135494 56.670904879699876, -2.4842400062899963 56.66861640438225, -2.4896597539128598 56.666941303511216, -2.495245199817161 56.66312713497405, -2.4987398788306177 56.657585384414226, -2.5000103138617633 56.652022847177406, -2.5025481705944346 56.64750455344662, -2.5039798196942122 56.64125496224067, -2.500955654721581 56.63328952447983, -2.498514384579797 56.6309913110092, -2.4945801905730995 56.630179654697656, -2.4865861246748695 56.63050854939787, -2.4813547829776836 56.627900160450466, -2.4786687349607788 56.62467814845636, -2.481291977435581 56.622704171282024, -2.4806838293675955 56.6211505088109, -2.4862778948926114 56.61833476365894, -2.4858659239769754 56.61518392613972, -2.4935259316997267 56.60959898546943, -2.4929601930430647 56.60769395025945, -2.4996179724547627 56.60473326290262, -2.50404094854848 56.60037615942356, -2.5035404439910494 56.59874043404337, -2.508814882149399 56.59687095680902, -2.5160732465226494 56.593166582143354, -2.5188517775332957 56.590226278165304, -2.515855529340991 56.58914175911139, -2.5165131025403964 56.58637913698548, -2.519553762680482 56.58526597741427, -2.5202532363247885 56.58154277659044, -2.523816728651097 56.57931506388081, -2.5327713885358447 56.577355346328474, -2.5356379652745162 56.57529104329169, -2.5351570626422713 56.57086042261112, -2.5382311346004074 56.56878716953447, -2.538829254254576 56.56587908456753, -2.5441169390534197 56.564006231189055, -2.550824481890512 56.56034090525871, -2.5558903678502656 56.55908663365362, -2.5646258966852615 56.55922598491644, -2.5719130562415558 56.55675446625388, -2.575850406004004 56.55410480246586, -2.5783910445462985 56.55365102549897, -2.5834112429156764 56.556411727520334, -2.5838195911440742 56.55124213518402, -2.588001079195095 56.54994938429697, -2.594052963691516 56.54929261470653, -2.6009926189809436 56.54976508393966, -2.6060686319627004 56.54871447438605, -2.6104065834901573 56.54599259193871, -2.6191445505107964 56.53848535893206, -2.620502379515469 56.538991610374325, -2.6270774444291374 56.534121505572294, -2.6308946489135625 56.529994651853, -2.6311724443129134 56.52636460550847, -2.6427267603526023 56.522042353803286, -2.648077404122762 56.521372191902294, -2.6527764311872066 56.51722567212201, -2.6574858294717 56.51655308176526, -2.662597464965396 56.514170227296475, -2.667377642837931 56.509232149907206, -2.6722501818709574 56.507107139874364, -2.6787859704900403 56.505078030817764, -2.6804218457182185 56.503712405322, -2.6855007164040163 56.5024716862164, -2.6899547207222616 56.50262575442686, -2.6898179359197063 56.50010195804372, -2.6949816194930465 56.497778628140594, -2.703083416573097 56.49819207216311, -2.706198441535386 56.496073050527855, -2.711749020203094 56.49020157574694, -2.7139839937049093 56.482357178660855, -2.716731827633186 56.47609997642176, -2.719747635576461 56.471271485229, -2.7248623017345315 56.46718172433813, -2.728143534089093 56.46266501770386, -2.729780148343537 56.46194288583385, -2.737680581397293 56.46197081830753, -2.7453905521180233 56.46346278398487, -2.765153989366913 56.46919852048813, -2.783309913573389 56.47367449608576, -2.7878349541581144 56.47449840676545, -2.801468137542975 56.4755153517412, -2.8046409920713087 56.47616414722707, -2.8104087060291962 56.47561897970845, -2.8163227743103283 56.47576983508258, -2.826528460949633 56.47387128033126, -2.8252591712333577 56.47088439136013, -2.820929801433746 56.47132545248909, -2.81622346126637 56.46894865396263, -2.818773800877644 56.467009217296685, -2.8224512917726745 56.46744764637871, -2.8257530202052608 56.469109360254876, -2.832202069969131 56.468462535444345, -2.8391675944717765 56.474529545977816, -2.8455122481979305 56.47784209166681, -2.8426273187265236 56.47894077812595, -2.8428408780823995 56.48169026847321, -2.8376075478611633 56.4850678949591, -2.839349540604902 56.4868880525743, -2.8356418457523356 56.4887207320269, -2.837926441247257 56.492166098623244, -2.8498265915640757 56.49167188315064, -2.8515713048268685 56.49292222864647, -2.860603397519884 56.492284135884866, -2.8617508978451003 56.49583395115141, -2.880984402106776 56.49403151722287, -2.881725476990346 56.4947521665421, -2.8890610700664445 56.495956776103824, -2.891637757885625 56.49397703417629, -2.8965035582171614 56.493203426111606, -2.8992216511701883 56.49509564095634, -2.902115824420935 56.49528850647451, -2.9079423284916586 56.49774909619824, -2.9150016635422995 56.49632719388656, -2.9183775366593347 56.4965502617444, -2.9224777302493825 56.50259239762449, -2.9260452132035106 56.50245267653165, -2.9324713240226408 56.5010353120191, -2.942833548499379 56.50042966082535, -2.947199715214096 56.50399115311695, -2.9493113400619553 56.49968763203116, -2.9547798927909694 56.49971576666971, -2.959020161797673 56.49882784099879, -2.961923421605562 56.500640921448266, -2.9684562928588902 56.50029096158237, -2.9680545858317706 56.495365198127516, -2.9699299764502487 56.49425621056728, -2.975638030754268 56.49541632522756, -2.980593640553347 56.494283027452695, -2.9826100692018445 56.49607029417477, -2.986615354766266 56.49555962116675, -2.993285907766034 56.497039206773906, -2.9951381019898973 56.49829567722809, -3.004771779415672 56.49888384495416, -3.00977676992283 56.50169940994733, -3.03172256862646 56.5024668971942, -3.0321335150526414 56.50025329582272, -3.0449542412280617 56.4987274698293, -3.052029024503357 56.496862721090196, -3.0509541227670782 56.49036069913186, -3.051087077567617 56.48254120523566, -3.057824902037936 56.48368613122998, -3.068497694928709 56.48401788331328, -3.073584732224903 56.484524777012, -3.0820143721232633 56.483224297426865, -3.0845002317583434 56.48094210114557, -3.0893294321454166 56.480899823120204, -3.0931024002023673 56.47975531328106, -3.098038569226464 56.47925977720119, -3.08942477272373 56.46694591744431, -3.099803312688133 56.46746715005432, -3.103906615862729 56.4670820418001, -3.1196097719822835 56.467678196123174, -3.1234342289860497 56.47423209454043, -3.1168446538679757 56.474113617832444, -3.118556942840684 56.476637254993896, -3.1286486343320976 56.47784418907271, -3.1301140750639544 56.47918760234216, -3.1436265977736086 56.47975386928008, -3.1420410383495394 56.48756088092426, -3.1578855211013104 56.49041676482539, -3.162193550043908 56.49034058886865, -3.166829976708651 56.49218119536882, -3.167942615417236 56.49361281305705, -3.177592311262963 56.49670673883732, -3.1785608284759697 56.49818543825428, -3.183790110781546 56.50131986357562, -3.1915655821919935 56.50329666348755, -3.1934381218295766 56.5055518802485, -3.185980157798775 56.50834741746057, -3.190130253374723 56.5100121670092, -3.194852090638164 56.513876032405946, -3.1998128130654195 56.514523610050134, -3.20667577711855 56.51799986224242, -3.210508123804675 56.52146389982081, -3.2120646945010716 56.52429506888615, -3.2086595249152383 56.52537942293223, -3.2008555385325126 56.52590977586555, -3.195170756456767 56.52420715630623, -3.184136929881515 56.52338649325116, -3.1815516685743797 56.52477503795591, -3.173022576602259 56.52620173685093, -3.1736210864825027 56.53099655275928, -3.1640433038037687 56.53815040915356, -3.171175306278134 56.542091364679564, -3.174659109483385 56.542939890577145, -3.1793049691522155 56.54631814056338, -3.18169996448591 56.55109495040553, -3.1840266508375312 56.553768230547135, -3.1903608575970956 56.556338389926665, -3.1902028056780907 56.56130571988706, -3.183604793158371 56.565005728077836, -3.16247861538453 56.57002437869639, -3.15304107869553 56.57436649694146, -3.1491160295269016 56.57445133931263, -3.1326574674756804 56.579100893523545, -3.1278472154492127 56.58200617717435, -3.123006820889047 56.584023947673714, -3.1163691917056355 56.58955253948284, -3.1173138664766045 56.59027715980504, -3.1121340985384998 56.59388240218052, -3.0979433929892197 56.598327254534915, -3.1015668995003027 56.605755024554256, -3.105270399131435 56.60739783004658, -3.0881410137759344 56.613196466139854, -3.091307239015798 56.61710565519193, -3.096005465656615 56.6154866898279, -3.105511704459538 56.613701859176686, -3.11064906780483 56.61220417870527, -3.1128662339282354 56.610032573681934, -3.1168945801926764 56.60972961748522, -3.118834825077286 56.60708156453078, -3.1216990333677774 56.60764246619187, -3.130601840773981 56.602669777245204, -3.1352692676402296 56.601495271740454, -3.137029535213493 56.59790151126625, -3.1423335569748336 56.59712069954232, -3.1444572742016774 56.595557628685306, -3.1489533232397964 56.598224139719434, -3.1549795527422906 56.59907837381624, -3.157056208733068 56.598488628109344, -3.164423558534888 56.600149346294934, -3.165967372896779 56.601093527361535, -3.162195425982156 56.6032312362735, -3.1612024016758538 56.60547764601934, -3.1556841046102106 56.60662609398863, -3.1541403869419513 56.60846241352237, -3.149919370713546 56.60814483312152, -3.153060924117374 56.613886552528704, -3.1555013416492046 56.61451258309044, -3.157530713105963 56.61741185552562, -3.1608949852246546 56.61924479692317, -3.168180236563051 56.617950209830816, -3.17408878729695 56.61773282416083, -3.1809385684338385 56.61577225903751, -3.1858426775297524 56.61757194050836, -3.19128188278807 56.621960121335725, -3.175609668645065 56.62424842504668, -3.1713489490918154 56.626130445742376, -3.1775017615209977 56.6300516381078, -3.1779037703314086 56.6333298312498, -3.177040920049455 56.63577551117657, -3.1737439502429465 56.63565485832389, -3.155882571393565 56.637165200101556, -3.153670322157821 56.637918830476295, -3.1486057079460785 56.644018480644775, -3.1487834912851604 56.64611114356502, -3.151811530404556 56.65144776322931, -3.150739668656458 56.65267238544484, -3.156935512319624 56.65563465799113, -3.1695805711990843 56.65579142553688, -3.1757351368133326 56.65196805372259, -3.1815676260955645 56.65175555118047, -3.1862074184380234 56.6543879417999, -3.2050755210759716 56.65471427513421, -3.212983682020005 56.65543353344641, -3.223680340092559 56.65837992071298, -3.226021208096032 56.65792296915773, -3.233984594017586 56.65945070931673, -3.2393057594448753 56.65988574886647, -3.2442993772042703 56.66136960899958, -3.2603794238018993 56.668415268182784, -3.2628541207704664 56.67039640942718, -3.2688389306348316 56.67012798783046, -3.271846841285576 56.66616659238328, -3.283570769482706 56.66550357564662, -3.286763246957626 56.6682127442382, -3.286785842109005 56.676392977318976, -3.2872414246940824 56.67869458029256, -3.2900649660539147 56.680551223842734, -3.2960650601105543 56.68315379481634, -3.2995701790021563 56.683732713633, -3.302953482548985 56.68668918382824, -3.3030462274573646 56.68819315109351, -3.308527936213845 56.68995956644871, -3.302022710141877 56.69496030914296, -3.3066074523898656 56.6988564798462, -3.3068068936463706 56.70272222137339, -3.314030125407592 56.70635688378324, -3.315283161159847 56.70996898017347, -3.319285665514291 56.71020519141285, -3.32790539654669 56.70912082759767, -3.331800491735531 56.71024718205843, -3.332659192455871 56.71235838757959, -3.3377012502120413 56.71655860349887, -3.338538029717349 56.719415693473934, -3.3444743690614773 56.722986000465404, -3.3527837030998597 56.72616202678407, -3.349109921278731 56.729449760171306, -3.363946250854911 56.738129107618846, -3.3586330199468946 56.74220327731048, -3.3569991638911136 56.74585987335914, -3.3580090574968358 56.747794021286374, -3.363749365589574 56.75141955126193, -3.367323178072567 56.75278195897666, -3.3718659785765963 56.75245351636689, -3.3776591969438914 56.75322522679754, -3.3831090299858873 56.7577739285756, -3.3876537589093183 56.76480334391178, -3.3897975248139325 56.76924479947922, -3.3795082707833446 56.77711278401868, -3.380009254946403 56.78139740935426, -3.3741185604781916 56.78927004972603, -3.3702663814599005 56.7902513153, -3.3667476433611068 56.79320538003948, -3.367169773784612 56.795357055746756, -3.3626005657851015 56.80006554378279, -3.3603036607644827 56.80039599737169, -3.357641749014122 56.80444558284005, -3.3592138218892105 56.80715529339047, -3.36204743409828 56.807838635047936, -3.3644875285096445 56.809860486267006, -3.366731109777937 56.81344766031051, -3.36002031596475 56.81789195237429, -3.3516366677641063 56.82028762271489, -3.3585402805605824 56.82565722586431, -3.36407601411155 56.827155655702086, -3.3702434146217075 56.831131129734146, -3.3768900384124203 56.82981811562532, -3.3809846948907496 56.83398208247047, -3.3815490985174605 56.83640167780591, -3.38494836629191 56.83701537721686, -3.392801364933671 56.84257476837319, -3.398409768989958 56.8437204988439, -3.4015316935422306 56.84302962516585, -3.407021820854091 56.84341705335122, -3.4030890785252095 56.84565803510704, -3.400829244531426 56.849021196156045, -3.39783066313674 56.85105382673972, -3.390899543281781 56.85140976609094, -3.3873772510556295 56.85503831265273, -3.378347326536321 56.8612207776486, -3.3783554680319012 56.86411815712148, -3.379689014685783 56.86692455269545, -3.3785113042723784 56.86946667819329, -3.37420457552108 56.87392999212322, -3.372138120624809 56.874626531882456))
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://statistics.gov.scot/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://statistics.gov.scot/sparql HTTP/1.1
Host: statistics.gov.scot
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://statistics.gov.scot/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://statistics.gov.scot/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://statistics.gov.scot/sparql

Request the results as JSON, using a GET:

curl -X GET -H "Accept: application/sparql-results+json" http://statistics.gov.scot/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://statistics.gov.scot/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>