Ordered Hierarchy of all ancestors of AAT Terms

66 views
Skip to first unread message

Julia Iwanowa

unread,
Oct 6, 2015, 6:35:58 AM10/6/15
to Getty Vocabularies as Linked Open Data
Hi,

I need an ordered hiererchiy of all ancestors of a given AAT term. I tryed following queries:

select * {

  aat
:300226882 gvp:broaderPreferredExtended ?parent.

 
?parent gvp:prefLabelGVP/xl:literalForm ?l.

  OPTIONAL
{?parent gvp:broaderPreferred ?grandParent}}


construct {?Subject gvp:term ?Term; skos:broaderTransitive ?parent; skos:scopeNote ?ScopeNote . }
 
where {
 
?Subject a skos:Concept; luc:term ' "baking dishes" ';
     gvp
:prefLabelGVP [xl:literalForm ?Term].
  optional
{?Subject skos:broaderTransitive ?parent}
  optional
{?Subject skos:scopeNote [dct:language gvp_lang:en; rdf:value ?ScopeNote]}
  optional
{?parent gvp:broaderPreferred ?grandParent}}



construct {?Subject gvp:term ?Term; gvp:broaderPreferredExtended ?parent; skos:scopeNote ?ScopeNote . }
 
where {
 
?Subject a skos:Concept; luc:term ' "baking dishes" ';
     gvp
:prefLabelGVP [xl:literalForm ?Term].
  optional
{?Subject gvp:broaderPreferredExtended ?parent}
  optional
{?Subject skos:scopeNote [dct:language gvp_lang:en; rdf:value ?ScopeNote]}
  optional
{?parent gvp:broaderPreferred ?grandParent}}


How can I recive the results as inordered list.

Thank you!
Julia

Vladimir Alexiev

unread,
Oct 6, 2015, 11:26:41 AM10/6/15
to Getty Vocabularies as Linked Open Data
  1. Do you really need all ancestors? Many concepts have several parents, which have several grandparents.... The number can grow quickly
  2. If you need only preferred ancestors, gvp:broaderPreferredExtended returns them all. 
  3. If you order them by asc(length(?parentString)), that will order them by seniority
Note: http://vocab.getty.edu/doc/queries/#Ordered_Hierarchy_of_Given_Subject does something similar but for descendants, which is much harder.

Vladimir Alexiev

unread,
Oct 6, 2015, 11:34:05 AM10/6/15
to Getty Vocabularies as Linked Open Data
Here's a sample query:
select ?x ?label ?parentString {
 
{?x skos:inScheme aat:; luc:term ' "baking dishes" '}
 
union  {?y skos:inScheme aat:; luc:term ' "baking dishes" '; gvp:broaderPreferredExtended ?x}.
 
?x gvp:prefLabelGVP [xl:literalForm ?label]; gvp:parentString ?parentStr.
  bind
(if (?parentStr="Top of the AAT hierarchies", "", ?parentStr) as ?parentString)
} order by asc(strlen(?parentString))

Julia Iwanowa

unread,
Oct 7, 2015, 6:18:44 AM10/7/15
to Getty Vocabularies as Linked Open Data


On Tuesday, 6 October 2015 17:26:41 UTC+2, Vladimir Alexiev wrote:
  1. Do you really need all ancestors? Many concepts have several parents, which have several grandparents.... The number can grow quickly
For the first prototype we are going to fetch only gvp:broaderPreferredExtended. For the productive version we will try to collect all availbale hierarchical paths per term.

  1. If you need only preferred ancestors, gvp:broaderPreferredExtended returns them all. 
  2. If you order them by asc(length(?parentString)), that will order them by seniority
Note: http://vocab.getty.edu/doc/queries/#Ordered_Hierarchy_of_Given_Subject does something similar but for descendants, which is much harder.

For our use cases we need to develop a service on the top of  Linked Open Vocabularies via SPARQL as generic as possible. The most online thesauries availble as LOD are modeled with skos. My question is: in principle, all getty specific SPARQL queris could be also performed with the general skos-Classes and skos:Properties? Or am I wrong?

Thank you!
Best regards,
Julia

Vladimir Alexiev

unread,
Oct 9, 2015, 8:23:08 AM10/9/15
to Getty Vocabularies as Linked Open Data
> collect all availbale hierarchical paths per term.

The question is how are you going to use/display them.


> in principle, all getty specific SPARQL queris could be also performed with the general skos-Classes and skos:Properties?

Correct: we've mapped as much as possible to SKOS. 
Limitations of SKOS:
Reply all
Reply to author
Forward
0 new messages