Skip to content

Commit f4c8e6f

Browse files
committed
Rewrite to use the namespacing (issue #8)
1 parent 2999dbd commit f4c8e6f

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

lib/RDF/LinkedData.pm

+24-23
Original file line numberDiff line numberDiff line change
@@ -757,59 +757,60 @@ has _last_extvoid_mtime => (is => 'rw', isa => Int);
757757
sub _common_fragments_control {
758758
my $self = shift;
759759
my $model = shift || RDF::Trine::Model->temporary_model;
760-
my $void = RDF::Trine::Namespace->new('http://rdfs.org/ns/void#');
761-
my $xsd = RDF::Trine::Namespace->new('http://www.w3.org/2001/XMLSchema#');
762-
my $hydra = RDF::Trine::Namespace->new('http://www.w3.org/ns/hydra/core#');
763-
my $rdf = RDF::Trine::Namespace->new('http://www.w3.org/1999/02/22-rdf-syntax-ns#');
760+
$self->guess_namespaces('rdf', 'void');
761+
$self->add_namespace_mapping(hydra => 'http://www.w3.org/ns/hydra/core#');
762+
my $void = $self->namespaces->void;
763+
my $hydra = $self->namespaces->hydra;
764+
my $rdf = $self->namespaces->rdf;
764765
$model->begin_bulk_ops;
765766
my $void_subject = $self->void->dataset_uri;
766767
$model->add_statement(statement($void_subject,
767-
$rdf->type,
768-
$hydra->Collection));
768+
iri($rdf->type),
769+
iri($hydra->Collection)));
769770
$model->add_statement(statement($void_subject,
770-
$rdf->type,
771-
$void->Dataset));
771+
iri($rdf->type),
772+
iri($void->Dataset)));
772773
$model->add_statement(statement($void_subject,
773-
$hydra->search,
774+
iri($hydra->search),
774775
blank('template')));
775776
$model->add_statement(statement($void_subject,
776-
$void->uriLookupEndpoint,
777+
iri($void->uriLookupEndpoint),
777778
literal($self->base_uri . $self->fragments_config->{fragments_path}
778779
. '{?subject,predicate,object}')));
779780
$model->add_statement(statement(blank('template'),
780-
$hydra->template,
781+
iri($hydra->template),
781782
literal($self->base_uri . $self->fragments_config->{fragments_path}
782783
. '{?subject,predicate,object}')));
783784

784785
$model->add_statement(statement(blank('template'),
785-
$hydra->mapping,
786+
iri($hydra->mapping),
786787
blank('subject')));
787788
$model->add_statement(statement(blank('template'),
788-
$hydra->mapping,
789+
iri($hydra->mapping),
789790
blank('predicate')));
790791
$model->add_statement(statement(blank('template'),
791-
$hydra->mapping,
792+
iri($hydra->mapping),
792793
blank('object')));
793794

794795
$model->add_statement(statement(blank('subject'),
795-
$hydra->property,
796-
$rdf->subject));
796+
iri($hydra->property),
797+
iri($rdf->subject)));
797798
$model->add_statement(statement(blank('subject'),
798-
$hydra->variable,
799+
iri($hydra->variable),
799800
literal('subject')));
800801

801802
$model->add_statement(statement(blank('predicate'),
802-
$hydra->property,
803-
$rdf->predicate));
803+
iri($hydra->property),
804+
iri($rdf->predicate)));
804805
$model->add_statement(statement(blank('predicate'),
805-
$hydra->variable,
806+
iri($hydra->variable),
806807
literal('predicate')));
807808

808809
$model->add_statement(statement(blank('object'),
809-
$hydra->property,
810-
$rdf->object));
810+
iri($hydra->property),
811+
iri($rdf->object)));
811812
$model->add_statement(statement(blank('object'),
812-
$hydra->variable,
813+
iri($hydra->variable),
813814
literal('object')));
814815
$model->end_bulk_ops;
815816
return $model;

0 commit comments

Comments
 (0)