File Coverage

blib/lib/Catmandu/RDF.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
1             package Catmandu::RDF;
2              
3 18     18   1426033 use namespace::clean;
  18         35  
  18         124  
4 18     18   3170 use Catmandu::Sane;
  18         50  
  18         193  
5 18     18   3657 use Catmandu::Util qw(is_instance);
  18         54  
  18         1091  
6 18     18   170 use Moo::Role;
  18         36  
  18         122  
7 18     18   29942 use RDF::NS;
  18         40888  
  18         3147  
8              
9             our $VERSION = '0.32';
10              
11             our %TYPE_ALIAS = (
12             Ttl => 'Turtle',
13             N3 => 'Notation3',
14             Xml => 'RDFXML',
15             XML => 'RDFXML',
16             Json => 'RDFJSON',
17             );
18              
19             has type => (
20             is => 'ro',
21             coerce => sub { my $t = ucfirst($_[0]); $TYPE_ALIAS{$t} // $t },
22             );
23              
24             has ns => (
25             is => 'ro',
26             default => sub { RDF::NS->new },
27             coerce => sub {
28             return $_[0] if is_instance($_[0],'RDF::NS');
29             return $_[0] if !$_[0];
30             return RDF::NS->new($_[0]);
31             },
32             handles => ['uri'],
33             );
34              
35             1;
36             __END__
37              
38             =encoding utf8
39              
40             =head1 NAME
41              
42             Catmandu::RDF - Modules for handling RDF data within the Catmandu framework
43              
44             =begin markdown
45              
46             # STATUS
47              
48             [![Build Status](https://travis-ci.org/LibreCat/Catmandu-RDF.svg)](https://travis-ci.org/LibreCat/Catmandu-RDF)
49             [![Coverage Status](https://coveralls.io/repos/LibreCat/Catmandu-RDF/badge.svg)](https://coveralls.io/r/LibreCat/Catmandu-RDF)
50             [![Kwalitee Score](http://cpants.cpanauthors.org/dist/Catmandu-RDF.png)](http://cpants.cpanauthors.org/dist/Catmandu-RDF)
51              
52             =end markdown
53              
54             =head1 SYNOPSIS
55              
56             Command line client C<catmandu>:
57              
58             catmandu convert RDF --url http://dx.doi.org/10.2474/trol.7.147
59             --fix 'aref_query(dct_title,title)' to YAML
60              
61             catmandu convert RDF --file rdfdump.ttl to RDF --type turtle
62              
63             # For big file the only efficient option to convert RDF is by
64             # transforming the input stream into triples and writing to NTriples
65             # in the output
66             catmandu convert convert RDF --triples 1 --type ttl to RDF --type NTriples < rdfdump.ttl
67              
68             See documentation of modules for more examples.
69              
70             =head1 DESCRIPTION
71              
72             Catmandu::RDF contains modules for handling RDF data within the L<Catmandu>
73             framework. RDF data is encoded/decoded in L<aREF|http://gbv.github.io/aREF/> as
74             implemented with L<RDF::aREF>. Please keep in mind that RDF is a graph-based
75             data structuring format with specialized technologies such as SPARQL and triple
76             stores. Using Catmandu::RDF to transform RDF to RDF (e.g. conversion from one
77             RDF serialization to another) is possible but probably less performant than
78             decent RDF tools. Catmandu::RDF, however, is more conventient to convert
79             between RDF and other data formats.
80              
81             =head1 AVAILABLE MODULES
82              
83             =over
84              
85             =item L<Catmandu::Exporter::RDF>
86              
87             Serialize RDF data (as RDF/XML, RDF/JSON, Turtle, NTriples, RDFa...)
88              
89             =item L<Catmandu::Importer::RDF>
90              
91             Parse RDF data (RDF/XML, RDF/JSON, Turtle, NTriples...) or import from a SPARQL
92             endpoint
93              
94             =item L<Catmandu::Fix::aref_query>
95              
96             Copy values of RDF data in aREF format to a new field
97              
98             =back
99              
100             =head1 SEE ALSO
101              
102             This module is based on L<Catmandu>, L<RDF::aREF>, L<RDF::Trine>, and
103             L<RDF::NS>.
104              
105             =head1 COPYRIGHT AND LICENSE
106              
107             Copyright Jakob Voß, 2014-
108              
109             This is free software; you can redistribute it and/or modify it under the same
110             terms as the Perl 5 programming language system itself.
111              
112             =head1 CONTRIBUTORS
113              
114             Jakob Voß, Patrick Hochstenbach
115              
116             =cut