TGN Combined Geospatial and Administrative hierarchy query

35 views
Skip to first unread message

Vladimir Alexiev

unread,
Mar 16, 2018, 5:39:31 AM3/16/18
to Getty Vocabularies as Linked Open Data
Prof Marcia Zeng of Kent State wrote: "I have, again, asking my students to use the Getty Vocab end-points and use the templates to query these rich knowledge bases after going through the lectures. Here one student sent me a question. I know it is not easy to do such kinds of searches because no administrative boundaries are in a regular shape or boundary. I wonder if you have any magic to do it (e.g., like by filtering out the 'Russia')?"

From the student: I was playing around with the SPARQL queries for the TGN for this week's sub-project, and I wondered if it's possible to find a list of geographic names/places that are within a certain bounding box AND within a particular nation. 
For instance, I would like to compile a list of places in Japan. I found bounding box coordinates here: https://gist.github.com/graydon/11198540  (Please note that this user has inverted long and lat values, but I made sure to enter them as lat and long in the query.) 

I then constructed this query based on the sample query: 
prefix ontogeo: <http://www.ontotext.com/owlim/geo#>
select * {
 
?place skos:inScheme tgn: ;
    foaf
:focus [ontogeo:within(31.0295791692 129.408463169 45.5514834662 145.543137242)];
    gvp
:prefLabelGVP [xl:literalForm ?name]
}
And I do get mostly places in Japan, but I still get some locations in Russia, etc. Is it possible to further limit by Japan as a nation or island group within the bounding box? 

Vladimir: In fact this is extremely easy to do. Places are organized in a hierarchy, so just add a gvp:broaderExtended condition to point up to Japan. 
I don't have to lookup the TGN node of Japan by hand, because I can just use its name (I use rdfs:label which incorporates all pref and alt labels):
prefix ontogeo: <http://www.ontotext.com/owlim/geo#>
select * {
 
?place skos:inScheme tgn: ;
    gvp
:broaderExtended [rdfs:label "Japan"@en];
    foaf
:focus [ontogeo:within(31.0295791692 129.408463169 45.5514834662 145.543137242)];
    gvp
:prefLabelGVP [xl:literalForm ?name];
    gvp
:parentString ?parents
}
I also display the parentString just to confirm. Please note that TGN's pref label for Japan is "Nihon".

The student continues: I had a fun idea of having three coordinating lists (a microthesaurus of color terms from the AAT, a list of place names in Japan from the TGN, and information about the painter Andō Hiroshige). 

Vladimir: using data from AAT, TGN and ULAN jointly sounds like an interesting project. Please share here if you have questions, and about your progress.
Reply all
Reply to author
Forward
0 new messages