W3C home > Mailing lists > Public > semantic-web@w3.org > January 2010

Re: RDF to CSV

From: Mark Wallace <mwallace@modusoperandi.com>
Date: Wed, 27 Jan 2010 08:27:16 -0500
Message-ID: <4B603F34.20107@modusoperandi.com>
CC: semantic-web@w3.org
I've used a command pipeline to do this, where I first convert to 
N-TRIPLES format.  I then use the "sed" tool to convert the NTRIPLES to 
CSV.  I use Jena's rdfcat tool to convert from Turtle or RDF/XML to 
N-TRIPLES.

The sed pipeline is:

    sed 's/ \.$//' | sed 's/> />,/g' | sed 's/ </,</'

Not sure if this works for all cases, but N-TRIPLES is a very simple 
syntax, so there aren't too many variations.

I put this script in a file named ntrip2csv, and then do something like 
this (for RDF file myfile.owl):

    java jena.rdfcat -out t  myfile.owl | ntrip2csv 

If on windows instead of Unix, use double quotes instead of single 
quotes in the sed command, and get a windows-compatible sed here: 
http://www.cornerstonemag.com/sed/

 -Mark

Mark Wallace
Principal Engineer, Semantic Applications
Modus Operandi, Melbourne, FL, USA



vasavi kamdar wrote:
> Hi,
>
> Can any one please help me with converting an RDF file to CSV
> Thanks and Regards,
> Vasavi Kamdar
>
> The great pleasure in life is doing what people say you cannot do...
Received on Wednesday, 27 January 2010 13:27:49 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:48:05 UTC