@@ -243,7 +243,9 @@ has last_etag => ( is => 'rw', isa => Str, predicate => 'has_last_etag');
243
243
=item namespaces ( $namespace_map )
244
244
245
245
Gets or sets the namespaces that some serializers use for
246
- pretty-printing. Should be handed a L<URI::NamespaceMap> object.
246
+ pretty-printing. Should be handed a L<URI::NamespaceMap> object. RDF,
247
+ VoID, Hydra, DC Terms and XML Schema are added by the module and do
248
+ not need to be declared.
247
249
248
250
=cut
249
251
@@ -258,13 +260,11 @@ has 'namespaces' => (is => 'rw',
258
260
259
261
260
262
sub _build_namespaces {
261
- my ($self , $ns_hash ) = @_ ;
262
- my $map = URI::NamespaceMap-> new([' rdf' , ' void' , ' dct' ]);
263
- while (my ($name , $uri ) = each %{$ns_hash }) {
264
- $map -> add_mapping($name => $uri );
265
- }
266
- warn Data::Dumper::Dumper($map )
267
- return $map ;
263
+ my $self = shift ;
264
+ my $nsmap = shift || URI::NamespaceMap-> new();
265
+ $nsmap -> guess_and_add(' rdf' , ' void' , ' dct' , ' xsd' );
266
+ $nsmap -> add_mapping(hydra => ' http://www.w3.org/ns/hydra/core#' );
267
+ return $nsmap ;
268
268
}
269
269
270
270
# Just a temporary compatibility hack
@@ -351,9 +351,7 @@ sub response {
351
351
# TODO: Paging goes here
352
352
$output_model -> add_statement($st );
353
353
}
354
- $self -> add_namespace_mapping(hydra => ' http://www.w3.org/ns/hydra/core#' );
355
354
my $cl = literal($counter , undef , ' http://www.w3.org/2001/XMLSchema#integer' );
356
- warn Data::Dumper::Dumper($self -> list_namespaces);
357
355
my $void = $self -> namespaces-> void;
358
356
$output_model -> add_statement(statement(iri($uri ),
359
357
iri($void -> triples),
0 commit comments