Subject: | don't URL-encode rr:column |
http://www.w3.org/TR/r2rml/#from-template says:
"R2RML always performs percent-encoding when IRIs are generated from string templates. If IRIs need to be generated without percent-encoding, then rr:column should be used instead of rr:template".
However, rr:column us turned into rr:template (by surrounding it with {..}), so this distinction is lost.
- This is done 4 times in R2RML.pm, search for {%s}.
One of them sets _about_is_column, but only for Subjects.
- in Simple.pm, template() and template_irisafe() should be called only for rr:template but not for rr:column.
I attach a test. It should output http://purl.org/dc/elements/1.1/title
or dc:title
but not http://example.com/base/http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2Ftitle
Subject: | R2RML-language.pl |
#!/usr/bin/perl
use 5.010;
use lib "../lib";
use RDF::Trine qw[iri statement literal variable];
use RDF::RDB2RDF::R2RML;
my $dbh = DBI->connect("dbi:SQLite:dbname=../t/library.sqlite");
my $mapper = RDF::RDB2RDF->new('R2RML', <<'R2RML');
@base <http://id.example.net/>.
@prefix rr: <http://www.w3.org/ns/r2rml#>.
@prefix rrx: <http://purl.org/r2rml-ext/>.
@prefix bibo: <http://purl.org/ontology/bibo/>.
@prefix dc: <http://purl.org/dc/elements/1.1/>.
[] rr:logicalTable [rr:sqlQuery """
select *,
'http://purl.org/dc/elements/1.1/title' as titleProperty
from books"""];
rr:subjectMap [rr:class bibo:Book; rr:template "book/{book_id}"];
rr:predicateObjectMap [
rr:predicateMap [rr:column "titleProperty"];
rr:objectMap [
rr:column "title";
rrx:languageColumn "title_lang";
rr:language "en" # default
]].
R2RML
print $mapper->process_turtle($dbh) #, no_json=>1, no_r2rml=>1);