5

I am working on a project to upgrading a set of 3-star open data (mostly in CSV and JSON formats) to 4-star level. I would like to know if there is any guideline for doing so? What tools may be needed to speed up the process? Examples on the conversion process will be great help. Thanks.

  • 2
    Can you explain/link to the definitions of these classifications? – raphael Nov 13 '15 at 23:53
3

I assume that your are talking about the 5-star Open Data from Tim-Berners Lee.

In this case, you can check this one about working with different kind of file types in Python.

3 star data is CSV and 4 star data is RDF.

From the linked answer:

Comma Separated Files (CSV) files can be a very useful format, because it is compact and thus suitable to transfer large sets of data with the same structure. However, the format is so spartan that data are often useless without documentation since it can be almost impossible to guess the significance of the different columns. It is therefore particularly important for the comma-separated formats that documentation of the individual fields are accurate. Furthermore, it is essential that the structure of the file is respected, as a single omission of a field may disturb the reading of all remaining data in the file without any real opportunity to rectify it, because it cannot be determined how the remaining data should be interpreted. You can use the CSV Python library. Here is an example:

import csv
with open('eggs.csv', 'rb') as csvfile:
    file = csv.reader(<file root>, delimiter=' ', quotechar='|')
    for row in file:
        print ', '.join(row)</pre>

RDF is a W3C-recommended format and makes it possible to represent data in a form that makes it easier to combine data from multiple sources. RDF data can be stored in XML and JSON, among other serializations. RDF encourages the use of URLs as identifiers, which provides a convenient way to directly interconnect existing open data initiatives on the Web. RDF is still not widespread, but it has been a trend among Open Government initiatives, including the British and Spanish Government Linked Open Data projects. The inventor of the Web, Tim Berners-Lee, has recently proposed a five-star scheme that includes linked RDF data as a goal to be sought for open data initiatives I use rdflib for this file format. Here is an example.

from rdflib.graph import Graph
g = Graph()
g.parse("<file root>", format="<format>")
for stmt in g:
   print(stmt)

In addition, you may find interesting the original proposal of W3C about tabular to RDF conversion.

  • There's also JSON-LD which looks like a much more sane approach to Linked Data, compared to the morass of RDF/OWL/SPARQL/triplestores/... – Steve Bennett Dec 7 '15 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.