Skip to content

A quick and easy conversion

Tim L edited this page Aug 8, 2013 · 61 revisions
csv2rdf4lod-automation is licensed under the [Apache License, Version 2.0](https://github.com/timrdf/csv2rdf4lod-automation/wiki/License)

What's first?

An example

Let's say we are interested in some oil well data shown at ScraperWiki, which offers a URL for the CSV. As data curators, we'll need to choose identifiers for our source, dataset, and version, so we choose scraperwiki-com, uk-offshore-oil-wells, and 2011-Jan-24, respectively. Knowing these values, we can make the directory:

bash-3.2$ mkdir ~/Desktop/source  # Creates the directory for all data that you collect and convert.
bash-3.2$ cd ~/Desktop/source
bash-3.2$ mkdir -p scraperwiki-com/uk-offshore-oil-wells/version/2011-Jan-24

Next, we'll hop into our conversion cockpit and set up shop:

~/Desktop/source
bash-3.2$ cd scraperwiki-com/uk-offshore-oil-wells/version/2011-Jan-24
bash-3.2$ mkdir source
bash-3.2$ mkdir manual

Hop into source/ and grab the data (with pcurl.sh!) and get back into our conversion cockpit:

~/Desktop/source/scraperwiki-com/uk-offshore-oil-wells/version/2011-Jan-24
bash-3.2$ cd source/
bash-3.2$ pcurl.sh http://purl.org/twc/query/scraperwiki/uk-offshore-oil-wells -e csv
bash-3.2$ cd ..

(If scraperwiki doesn't return the CSV, you can point pcurl.sh to our cached copy of uk-offshore-oil-wells.csv instead.)

[Make the conversion trigger](Conversion process phase: create conversion trigger), [pull it](Conversion process phase: pull conversion trigger) (if you hit a memory error, see FAQ), and see [what it did](A guided tour of csv2rdf4lod's Turtle dump file):

~/Desktop/source/scraperwiki-com/uk-offshore-oil-wells/version/2011-Jan-24
bash-3.2$ cr-create-convert-sh.sh -w source/uk-offshore-oil-wells.csv

bash-3.2$ ./convert-uk-offshore-oil-wells.sh

bash-3.2$ vi automatic/uk-offshore-oil-wells.csv.raw.ttl

There's your RDF --------^^ as a verbatim interpretation of the tabular literals (if you hit a memory error, see FAQ). But having an enhanced version is better! Start by reviewing the Conversion process phases, one of which will show you how to make an enhancement to add to your initial conversion. conversion:Enhancement shows a good set of things you can tell the converter to make nicely-structured RDF from a relatively uninformative bucket of literals. But if you want to cheat, grab my enhancement parameters for this dataset and plop them into the manual/ directory of your conversion cockpit; then run ./convert-uk-offshore-oil-wells.sh again (it'll realize that you already ran the raw conversion and move on with enhancing).

What's next?

Clone this wiki locally