There are probably dozens of ways to convert comma-separated values to parsable RDF, but I recently came up with one that was so simple that I wanted to share it.

Here is a sample CSV list:

"red" , "blue", "gray"

If I put the following before it and a period after it,

@prefix : <http://rdfdata.org/csv#> . :csvList :item

I get this: parsable RDF using the Turtle syntax.

@prefix : <http://rdfdata.org/csv#> . :csvList :item "red" , "blue", "gray" .

That's it. It works as a single line like that, but it's easier for human eyes to read if you look at it as an abbreviated version of the following:

@prefix : <http://rdfdata.org/csv#> . :csvList :item "red" . :csvList :item "blue" . :csvList :item "gray" .

Or, "the csvList resource has 'red', 'blue', and 'gray' as item property values".

I just made up the URI, subject, and predicate. Your next step would probably be to use SPARQL to convert them to something more appropriate to your application.

I've used the semicolon in Turtle and SPARQL many times to avoid repeating a triple's subject for multiple triples. I've used the comma, which delimits a list of objects that go with the same subject and predicate, less often, and it's the key to the trick here: that a CSV list is already a part of Turtle syntax.

Converting CSV data to RDF in just about any programming language would be a very short script, and it's easy enough with products such as TopBraid Composer, so I'm not interested in accumulating a list of other ways to do it here, unless you can beat mine for simplicity. I just thought it was neat that something as simple as prepending a short string and appending a period would turn a CSV list into legal, parsable RDF.