Skip to content

Instantly share code, notes, and snippets.

@dret
Created December 12, 2013 01:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dret/7921696 to your computer and use it in GitHub Desktop.
Save dret/7921696 to your computer and use it in GitHub Desktop.
HyperCSV: Very Rough Sketch
http://example.com/people/{cell},#relcell(1),name CRLF
42,employee,Jeni CRLF
66,customer,Erik CRLF
@dret
Copy link
Author

dret commented Dec 12, 2013

CSV is pure data and as such does not really allow any meaningful linking to other web resources. To create HyperCVS, a hypothetical hyperlinked CSV format, one needs to establish linking capabilities (the ability to carry links in a discoverable way) and maybe even meaningful links (the ability to qualify link through link relations, i.e. the ability to create types links). A very limited (and basic) way of establishing these goals could be done as follows:

The optional header line is used to express linking capabilities in the data. URI Templates are used for a column to map each row's value to a URI, so that, when interpreting that cell value as HyperCSV, it's a URI. Here's how this might look (no idea what to use best for the variable name):

http://example.com/products/{cell},product name CRLF
42,car CRLF
66,book CRLF

The optional header line could also be used to designate rows as specifying link relations (and maybe there's a good way how the URI Template shown above could be augmented also define the link relation, if it is the same for all rows). Let's say CSV contains address information about employees and customers. this could be turned into typed links through something like this:

http://example.com/people/{cell},#relcell(1),name CRLF
42,employee,Jeni CRLF
66,customer,Erik CRLF

now the links established through the constructed URIs in column 1 is typed through the link relation given in column 2. But maybe that mechanism should also allow URI templates, because link relations often are URIs (unless they use registered link relation types)? I'll leave that as an exercise for more detailed discussions.

Even more complex version of this approach might allow URI templates combining values from various cells, but that might become tricky.

With this approach, it would be possible to have CSV that one tyhe one hand still looks useful and concise in a regular spreadsheet, but it also has well-defined ways of how it connects to other web resources. The linking model is necessarily primitive (it probably could be improved, but will always be limited by the natural simplicity of the CSV format), but at least is good enough to turn CSV data into linked data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment