Tarql is a command-line tool for converting CSV files to RDF using SPARQL 1.1 syntax. It's written in Java and based on Apache ARQ.
See http://tarql.github.io/ for documentation.
Get the code from GitHub: http://github.com/tarql/tarql
Tarql uses Maven. To create executable scripts for Windows and Unix in /target/appassembler/bin/tarql
:
mvn package appassembler:assemble
Otherwise it's standard Maven.
Note: This fork includes support to generate RDF/HDT files as output.
Make sure you install the latest hdt-java 2.1-SNAPSHOT before compiling Tarql.
- Download geeky CSV file:
$ wget https://raw.githubusercontent.com/datasets/s-and-p-500-companies/master/data/constituents-financials.csv
- Write typical select all query to see what's in there in file
all.sparql
:
SELECT * WHERE {} LIMIT 50
- Run and see what is in the CSV file:
$ tarql all.sparql constituents-financials.csv
- Write final Tarql query into file
query.sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX nas: <http://nasdaq.com/symbol/>
CONSTRUCT {
?uri <http://example.org/price> ?tprice .
} WHERE {
BIND(URI(concat("http://nasdaq.com/symbol/",?Symbol)) AS ?uri)
BIND(xsd:decimal(?Price) AS ?tprice)
}
- Run tarql and generate output HDT file:
$ tarql -base https://example.org/constituents-financials.csv --hdt out.hdt query.sparql constituents-financials.csv