-
Notifications
You must be signed in to change notification settings - Fork 36
conversion:datetime_pattern
See conversion:Enhancement. See also conversion:date_pattern.
Patterns are now processed with Joda time.
Patterns used to be processed by Java's SimpleDateFormat.
Tue 14 Dec 2010 01:49:21 +0000
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 +0000" !~ 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!
This tells the converter how to parse the date. It is also very helpful to include a sample value using conversion:eg, so you can see an example while you determine the pattern. It is also helpful for documentation in the future.
conversion:enhance [
ov:csvCol 4;
ov:csvHeader "Completion_Date";
conversion:label "Completion_Date";
conversion:eg "Tue 14 Dec 2010 01:49:21 +0000";
conversion:datetime_pattern "EEE dd MMM yyyy HH:mm:ss Z";
conversion:comment "";
conversion:range xsd:dateTime;
];
Patterns should be specified using Java's SimpleDateFormat, whose table of variables is reproduced here:
What kinds of patterns have been applied to promote literal strings to date times (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
]
]
}
}