Sparql query by AAT ID from within OpenRefine?

17 views
Skip to first unread message

Rolf Blijleven

unread,
Mar 7, 2023, 10:43:52 AM3/7/23
to Getty Vocabularies as Linked Open Data
Hi, 

I'm reconciling a list of terms using OpenRefine and the GVP reconciliation service. This works, I get links to GVP/AAT data. I can then select the best match, so that I have only one link per term. I then want to extract only the dutch scopenote for that concept. From within OpenRefine, this doesn't seem to work (anymore).

In GVP's Sparql endpoint (http://vocab.getty.edu/sparql), this does exactly what I want.

    select * {
      aat:300212636 skos:scopeNote [dct:language gvp_lang:nl; rdf:value ?scope_note]
    }

Copy-pasting this line in the browser works too: 

http://vocab.getty.edu/sparql.json?query=select * {aat:300212636 skos:scopeNote [dct:language gvp_lang:nl; rdf:value ?scope_note]}

The question is: how to do this from OpenRefine using Add column by fetching urls. 

As per documentation, I think I need to replace all spaces in the query by a plus, and replace the value that I'm looking for by either `'+ value + '` or `' + escape(value, 'url') +'`.

Like this:   

http://vocab.getty.edu/sparql.json?query=select+*{aat:' + value + '+skos:scopeNote+[dct:language+gvp_lang:nl;+rdf:value+?scope_note]}

or

'http://vocab.getty.edu/sparql.json?query=select+*{aat:' + escape(value, 'url') + '+skos:scopeNote+[dct:language+gvp_lang:nl;+rdf:value+?scope_note]}'

However I'm not getting any response at all this way. I tried setting the accept header like this (with and without quotes), to no avail (screenshot attached). 

"Accept-Profile: <http://www.w3.org/2004/02/skos/core#>"

I think the URL just doesn't give any response, not even an error code. I also tried using a simple google url, that does return html soup. 

What am I doing wrong? 

Many thanks, 
Rolf 


Schermafbeelding 2023-03-07 164253.png

Rolf Blijleven

unread,
Mar 8, 2023, 10:52:29 AM3/8/23
to Getty Vocabularies as Linked Open Data
This issue is resolved, it boils down to escaping the query in OpenRefine. Full detail here.

Case closed.. 


Op dinsdag 7 maart 2023 om 16:43:52 UTC+1 schreef Rolf Blijleven:
Reply all
Reply to author
Forward
0 new messages