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/S20001198 http://www.w3.org/1999/02/22-rdf-syntax-ns#type geosparql: Geometry
http://statistics.gov.scot/id/statistical-geography/S20001198 geosparql: asWKT MULTIPOLYGON (((-3.17867465810001 55.98932431622567, -3.156785290672906 55.98159482392016, -3.155645108123459 55.9792055798235, -3.151259038283991 55.97614306468974, -3.141624763052772 55.97276253547347, -3.137203236739997 55.97006284986729, -3.1378387637911325 55.96862647011205, -3.1348841635938167 55.96774447570765, -3.129637248421009 55.9649415420839, -3.1290688664535837 55.964401405200576, -3.1249191705550636 55.96189830204154, -3.1195373081298934 55.9590845877515, -3.1162109307870463 55.956877329071474, -3.113656910404362 55.95678995253987, -3.1106646171522 55.95531997796725, -3.099638797080244 55.950904665652985, -3.096045874572855 55.94956734519389, -3.0938337406449152 55.94897599575965, -3.089555221959384 55.948984266418115, -3.086214962593274 55.94870646136373, -3.082604066789448 55.94813442255483, -3.071887191023498 55.94543547952622, -3.0676719092715707 55.94511268355585, -3.064073758621423 55.94568556646683, -3.056907283217288 55.94805384989312, -3.052821095227216 55.9488884817068, -3.0494292296512873 55.94905943860753, -3.0488609137772524 55.9495766846709, -3.0463639281507975 55.94947282596462, -3.044183790111676 55.949898442159146, -3.04216428476574 55.94935614754317, -3.046458591854965 55.94745024603729, -3.0457970911973717 55.94635620476293, -3.0431400778432267 55.9462333943497, -3.04105132148828 55.945510350337436, -3.038278636777375 55.945726296324246, -3.0352642406053474 55.94559501542788, -3.031146761840141 55.944901739371375, -3.0269548590040616 55.94441560857705, -3.027684982811012 55.94619817773238, -3.0238110114503094 55.94602318813655, -3.0205397569892973 55.94699689503058, -3.019066059635083 55.94520892829055, -3.0172824985514004 55.94612306946385, -3.014554680784032 55.94659160299335, -3.013730689135137 55.94590966449139, -3.016211182509075 55.94441485058205, -3.014081031835844 55.943165479129895, -3.014088391879779 55.94222196357784, -3.009128770907757 55.94236153039368, -3.006205727003574 55.94447901041133, -3.0048252676171794 55.94372652992287, -3.0004501741765264 55.94516889976789, -2.999743697373068 55.94358105289634, -3.0080127060349233 55.94254138836231, -3.009060890104057 55.94159832856178, -3.0067218005060754 55.939685640544354, -3.005791765813365 55.93841522531864, -3.0082347038993196 55.93814576835759, -3.0091887095532828 55.93736497866791, -3.0083016298340572 55.9363088973987, -3.0112960906424027 55.935009515319635, -3.012480015080606 55.93273774084169, -3.0184725433245116 55.93418888063743, -3.0181751976188442 55.93454718384061, -3.0259745188857505 55.93679241752445, -3.021032190898597 55.938390780817386, -3.0254277929566076 55.93978389347999, -3.027817863408856 55.93925993265641, -3.033141564375937 55.939604415666665, -3.0323209299151417 55.93718990730973, -3.0329129865584243 55.93657164243919, -3.0352985194810143 55.936079274912935, -3.0349348766531214 55.935049028330354, -3.0382119432334793 55.935479701317185, -3.0395739439037235 55.933627040049544, -3.041182753812337 55.93434106476363, -3.0425781814298913 55.93376705375319, -3.0407609126334156 55.930246700312225, -3.042392139389756 55.93099467289177, -3.0435706760738466 55.930111390413686, -3.04614081690906 55.931102593675035, -3.044713770485449 55.932836556657755, -3.042873149919675 55.93439802674734, -3.046711057814738 55.935669054944796, -3.0475435501845274 55.93485258814136, -3.049701913295765 55.93534637711133, -3.051718663832693 55.93533815894842, -3.0518192870496623 55.93626775811838, -3.0530091435174325 55.93658065069662, -3.0550234340443843 55.936337675789524, -3.05375132259246 55.93473673936187, -3.0595418569410984 55.933411145745744, -3.0592000419148753 55.9320303421811, -3.0606905791049397 55.93059091993177, -3.055693989111446 55.92960568242703, -3.057868103488757 55.92896879983958, -3.0615006209914863 55.929530579293555, -3.064520103236318 55.92619361020832, -3.062381093372854 55.92526559920211, -3.065508399491944 55.92455369817648, -3.0648773420859463 55.92586493816081, -3.0721926908137163 55.92849549821344, -3.080811296818113 55.930694052680835, -3.085762456039164 55.93131728435392, -3.0885871444147237 55.93139933750395, -3.092184242246585 55.932023515677486, -3.094287982248589 55.931643630391626, -3.0986242051619435 55.93136511866217, -3.105335237005957 55.93005969819354, -3.1097673078417727 55.92961549971665, -3.111669420347917 55.92969448993796, -3.1130125103242348 55.926273211474914, -3.115609396162282 55.926672804551096, -3.112895715649765 55.929007186802515, -3.114521698375408 55.93106676165035, -3.117866128037434 55.931619830808486, -3.119057447883273 55.92900497589899, -3.1220077128712966 55.92734715430945, -3.124709186618871 55.92647263065787, -3.1230294874535804 55.92569914677192, -3.120583312847029 55.92616118313255, -3.1180607671180827 55.92421681294412, -3.120666763877771 55.9235512284666, -3.1221634571935186 55.925160175086184, -3.125694947975143 55.924838101628765, -3.1269316405713887 55.926253643184175, -3.128994839608807 55.92620779072499, -3.1335457735022136 55.9284611743096, -3.1352978160009073 55.92830635529811, -3.1360397826686253 55.930350332010654, -3.1392342200749312 55.92991434264199, -3.1439588071773 55.92892707902182, -3.1472906867479646 55.931187367524615, -3.150500158402102 55.92984556245454, -3.1541788247607134 55.929218104098815, -3.1554834145392445 55.92826871502453, -3.153729183975339 55.927620847422276, -3.154612041637981 55.92684179913975, -3.1538123050473295 55.926040685084665, -3.1495480705049252 55.92309738830692, -3.1468789490929696 55.92158576018509, -3.145703495927539 55.92242336368668, -3.1427881258919954 55.92123741490952, -3.1397206477307957 55.923109162567954, -3.14187008103226 55.924493920594955, -3.141955780358744 55.92602391427101, -3.1384374213148805 55.92621455929314, -3.13671766397671 55.92595051174533, -3.1318578586190546 55.92256813411265, -3.1299029425016296 55.92199442146265, -3.1268940987837808 55.920072335583455, -3.130035868306843 55.91804652700214, -3.1319782116301527 55.91767306603077, -3.130354038222866 55.91682350703592, -3.1308997715171025 55.91633328208057, -3.1255641137001775 55.91330914544558, -3.1278479304725866 55.91151811412045, -3.1258434950406837 55.91007061594157, -3.122964315496779 55.9084229725319, -3.1259137352636577 55.907155640044095, -3.1268159389746195 55.90588435442754, -3.1285696153899183 55.904826517735884, -3.127520079074777 55.9040811571034, -3.128028735328956 55.90342055888834, -3.1313370192233134 55.90403631255341, -3.1330408407941532 55.902520915399464, -3.1338510923794862 55.901237518690614, -3.1354463928887295 55.90164513347568, -3.136277487374206 55.90075187507167, -3.1388400847434803 55.90120045583569, -3.141505042741513 55.898273463495165, -3.1433531803805503 55.89893490633682, -3.1449792759595887 55.897478529757905, -3.148968761062822 55.89496533507626, -3.1511190536502256 55.89470761443627, -3.154149498661002 55.89538803559077, -3.1559703719521384 55.894777907134724, -3.157756674423122 55.895156473877876, -3.16150515168588 55.894303490456736, -3.160715983203093 55.89287599090345, -3.157747776742313 55.89432090494762, -3.156041935470031 55.89342042297881, -3.15712585686765 55.89181765733801, -3.159016406489087 55.892367977333514, -3.161808938016389 55.8921620702911, -3.1634353179297925 55.892542072700536, -3.1621006695023484 55.89550192939906, -3.1628618659080794 55.895726927140856, -3.1621351787769023 55.897190880417575, -3.162167005698819 55.89879000120229, -3.1639624613662334 55.899752666481405, -3.1656460791302687 55.89907298620235, -3.1667848376045318 55.89946529809753, -3.174367231783152 55.89977045985786, -3.1775872305818087 55.899442164274284, -3.1785620183989116 55.90122995108117, -3.181394511031366 55.901235726291326, -3.182830401069564 55.90284624477777, -3.1865492460100606 55.9024482803572, -3.188919589756171 55.904557968467984, -3.1835776927400783 55.90496574920252, -3.182134882466628 55.90577632132948, -3.184503121712638 55.906955096078995, -3.186039152339881 55.90718361941587, -3.18527889484423 55.910446971237285, -3.1818105584334924 55.91260244581529, -3.176407005198379 55.91414306089634, -3.1682395887330146 55.91459194668482, -3.1690199642165053 55.9160671474602, -3.170780274624344 55.916077380016354, -3.1697138936067724 55.91785766568941, -3.1679875846606245 55.91826186526165, -3.1679967467507475 55.9192846775788, -3.1704694382756395 55.9195667068172, -3.1744900344888274 55.919177992163526, -3.1805635944404336 55.91894919168796, -3.187842565146106 55.91889716571185, -3.1904593315011 55.91969856436868, -3.1958988421867445 55.92018499160345, -3.1990951848314246 55.92005506919529, -3.20064843869639 55.91957268772442, -3.2003500075295994 55.918200811069475, -3.203571118829905 55.91737131171898, -3.2033448834382248 55.91547042209034, -3.2059209564531335 55.91467796369329, -3.2079438955395796 55.91438856950953, -3.207511356894457 55.91334149412117, -3.2091688479586375 55.91241274653096, -3.2088439717243467 55.910408124241954, -3.2075199128853624 55.91052895180938, -3.2045319683229683 55.90961472650583, -3.1994719246357657 55.90945745599101, -3.197854490564872 55.908484540828425, -3.197399203925263 55.907087476500394, -3.1964044057579044 55.906989320521944, -3.194309989068379 55.90546414148187, -3.1930306777646673 55.90492892976418, -3.190805926778857 55.90177807779651, -3.1888675850118515 55.901285910934895, -3.189338306799878 55.899167533708216, -3.194906240555691 55.89900412857703, -3.195026806644378 55.89792944551792, -3.192607014802042 55.89757352303371, -3.191949532426924 55.8963037898321, -3.191890571106063 55.894902614676866, -3.1965846538144884 55.8964425874112, -3.1959146450132074 55.897797209724416, -3.198489701391505 55.89836089247782, -3.1990727356368396 55.896422331853465, -3.203729103048768 55.89769737335338, -3.2019858405435815 55.894886239097055, -3.2008623664924234 55.891714503726455, -3.200743250284588 55.89039478710957, -3.2068926172688093 55.88966352882021, -3.207031885125363 55.89259459346957, -3.205699663524344 55.896724513661646, -3.207380796960596 55.8976328498521, -3.2195484420395077 55.89925929789572, -3.2232885620303477 55.89918144136653, -3.2310655675333617 55.89982757417372, -3.240591346384551 55.899265915809586, -3.2474180260767507 55.89849251076306, -3.2511097741174977 55.89828862649112, -3.2562093304416817 55.89831541083334, -3.2600421553116594 55.8985960061303, -3.2655098569525887 55.89942797247253, -3.2674290853445496 55.899162055554534, -3.267082382284615 55.89833894544729, -3.2732747521248093 55.89745736114558, -3.274841712594836 55.89793535523598, -3.27516321409252 55.89880094702813, -3.27251310962998 55.8995948259687, -3.2702880399555068 55.899939895319996, -3.26942840089372 55.90079666806741, -3.2718578859150544 55.90207300390535, -3.273716953856056 55.90358683594088, -3.2753325006720844 55.905437310387896, -3.276246613888521 55.90467800693438, -3.2790979062136265 55.903830723585365, -3.2804878418071106 55.904265557943674, -3.2823980136982494 55.90349986724893, -3.280568386740107 55.90213572270159, -3.287344855178989 55.900222954326416, -3.288102592031853 55.901031160598315, -3.2904806672726687 55.90076464072818, -3.29688581548853 55.89715697675447, -3.2963647966235796 55.89672599393472, -3.2992370978426115 55.89582174774318, -3.3008207957347615 55.89622587692057, -3.3017690315971135 55.8973210931759, -3.30321663558058 55.89661387902297, -3.305961191945236 55.895955795299614, -3.3056661886419483 55.89526702595513, -3.307101284257143 55.894667726110015, -3.3096781691827184 55.89455369745753, -3.3118675552544747 55.895165153234906, -3.312774017515646 55.89406821950109, -3.3149519406533665 55.89274203723168, -3.319141215249601 55.8927331673733, -3.3216019835582213 55.89126905723073, -3.324525718558211 55.890258187828074, -3.3262807839553656 55.89108394891251, -3.3335025005347854 55.88911867893321, -3.3357565124018507 55.88901864257924, -3.3377186706251973 55.886116853141154, -3.337678597140273 55.884924214337516, -3.336388454766018 55.88416343233257, -3.336272294729905 55.882848406407064, -3.33735118506526 55.88238944924266, -3.3365816873324023 55.881503842056865, -3.3337508227863952 55.88187479704498, -3.3318133201535445 55.87894737271975, -3.3292367835829606 55.87767778609981, -3.3241390862696143 55.87670581649773, -3.3242503943541255 55.876072670129275, -3.327073096412051 55.87650105039131, -3.3301256930934535 55.87494000540548, -3.328791920920076 55.874262510554566, -3.329353931509119 55.87293553460402, -3.3332382999486323 55.871087374871124, -3.3368860484820013 55.87678072084733, -3.3385053204381054 55.876457604338306, -3.344133136752636 55.87418576671186, -3.346168140093035 55.87433425323013, -3.347754019885837 55.87690329976175, -3.349643191627813 55.8789600460883, -3.352195177306833 55.87805119393941, -3.3541864581118745 55.87969166973047, -3.356846873779056 55.881261838469776, -3.3551986460343 55.88161198671407, -3.3542675178091463 55.88009095965971, -3.351076322181387 55.88026763957146, -3.3504926376770165 55.881278996918596, -3.348370573534642 55.88252460690935, -3.346730546821329 55.88272979932413, -3.34491238237456 55.88424131705842, -3.3474262158131247 55.88575738007314, -3.3508500958364023 55.884886169149, -3.351446347768109 55.88548167054403, -3.3532225625688667 55.88506678122229, -3.3565109848254826 55.885381028846666, -3.3583242062199656 55.88592914008802, -3.355835224498423 55.88695166715192, -3.3546123508620624 55.88675720047587, -3.3472957349042876 55.8884295750007, -3.3483589565385046 55.89050262953542, -3.342660152198637 55.89170611222545, -3.3419517091235322 55.89202833871138, -3.3371290125664173 55.89005338390871, -3.3336073136209943 55.89142686973256, -3.3353678100509776 55.89265903046477, -3.336903924657231 55.89293596616747, -3.3335566738428812 55.894824278339705, -3.3227939670286593 55.89810337235314, -3.319650170244021 55.89877509786022, -3.3158512039890002 55.8999389748586, -3.317546382256977 55.90134956253355, -3.3199342801168736 55.901018488209644, -3.3215978800117547 55.90149484590924, -3.325746556574815 55.904487411458035, -3.3264437978254957 55.90616921500935, -3.3285163887087474 55.90643441132313, -3.331996607482789 55.90902962385533, -3.3329342883094273 55.90931600485802, -3.3373298743427964 55.91431831319942, -3.3348776483314153 55.914659421358, -3.328605263642289 55.91511364358103, -3.3266172993632845 55.9159348039471, -3.322162552131478 55.91701234123708, -3.3242293889169328 55.91877256046859, -3.321567564855221 55.919412640604655, -3.315406138160171 55.920184731253954, -3.3084365716350628 55.921502749447875, -3.307862669677229 55.922015789861106, -3.3146966560244002 55.926807422308514, -3.323456771008367 55.92601480782989, -3.3256069856752095 55.92946015398101, -3.3256672083517502 55.930286187856524, -3.3223448583878428 55.930959885666894, -3.323874016260437 55.93289125510091, -3.3259109751223135 55.93601642161295, -3.3250295445600146 55.936457218636896, -3.3221941862647832 55.936874070445505, -3.322430142853794 55.93872356265257, -3.3217250924901425 55.93959639481742, -3.3287274899311714 55.93836121298625, -3.3306873464989635 55.94070970894115, -3.325113162116023 55.940974260378994, -3.323645706362701 55.9418814641041, -3.3216755427543467 55.941857690134135, -3.320136378396842 55.94273681712429, -3.3203492314944945 55.943345560005724, -3.31908684355251 55.94466740331258, -3.3176793769236546 55.94520249238811, -3.3162234110277966 55.94441453435461, -3.3172764264753303 55.9433874516705, -3.313365337625088 55.943734706105175, -3.314123363906164 55.94548078941932, -3.3141052466839125 55.94856109673293, -3.31227069391301 55.95160880882249, -3.306741630611764 55.95909867123436, -3.3106081300313193 55.95880601618853, -3.317848041255259 55.95785718740862, -3.3184375141569746 55.95964800605813, -3.3199279822037555 55.96061148162461, -3.320486895823653 55.961971307961576, -3.3240840892220564 55.96176197869054, -3.3277511060269673 55.96265702462978, -3.333821573451561 55.963094658595395, -3.334119887098712 55.962453448603966, -3.336991808949064 55.96211679927331, -3.337673669805699 55.96237897716544, -3.3394076570312197 55.9643459686238, -3.341495272447731 55.96402673246268, -3.3428670547718324 55.96431730256128, -3.34337317906613 55.96551586293427, -3.344589240870592 55.96593390184873, -3.346483113993616 55.968488536593945, -3.3373386660499653 55.96984968056919, -3.3346254983180046 55.97062490191234, -3.3306231608300276 55.9711067348803, -3.3245798525583874 55.96705723468502, -3.325172182828284 55.96592041195888, -3.322714118947391 55.96495217623319, -3.3193168497404373 55.966189110866026, -3.3176306486583136 55.96525344651696, -3.316099010832942 55.966259463069704, -3.316741459101372 55.96725000267717, -3.314402881722597 55.969629197946155, -3.312699168627498 55.97076412458898, -3.3164765382600776 55.97149288074789, -3.315501097711847 55.973063997406015, -3.320289495391748 55.97349949606271, -3.319311046388946 55.97590261623766, -3.3210798800623893 55.97608135151183, -3.3192590996074407 55.9790840746743, -3.3201061286206275 55.98136633239679, -3.3170779626807287 55.98295325467419, -3.3154772329907014 55.98409798651114, -3.311452943135118 55.98287929675023, -3.3085281383913787 55.98303084486273, -3.3046836512926974 55.98152607363529, -3.301858483756697 55.97953593987756, -3.2989524081150376 55.98129187600588, -3.2947407288617945 55.979814921463024, -3.291711893866773 55.979195255316874, -3.2893571358101044 55.97903477256093, -3.2832163687572717 55.980018089592626, -3.280319841666546 55.97981016306037, -3.276458378915715 55.98027340370957, -3.272016814037333 55.98011172669301, -3.269352708296597 55.97975642912809, -3.2675975032232616 55.97984545848027, -3.2648215930112374 55.979253075141315, -3.26205990096732 55.979337978115424, -3.259989922044422 55.98014543396157, -3.2596202163744676 55.98090216327827, -3.254804018879135 55.982282112201105, -3.250604639695576 55.98376870897706, -3.246514335653026 55.98382092237932, -3.2413279738981866 55.98353182287009, -3.2394318801576536 55.98323102238632, -3.2373735147526466 55.984021808035294, -3.2338592829777775 55.98369394806932, -3.2303722613022248 55.986896176471426, -3.227321302363887 55.98687628815421, -3.226068879069704 55.98594797377427, -3.225951955367586 55.98503889992721, -3.2233433021708415 55.98465780267674, -3.222975456249327 55.98133239225993, -3.21953370143533 55.98029357809512, -3.2168904878765185 55.980276584919, -3.2135935480450195 55.98078168243247, -3.2034994585453864 55.980045072204156, -3.1993430361465958 55.98033180876017, -3.1954726908829385 55.98106126937296, -3.196353190773957 55.98352283375842, -3.1951842129629777 55.98511291196287, -3.1854838845125633 55.98878634220367, -3.184591320208964 55.988115640183494, -3.1809630015546038 55.988195369642085, -3.1800986946512557 55.989607215257685, -3.17867465810001 55.98932431622567)), ((-3.290123424108049 55.99545059841147, -3.287867991686141 55.99517406094277, -3.2875352436437013 55.992593317566396, -3.2900554918157887 55.99110229589485, -3.2910634992824956 55.990995624309235, -3.292295605204915 55.993425812849665, -3.291465201228133 55.99491984923518, -3.290123424108049 55.99545059841147)))
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>