get json through http request to ulan

58 views
Skip to first unread message

ziny...@gmail.com

unread,
Jan 26, 2018, 1:51:32 AM1/26/18
to Getty Vocabularies as Linked Open Data
Hi,

I'd like to pass a sparql query through a url and get the data in json. 

Kevin Ford

unread,
Jan 26, 2018, 10:31:25 AM1/26/18
to ziny...@gmail.com, Getty Vocabularies as Linked Open Data
Hi Zin,

Two things:

1) You can alter the query point you are hitting from "/sparql" to
"/sparql.json"

http://vocab.getty.edu/sparql.json?query=select+*+%7B%3Fx+luc%3Aterm+%22vincent+van+gogh%22%3Bskos%3AinScheme+ulan%3A%3Bgvp%3AprefLabelGVP%2Fxl%3AliteralForm+%3Fname%3Brdf%3Atype+gvp%3APersonConcept%7D&_implicit=false&implicit=true&_equivalent=false&_form=%2Fsparql

There's probably a way to do it with content negotiation, but this might
meet your needs.


2) As for changing the name, just change it in your query string;

http://vocab.getty.edu/sparql.json?query=select+*+%7B%3Fx+luc%3Aterm+%22Leonardo+da+Vinci%22%3Bskos%3AinScheme+ulan%3A%3Bgvp%3AprefLabelGVP%2Fxl%3AliteralForm+%3Fname%3Brdf%3Atype+gvp%3APersonConcept%7D&_implicit=false&implicit=true&_equivalent=false&_form=%2Fsparql

Here's the same URL but this time it will query Leonardo da Vinci..


HTH,
Kevin
> <http://vocab.getty.edu/sparql?query=select+*+%7B%3Fx+luc%3Aterm+%22vincent+van+gogh%22%3Bskos%3AinScheme+ulan%3A%3Bgvp%3AprefLabelGVP%2Fxl%3AliteralForm+%3Fname%3Brdf%3Atype+gvp%3APersonConcept%7D&_implicit=false&implicit=true&_equivalent=false&_form=%2Fsparql>)
> How does the url need to be structured?
> thanks
> Zin
>
> --
> You received this message because you are subscribed to the Google
> Groups "Getty Vocabularies as Linked Open Data" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to gettyvocablo...@googlegroups.com
> <mailto:gettyvocablo...@googlegroups.com>.
> To post to this group, send email to gettyv...@googlegroups.com
> <mailto:gettyv...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/gettyvocablod/23761686-6e27-413e-945e-295d6e3786c2%40googlegroups.com
> <https://groups.google.com/d/msgid/gettyvocablod/23761686-6e27-413e-945e-295d6e3786c2%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

Zin Yosrim

unread,
Jan 26, 2018, 12:42:57 PM1/26/18
to Kevin Ford, Getty Vocabularies as Linked Open Data
Thanks alot. I already figured out the 2nd part and am extracting the data via scrapy and xpaths. But 1. will help me doing this in a more elegant manner
--
Beste Grüsse.

Deniz Demirsoy

Kevin Ford

unread,
Jan 26, 2018, 12:53:17 PM1/26/18
to Zin Yosrim, Getty Vocabularies as Linked Open Data
You might also consider downloading the source vocabs and loading it
locally. Links to the source vocabs downloads can be found in the
middle of this page:

http://vocab.getty.edu/

Mind you, loading the data into a triplestore and setting up a query
infrastructure is a much higher bar than the readily-available query
endpoint the Getty has provided, but it may be faster and, depending on
how the Getty feels about this, nicer to the online sparql service
because you reduce the load on the Getty servers. But I'm not in any
position to advise on the latter; just speculating.

All the best,
Kevin


On 1/26/18 11:42, Zin Yosrim wrote:
> Thanks alot. I already figured out the 2nd part and am extracting the
> data via scrapy and xpaths. But 1. will help me doing this in a more
> elegant manner
>
> Kevin Ford <kfo...@artic.edu <mailto:kfo...@artic.edu>> schrieb am Fr.
> 26. Jan. 2018 um 16:31:
>
> Hi Zin,
>
> Two things:
>
> 1) You can alter the query point you are hitting from "/sparql" to
> "/sparql.json"
>
> http://vocab.getty.edu/sparql.json?query=select+*+%7B%3Fx+luc%3Aterm+%22vincent+van+gogh%22%3Bskos%3AinScheme+ulan%3A%3Bgvp%3AprefLabelGVP%2Fxl%3AliteralForm+%3Fname%3Brdf%3Atype+gvp%3APersonConcept%7D&_implicit=false&implicit=true&_equivalent=false&_form=%2Fsparql
>
> There's probably a way to do it with content negotiation, but this might
> meet your needs.
>
>
> 2) As for changing the name, just change it in your query string;
>
> http://vocab.getty.edu/sparql.json?query=select+*+%7B%3Fx+luc%3Aterm+%22Leonardo+da+Vinci%22%3Bskos%3AinScheme+ulan%3A%3Bgvp%3AprefLabelGVP%2Fxl%3AliteralForm+%3Fname%3Brdf%3Atype+gvp%3APersonConcept%7D&_implicit=false&implicit=true&_equivalent=false&_form=%2Fsparql
>
> Here's the same URL but this time it will query Leonardo da Vinci..
>
>
> HTH,
> Kevin
>
>
>
> On 1/26/18 00:51, ziny...@gmail.com <mailto:ziny...@gmail.com>
> wrote:
> > Hi,
> >
> > I'd like to pass a sparql query through a url and get the data in
> json.
> >
> > Can I get xml/json output through a query like this:
> >
> http://vocab.getty.edu/sparql?query=select+*+%7B%3Fx+luc%3Aterm+%22vincent+van+gogh%22%3Bskos%3AinScheme+ulan%3A%3Bgvp%3AprefLabelGVP%2Fxl%3AliteralForm+%3Fname%3Brdf%3Atype+gvp%3APersonConcept%7D&_implicit=false&implicit=true&_equivalent=false&_form=%2Fsparql
> >
> <http://vocab.getty.edu/sparql?query=select+*+%7B%3Fx+luc%3Aterm+%22vincent+van+gogh%22%3Bskos%3AinScheme+ulan%3A%3Bgvp%3AprefLabelGVP%2Fxl%3AliteralForm+%3Fname%3Brdf%3Atype+gvp%3APersonConcept%7D&_implicit=false&implicit=true&_equivalent=false&_form=%2Fsparql>
> >
> > My query will be the same, I'm just exchanging the the artists name
> > (vincent+van+gogh
> >
> <http://vocab.getty.edu/sparql?query=select+*+%7B%3Fx+luc%3Aterm+%22vincent+van+gogh%22%3Bskos%3AinScheme+ulan%3A%3Bgvp%3AprefLabelGVP%2Fxl%3AliteralForm+%3Fname%3Brdf%3Atype+gvp%3APersonConcept%7D&_implicit=false&implicit=true&_equivalent=false&_form=%2Fsparql>)
> > How does the url need to be structured?
> > thanks
> > Zin
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Getty Vocabularies as Linked Open Data" group.
> > To unsubscribe from this group and stop receiving emails from it,
> send
> > an email to gettyvocablo...@googlegroups.com
> <mailto:gettyvocablod%2Bunsu...@googlegroups.com>
> > <mailto:gettyvocablo...@googlegroups.com
> <mailto:gettyvocablod%2Bunsu...@googlegroups.com>>.
> > To post to this group, send email to
> gettyv...@googlegroups.com <mailto:gettyv...@googlegroups.com>
> > <mailto:gettyv...@googlegroups.com

Zin Yosrim

unread,
Jan 26, 2018, 3:41:54 PM1/26/18
to Kevin Ford, Getty Vocabularies as Linked Open Data
Thanks you for your advice Kevin. Don't have really much sparql knowledge yet but will look into the option working with a local I instance. I just managed to do simple online queries with python up to now. A while ago I asked in the Google group here if there are any access/query limitations for Getty, but I didn't get any response yet.
Thanks again for your help. Zin
Reply all
Reply to author
Forward
0 new messages