csv2rdf python experiments

Following today's discussion on the csv2rdf work, I found time to hack
a little. It's a mess so I put it in my own github repo, but:

https://github.com/danbri/csvrdfize

All it does currently is take 3 parameters, and return Turtle RDF in
textual form.

e.g.

  t1_cfg = {
    'fn': 'samples/simple-weather-observation/t1.csv',
    'tf': 'samples/simple-weather-observation/map1.ttlt',
    'mf': 'samples/simple-weather-observation/t1.json'
  }

  print generateTurtle( t1_cfg )


The inputs are: CSV file + simple metadata (column names) +
URI-Template-ized Turtle mapping.

Example mapping template (based on Jeremy, Andy, Gregg Ivan et al.'s
investigations) copied below. The code is entirely disposable but
you're welcome to mess around with it. I think Andy already has
something similar.

Dan



@base               <http://data.example.org/wow/data/weather-observations/> .
@prefix ssn:        <http://purl.oclc.org/NET/ssnx/ssn#> .
@prefix time:       <http://www.w3.org/2006/time#> .
@prefix xsd:        <http://www.w3.org/2001/XMLSchema#> .
@prefix qudt:       <http://qudt.org/1.1/schema/qudt#> .
@prefix def-op:     <http://data.example.org/wow/def/observed-property#> .

<site/22580943/date-time/{sample-time}>
   a ssn:Observation ;
   ssn:observationSamplingTime [ time:inXSDDateTime
"{sample-time}"^^xsd:dateTime ] ;
   ssn:observationResult [
       a ssn:SensorOutput ;
       def-op:airTemperature_C [ qudt:numericValue "{air-temp}"^^xsd:double ] ;
       def-op:dewPointTemperature_C [ qudt:numericValue
"{dew-point}"^^xsd:double ] ] .

Received on Wednesday, 21 May 2014 17:18:11 UTC