~ubuntu-branches/ubuntu/saucy/libmodule-install-doapchangesets-perl/saucy

« back to all changes in this revision

Viewing changes to lib/RDF/DOAP/ChangeSets.pm

  • Committer: Package Import Robot
  • Author(s): Jonas Smedegaard, Jonas Smedegaard
  • Date: 2012-08-07 14:25:59 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120807142559-wukqwz5jfgytood9
Tags: 0.203-1
* New upstream release.

[ Jonas Smedegaard ]
* Bump debhelper compatibility level to 8.
* Update copyright file:
  + Fix use pseudo-license-in-comment and -comment-in-license fields:
    File format 1.0 mandates License field to either be single-line or
    include all licensing info.
  + Extend coverage of main project to include current year.
* Tidy rules file.
* Update package relations:
  + Recommend libmodule-install-doap-perl, libmodule-package-perl and
    recent libmodule-install-rdf-perl.
  + Relax to (build-)depend unversioned on cdbs: Needed version
    satisfied in stable, and oldstable no longer supported.
* Use metacpan.org page as Homepage.
* Use bugtracker as preferred upstream contact.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
2
 
 
3
 
=head1 NAME
4
 
 
5
 
RDF::DOAP::ChangeSets - create pretty ChangeLogs from RDF
6
 
 
7
 
=head1 SYNOPSIS
8
 
 
9
 
 use RDF::DOAP::ChangeSets;
10
 
 use URI::file;
11
 
 
12
 
 my $file     = 'path/to/changelog.rdf';
13
 
 my $file_uri = URI::file->new_abs($file);
14
 
 
15
 
 my $dcs = RDF::DOAP::ChangeSets->new(
16
 
             $file_uri, undef, undef, 'RDFXML');
17
 
 print $dcs->to_string;
18
 
 
19
 
=cut
20
 
 
21
1
package RDF::DOAP::ChangeSets;
22
2
 
23
3
use 5.008;
30
10
use RDF::Query;
31
11
use Text::Wrap;
32
12
 
33
 
our $VERSION = '0.202';
34
 
 
35
 
=head1 DESCRIPTION
36
 
 
37
 
This module takes software changelogs written in the RDF DOAP
38
 
Change Sets vocabulary and produces human-readable changelogs.
39
 
 
40
 
=over
41
 
 
42
 
=item C<< RDF::DOAP::ChangeSets->new($uri, $data, $type, $fmt) >>
43
 
 
44
 
Creates and initialises an object.
45
 
 
46
 
$uri is a URL for the input data. The URL is used to query the
47
 
RDF data for the heading of the output changelog. It may be passed
48
 
as either a string, or a L<URI> object.
49
 
 
50
 
$data is the RDF data to use as input. It may be passed as a
51
 
string, or as an L<RDF::Trine::Model> object. If undefined,
52
 
this module will attempt to read data from the URL using
53
 
L<LWP::Simple>.
54
 
 
55
 
$type gives the constructor a hint as to the RDF vocabulary you
56
 
are using. For DOAP Change Sets, use 'current'; for Aaron Cope's
57
 
Changefile vocab, use 'legacy'; to autodetect, use 'auto'. By
58
 
default, performs autodetection. This module may crash and burn
59
 
if you try to mix both vocabs!!
60
 
 
61
 
$fmt provides a hint as to what RDF format you're using. By
62
 
default, Turtle is assumed. Valid values are whatever
63
 
RDF::Trine::Parser->new accepts.
64
 
 
65
 
=cut
 
13
our $VERSION = '0.203';
66
14
 
67
15
sub new
68
16
{
117
65
        bless $self, $class;
118
66
}
119
67
 
120
 
=item C<< $changeset->is_legacy >>
121
 
 
122
 
Boolean, indicating if a legacy vocab is being used.
123
 
 
124
 
=cut
125
 
 
126
68
sub is_legacy
127
69
{
128
70
        my $self = shift;
129
71
        return (lc $self->{'type'} eq 'legacy');
130
72
}
131
73
 
132
 
=item C<< $changeset->is_current >>
133
 
 
134
 
Boolean, indicating if the current vocab is being used.
135
 
 
136
 
=cut
137
 
 
138
74
sub is_current
139
75
{
140
76
        my $self = shift;
141
77
        return !$self->is_legacy(@_);
142
78
}
143
79
 
144
 
=item C<< $changeset->model >>
145
 
 
146
 
RDF::Trine::Model object representing the changelog data.
147
 
 
148
 
=cut
149
 
 
150
80
sub model
151
81
{
152
82
        my $self = shift;
153
83
        return $self->{'model'};
154
84
}
155
85
 
156
 
=item C<< $changeset->uri >>
157
 
 
158
 
String representing the changelog URI.
159
 
 
160
 
=cut
161
 
 
162
86
sub uri
163
87
{
164
88
        my $self = shift;
165
89
        return $self->{'uri'} . '';
166
90
}
167
91
 
168
 
=item C<< $changeset->to_string >>
169
 
 
170
 
Creates a human-readable representation of the changelog.
171
 
 
172
 
=cut
173
 
 
174
92
sub to_string
175
93
{
176
94
        my $self = shift;
277
195
        return $rv;
278
196
}
279
197
 
280
 
=item C<< $changeset->to_file($filename) >>
281
 
 
282
 
Same as C<to_string>, but outputs to a file.
283
 
 
284
 
=cut
285
 
 
286
198
sub to_file
287
199
{
288
200
        my $self = shift;
503
415
                        OPTIONAL { ?item a ?itemtype . }
504
416
                        OPTIONAL { ?item rdfs:label ?itemlabel . }
505
417
                        OPTIONAL {
506
 
                                ?item dcs:blame ?blame .
 
418
                                ?item dcs:blame|dcs:thanks ?blame .
507
419
                                OPTIONAL { ?blame foaf:nick ?blamenick . }
508
420
                                OPTIONAL { ?blame foaf:name ?blamename . }
509
421
                                OPTIONAL { ?blame rdfs:label ?blamename . }
612
524
 
613
525
__END__
614
526
 
 
527
=head1 NAME
 
528
 
 
529
RDF::DOAP::ChangeSets - create pretty ChangeLogs from RDF
 
530
 
 
531
=head1 SYNOPSIS
 
532
 
 
533
 use RDF::DOAP::ChangeSets;
 
534
 use URI::file;
 
535
 
 
536
 my $file     = 'path/to/changelog.rdf';
 
537
 my $file_uri = URI::file->new_abs($file);
 
538
 
 
539
 my $dcs = RDF::DOAP::ChangeSets->new(
 
540
             $file_uri, undef, undef, 'RDFXML');
 
541
 print $dcs->to_string;
 
542
 
 
543
=head1 DESCRIPTION
 
544
 
 
545
This module takes software changelogs written in the RDF DOAP
 
546
Change Sets vocabulary and produces human-readable changelogs.
 
547
 
 
548
=over
 
549
 
 
550
=item C<< RDF::DOAP::ChangeSets->new($uri, $data, $type, $fmt) >>
 
551
 
 
552
Creates and initialises an object.
 
553
 
 
554
$uri is a URL for the input data. The URL is used to query the
 
555
RDF data for the heading of the output changelog. It may be passed
 
556
as either a string, or a L<URI> object.
 
557
 
 
558
$data is the RDF data to use as input. It may be passed as a
 
559
string, or as an L<RDF::Trine::Model> object. If undefined,
 
560
this module will attempt to read data from the URL using
 
561
L<LWP::Simple>.
 
562
 
 
563
$type gives the constructor a hint as to the RDF vocabulary you
 
564
are using. For DOAP Change Sets, use 'current'; for Aaron Cope's
 
565
Changefile vocab, use 'legacy'; to autodetect, use 'auto'. By
 
566
default, performs autodetection. This module may crash and burn
 
567
if you try to mix both vocabs!!
 
568
 
 
569
$fmt provides a hint as to what RDF format you're using. By
 
570
default, Turtle is assumed. Valid values are whatever
 
571
RDF::Trine::Parser->new accepts.
 
572
 
 
573
=item C<< $changeset->is_legacy >>
 
574
 
 
575
Boolean, indicating if a legacy vocab is being used.
 
576
 
 
577
=item C<< $changeset->is_current >>
 
578
 
 
579
Boolean, indicating if the current vocab is being used.
 
580
 
 
581
=item C<< $changeset->model >>
 
582
 
 
583
RDF::Trine::Model object representing the changelog data.
 
584
 
 
585
=item C<< $changeset->uri >>
 
586
 
 
587
String representing the changelog URI.
 
588
 
 
589
=item C<< $changeset->to_string >>
 
590
 
 
591
Creates a human-readable representation of the changelog.
 
592
 
 
593
=item C<< $changeset->to_file($filename) >>
 
594
 
 
595
Same as C<to_string>, but outputs to a file.
 
596
 
615
597
=back
616
598
 
617
599
=head1 BUGS
630
612
 
631
613
=head1 COPYRIGHT
632
614
 
633
 
Copyright 2010-2011 Toby Inkster
 
615
Copyright 2010-2012 Toby Inkster
634
616
 
635
617
This library is free software; you can redistribute it and/or modify it
636
618
under the same terms as Perl itself.