Skip to content

conversion:pattern

timrdf edited this page Oct 24, 2012 · 4 revisions

What is first

What we will cover

How to use conversion:pattern to specify how to parse an input cell value.

Let's get to it!

conversion:pattern is used to specify how to parse the cell value.

It's most common use is for dates and times. When targeting dates and times, use the pattern syntax of Joda time.

Input table:

description,datetime,date
ate breakfast,2011-05-16T05:43:18Z,13-FEB-09

Enhancement parameters:

      conversion:enhance [
         ov:csvCol          2;
         ov:csvHeader       "datetime";
         conversion:pattern "yyyy-MM-dd'T'HH:mm:ssZ";
         conversion:range   xsd:dateTime;
      ];
      conversion:enhance [
         ov:csvCol          3;
         ov:csvHeader       "date";
         conversion:eg "13-FEB-09";
         conversion:pattern "dd-MMM-yy";
         conversion:range   xsd:date;
      ];

Produces:

:thing_2 
   e1:description "ate breakfast" ;
   e1:datetime    "2011-05-16T01:43:18-04:00"^^xsd:dateTime ;
   e1:date        "2009-02-13"^^xsd:date ;

Historical note: conversion:pattern replaced conversion:datetime_pattern and conversion:date_pattern to provide a general form independent of the target datatype.

Clone this wiki locally