Getting more data out of ULAN

146 views
Skip to first unread message

Vladimir Alexiev

unread,
Jan 7, 2016, 3:46:06 AM1/7/16
to Getty Vocabularies as Linked Open Data, diana-...@utulsa.edu, Joseph-...@utulsa.edu
People working for the Gilcrease Museum (Tulsa, Oklahoma) are asking

We are currently developing a website application for displaying and searching the collections of the Gilcrease Museum. One portion of this application is to integrate the artist and creator records with Getty ULAN linked open data. We plan to query supplementary data from ULAN about the artist and creator
The fields we are attempting to query and display on the website are: Note, Names (all), Birth Date, Death Date, Nationalities, Roles, Gender, Death Place, Events, and Related People or Corporate Bodies.
We have reviewed the example queries found on the Getty website and been able to build a sample query that gets us close to what we are trying to do:

select ?x ?Name ?Bio ?Birthplace ?labGVP ?Deathplace ?Gender ?Start ?End ?Nationality ?Term ?Parents ?ScopeNote {
?x a skos:Concept; dc:identifier "500015257";
gvp
:prefLabelGVP [xl:literalForm ?Term].
?x gvp:prefLabelGVP/xl:literalForm ?Name;
foaf
:focus/gvp:biographyPreferred ?biography.
?biography gvp:estStart ?Start;
gvp
:estEnd ?End;
schema
:gender [gvp:prefLabelGVP [xl:literalForm ?Gender]]
optional
{?biography schema:birthPlace ?Birthplace}
optional
{?biography schema:deathPlace ?Deathplace}
optional
{?x foaf:focus [gvp:nationalityPreferred [gvp:prefLabelGVP [xl:literalForm ?Nationality]]];}
optional
{?x foaf:focus/gvp:biographyPreferred/schema:description ?Bio}
optional
{?x gvp:parentStringAbbrev ?Parents}
optional
{?x skos:scopeNote [dct:language gvp_lang:en; rdf:value ?ScopeNote]}
}


Comments on the above query:
  1. Use indentation after ";" to show the nesting of sub-patterns.
  2. Selecting by dc:identifier "500015257" is a little inefficient. Better use bind(ulan:500015257 as ?x)
  3. Once you pick ?biography there's no need to navigate to it again using ?x foaf:focus/gvp:biographyPreferred/...
  4. These two forms fetch exactly the same (but the first is more robust because of a SPARQL parser bug (SES-2024), as documented in http://vocab.getty.edu/doc/queries/
    ?x gvp:prefLabelGVP [xl:literalForm ?Term].
    ?x gvp:prefLabelGVP/xl:literalForm ?Name;
  5. If you need to fetch all names, you need to use xl:prefLabel|xl:altLabel [xl:literalForm ?anyName], and then group_concat()


Now to answer some other questions:

1. How can we get all the relations a Subject has ex:
gvp:ulan1501_sibling_of
gvp:ulan1532_uncle-aunt_of
gvp:ulan1541_spouse_of

This is explained in http://vocab.getty.edu/doc/queries/#Associative_Relations_of_Agent. You can adapt it for your case eg like this:
select * {
  bind
(ulan:500015257 as ?x)
 
?x ?rel ?related.
 
?rel sesame:directSubPropertyOf skos:related; dc:title ?relName.
 
?related gvp:prefLabelGVP/xl:literalForm ?relatedName.
 
?related foaf:focus/gvp:biographyPreferred/schema:description ?relatedBio.
  optional
{[
    rdf
:subject ?x;
    rdf
:predicate ?rel;
    rdf
:object ?related;
    rdfs
:comment ?comment]}}
If you don't care about possible "display date" (?comment), just drop the optional{...}

1a. and are there posibilities of other relations?

Yes. All ULAN relations are listed in http://vocab.getty.edu/ontology. You can also get them as PDF or XLSX from http://vocab.getty.edu/doc/#Relationships_Table, which is easier to read and understand

2. How can we query for "Has Affiliation" with corporate bodies, related organizations

These are also associative relations. You could filter by source or target type, eg here's how to find relations from Person to Group (corporate body):
select ?x ?xName ?rel ?relName ?y ?yName {
 
?x ?rel ?y.
 
?x a gvp:PersonConcept.
 
?y a gvp:GroupConcept.
 
?rel sesame:directSubPropertyOf skos:related; dc:title ?relName.
 
?x gvp:prefLabelGVP [xl:literalForm ?xName].
 
?y gvp:prefLabelGVP [xl:literalForm ?yName].
} limit 10
(Note: it may time out on http://vocab.getty.edu/sparql, I posted an issue, if so then try it on http://getty.ontotext.com/sparql)

But I think in your case it's better to get all relations, then sort them by target type.

3. How can we query for related events?

Here's a sample query (I'll add it to the documentation):
select * {
  bind
(ulan:500015257 as ?x).
 
?x foaf:focus [bio:event ?event].
 
?event dct:type [gvp:prefLabelGVP [xl:literalForm ?type]].
  bind
(exists {?x foaf:focus [gvp:eventPreferred ?event]} as ?pref)
  optional
{?event rdfs:comment ?comment}
  optional
{?event gvp:displayOrder ?order}
  optional
{?event gvp:estStart ?start}
  optional
{?event gvp:estEnd ?end}
  optional
{?event schema:location [gvp:prefLabelGVP [xl:literalForm ?place]]}
} order by ?order desc(?pref)

Please note that events having the same type (eg "active") often express different opinions about the event details (dates), not several actual instances. In such case you should display only the Preferred event. But ULAN offers no information which event types imply single-instance events.

Lehel Matyus

unread,
Jan 26, 2016, 7:48:02 PM1/26/16
to Getty Vocabularies as Linked Open Data
Hi Vladimir,

thank you for your response.
If I may ask your help with some further questions:

1. I am wondering how to return the literal form of a TGN
Example:
in the very last query (3), the line:


optional {?event schema:location [gvp:prefLabelGVP [xl:literalForm ?place]]}

returns "-" instead of "Philadelphia"

even though, when you run the query,
the event http://vocab.getty.edu/ulan/event/102217
has schema:location http://vocab.getty.edu/tgn/7014406-place (Philadelphia)

2. What would be the best way to filter the relations query provided in your response (2) to a ULAN (ulan:500015257) so the query is more efficient.

Thank you,
Lehel
...

Vladimir Alexiev

unread,
Feb 1, 2016, 2:48:56 AM2/1/16
to Lehel Matyus, Getty Vocabularies as Linked Open Data

 

optional {?event schema:location [gvp:prefLabelGVP [xl:literalForm ?place]]}

returns "-" instead of "Philadelphia"

 

Sorry, the label is attached to http://vocab.getty.edu/tgn/7014406 not http://vocab.getty.edu/tgn/7014406-place.

To get to it, try to use foaf:focus in is inverse direction:

optional {?event schema:location [^foaf:focus/gvp:prefLabelGVP [xl:literalForm ?place]]}


2. What would be the best way to filter the relations query provided in your response (2) to a ULAN (ulan:500015257) so the query is more efficient.

Given that ?x is bound, I don’t think the query can be optimized much. Is it slow?

Reply all
Reply to author
Forward
0 new messages