Subject: | addendum to #13839 : patch to prevent W3CDTF strings being rendered as resources |
Hi,
This is an addendum to an earlier report. [1] Attached is a patch that will make the serialiser DWIM when passed a W3CDTF string. Currently, the package will render it as a resource. The patch will allow it to be rendered as a literal.
Cheers,
---
[1] http://rt.cpan.org/NoAuth/Bug.html?id=13839
--- Serialiser.pm.dist Wed Aug 11 01:51:42 2004
+++ Serialiser.pm Wed Aug 3 20:26:49 2005
@@ -60,7 +60,7 @@
# assign identifier as an arbitrary (but resolving) uri
my $id = $triples[0]->[0];
- if (($id =~ m/^http/) or ($id =~ m/^\#/)) {
+ if (($id =~ m/^(?:http|file)/) or ($id =~ m/^\#/)) {
$object->{Uri} = $id;
}
else {
@@ -76,7 +76,8 @@
$statement->[2] =~ s/\W//g;
push @{ $object->{nodeid}->{$statement->[1]} },$statement->[2];
}
- elsif (($statement->[2] =~ m/^\w+\:/) or ($statement->[2] =~ m/^\#/)) {
+ elsif ((($statement->[2] =~ m/^\w+\:/) and ($statement->[2] !~ m/^\d{2,4}\:\d{2}\:\d{2}/)) or
+ ($statement->[2] =~ m/^\#/)) {
push @{ $object->{resource}->{$statement->[1]} }, $statement->[2];
}
else {