line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::RDF; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
539704
|
use namespace::clean; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
49
|
|
4
|
7
|
|
|
7
|
|
771
|
use Catmandu::Sane; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
52
|
|
5
|
7
|
|
|
7
|
|
1451
|
use Catmandu::Util qw(is_instance); |
|
7
|
|
|
|
|
33
|
|
|
7
|
|
|
|
|
354
|
|
6
|
7
|
|
|
7
|
|
26
|
use Moo::Role; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
57
|
|
7
|
7
|
|
|
7
|
|
11821
|
use RDF::NS; |
|
7
|
|
|
|
|
13678
|
|
|
7
|
|
|
|
|
1322
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.30'; |
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.png)](https://travis-ci.org/LibreCat/Catmandu-RDF) |
49
|
|
|
|
|
|
|
[![Coverage Status](https://coveralls.io/repos/LibreCat/Catmandu-RDF/badge.png)](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.nt to RDF --type turtle |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
See documentation of modules for more examples. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 DESCRIPTION |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Catmandu::RDF contains modules for handling RDF data within the L<Catmandu> |
68
|
|
|
|
|
|
|
framework. RDF data is encoded/decoded in L<aREF|http://gbv.github.io/aREF/> as |
69
|
|
|
|
|
|
|
implemented with L<RDF::aREF>. Please keep in mind that RDF is a graph-based |
70
|
|
|
|
|
|
|
data structuring format with specialized technologies such as SPARQL and triple |
71
|
|
|
|
|
|
|
stores. Using Catmandu::RDF to transform RDF to RDF (e.g. conversion from one |
72
|
|
|
|
|
|
|
RDF serialization to another) is possible but probably less performant than |
73
|
|
|
|
|
|
|
decent RDF tools. Catmandu::RDF, however, is more conventient to convert |
74
|
|
|
|
|
|
|
between RDF and other data formats. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 AVAILABLE MODULES |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=over |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item L<Catmandu::Exporter::RDF> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Serialize RDF data (as RDF/XML, RDF/JSON, Turtle, NTriples, RDFa...) |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item L<Catmandu::Importer::RDF> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Parse RDF data (RDF/XML, RDF/JSON, Turtle, NTriples...) or import from a SPARQL |
87
|
|
|
|
|
|
|
endpoint |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item L<Catmandu::Fix::aref_query> |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Copy values of RDF data in aREF format to a new field |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=back |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 SEE ALSO |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This module is based on L<Catmandu>, L<RDF::aREF>, L<RDF::Trine>, and |
98
|
|
|
|
|
|
|
L<RDF::NS>. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Copyright Jakob VoÃ, 2014- |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under the same |
105
|
|
|
|
|
|
|
terms as the Perl 5 programming language system itself. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Jakob VoÃ, Patrick Hochstenbach |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |