You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by "Kim A. Jakobsen" <Ki...@gmail.com> on 2015/10/01 09:03:24 UTC

CSV to RDF with delimiter |

Hi

I am trying to convert some CSV data into rdf.

My code looks as following:
    Model model_csv_array_impl = ModelFactory.createModelForGraph(new
GraphCSV(getDatasetPath()+"/item.dat")); // PropertyTableArrayImpl
    Dataset dataset = TDBFactory.createDataset(directory) ;
    dataset.begin(ReadWrite.WRITE);
    dataset.addNamedModel("http://example/table1", model_csv_array_impl) ;
    dataset.commit();

My problem is that my CSV file is "|" seperated, how can I tell the parser
what to expect?
Further then I need to tell it my base URI, how do I do that?

Regards Kim

Re: CSV to RDF with delimiter |

Posted by Andy Seaborne <an...@apache.org>.
On 02/10/15 09:22, Claude Warren wrote:
> You might try using any23 (http://any23.apache.org/) to convert from csv to
> turtle or other format understood by Jena and then reading that file.
>
> Claude
>

Just to complete the picture:

The "CSV on the web" W3C working group are in the final stages of their 
standards work and implementations of converters are now appearing.

One that is up to date with the work of the group is Gregg Kellogg's

http://www.slideshare.net/gkellogg1/tabular-data-on-the-web
==>
https://github.com/ruby-rdf/rdf-tabular

	Andy

> On Thu, Oct 1, 2015 at 8:03 AM, Kim A. Jakobsen <Ki...@gmail.com>
> wrote:
>
>> Hi
>>
>> I am trying to convert some CSV data into rdf.
>>
>> My code looks as following:
>>      Model model_csv_array_impl = ModelFactory.createModelForGraph(new
>> GraphCSV(getDatasetPath()+"/item.dat")); // PropertyTableArrayImpl
>>      Dataset dataset = TDBFactory.createDataset(directory) ;
>>      dataset.begin(ReadWrite.WRITE);
>>      dataset.addNamedModel("http://example/table1", model_csv_array_impl) ;
>>      dataset.commit();
>>
>> My problem is that my CSV file is "|" seperated, how can I tell the parser
>> what to expect?
>> Further then I need to tell it my base URI, how do I do that?
>>
>> Regards Kim
>>
>
>
>


Re: CSV to RDF with delimiter |

Posted by Claude Warren <cl...@xenei.com>.
You might try using any23 (http://any23.apache.org/) to convert from csv to
turtle or other format understood by Jena and then reading that file.

Claude

On Thu, Oct 1, 2015 at 8:03 AM, Kim A. Jakobsen <Ki...@gmail.com>
wrote:

> Hi
>
> I am trying to convert some CSV data into rdf.
>
> My code looks as following:
>     Model model_csv_array_impl = ModelFactory.createModelForGraph(new
> GraphCSV(getDatasetPath()+"/item.dat")); // PropertyTableArrayImpl
>     Dataset dataset = TDBFactory.createDataset(directory) ;
>     dataset.begin(ReadWrite.WRITE);
>     dataset.addNamedModel("http://example/table1", model_csv_array_impl) ;
>     dataset.commit();
>
> My problem is that my CSV file is "|" seperated, how can I tell the parser
> what to expect?
> Further then I need to tell it my base URI, how do I do that?
>
> Regards Kim
>



-- 
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren