Public
Edited
Apr 3, 2023
Insert cell
Insert cell
viewof objectURI = Inputs.text({
label: "JSON-LD URI",
placeholder:
"https://data.getty.edu/museum/collection/object/3738b2d5-ee17-4367-bf84-b46961cfa5f4",
value:
"https://data.getty.edu/museum/collection/object/3738b2d5-ee17-4367-bf84-b46961cfa5f4"
})
Insert cell
// Here we are using a convenient helper built into Observable that makes the http request
// to the URI, reads the response, and returns just the JSON
objectData = d3.json(objectURI)
Insert cell
LinkedArtJS = import("https://cdn.skypack.dev/@thegetty/linkedart.js")
Insert cell
Insert cell
{
return LinkedArtJS.normalizeFieldToArray(objectData, "member_of")[0].id;
}
Insert cell
Insert cell
{
// (1) Find the artist URI
// (2) Fetch data for the artist
// (3) Check if this URI is mapped onto any other entities? One possibility might be an exact match as defined in SKOS [https://www.w3.org/2004/02/skos/intro]
// (4) What triples are defined in relation to this same entity from a different data source? Is there a relationship that defines an image or illustration of a subject?

/***
* sidenote: to actually get an image you might need the following pattern
* https://commons.wikimedia.org/w/index.php?title=Special:Redirect/file/filename.png
**/
return LinkedArtJS.getCarriedOutBy(objectData)[0].id;
}
Insert cell
Insert cell
Insert cell
{
const sparqlEndpoint = "https://data.getty.edu/museum/collection/sparql";
let params = new URLSearchParams(
"query=PREFIX%20rdf%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0A%20%20PREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%20%20PREFIX%20crm%3A%20%3Chttp%3A%2F%2Fwww.cidoc-crm.org%2Fcidoc-crm%2F%3E%0A%20%20PREFIX%20skos%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2004%2F02%2Fskos%2Fcore%23%3E%0A%20%20PREFIX%20la%3A%20%3Chttps%3A%2F%2Flinked.art%2Fns%2Fterms%2F%3E%0A%20%20PREFIX%20aat%3A%20%3Chttp%3A%2F%2Fvocab.getty.edu%2Faat%2F%3E%0A%20%20PREFIX%20getty%3A%20%3Chttp%3A%2F%2Fdata.getty.edu%2Flocal%2F%3E%0A%20%20%0A%20%20SELECT%20*%20WHERE%20%7B%0A%20%20%20%20%3Chttps%3A%2F%2Fdata.getty.edu%2Fmuseum%2Fcollection%2Fobject%2F3738b2d5-ee17-4367-bf84-b46961cfa5f4%3E%20%3Fpred%20%3Fobj%0A%20%20%7D&endpoint=https%3A%2F%2Fdata.getty.edu%2Fmuseum%2Fcollection%2Fsparql&requestMethod=POST&tabTitle=Query&headers=%7B%7D&contentTypeConstruct=application%2Fn-triples%2C*%2F*%3Bq%3D0.9&contentTypeSelect=application%2Fsparql-results%2Bjson%2C*%2F*%3Bq%3D0.9"
);

return (
await fetch(sparqlEndpoint, {
method: "POST",
body: params
})
).json();
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more