Graph Templates

I updated the CSV2RDF document [1] with a sketch of Graph Templates. Basically using concepts from CSV-LD, but applying them to a graph. This needs to be integrated and extended with other metadata requirements, but the basic idea is that the RDF metadata may include a graph template, perhaps as a named graph within the metadata. The graph template is composed of a set of triples where any of subject, predicate, or object can contain a field reference. This largely leverages work from RFC 6570 on URI templates, with a couple of CSV-specific features. It also allows field references to be used in a Literal. There is as yet no consideration for value transformation beyond simple substitution. For example, given an input record such as the following:


name,homepage,image
Homer Simpson,	http://example/homer,	http://example/avatar/homer.png

A template might be defined as follows:

[
  schema:name "{name}"@en;
  schema:homepage <{+homepage}>;
  schema:image <{+image}>
] .

Each record from the input causes the template to be expanded using appropriate value substitution with resulting triples being emitted. There is provision for unmapped values to be expressed as csv:nil, which causes any output triples containing that value to be removed from output.

In the previous example, the result would map as follows:

[
  schema:name "Homer Simpson"@en;
  schema:homepage <http://example/homer>;
  schema:image <http://example/avatar/homer.png>
] .

There should also be provision for referencing field meta-data such as row number.

Gregg Kellogg
gregg@greggkellogg.net

[1] http://w3c.github.io/csvw/csv2rdf/#graph-template
[2] http://tools.ietf.org/html/rfc6570

Received on Tuesday, 15 April 2014 01:17:09 UTC