[libcatmandu-rdf-perl] 09/20: Fixing RDF/JSON

Jonas Smedegaard dr at jones.dk
Sat Oct 28 03:10:21 UTC 2017


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag upstream/0.32
in repository libcatmandu-rdf-perl.

commit 22b0030795ddd8da7e5560f7c481504fbb4accfb
Author: Patrick Hochstenbach <patrick.hochstenbach at ugent.be>
Date:   Sat Jul 29 10:46:10 2017 +0200

    Fixing RDF/JSON
---
 lib/Catmandu/Importer/RDF.pm | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/lib/Catmandu/Importer/RDF.pm b/lib/Catmandu/Importer/RDF.pm
index c8dbc2c..8959606 100644
--- a/lib/Catmandu/Importer/RDF.pm
+++ b/lib/Catmandu/Importer/RDF.pm
@@ -307,13 +307,14 @@ sub _aref_stream {
         my $lang      = $triple->object->is_literal ? $triple->object->literal_value_language : undef;
         my $datatype  = $triple->object->is_literal ? $triple->object->literal_datatype : undef;
 
-        print $pipe encode_json({
-            $subject => {
-              $predicate => [
-                { type => $type , datatype => $datatype , lang => $lang , value => $value }
-              ]
-            }
-        }) , "\n";
+        my $hashref = {};
+
+        $hashref->{$subject}->{$predicate}->[0]->{type}     = $type;
+        $hashref->{$subject}->{$predicate}->[0]->{datatype} = $datatype if $datatype;
+        $hashref->{$subject}->{$predicate}->[0]->{lang}     = $lang if $lang;
+        $hashref->{$subject}->{$predicate}->[0]->{value}    = $value;
+
+        print $pipe encode_json($hashref) , "\n";
     };
 
     if ($self->url) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcatmandu-rdf-perl.git



More information about the Pkg-perl-cvs-commits mailing list