Skip to content

Instantly share code, notes, and snippets.

@Robsteranium
Last active October 1, 2021 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Robsteranium/815e46df7f06e841cea11bfaa289b3a7 to your computer and use it in GitHub Desktop.
Save Robsteranium/815e46df7f06e841cea11bfaa289b3a7 to your computer and use it in GitHub Desktop.
CSVW to represent a Profile from https://onsvisual.github.io/geo-draw/
oa11cd lat lng
E00096185 50.4068 -4.6742
E00096186 50.4059 -4.6697
E00096187 50.4071 -4.6601
E00096188 50.407 -4.6634
E00096189 50.4044 -4.6689
E00096191 50.4093 -4.6736
E00096192 50.4089 -4.661
E00096193 50.4079 -4.6704
E00096194 50.4091 -4.67
E00096195 50.4067 -4.6712
{
"@context": ["http://www.w3.org/ns/csvw", {"@language": "en"}],
"url": "my-lostwithiel.csv",
"dc:title": "Geo Draw Profile My Lostwithiel",
"dc:modified": {"@value": "2021-10-01", "@type": "xsd:date"},
"@id": "https://onsvisual.github.io/geo-draw/profile/my-lostwithiel",
"tableSchema": {
"columns": [{
"name": "oa11cd",
"datatype": "string",
"propertyUrl": "http://purl.org/linked-data/sdmx/2009/concept#refArea",
"valueUrl": "http://statistics.data.gov.uk/def/statistical-geography/{oa11cd}"
},{
"name": "lat",
"datatype": "decimal",
"propertyUrl": "http://www.w3.org/2003/01/geo/wgs84_pos#lat",
"suppressOutput": true
},{
"name": "lon",
"datatype": "decimal",
"propertyUrl": "http://www.w3.org/2003/01/geo/wgs84_pos#lon",
"suppressOutput": true
}],
"aboutUrl": "https://onsvisual.github.io/geo-draw/profile/my-lostwithiel"
}
}
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix statgeo: <http://statistics.data.gov.uk/def/statistical-geography/> .
@prefix sdmx-concept: <http://purl.org/linked-data/sdmx/2009/concept#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<https://onsvisual.github.io/geo-draw/profile/my-lostwithiel>
dcterms:modified "2021-10-01"^^xsd:date ;
dcterms:title "Geo Draw Profile My Lostwithiel"@en ;
sdmx-concept:refArea statgeo:E00096185, statgeo:E00096186, statgeo:E00096187, statgeo:E00096188, statgeo:E00096189, statgeo:E00096191, statgeo:E00096192, statgeo:E00096193, statgeo:E00096194, statgeo:E00096195 .
@Robsteranium
Copy link
Author

Whereas the geographies.json CSVW metadata creates a collection of geographies, here we define a profile. It's more precise which helps explain the provenance/ original purpose but might require more work to ingest from another tool.

The turtle was created with csv2rdf and rapper (to get the compact URIs) as follows:

csv2rdf -t my-lostwithiel.csv -u profile.json -m annotated | rapper -i turtle -f 'xmlns:statgeo="http://statistics.data.gov.uk/def/statistical-geography/"' -f 'xmlns:sdmx-concept="http://purl.org/linked-data/sdmx/2009/concept#"' -f 'xmlns:xsd="http://www.w3.org/2001/XMLSchema#"'' -o turtle -I / -

I chose sdmx-concept:refArea as it's generic. Ultimately you'd probably want to think a little more about a model to describe the API (and perhaps how the downloads/ uploads might integrate a suite of related tools).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment