RDF to CSV

3,153 views
Skip to first unread message

zoe

unread,
Jan 27, 2010, 10:03:33 AM1/27/10
to TopBraid Composer Users
Hi,

I am working on a research project in the biomedical sciences
I am trying to find a way to convert RDF files that I downloaded from
Gopubmed to CSV format so that I can analyze the data and answer
my research questions.

I have thousands of file to convert. Can any one pls guide me :)

Thanks Zoe

Dave butlerdi

unread,
Jan 27, 2010, 10:40:14 AM1/27/10
to topbraid-co...@googlegroups.com
XSLT


--
You received this message because you are subscribed to the Google Groups "TopBraid Composer Users" group.
To post to this group, send email to topbraid-co...@googlegroups.com.
To unsubscribe from this group, send email to topbraid-composer...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/topbraid-composer-users?hl=en.




--
Regards

Dave Butler
butlerdi-at-gmail-dot-com

Also on Skype as butlerdi

Get Skype here http://www.skype.com/download.html


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************

zoe

unread,
Jan 27, 2010, 10:55:23 AM1/27/10
to TopBraid Composer Users
Thanks Dave for your quick response. I appreciate if you can provide
little more details on approaching this method :)


On Jan 27, 10:40 am, Dave butlerdi <butle...@gmail.com> wrote:
> XSLT
>
>
>
>
>
> On Wed, Jan 27, 2010 at 4:03 PM, zoe <zoe.semant...@gmail.com> wrote:
> > Hi,
>
> > I am working on a research project in the biomedical sciences
> > I am trying to find a way to convert RDF files that I downloaded from
> > Gopubmed to CSV format so that I can analyze the data and answer
> > my research questions.
>
> > I have thousands of file to convert. Can any one pls guide me :)
>
> > Thanks Zoe
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "TopBraid Composer Users" group.
> > To post to this group, send email to
> > topbraid-co...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > topbraid-composer...@googlegroups.com<topbraid-composer-user s%2Bunsu...@googlegroups.com>


> > .
> > For more options, visit this group at
> >http://groups.google.com/group/topbraid-composer-users?hl=en.
>
> --
> Regards
>
> Dave Butler
> butlerdi-at-gmail-dot-com
>
> Also on Skype as butlerdi
>

> Get Skype herehttp://www.skype.com/download.html

Scott Henninger

unread,
Jan 27, 2010, 11:02:18 AM1/27/10
to TopBraid Composer Users
Zoe; To convert RDF triples to CSVs try sml:CreateSpreadsheet. This
takes SPARQL query and creates tab-delimited text from the results.
Then pass to an ExportText module.

If you're unfamiliar with SPARQLMotion, this would minimally consist
of three modules:
1. ImportRDFFromWorkspace (or URL) - this can be in any format,
including xml/rdf, n3/turtle, data back-ends, etc
2. CreateSpreadsheet
3. ExportText

-- Scott

Scott Henninger

unread,
Jan 27, 2010, 11:13:42 AM1/27/10
to TopBraid Composer Users
XSLT might work if you have an XML serialization of your RDF.
Generally there are less painful ways of doing this (such as the
CreateSpreadsheet approach) if you are working at the RDF level
instead of the XML source code level.

Lots of tutorials on XSLT, but RDF/XML adds significant complications
as XML is a tree-based data structure trying to represent RDF graphs.
SPARQL is a much more direct way of querying the data.

-- Scott

Holger Knublauch

unread,
Jan 27, 2010, 12:05:26 PM1/27/10
to topbraid-co...@googlegroups.com
And if you have thousands of files to convert, then you can use tops:files to iterate over them. Using SPARQLMotion you can define an sml:IterateOverSelect with a query such as the following:

SELECT ?file
WHERE {
    ?file tops:files ("Demos" true) .
}

Holger


--
You received this message because you are subscribed to the Google Groups "TopBraid Composer Users" group.
To post to this group, send email to topbraid-co...@googlegroups.com.
To unsubscribe from this group, send email to topbraid-composer...@googlegroups.com.

zoe

unread,
Jan 27, 2010, 1:04:19 PM1/27/10
to TopBraid Composer Users
Hi,
Thank you all for your responses :)
Have already started working on it. Hope it works!

Thanks once again!

zoe snow

unread,
Jan 27, 2010, 4:30:15 PM1/27/10
to topbraid-co...@googlegroups.com
Hi,

I am trying to open an RDF file in TopBraidComposer, but its throwing me some error. As I am novice user I beleive I am doing wrong somewhere. Attach images can help you understand better about my error. 

I am not even able to import the file as its showing me a dialog box where I cannot browse for the file.

Pls guide me.

Are there any tutorials or documentation on TBC?


--
You received this message because you are subscribed to the Google Groups "TopBraid Composer Users" group.
To post to this group, send email to topbraid-co...@googlegroups.com.
To unsubscribe from this group, send email to topbraid-composer...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/topbraid-composer-users?hl=en.




--
Thanks,
Zoe
OpenRDFFile.JPG
OpenRDFFileError.JPG

Holger Knublauch

unread,
Jan 28, 2010, 6:21:59 AM1/28/10
to topbraid-co...@googlegroups.com
Hi Zoe,

the file may be invalid or corrupted. In any case, you should copy all your .rdf files into the Eclipse workspace and open them from there.

Since I found that your use case may also be a good example for others, I have prepared a quick demo SPARQLMotion script that does the following:

For all .rdf or .owl files in a given folder (recursively)
Load the file
Create a spreadsheet with all sub/superclass relationships
Write the spreadsheet to a file {?fileName}-report.txt

An example report spreadsheet would look like:

subClass superClass
xsd:decimal nc:numericUnion
xsd:double nc:numericUnion
xsd:float nc:numericUnion
xsd:integer nc:numericUnion
nc:Cogency nc:Category
nc:ConceptDomain nc:Category
...

The script is attached - you just need to replace the rootFileName in the first module of the script. See also the screenshot of the script.

Regards
Holger

> <OpenRDFFile.JPG><OpenRDFFileError.JPG>

CreateReportSpreadsheets.rdf
CreateReportSpreadsheets.png

Jacson Barros

unread,
Jan 28, 2010, 6:05:17 AM1/28/10
to topbraid-co...@googlegroups.com
Hi,
 
See these links. Can be useful.
 
 
Regards,
 
Jacson
 
 

 
2010/1/27 zoe snow <zoe.se...@gmail.com>

Scott Henninger

unread,
Jan 28, 2010, 12:15:14 PM1/28/10
to topbraid-co...@googlegroups.com
Zoe; As Holger stated, this is a frequent kind of process pattern.  So I've attached an example using his script.  This one process some sample data on persons (our much-used kennedy's example).  It demonstrates that the RDF source can be in different formats and has another example of a SPARQL script that generates the CSV file.  Hopefully this will help you and others.

To install this, unzip and do a File > Import > General > Existing Projects into workspace.

Some other information to help you get started below.  Also we do offer training (see http://www.topquadrant.com/training/training_overview.html)
 -  Getting Ready for the Semantic Web with TopBraid Suite
    - February 1-4, 2010, Wash., DC.
    - May 3-6, 2010, Wash., DC.
 - TopBraid Advanced Product Training
    - March 1-4, 2010, Wash., DC.

You should take a look at the Help files.  Lots of good introduction information in Getting Started

The initial steps for the screen image you sent are to:

 1. Do a File  >New > Project, General > Project and Next.  Fill in a project name.  This creates a project in the Navigator view (lower-left pane of the TopBraid Composer view)

 2. Populate the project with your RDF files.  This can be done by drag & drop or clicking on the project and do an Import from the file system (yea, just drag & drop).

 3. Open the model by double-clicking on the name in the Navigator.

For SPARQLMotion scripts there is a tutorial on SPARQLMotion scripts at http://www.topquadrant.com/products/SPARQLMotion.html

Hope all of this helps!
-- Scott


zoe snow wrote:





ExampleProject.zip

zoe snow

unread,
Jan 28, 2010, 3:48:20 PM1/28/10
to topbraid-co...@googlegroups.com
Hi,
Thank you all for quick responses. I followed the steps of Importing rdf file --> creating Spread Sheet--> exporting as text

when I am debugging the Export, its throwing me error saying "Could not Execute SPARQLMotion Script."

following images might help you understand better.

Please guide.
ConsoleError.JPG
FileCreate.JPG

Scott Henninger

unread,
Jan 28, 2010, 4:01:36 PM1/28/10
to TopBraid Composer Users
Zoe; You need to use ImportRDFFromWorkspace. Really highly suggested
that you take a quick look at the SPARQLMotion tutorial.

-- Scott

On Jan 28, 2:48 pm, zoe snow <zoe.semant...@gmail.com> wrote:
> Hi,
> Thank you all for quick responses. I followed the steps of Importing rdf
> file --> creating Spread Sheet--> exporting as text
>
> when I am debugging the Export, its throwing me error saying "Could not
> Execute SPARQLMotion Script."
>
> following images might help you understand better.
>
> Please guide.
>
> On Thu, Jan 28, 2010 at 12:15 PM, Scott Henninger <
>
>
>
> shennin...@topquadrant.com> wrote:
> >  Zoe; As Holger stated, this is a frequent kind of process pattern.  So
> > I've attached an example using his script.  This one process some sample
> > data on persons (our much-used kennedy's example).  It demonstrates that the
> > RDF source can be in different formats and has another example of a SPARQL
> > script that generates the CSV file.  Hopefully this will help you and
> > others.
>
> > To install this, unzip and do a File > Import > General > Existing Projects
> > into workspace.
>
> > Some other information to help you get started below.  Also we do offer

> > training (seehttp://www.topquadrant.com/training/training_overview.html)

> >> topbraid-composer...@googlegroups.com<topbraid-composer-users%2Bunsu...@googlegroups.com>


> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/topbraid-composer-users?hl=en.
>
> > --
> > Thanks,
> > Zoe
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "TopBraid Composer Users" group.
> > To post to this group, send email to
> > topbraid-co...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > topbraid-composer...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/topbraid-composer-users?hl=en.
>

> > ------------------------------
>
> >  ------------------------------


>
> >   --
> > You received this message because you are subscribed to the Google Groups
> > "TopBraid Composer Users" group.
> > To post to this group, send email to
> > topbraid-co...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > topbraid-composer...@googlegroups.com<topbraid-composer-users%2Bunsu...@googlegroups.com>


> > .
> > For more options, visit this group at
> >http://groups.google.com/group/topbraid-composer-users?hl=en.
>
> --
> Thanks,
> Zoe
>

>  image_jpeg_part
> 47KViewDownload
>
>  image_jpeg_part
> 38KViewDownload
>
>  ConsoleError.JPG
> 49KViewDownload
>
>  FileCreate.JPG
> 30KViewDownload

Matt

unread,
Feb 1, 2010, 12:19:02 PM2/1/10
to TopBraid Composer Users
A simplistic alternative is just to:
1) Load the rdf file into TBC (File->Open-><find file on hard drive>)
2) Execute a SPARQL Query in the "Sparql" View.
-->For example: SELECT ?s ?p ?o WHERE {?s ?p ?o}
3) Click on the Disk Icon (called "Export"), choose a file name and
select "Tab-separated Spreadsheet".
4) Then Open the saved file from step3 in excel, when you import
choose the deliminator to be "tab-separated"

I haven't learned SPARQL Motion yet myself, although it is eternally
on my ToDo list, because it seems like a nice way to script some
common semantic web tasks.

Rupal Verma

unread,
May 20, 2015, 8:21:20 AM5/20/15
to topbrai...@googlegroups.com, topbraid-co...@googlegroups.com
Hi Zoe

I am into the similar situation of converting an RDF file to a .csv/.xlsx file but could find an effective tool for the conversion. If you have already worked on this problem can you please help me out with it. 

Thanks
Rupal

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. You are also notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

David Price

unread,
May 20, 2015, 8:45:10 AM5/20/15
to topbrai...@googlegroups.com, topbraid-co...@googlegroups.com
There is no generic way to convert from data in a graph to data in a table, which is what RDF to CSV would be doing.

Best way is probably to write a SPARQL query over the RDF and let that produce the CSV results that you want. That way you control everything.

Cheers,
--
You received this message because you are subscribed to the Google Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary Network (EVN), Reference Data Manager (RDM), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to topbrai...@googlegroups.com
---
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Irene Polikoff

unread,
May 20, 2015, 12:39:15 PM5/20/15
to topbrai...@googlegroups.com, topbraid-co...@googlegroups.com
Zoe and Rupal,

Open CreateReportSpreadsheets.ttl in the Examples folder of TopBraid project in TopBraid Composer. Then, click on Scripts menu > Edit/View SPARQLMotion Scripts.

You will see a script that iterates over all RDF files in a given folder and converts each into a spreadsheet. The spreadsheet has two columns – one listing a class and another listing its immediate parent class. The columns are determined by a query so you can change it according to what data you want to have in your spreadsheets.

You will need TopBraid Composer Maestro Edition.

It is also possible to generate Excel files, but this is a bit more involved, so lets start with this example.

Regards,

Irene Polikoff


--
Reply all
Reply to author
Forward
0 new messages