linked-csv
linked-csv copied to clipboard
Sniff URL values (starting with http:)
@kidehen suggests sniffing URL values (those beginning with http:). See https://twitter.com/kidehen/status/327541085985439744
Sniffing would cover different scenarios but, CSV outputs from a SPARQL query can already come with HTML anchors:
BIND(CONCAT("<a href=\"", str(?iriA), "\">", str(?iriA), "</a>") AS ?iriB)
I don't think that's what @kidehen had in mind: the idea is that normal values in the linked CSV file could be recognised as URLs (just as numbers are recognised as numbers) without there being an explicit type in the type prolog line.
Hi all, I returned to this issue and started working on it again. In the Pull Request, @JeniT suggested that this is done through recognizing (sniffing) that a value is an URL, and assigning it the URL type. After this, the rest of the code should treat and display the value as an URL.
I wanted to ask, where do you think it would be most appropriate to put this sniffing code?
My thought is that it should be done in the parseValue function (in jquery.linked-csv.js), when the app check if the type === 'url'. I'd put a regex in the same if condition, so that the app recognizes an entry as an URL either by the type parameter, or by the regex match.