How to convert CSV to RDF file format

1,104 views
Skip to first unread message

Arun Tyagi

unread,
May 6, 2016, 8:41:42 AM5/6/16
to rdflib-dev
Hi:

I am new to semantic web classification. I am looking to use this methodology on raw text data(like: Chat data). I have below questions: please help
1. Is there any way/library to convert CSV file format to RDF file format.
2. If we can convert CSV to RDF, how to write the ontology??
3. How to use RDF file data for semantic classification(is there any library, which can help me in semantic web classification)?

rezai...@gmail.com

unread,
Nov 8, 2017, 4:19:25 AM11/8/17
to rdflib-dev


Hi
I have a csv file and would like to rdf format. Have you find any solution regarding this issue?
Cheers,

Thomas Winningham

unread,
Nov 8, 2017, 1:44:07 PM11/8/17
to rdfli...@googlegroups.com
The Java based Jena library has a command line tool mentioned towards the bottom of this getting started guide: http://jena.apache.org/documentation/csv/get_started.html ... There are also some notes about their CSV schema here: http://jena.apache.org/documentation/csv/ ... Jython could be used if you want to remain in the Python world, but I've had success with the command line tool just fine without any programming required.


--
http://github.com/RDFLib
---
You received this message because you are subscribed to the Google Groups "rdflib-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rdflib-dev+unsubscribe@googlegroups.com.
To post to this group, send email to rdfli...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rdflib-dev/04f73520-6f46-4a5d-a28f-ef2267ad04a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

rezai...@gmail.com

unread,
Nov 8, 2017, 2:49:43 PM11/8/17
to rdflib-dev
On Wednesday, 8 November 2017 19:44:07 UTC+1, Thomas wrote:
> The Java based Jena library has a command line tool mentioned towards the bottom of this getting started guide: http://jena.apache.org/documentation/csv/get_started.html ... There are also some notes about their CSV schema here: http://jena.apache.org/documentation/csv/ ... Jython could be used if you want to remain in the Python world, but I've had success with the command line tool just fine without any programming required.
>
>
> On Wed, Nov 8, 2017 at 4:19 AM, <rezai...@gmail.com> wrote:
> On Friday, 6 May 2016 14:41:42 UTC+2, Arun Tyagi  wrote:
>
> > Hi:
>
> >
>
> >
>
> > I am new to semantic web classification. I am looking to use this methodology on raw text data(like: Chat data). I have below questions: please help
>
> > 1. Is there any way/library to convert CSV file format to RDF file format.
>
> > 2. If we can convert CSV to RDF, how to write the ontology??
>
> > 3. How to use RDF file data for semantic classification(is there any library, which can help me in semantic web classification)?
>
>
>
>
>
> Hi
>
>  I have a csv file and would like to rdf format. Have you find any solution regarding this issue?
>
> Cheers,
>
>
>
> --
>
> http://github.com/RDFLib
>
> ---
>
> You received this message because you are subscribed to the Google Groups "rdflib-dev" group.
>
> To unsubscribe from this group and stop receiving emails from it, send an email to rdflib-dev+...@googlegroups.com.
>
> To post to this group, send email to rdfli...@googlegroups.com.
>
> To view this discussion on the web visit https://groups.google.com/d/msgid/rdflib-dev/04f73520-6f46-4a5d-a28f-ef2267ad04a9%40googlegroups.com.
>
>
>
> For more options, visit https://groups.google.com/d/optout.

Thank you very much for your help regarding the issue.

Cheers,

张玉卿

unread,
Jan 21, 2024, 10:11:46 AMJan 21
to rdflib-dev
I tried a web service app, it is efficient and easy to use,  but it is not free, if you want to try, here is the web service app link:
https://github.com/zzheng90/csv2rdf-converter

Nicholas Car

unread,
Jan 22, 2024, 2:59:41 AMJan 22
to rdfli...@googlegroups.com
Converting CSV data to RDF is a common task. I usually use just a few lines of Python for this - read CSV, add triple(s) to graph etc.

There are some pre-canned tools in RDFlib for this - https://github.com/RDFLib/rdflib/blob/main/rdflib/tools/csv2rdf.py - but again, I usually just write a few lines of Python, for my particular task.

> 1. Is there any way/library to convert CSV file format to RDF file format. 

Described above!


> 2. If we can convert CSV to RDF, how to write the ontology?? 

I usually use standard OWL models where I can and, if I can't think I make a model, publish it in some way (even if only internally) then use the elements from that model in my conversion script. You can create the shell of an ontology - just naming the elements, no ontology rules - by created a Defined Namespace, like RDFLib does for lots of reference models, see all the files in https://github.com/RDFLib/rdflib/tree/main/rdflib/namespace. You could create a DefinedNAmespace for your model, e.g. class MyModel ... and then definite all the classes and predicates you want and then use them.

As to what classes and predicates to make... sorry, that's modelling not technical RDFLib use.


3. How to use RDF file data for semantic classification(is there any library, which can help me in semantic web classification)? 

Try Annif (https://annif.org/). That'a whole workflow system that needs SKOS vocabularies, not just any RDF files, but it's very powerful. Apart from that, you can do any custom code: RDF is just a data model and you can use Large Language Models, clustering algorithms etc to classify data according to entries in an RDF data model, like classes in an ontology or concepts in a vocabulary.

Cheers, Nick



Reply all
Reply to author
Forward
0 new messages