2

I have CSV data set and I want to construct RDF using Data Cube Vocabulary.

Now I have triplifier, which constructs "regular" RDF with tarql:

PREFIX data1: <http://data1/#>
PREFIX data2: <http://data2/#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX dbo: <http://dbpedia.org/ontology/#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

CONSTRUCT {
  ?URI a data1:Data1;
    variale:name ?name;
    variable:something ?something;
}

  FROM <file:data2.csv>

  WHERE {
    BIND (URI(CONCAT('http://data1/', ?someValue)) AS ?URI)
    BIND (STRLANG(?someName, "en")  AS ?name) 
    BIND (xsd:string(?anotherValue) AS ?value)
  }

OFFSET 1

I can find some explanations about how result RDF with Data Cube should look like, but I've found no examples about constructing it.

Here is the dataset I'm trying to process.

unor
  • 92,415
  • 26
  • 211
  • 360
Alex
  • 350
  • 5
  • 20
  • My guess would be that you want to use some tool convert RDF into Data Cube Vocabulary. A number of [implementations](https://www.w3.org/2011/gld/wiki/Data_Cube_Implementations) exist, but they all seem to not be well maintained (with the last commit being 4+ years ago). – Henriette Harmse May 17 '18 at 13:13
  • Please also paste sample CSV data... – Stanislav Kralin May 17 '18 at 13:44
  • @HenrietteHarmse the problem is I have to do it without tools, using only SPARQL. – Alex May 18 '18 at 19:43
  • @StanislavKralin I've put link to `CSV` in the description. – Alex May 18 '18 at 19:44
  • To the best of my knowledge, no open source tools exist that will let you read a CSV directly. Can't you use a script instead to read the CSV, put it into a graph, and then do the CONSTRUCT or INSERT? If you data isn't very large, RDFLib in Python is worth a shot. – kurious Oct 17 '18 at 22:42

1 Answers1

0

SPARQL can produce tabular data from RDF data using SELECT queries, or RDF data from RDF data using CONSTRUCT queries, but SPARQL is not suitable for converting CSV tabular data into RDF.

Ben Companjen
  • 1,417
  • 10
  • 24