Skip to content
SqueezyDough edited this page Nov 15, 2019 · 30 revisions

Sprint report

Client challenge

Create a data visualisation that covers the entire collection

Angles of approach

  • Create a map that shows type variety
  • Focus on expeditions (data available?)
  • Let them create their own graph

Chosen angle: Type variety

A visualisation that shows all the different type of items. It starts as a single sphere but can be transformed to show different categorical layouts/ordering like a map, materials, size?. Clicking on a type shows all items of that type (+ chosen filter).

Land Types are displayed in a bubble chart per country. The bigger the bubble, the more items the country contains.

Geo There are different display methods to plot the types. Here you can see the bubbles plotted on a map

Data

Required data

  • Type
  • Long/lat
  • Image
  • Description

Optional data

  • Culture
  • Material
  • Size

Categories

  • Clothes
  • Jewellery
  • Gear
  • Weapons
  • Photo's
  • Pots
  • Maskers
  • Beelden

Explorative Sparql query

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>

SELECT ?typeLabel (COUNT(?cho) AS ?choAmount)
WHERE {
 ?cho edm:object ?type .
 ?type skos:broader/skos:broader/skos:broader ?typeBT .
 ?typeBT skos:prefLabel ?typeLabel .
}
GROUP BY ?typeLabel
ORDER BY DESC(?choAmount)

I've created a simple Sparql query to explore the types that are most common in the database. The query counts the objects with the same type. I discovered that the database contains lots of clothing, weapons, pictures/photo' and jewellery.

Data query

I've created a query that requests all items with the type clothing. I get the location, long/lat, title and category. I wanted to count these items with d3 and present them inside a bubble chart.

PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>
PREFIX wgs84: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX gn: <http://www.geonames.org/ontology#>

SELECT  
?cho ?title
       ?mainCategory
       ?placeLabel
       ?countryLabel
       ?lat
       ?long
       ?type
       ?thesType
WHERE {
# VALUES ?type {"kleding" "Kleding"}  # variabelen definiëren
# ?cho dc:type ?type . # obj type
  <https://hdl.handle.net/20.500.11840/termmaster13527> skos:narrower* ?type .
  ?cho edm:object ?type .

  ?cho edm:isRelatedTo ?cat . # obj uri
  ?cat skos:prefLabel ?mainCategory .

  ?cho dct:spatial ?place . # obj place  
  ?place skos:exactMatch/wgs84:lat ?lat .
  ?place skos:exactMatch/wgs84:long ?long .
  ?place skos:prefLabel ?placeLabel .
  OPTIONAL {  
        ?place skos:exactMatch/gn:parentCountry ?country .  
         ?country gn:name ?countryLabel .
  }

  ?cho dc:title ?title . # obj title
}

Troubles

I've discovered that it is very difficult to fetch all items from a specific level. Some items have more subtypes than others which makes it so that the types depth isn't the same for all fetched types.

It turned out that d3 works a bit different than I perviously expected, so I needed to change the query. To present items inside a bubble chart d3 only wants a name and a number. D3 doesn't actually count the items itself. At least, not in all the examples out there. It might still be possible though, however I find it better to do this client/server-side and use d3 only to present data. This creates a clear separation of concerns and what different modules do/should do.

Counting items in categories

PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>
PREFIX wgs84: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX gn: <http://www.geonames.org/ontology#>

SELECT ?countryLabel
       (COUNT(?cho) AS ?choCount)
WHERE {
  <https://hdl.handle.net/20.500.11840/termmaster13435> skos:narrower* ?type .
  ?cho edm:object ?type .

  ?cho dct:spatial ?place . # obj place  
  ?place skos:exactMatch/gn:parentCountry ?country .  
  ?country gn:name ?countryLabel .

} GROUP BY ?country ?countryLabel
ORDER BY DESC(?choCount) 

I went with this query instead. It counts the amount of items in a country where the category is a term master uri. Ivo thought this would be better than the previous query, because it is a broader term and this includes all items where the other query simply looked at items that had 'clothing' in the type title.

Functional programming

I've spend almost a week to clean the data from the survey in a functional manner. The results can be found below as well as other things I have done with the visualisation.