Lab: Semantic Lifting - CSV: Difference between revisions

From info216
No edit summary
No edit summary
Line 16: Line 16:


'''Task 1'''
'''Task 1'''
Below are four lines of comma-separated values (csv - five lines with the headers) that could have been saved from a spreadsheet. Copy them into a file and write a program with a loop that reads each line from that file (except the initial header line) and adds it to your graph as triples:
Below are four lines of comma-separated values (csv - five lines with the headers) that could have been saved from a spreadsheet. Copy them into a file and write a program with a loop that reads each line from that file (except the initial header line) and adds it to your graph as triples:



Revision as of 19:23, 12 March 2020

Lab 9: Semantic Lifting - CSV

Topics

Today's topic involves lifting the data in CSV format into RDF. The goal is for you to learn an example of how we can convert unsemantic data into RDF.

CSV stands for Comma Seperated Values, meaning that each point of data is seperated by a column.

Fortunately, CSV is already structured in a way that makes the creation of triples relatively easy.

Relevant Libraries

  • Pandas

Tasks

Task 1

Below are four lines of comma-separated values (csv - five lines with the headers) that could have been saved from a spreadsheet. Copy them into a file and write a program with a loop that reads each line from that file (except the initial header line) and adds it to your graph as triples:

"Name","Gender","Country","Town","Expertise","Interests"
"Regina Catherine Hall","F","Great Britain","Manchester","Ecology, zoology","Football, music travelling"
"Achille Blaise","M","France","Nancy","","Chess, computer games"
"Nyarai Awotwi Ihejirika","F","Kenya","Nairobi","Computers, semantic networks","Hiking, botany"
"Xun He Zhang","M","China","Chengdu","Internet, mathematics, logistics","Dancing, music, trombone"

In the resulting graph, delete all information about Achille.

Useful Readings