ULAN additional Names and Types

Skip to first unread message

Ben Do

Nov 11, 2017, 8:50:59 AM11/11/17
to Getty Vocabularies as Linked Open Data

Hello everybody,

I am very new to SPARQL. I want to count the frequency of specific artist names in a text.
This query  gives me nearly all the artist information I need. Adding all Artist Names and Types would be perfect. 

select ?x ?name ?bio ?nationality ?type {

  ?x gvp:broaderExtended ulan:500000002. # Persons, Artists
  optional {?x gvp:agentTypePreferred [gvp:prefLabelGVP [xl:literalForm ?type]]}
  optional {?x foaf:focus [gvp:nationalityPreferred [gvp:prefLabelGVP [xl:literalForm ?nationality]]]}
  optional {?x gvp:prefLabelGVP [xl:literalForm ?name]}
  optional {?x foaf:focus [gvp:biographyPreferred [schema:description ?bio]]}

Is it possible to expand the query to include:
  1. the nonPreferred Types
  2. the nonPreferred Names 

Thank you so much in advance!

Best regards


Vladimir Alexiev

Nov 13, 2017, 2:27:07 AM11/13/17
to Getty Vocabularies as Linked Open Data
Hi Ben!

If you add multi-valued fields to the query, you'll have a Cartesian explosion (eg 5 names * 3 types makes 15 rows for that artist alone), and how'd you collect those extra rows together? So I suggest making two extra queries and assembling the results yourself, keyed on ?x:

select * {?x gvp:broaderExtended ulan:500000002; gvp:agentType [gvp:prefLabelGVP [xl:literalForm ?type]]}
select * {?x gvp:broaderExtended ulan:500000002; rdfs:label ?name}

rdfs:label includes both skos:prefLabel and skos:altLabel, which are shortcuts for xl:prefLabel/xl:literalForm and xl:altLabel/xl:literalForm

Cheers! V

Ben Do

Nov 13, 2017, 7:26:36 AM11/13/17
to Getty Vocabularies as Linked Open Data

Dear Vladimir Alexiev,

thank you very much for your kind, fast and competent response. The code you provided is everything that I need!

Best regards 


Reply all
Reply to author
0 new messages