D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] SPARCQL

 

 > Hands up anyone that knows how to drive SPARQL via a HTTP URI.
 > 
 > I need to be able to pull a list of organisations from 
 > https://edmo.seadatanet.org/ but they don't make it easy.


I don't know much about SPARQL but here's a minimal example of how to query their 
API in Python:


import requests

result = requests.get(
    'https://edmo.seadatanet.org/sparql/sparql',
    params={
        'query': 'select ?s ?p ?o where { ?s ?p ?o } limit 25',
        'output': 'json'}
    )

for i in result.json()['results']['bindings']:
    print(i)


You'll need to play with the SPARQL query. You can test this out on their website 
(https://edmo.seadatanet.org/sparql/) to get to what you need.

Best wishes

Mark

-- 
The Mailing List for the Devon & Cornwall LUG
https://mailman.dcglug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq