Catmandu-AAT-0.03 000755 001750 001750 0 13035363337 14070 5 ustar 00vagrant vagrant 000000 000000 README 100644 001750 001750 3305 13035363337 15032 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03 NAME
Catmandu::AAT - Retrieve items from the AAT
SYNOPSIS
This module contains a store to lookup a Subject in the AAT
using its
SPARQL endpoint .
Also included is a fix to match a term to a Subject and a fix to search
for a term in the AAT.
lookup_in_store(objectName, AAT, lang:nl)
aat_match(objectName, -lang:nl)
aat_search(objectName, -lang:nl)
DESCRIPTION
Catmandu::Store::AAT
lookup_in_store(
objectName,
AAT,
lang: nl
)
The lang parameter is optional and defaults to nl. It sets the language
of the returned prefLabel. If no prefLabel for the Subject in provided
lang exists, nothing is returned.
The store takes the dc:identifier of a Subject from the AAT and returns
the following data:
{
'id' => 'The dc:identifier of the Subject',
'prefLabel' => 'The prefLabel in the provided language',
'uri' => 'The URI of the Subject'
}
Catmandu::Fix::aat_match
aat_match(
path,
-lang: nl
)
A fix that performs a match between a term and a prefLabel of an AAT
Subject.
Catmandu::Fix::aat_search
aat_search(
path,
-lang: nl
)
A fix that performs a search for a term in the AAT.
AUTHOR
Pieter De Praetere
COPYRIGHT
Copyright 2017- PACKED vzw
LICENSE
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
SEE ALSO
Catmandu Catmandu::Store::AAT Catmandu::Fix::aat_search
Catmandu::Fix::aat_match
Changes 100644 001750 001750 335 13035363337 15425 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03 Revision history for Catmandu-Store-AAT
0.03 2017-01-11 08:03:38 UTC
- Bugfix for #1
0.02 2017-01-11 07:11:55 UTC
- Refactored to Catmandu::AAT
0.01 2017-01-06 14:22:12 UTC
- Initial release
LICENSE 100644 001750 001750 44007 13035363337 15203 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03 This software is copyright (c) 2017- by Pieter De Praetere .
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
Terms of the Perl programming language system itself
a) the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any
later version, or
b) the "Artistic License"
--- The GNU General Public License, Version 1, February 1989 ---
This software is Copyright (c) 2017- by Pieter De Praetere .
This is free software, licensed under:
The GNU General Public License, Version 1, February 1989
GNU GENERAL PUBLIC LICENSE
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The license agreements of most software companies try to keep users
at the mercy of those companies. By contrast, our General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. The
General Public License applies to the Free Software Foundation's
software and to any other program whose authors commit to using it.
You can use it for your programs, too.
When we speak of free software, we are referring to freedom, not
price. Specifically, the General Public License is designed to make
sure that you have the freedom to give away or sell copies of free
software, that you receive source code or can get it if you want it,
that you can change the software or use pieces of it in new free
programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of a such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must tell them their rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any program or other work which
contains a notice placed by the copyright holder saying it may be
distributed under the terms of this General Public License. The
"Program", below, refers to any such program or work, and a "work based
on the Program" means either the Program or any work containing the
Program or a portion of it, either verbatim or with modifications. Each
licensee is addressed as "you".
1. You may copy and distribute verbatim copies of the Program's source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this
General Public License and to the absence of any warranty; and give any
other recipients of the Program a copy of this General Public License
along with the Program. You may charge a fee for the physical act of
transferring a copy.
2. You may modify your copy or copies of the Program or any portion of
it, and copy and distribute such modifications under the terms of Paragraph
1 above, provided that you also do the following:
a) cause the modified files to carry prominent notices stating that
you changed the files and the date of any change; and
b) cause the whole of any work that you distribute or publish, that
in whole or in part contains the Program or any part thereof, either
with or without modifications, to be licensed at no charge to all
third parties under the terms of this General Public License (except
that you may choose to grant warranty protection to some or all
third parties, at your option).
c) If the modified program normally reads commands interactively when
run, you must cause it, when started running for such interactive use
in the simplest and most usual way, to print or display an
announcement including an appropriate copyright notice and a notice
that there is no warranty (or else, saying that you provide a
warranty) and that users may redistribute the program under these
conditions, and telling the user how to view a copy of this General
Public License.
d) You may charge a fee for the physical act of transferring a
copy, and you may at your option offer warranty protection in
exchange for a fee.
Mere aggregation of another independent work with the Program (or its
derivative) on a volume of a storage or distribution medium does not bring
the other work under the scope of these terms.
3. You may copy and distribute the Program (or a portion or derivative of
it, under Paragraph 2) in object code or executable form under the terms of
Paragraphs 1 and 2 above provided that you also do one of the following:
a) accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of
Paragraphs 1 and 2 above; or,
b) accompany it with a written offer, valid for at least three
years, to give any third party free (except for a nominal charge
for the cost of distribution) a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of
Paragraphs 1 and 2 above; or,
c) accompany it with the information you received as to where the
corresponding source code may be obtained. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form alone.)
Source code for a work means the preferred form of the work for making
modifications to it. For an executable file, complete source code means
all the source code for all modules it contains; but, as a special
exception, it need not include source code for modules which are standard
libraries that accompany the operating system on which the executable
file runs, or for standard header files or definitions files that
accompany that operating system.
4. You may not copy, modify, sublicense, distribute or transfer the
Program except as expressly provided under this General Public License.
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
the Program is void, and will automatically terminate your rights to use
the Program under this License. However, parties who have received
copies, or rights to use copies, from you under this General Public
License will not have their licenses terminated so long as such parties
remain in full compliance.
5. By copying, distributing or modifying the Program (or any work based
on the Program) you indicate your acceptance of this license to do so,
and all its terms and conditions.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the original
licensor to copy, distribute or modify the Program subject to these
terms and conditions. You may not impose any further restrictions on the
recipients' exercise of the rights granted herein.
7. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of the license which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
the license, you may choose any version ever published by the Free Software
Foundation.
8. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to humanity, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
Copyright (C) 19yy
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19xx name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License. Of course, the
commands you use may be called something other than `show w' and `show
c'; they could even be mouse-clicks or menu items--whatever suits your
program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
program `Gnomovision' (a program to direct compilers to make passes
at assemblers) written by James Hacker.
, 1 April 1989
Ty Coon, President of Vice
That's all there is to it!
--- The Artistic License 1.0 ---
This software is Copyright (c) 2017- by Pieter De Praetere .
This is free software, licensed under:
The Artistic License 1.0
The Artistic License
Preamble
The intent of this document is to state the conditions under which a Package
may be copied, such that the Copyright Holder maintains some semblance of
artistic control over the development of the package, while giving the users of
the package the right to use and distribute the Package in a more-or-less
customary fashion, plus the right to make reasonable modifications.
Definitions:
- "Package" refers to the collection of files distributed by the Copyright
Holder, and derivatives of that collection of files created through
textual modification.
- "Standard Version" refers to such a Package if it has not been modified,
or has been modified in accordance with the wishes of the Copyright
Holder.
- "Copyright Holder" is whoever is named in the copyright or copyrights for
the package.
- "You" is you, if you're thinking about copying or distributing this Package.
- "Reasonable copying fee" is whatever you can justify on the basis of media
cost, duplication charges, time of people involved, and so on. (You will
not be required to justify it to the Copyright Holder, but only to the
computing community at large as a market that must bear the fee.)
- "Freely Available" means that no fee is charged for the item itself, though
there may be fees involved in handling the item. It also means that
recipients of the item may redistribute it under the same conditions they
received it.
1. You may make and give away verbatim copies of the source form of the
Standard Version of this Package without restriction, provided that you
duplicate all of the original copyright notices and associated disclaimers.
2. You may apply bug fixes, portability fixes and other modifications derived
from the Public Domain or from the Copyright Holder. A Package modified in such
a way shall still be considered the Standard Version.
3. You may otherwise modify your copy of this Package in any way, provided that
you insert a prominent notice in each changed file stating how and when you
changed that file, and provided that you do at least ONE of the following:
a) place your modifications in the Public Domain or otherwise make them
Freely Available, such as by posting said modifications to Usenet or an
equivalent medium, or placing the modifications on a major archive site
such as ftp.uu.net, or by allowing the Copyright Holder to include your
modifications in the Standard Version of the Package.
b) use the modified Package only within your corporation or organization.
c) rename any non-standard executables so the names do not conflict with
standard executables, which must also be provided, and provide a separate
manual page for each non-standard executable that clearly documents how it
differs from the Standard Version.
d) make other distribution arrangements with the Copyright Holder.
4. You may distribute the programs of this Package in object code or executable
form, provided that you do at least ONE of the following:
a) distribute a Standard Version of the executables and library files,
together with instructions (in the manual page or equivalent) on where to
get the Standard Version.
b) accompany the distribution with the machine-readable source of the Package
with your modifications.
c) accompany any non-standard executables with their corresponding Standard
Version executables, giving the non-standard executables non-standard
names, and clearly documenting the differences in manual pages (or
equivalent), together with instructions on where to get the Standard
Version.
d) make other distribution arrangements with the Copyright Holder.
5. You may charge a reasonable copying fee for any distribution of this
Package. You may charge any fee you choose for support of this Package. You
may not charge a fee for this Package itself. However, you may distribute this
Package in aggregate with other (possibly commercial) programs as part of a
larger (possibly commercial) software distribution provided that you do not
advertise this Package as a product of your own.
6. The scripts and library files supplied as input to or produced as output
from the programs of this Package do not automatically fall under the copyright
of this Package, but belong to whomever generated them, and may be sold
commercially, and may be aggregated with this Package.
7. C or perl subroutines supplied by you and linked into this Package shall not
be considered part of this Package.
8. The name of the Copyright Holder may not be used to endorse or promote
products derived from this software without specific prior written permission.
9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
The End
cpanfile 100644 001750 001750 516 13035363337 15637 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03 requires 'perl', '5.008005';
# requires 'Some::Module', 'VERSION';
on test => sub {
requires 'Test::More', '0.96';
requires 'Catmandu', '>=1.0304';
};
requires 'Moo';
requires 'JSON';
requires 'LWP::UserAgent';
requires 'LWP::Protocol::https';
requires 'Catmandu', '>=1.0304';
requires 'Catmandu::Fix::Datahub', '>=0.01';
dist.ini 100644 001750 001750 11 13035363337 15545 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03 [@Milla]
Build.PL 100644 001750 001750 262 13035363337 15425 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03 # This Build.PL for Catmandu-AAT was generated by Dist::Zilla::Plugin::ModuleBuildTiny 0.015.
use strict;
use warnings;
use 5.008005;
use Module::Build::Tiny 0.034;
Build_PL();
META.yml 100644 001750 001750 2111 13035363337 15415 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03 ---
abstract: 'Retrieve items from the AAT'
author:
- 'Pieter De Praetere '
build_requires:
Catmandu: '1.0304'
Test::More: '0.96'
configure_requires:
Module::Build::Tiny: '0.034'
dynamic_config: 0
generated_by: 'Dist::Milla version v1.0.17, Dist::Zilla version 6.008, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: Catmandu-AAT
no_index:
directory:
- eg
- examples
- inc
- share
- t
- xt
requires:
Catmandu: '1.0304'
Catmandu::Fix::Datahub: '0.01'
JSON: '0'
LWP::Protocol::https: '0'
LWP::UserAgent: '0'
Moo: '0'
perl: '5.008005'
resources:
bugtracker: https://github.com/thedatahub/Catmandu-Store-AAT/issues
homepage: https://github.com/thedatahub/Catmandu-Store-AAT
repository: https://github.com/thedatahub/Catmandu-Store-AAT.git
version: '0.03'
x_contributors:
- 'Pieter De Praetere '
- 'Pieter De Praetere '
x_serialization_backend: 'YAML::Tiny version 1.69'
MANIFEST 100644 001750 001750 632 13035363337 15263 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.008.
Build.PL
Changes
LICENSE
MANIFEST
META.json
META.yml
README
cpanfile
dist.ini
lib/Catmandu/AAT.pm
lib/Catmandu/AAT/API.pm
lib/Catmandu/AAT/SPARQL.pm
lib/Catmandu/Fix/aat_match.pm
lib/Catmandu/Fix/aat_search.pm
lib/Catmandu/Store/AAT.pm
lib/Catmandu/Store/AAT/Bag.pm
t/author-pod-syntax.t
t/basic.t
t/match.t
t/search.t
t/store.t
t 000755 001750 001750 0 13035363337 14254 5 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03 basic.t 100644 001750 001750 376 13035363337 15650 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03/t use strict;
use Test::More;
my @pkgs = qw (
Catmandu::Store::AAT
Catmandu::Store::AAT::Bag
Catmandu::AAT::API
Catmandu::AAT::SPARQL
Catmandu::Fix::aat_match
Catmandu::Fix::aat_search
);
require_ok $_ for @pkgs;
done_testing 6;
match.t 100644 001750 001750 1634 13035363337 15701 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03/t use strict;
use warnings;
use Test::More;
use Catmandu::Fix;
my $pkg;
BEGIN {
$pkg = 'Catmandu::Fix::aat_match';
use_ok $pkg;
}
my $record = {
'objectName' => 'schilderingen'
};
my $record_lang = {
'objectName' => 'paintings (visual works)'
};
my $fixer = Catmandu::Fix->new(fixes => ['aat_match(objectName)']);
my $fixer_lang = Catmandu::Fix->new(fixes => ['aat_match(objectName, -lang:en)']);
$fixer->fix($record);
$fixer_lang->fix($record_lang);
my $expected = {
'objectName' => {
'id' => '300033618',
'prefLabel' => 'schilderingen',
'uri' => 'http://vocab.getty.edu/aat/300033618'
}
};
my $expected_lang = {
'objectName' => {
'id' => '300033618',
'prefLabel' => 'paintings (visual works)',
'uri' => 'http://vocab.getty.edu/aat/300033618'
}
};
is_deeply $record, $expected;
is_deeply $record_lang, $expected_lang;
done_testing 3; store.t 100644 001750 001750 1631 13035363337 15736 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03/t use strict;
use warnings;
use Test::More;
use Catmandu::Fix;
my $pkg;
BEGIN {
$pkg = 'Catmandu::Store::AAT';
use_ok $pkg;
}
my $record = {
'objectName' => '300033618'
};
my $record_lang = {
'objectName' => '300033618'
};
my $fixer = Catmandu::Fix->new(fixes => ['lookup_in_store(objectName, AAT)']);
my $fixer_lang = Catmandu::Fix->new(fixes => ['lookup_in_store(objectName, AAT, lang:en)']);
$fixer->fix($record);
$fixer_lang->fix($record_lang);
my $expected = {
'objectName' => {
'id' => '300033618',
'prefLabel' => 'schilderingen',
'uri' => 'http://vocab.getty.edu/aat/300033618'
}
};
my $expected_lang = {
'objectName' => {
'id' => '300033618',
'prefLabel' => 'paintings (visual works)',
'uri' => 'http://vocab.getty.edu/aat/300033618'
}
};
is_deeply $record, $expected;
is_deeply $record_lang, $expected_lang;
done_testing 3; META.json 100644 001750 001750 3644 13035363337 15601 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03 {
"abstract" : "Retrieve items from the AAT",
"author" : [
"Pieter De Praetere "
],
"dynamic_config" : 0,
"generated_by" : "Dist::Milla version v1.0.17, Dist::Zilla version 6.008, CPAN::Meta::Converter version 2.150010",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : 2
},
"name" : "Catmandu-AAT",
"no_index" : {
"directory" : [
"eg",
"examples",
"inc",
"share",
"t",
"xt"
]
},
"prereqs" : {
"configure" : {
"requires" : {
"Module::Build::Tiny" : "0.034"
}
},
"develop" : {
"requires" : {
"Dist::Milla" : "v1.0.17",
"Test::Pod" : "1.41"
}
},
"runtime" : {
"requires" : {
"Catmandu" : "1.0304",
"Catmandu::Fix::Datahub" : "0.01",
"JSON" : "0",
"LWP::Protocol::https" : "0",
"LWP::UserAgent" : "0",
"Moo" : "0",
"perl" : "5.008005"
}
},
"test" : {
"requires" : {
"Catmandu" : "1.0304",
"Test::More" : "0.96"
}
}
},
"release_status" : "stable",
"resources" : {
"bugtracker" : {
"web" : "https://github.com/thedatahub/Catmandu-Store-AAT/issues"
},
"homepage" : "https://github.com/thedatahub/Catmandu-Store-AAT",
"repository" : {
"type" : "git",
"url" : "https://github.com/thedatahub/Catmandu-Store-AAT.git",
"web" : "https://github.com/thedatahub/Catmandu-Store-AAT"
}
},
"version" : "0.03",
"x_contributors" : [
"Pieter De Praetere ",
"Pieter De Praetere "
],
"x_serialization_backend" : "Cpanel::JSON::XS version 3.0217"
}
search.t 100644 001750 001750 1075 13035363337 16051 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03/t use strict;
use warnings;
use Test::More;
use Catmandu::Fix;
my $pkg;
BEGIN {
$pkg = 'Catmandu::Fix::aat_search';
use_ok $pkg;
}
my $record = {
'objectName' => 'schilderingen'
};
my $record_lang = {
'objectName' => 'matte paintings'
};
my $fixer = Catmandu::Fix->new(fixes => ['aat_search(objectName)']);
my $fixer_lang = Catmandu::Fix->new(fixes => ['aat_search(objectName, -lang:en)']);
$fixer->fix($record);
$fixer_lang->fix($record_lang);
isa_ok($record->{'objectName'}, 'ARRAY');
isa_ok($record_lang->{'objectName'}, 'ARRAY');
done_testing 3; Catmandu 000755 001750 001750 0 13035363337 16313 5 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03/lib AAT.pm 100644 001750 001750 4043 13035363337 17417 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03/lib/Catmandu package Catmandu::AAT;
our $VERSION = '0.03';
use strict;
use warnings;
use Catmandu::Sane;
use Moo;
1;
__END__
__END__
=encoding utf-8
=head1 NAME
=for html
Catmandu::AAT - Retrieve items from the AAT
=head1 SYNOPSIS
This module contains a L to lookup a I in the L
using its L.
Also included is a L to match a term to a I and a
L to search for a term in the AAT.
lookup_in_store(objectName, AAT, lang:nl)
aat_match(objectName, -lang:nl)
aat_search(objectName, -lang:nl)
=head1 DESCRIPTION
=head2 L
lookup_in_store(
objectName,
AAT,
lang: nl
)
The C parameter is optional and defaults to I. It sets
the language of the returned I. If no I for the
I in provided I exists, nothing is returned.
The store takes the C of a I from the AAT and returns the following data:
{
'id' => 'The dc:identifier of the Subject',
'prefLabel' => 'The prefLabel in the provided language',
'uri' => 'The URI of the Subject'
}
=head2 L
aat_match(
path,
-lang: nl
)
A fix that performs a match between a term and a I of an AAT I.
=head2 L
aat_search(
path,
-lang: nl
)
A fix that performs a search for a term in the AAT.
=head1 AUTHOR
Pieter De Praetere Epieter at packed.be E
=head1 COPYRIGHT
Copyright 2017- PACKED vzw
=head1 LICENSE
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=head1 SEE ALSO
L
L
L
L
=cut
author-pod-syntax.t 100644 001750 001750 454 13035363337 20172 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03/t #!perl
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
print qq{1..0 # SKIP these tests are for testing by the author\n};
exit
}
}
# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
use strict; use warnings;
use Test::More;
use Test::Pod 1.41;
all_pod_files_ok();
AAT 000755 001750 001750 0 13035363337 16720 5 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03/lib/Catmandu API.pm 100644 001750 001750 4137 13035363337 20034 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03/lib/Catmandu/AAT package Catmandu::AAT::API;
use strict;
use warnings;
use Moo;
use Catmandu::Sane;
use Catmandu::AAT::SPARQL;
has term => (is => 'ro', required => 1);
has language => (is => 'ro', default => 'nl');
##
# Search for a term
sub search {
my $self = shift;
my $search_query = '?Subject luc:term "%s" .';
my $query = $self->build_query(sprintf($search_query, $self->term));
return $self->request($query);
}
##
# Exactly match a term
sub match {
my $self = shift;
my $match_query = '?Subject skos:prefLabel "%s"@%s .';
my $query = $self->build_query(sprintf($match_query, $self->term, $self->language));
my $result = $self->request($query);
if (scalar @{$result} >= 1) {
return $result->[0];
} else {
return {};
}
}
##
# By ID
sub id {
my $self = shift;
my $id_query = '?Subject dc:identifier "%s" .';
my $query = $self->build_query(sprintf($id_query, $self->term));
my $result = $self->request($query);
if (scalar @{$result} >= 1) {
return $result->[0];
} else {
return {};
}
}
sub request {
my ($self, $query) = @_;
my $sparql = Catmandu::AAT::SPARQL->new(query => $query, lang => $self->language);
if (defined ($sparql->results)) {
return $self->parse($sparql->results);
} else {
return [];
}
}
sub parse {
my ($self, $raw_results) = @_;
my $results = [];
foreach my $raw_result (@{$raw_results->{'results'}->{'bindings'}}) {
my $result = {
'prefLabel' => $raw_result->{'prefLabel'}->{'value'},
'id' => $raw_result->{'id'}->{'value'},
'uri' => $raw_result->{'Subject'}->{'value'}
};
push @{$results}, $result;
}
return $results;
}
sub build_query {
my ($self, $match_query) = @_;
my $query = q(select ?prefLabel ?id ?Subject ?scheme { ?Subject xl:prefLabel [xl:literalForm ?prefLabel; dct:language gvp_lang:%s] . values ?scheme {} . ?Subject dc:identifier ?id . ?Subject skos:inScheme ?scheme . %s });
return sprintf($query, $self->language, $match_query);
}
1.
__END__ Store 000755 001750 001750 0 13035363337 17407 5 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03/lib/Catmandu AAT.pm 100644 001750 001750 2615 13035363337 20516 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03/lib/Catmandu/Store package Catmandu::Store::AAT;
our $VERSION = '0.03';
use strict;
use warnings;
use Moo;
use Catmandu::Sane;
use Catmandu::Store::AAT::Bag;
with 'Catmandu::Store';
has lang => (is => 'ro', default => 'nl');
1;
__END__
=encoding utf-8
=head1 NAME
=for html
Catmandu::Store::AAT - Retrieve items from the AAT
=head1 SYNOPSIS
lookup_in_store(objectName, AAT, lang:nl)
=head1 DESCRIPTION
lookup_in_store(
objectName,
AAT,
lang: nl
)
The C parameter is optional and defaults to I. It sets
the language of the returned I. If no I for the
I in provided I exists, nothing is returned.
The store takes the C of a I from the AAT and returns the following data:
{
'id' => 'The dc:identifier of the Subject',
'prefLabel' => 'The prefLabel in the provided language',
'uri' => 'The URI of the Subject'
}
=head1 AUTHOR
Pieter De Praetere Epieter at packed.be E
=head1 COPYRIGHT
Copyright 2017- PACKED vzw
=head1 LICENSE
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=head1 SEE ALSO
L
L
L
L
=cut
SPARQL.pm 100644 001750 001750 3514 13035363337 20423 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03/lib/Catmandu/AAT package Catmandu::AAT::SPARQL;
our $VERSION = '0.03';
use strict;
use warnings;
use Moo;
use Catmandu::Sane;
use LWP::UserAgent;
use JSON;
has query => (is => 'ro', required => 1);
has url => (is => 'ro', default => 'http://vocab.getty.edu/sparql.json');
has lang => (is => 'ro', default => 'nl');
has results => (is => 'lazy');
has ua => (is => 'lazy');
sub _build_ua {
my $self = shift;
my $ua = LWP::UserAgent->new(
agent => sprintf('catmandu-store-aat/%s', $VERSION)
);
# Otherwise, the endpoint blows up.
$ua->default_header('Accept' => '*/*');
return $ua;
}
sub _build_results {
my $self = shift;
my $r = $self->get();
return $r;
}
sub get {
my $self = shift;
my $form_template = 'query=%s';
my $form = {
'query' => $self->query
};
my $response = $self->ua->post($self->url, $form);
if ($response->is_success) {
return decode_json($response->decoded_content);
} else {
Catmandu::HTTPError->throw({
code => $response->code,
message => $response->status_line,
url => $response->request->uri,
method => $response->request->method,
request_headers => [],
request_body => $response->request->decoded_content,
response_headers => [],
response_body => $response->decoded_content
});
return undef;
}
}
1;
__END__
=head1 DESCRIPTION
=head2 SPARQL Query
select ?anyLabel ?id ?Subject ?scheme {
?Subject xl:prefLabel|xl:altLabel [xl:literalForm ?anyLabel; dct:language gvp_lang:nl] .
values ?scheme {} .
?Subject dc:identifier ?id .
?Subject skos:inScheme ?scheme .
?Subject luc:term "schildering" .
}
=cut Fix 000755 001750 001750 0 13035363337 17041 5 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03/lib/Catmandu aat_match.pm 100644 001750 001750 4323 13035363337 21462 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03/lib/Catmandu/Fix package Catmandu::Fix::aat_match;
use strict;
use warnings;
use Catmandu::Sane;
use Moo;
use Catmandu::Fix::Has;
use Catmandu::Fix::Datahub::Util qw(declare_source);
with 'Catmandu::Fix::Base';
has path => (fix_arg => 1);
has lang => (fix_opt => 1, default => sub { 'nl' });
sub emit {
my ($self, $fixer) = @_;
my $perl = '';
$perl .= 'use Catmandu::AAT::API;';
my $term = $fixer->generate_var();
my $aat = $fixer->generate_var();
$perl .= "my ${term};";
$perl .= declare_source($fixer, $self->path, $term);
$perl .= "my ${aat} = Catmandu::AAT::API->new(term => ${term}, language => '".$self->lang."');";
$perl .= $fixer->emit_create_path(
$fixer->var,
$fixer->split_path($self->path),
sub {
my $root = shift;
my $code = '';
$code .= "${root} = ${aat}->match();";
return $code;
}
);
return $perl;
}
1;
__END__
=encoding utf-8
=head1 NAME
Catmandu::Fix::aat_match - Perform a direct match between a term and a Subject in the AAT
=head1 SYNOPSIS
aat_match(
path,
-lang: nl
)
=head1 DESCRIPTION
Perform a direct match between a term and the L of the AAT.
This fix will attempt to find a I for which the I in I (optional, default C)
equals the term. Will return a single item if one is found, or an empty hash if none was found.
Returns the following data:
{
'id' => 'The dc:identifier of the Subject',
'prefLabel' => 'The prefLabel in the provided language',
'uri' => 'The URI of the Subject'
}
=head2 PARAMETERS
=head3 Required parameters
=over
=item C
Path to the term.
=back
=head3 Optional parameters
=over
=item C
Language of both the I that is matched and the I that is returned.
=back
=head1 AUTHOR
Pieter De Praetere Epieter at packed.be E
=head1 COPYRIGHT
Copyright 2017- PACKED vzw
=head1 LICENSE
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=head1 SEE ALSO
L
L
L
L
=cut
AAT 000755 001750 001750 0 13035363337 20014 5 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03/lib/Catmandu/Store Bag.pm 100644 001750 001750 1637 13035363337 21212 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03/lib/Catmandu/Store/AAT package Catmandu::Store::AAT::Bag;
use strict;
use warnings;
use Moo;
use Catmandu::Sane;
use Catmandu::AAT::API;
with 'Catmandu::Bag';
sub generator {
my $self = shift;
}
sub get {
my ($self, $id) = @_;
my $api = Catmandu::AAT::API->new(term => $id, language => $self->store->lang);
return $api->id();
}
sub add {
my ($self, $data) = @_;
Catmandu::NotImplemented->throw(
message => 'Adding item to store not supported.'
);
}
sub update {
my ($self, $id, $data) = @_;
Catmandu::NotImplemented->throw(
message => 'Updating item in store not supported.'
);
}
sub delete {
my ($self, $id) = @_;
Catmandu::NotImplemented->throw(
message => 'Deleting item from store not supported.'
);
}
sub delete_all {
my $self = shift;
Catmandu::NotImplemented->throw(
message => 'Deleting items from store not supported.'
);
}
1;
__END__ aat_search.pm 100644 001750 001750 4364 13035363337 21640 0 ustar 00vagrant vagrant 000000 000000 Catmandu-AAT-0.03/lib/Catmandu/Fix package Catmandu::Fix::aat_search;
use strict;
use warnings;
use Catmandu::Sane;
use Moo;
use Catmandu::Fix::Has;
use Catmandu::Fix::Datahub::Util qw(declare_source);
with 'Catmandu::Fix::Base';
has path => (fix_arg => 1);
has lang => (fix_opt => 1, default => sub { 'nl' });
sub emit {
my ($self, $fixer) = @_;
my $perl = '';
$perl .= 'use Catmandu::AAT::API;';
my $term = $fixer->generate_var();
my $aat = $fixer->generate_var();
$perl .= "my ${term};";
$perl .= declare_source($fixer, $self->path, $term);
$perl .= "my ${aat} = Catmandu::AAT::API->new(term => ${term}, language => '".$self->lang."');";
$perl .= $fixer->emit_create_path(
$fixer->var,
$fixer->split_path($self->path),
sub {
my $root = shift;
my $code = '';
$code .= "${root} = ${aat}->search();";
return $code;
}
);
return $perl;
}
1;
__END__
=encoding utf-8
=head1 NAME
Catmandu::Fix::aat_search - Perform a search for a term in the AAT
=head1 SYNOPSIS
aat_search(
path,
-lang: nl
)
=head1 DESCRIPTION
Perform a search for a term and the L of the AAT.
This fix will attempt to find a I that contains a I, I or a
I containing the searched for term. More details can be found L
(C is used).
Returns an array of results containing the following data:
{
'id' => 'The dc:identifier of the Subject',
'prefLabel' => 'The prefLabel in the provided language',
'uri' => 'The URI of the Subject'
}
=head2 PARAMETERS
=head3 Required parameters
=over
=item C
Path to the term.
=back
=head3 Optional parameters
=over
=item C
Language of both the I that is matched and the I that is returned.
=back
=head1 AUTHOR
Pieter De Praetere Epieter at packed.be E
=head1 COPYRIGHT
Copyright 2017- PACKED vzw
=head1 LICENSE
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=head1 SEE ALSO
L
L
L
L
=cut