[libcatmandu-rdf-perl] 12/20: Fixing pod
Jonas Smedegaard
dr at jones.dk
Sat Oct 28 03:10:22 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 091a1f847cea8b3cba8989a472a7ffbed0dc8fd6
Author: Patrick Hochstenbach <patrick.hochstenbach at ugent.be>
Date: Sat Jul 29 11:21:02 2017 +0200
Fixing pod
---
lib/Catmandu/Importer/RDF.pm | 9 ++++++++-
lib/Catmandu/RDF.pm | 13 +++++++++----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/lib/Catmandu/Importer/RDF.pm b/lib/Catmandu/Importer/RDF.pm
index 39a3517..8a443fa 100644
--- a/lib/Catmandu/Importer/RDF.pm
+++ b/lib/Catmandu/Importer/RDF.pm
@@ -285,7 +285,7 @@ sub _hashref_stream {
my $value = $triple->object->is_literal ?
$triple->object->literal_value :
$triple->object->is_blank ?
- $triple->object->blank_identifier :
+ $triple->object->value :
$triple->object->uri_value;
my $type = lc $triple->object->type;
my $lang = $triple->object->is_literal ? $triple->object->literal_value_language : undef;
@@ -340,6 +340,13 @@ Command line client C<catmandu>:
catmandu convert RDF --type ttl --file rdfdump.ttl to JSON
+ # For big input files it will be faster not to build a big hash in memory
+ # bit to return each triple fragment
+ catmandu convert RDF --type ttl --triples 1 --file rdfdump.ttl to JSON
+
+ # Transform back into NTriples
+ catmandu convert RDF --type ttl --triples 1 --file rdfdump.ttl to RDF --type NTriples
+
# Query a SPARQL endpoint
catmandu convert RDF --url http://dbpedia.org/sparql
--sparql "SELECT ?film WHERE { ?film dct:subject <http://dbpedia.org/resource/Category:French_films> }"
diff --git a/lib/Catmandu/RDF.pm b/lib/Catmandu/RDF.pm
index 8a28395..50c88f4 100644
--- a/lib/Catmandu/RDF.pm
+++ b/lib/Catmandu/RDF.pm
@@ -17,12 +17,12 @@ our %TYPE_ALIAS = (
);
has type => (
- is => 'ro',
+ is => 'ro',
coerce => sub { my $t = ucfirst($_[0]); $TYPE_ALIAS{$t} // $t },
);
has ns => (
- is => 'ro',
+ is => 'ro',
default => sub { RDF::NS->new },
coerce => sub {
return $_[0] if is_instance($_[0],'RDF::NS');
@@ -55,10 +55,15 @@ Catmandu::RDF - Modules for handling RDF data within the Catmandu framework
Command line client C<catmandu>:
- catmandu convert RDF --url http://dx.doi.org/10.2474/trol.7.147
+ catmandu convert RDF --url http://dx.doi.org/10.2474/trol.7.147
--fix 'aref_query(dct_title,title)' to YAML
- catmandu convert RDF --file rdfdump.nt to RDF --type turtle
+ catmandu convert RDF --file rdfdump.ttl to RDF --type turtle
+
+ # For big file the only efficient option to convert RDF is by
+ # transforming the input stream into triples and writing to NTriples
+ # in the output
+ catmandu convert convert RDF --triples 1 --type ttl to RDF --type NTriples < rdfdump.ttl
See documentation of modules for more examples.
--
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