gtfs-csv2rdf
Mapping library which transforms GTFS CSV files into GTFS triples using the Linked GTFS vocabulary.
If you need route planning over Linked Data, then please check out the Linked Connections framework instead. Transforming GTFS to Linked Data will not return you the data in a format that is useful for route planning.
Use
Requirements:
- node js
Install using npm install gtfs-csv2rdf --save
Command Line
In this case, you can install it globally using npm install -g gtfs-csv2rdf
# First argument: path to gtfs # Second argument: the base URI # Third argument (optional): the requested format (turtle (default), ntriples or jsonld) gtfs-csv2rdf path-to-gtfs.zip http://data.gtfs.org/sample-feed/0.1/ turtle > gtfsintriples.ttl
As a nodejs library
By example:
var fs = ;var N3 = ;var gtfs-csv2rdf = zipToTriples;var path = "/path/to/gtfs.zip";if /?\.zip/ var feedname = /?\.zip/2; else throw "Not a zip file: " + path;//create the writer of turtle file towards stdoutvar streamWriter = 'gtfs': 'http://vocab.gtfs.org/terms#' 'rdf': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' 'foaf' : 'http://xmlns.com/foaf/0.1/' 'dct' : 'http://purl.org/dc/terms/' 'rdfs' : 'http://www.w3.org/2000/01/rdf-schema#' 'owl' : 'http://www.w3.org/2002/07/owl#' 'xsd' : 'http://www.w3.org/2001/XMLSchema#' 'vann' : 'http://purl.org/vocab/vann/' 'skos' : 'http://www.w3.org/2004/02/skos/core#' 'dcat' : 'http://www.w3.org/ns/dcat#';streamWriter;var options = feedname : feedname baseuri : "http://data.example.org/sample-feed/0.1/";;
For other functions, check out the main file of the library