Skip to content

conversion:datetime_pattern

timrdf edited this page Mar 25, 2011 · 19 revisions

See conversion:Enhancement. See also conversion:date_pattern.

Patterns are processed by Java's SimpleDateFormat.

Tue 14 Dec 2010 01:49:21 +000

Step 1: Change the conversion:range to xsd:dateTime

  conversion:enhance [
     ov:csvCol         4;
     ov:csvHeader     "Completion_Date";
     conversion:label "Completion_Date";
     conversion:comment "";
     conversion:range  xsd:dateTime;
  ];

If you run the conversion without following Step 2 (below), you will see something like this in the stderr log:

bash-3.2$ ./convert-uk-offshore-oil-wells.sh 
...
DATETIME FAILED: "Tue 14 Dec 2010 01:49:21 +000" !~ 0 patterns @ :thing_2 :completion_date
...

This is telling you that the string did not match any of the zero patterns provided. So let's add some patterns!

Step 2: Add the conversion:datetime_pattern

This tells the converter how to parse the date.

  conversion:enhance [
     ov:csvCol         4;
     ov:csvHeader     "Completion_Date";
     conversion:label "Completion_Date";
     conversion:eg           "Tue 14 Dec 2010 01:49:21 +000";
     conversion:datetime_pattern "TODO";
     conversion:comment "";
     conversion:range  xsd:dateTime;
  ];
snapshot of Java's SimpleDateFormat patterns

Queries

What kinds of patterns have been applied (results)?:

prefix conversion: <http://purl.org/twc/vocab/conversion/>

select distinct ?datetime
where {
  graph <http://purl.org/twc/vocab/conversion/ConversionProcess> {
    ?dataset conversion:conversion_process [
      conversion:enhancement_identifier ?e;
      conversion:enhance [ 
        conversion:datetime_pattern ?datetime
      ]
    ] 
  }
}
Clone this wiki locally