D&C GLug - Home Page

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

Re: [LUG] SPARCQL

 

Dear Martin,

> Thanks. Yes, I'd got that. This data is constantly updated. I need to
> be able to set up a cron job to automate it.
>
> ie. http->json-mysql

Here's a nice way of getting the organisations using Pete's query, one
per line:

curl -s 
'https://edmo.seadatanet.org/sparql/sparql?query=PREFIX+skos%3A%3Chttp%3A%2F%2Fwww.w3.org%2F2004%2F02%2Fskos%2Fcore%23%3E%0D%0APREFIX+rdf%3A%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0D%0ASELECT+DISTINCT+%3Fs+%3Fp+WHERE+%7B%3Fs+rdf%3Atype+%3Chttp%3A%2F%2Fwww.w3.org%2Fns%2Forg%23Organization%3E.+%3Fs+skos%3AprefLabel+%3Fp%7D+ORDER+By+%3Fp&output=xml&force-accept=text%2Fplain'\
| xpath -q -e '/sparql/results/result/binding[@name="p"]/literal/text()'\
| sort


Note that some of the organisations' names, particularly the CJK ones,
don't come out very well due to the character encoding (you'll need to
un-escape these at some point, I imagine). Apart from those ones though,
it'll run like clockwork as part a cron job!

Hope this helps!

Best wishes,

Sebastian

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