Newbie Question

15 views
Skip to first unread message

C T-B

unread,
Apr 19, 2023, 3:14:30 AM4/19/23
to Getty Vocabularies as Linked Open Data
Hello,
doing my first steps with Sparql and Getty and it is not an easy start :-)
Looks like all of the examples on http://vocab.getty.edu/queries are quite advanced and I miss some very basic steps to get going.

So perhaps someone here someone can help me out.
I somehow can not figure out to retreive multiple data for one specific AAT ID in one call.
I am able to do this:

select * {
   aat:300212636 rdfs:label ?label
}

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

But I would like to get both things in the same call (as I will add later even more fields to the call, but this as as start).

Can somebody point me into the right direction?
Thanks a lot !

Chris

Richard Light

unread,
Apr 19, 2023, 4:00:00 AM4/19/23
to gettyv...@googlegroups.com

Chris,

Well, you can include multiple variables in your search expression:

select * WHERE {
   aat:300212636 rdfs:label ?label; skos:scopeNote [dct:language gvp_lang:nl; rdf:value ?scope_note]
}
(The semicolon separates your second 'predicate object' pair from your first one.)

However, as you'll see the result isn't particularly helpful, since you get the same scope note listed for each term.

Personally, I never found much use for the SELECT result format (HTML), and preferred to use CONSTRUCT, with which you can build up a machine-processible chunk of RDF. (Note the past tense. It's been some years since I have had cause to use SPARQL in anger.)

Best wishes,

Richard

--
You received this message because you are subscribed to the Google Groups "Getty Vocabularies as Linked Open Data" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gettyvocablo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gettyvocablod/9af086a8-5983-4aa9-b1eb-3b6fdab4cc99n%40googlegroups.com.
--

Richard Light
richard...@gmail.com
@richardofsussex

C T-B

unread,
Apr 19, 2023, 4:32:48 AM4/19/23
to Getty Vocabularies as Linked Open Data
Hi Richard,
thanks for your help.
Highly appreciated !

Chris

Vladimir Alexiev

unread,
Apr 19, 2023, 9:22:00 AM4/19/23
to Getty Vocabularies as Linked Open Data
C T-B, presumably you want to get only one label. In this case the "nl" prefLabel:

select * {
  aat:300212636
    xl:prefLabel   [dct:language gvp_lang:nl; xl:literalForm ?label];

    skos:scopeNote [dct:language gvp_lang:nl; rdf:value ?scope_note]
}

If you want to get multi-valued fields, you need a UNION clause for each multi-valued field, in order to avoid Cartesian Product.
Eg here's how to get all prefLabels and all scopeNotes:

select * {
  {aat:300212636 skos:prefLabel ?label}
  union {aat:300212636 skos:scopeNote/rdf:value ?scope_note}
}

> Richard: never found much use for the SELECT result format (HTML), and preferred to use CONSTRUCT

Yeah, but CONSTRUCT is based on an underlying SELECT.
In other words, the CONSTRUCT template is instantiated for each resultset row.
Triples are deduplicated when writing to a repo, and by some serialization formats.
So if the Cartesian Product is small, you can squash it with CONSTRUCT.

But if you have a bunch of multi-valued fields to fetch, you cannot do that.
See query All_Data_For_Subject that uses UNIONS on a large scale.
Check out the diagram in the documentation: it shows the shape of data being fetched.

Cheers!
Reply all
Reply to author
Forward
0 new messages