NAME
RDF::SKOS - SKOS - Simple Knowledge Organization System
SYNOPSIS
use RDF::SKOS;
my $skos = new RDF::SKOS;
# adding one
$skos->concept ('aaa' => { prefLabels => [ [ 'xxx', 'de' ] ] });
# regain it
my $c = $skos->concept ('aaa');
# get all of them
my @cs = $skos->concepts;
# label stuff
@labels = $c->prefLabels;
@labels = $c->altLabels;
@labels = $c->hiddenLabels;
@labels = $c->notes;
@labels = $c->scopeNotes;
@labels = $c->definitions;
@labels = $c->examples;
@labels = $c->historyNotes;
@labels = $c->editorialNotes;
@labels = $c->changeNotes;
# broader/narrower
$c->narrower
$c->narrowerTransitive
$c->broader
$c->broaderTransitive
$c->related
$c->relatedTransitive
# get all schemes
@ss = $skos->schemes
# get a particular
$sch = $skos->scheme ('some_scheme');
# find top-level concepts
@tops = $skos->topConcepts ('some_scheme');
DESCRIPTION
SKOS is a model for expressing very basic concept schemes, much simpler than Topic Maps or RDF. This includes subject headings, taxonomies, folksonomies. For a primer see
http://www.w3.org/TR/skos-primer/Overview
This package suite supports SKOS in that:
It provides packages with particular SKOS data,
It implements SKOS on top of various RDF stores, so that you can read RDF and enjoy an SKOS view on top of that,
Or you can derive your own subclasses of the generic RDF::SKOS, especially for the case where you have a different format.
Concept Identification
This implementation assumes that each concept has a unique ID. That is simply a scalar.
Caveats
Following things are not yet added:
At the moment there is mostly read-only support. You can add concepts to the SKOS, but there is no proper interface for added/removing concepts, or schemes.
There is also no support for collections yet.
And none for all *Match relationships between concepts.
If you need any of that, please throw obscene amounts of (good) chocolate into my direction. Or write a patch! No. Better send chocolate.
INTERFACE
Constructor
The constructor does not expect any additional information.
Example:
my $skos = new RDF::SKOS;
Methods
- concept
-
$c = $skos->concept ('xyz')
Given the ID of the concept, this method returns an RDF::SKOS::Concept object representing the concept. If there is no such concept
undef
will be returned.If - apart from the ID - another parameter is added, that must be a HASH reference carrying all the attributes for that concept. That concept will be stored under this ID. If there was already something there, it will be overwritten.
- concepts
-
@concepts = $skos->concepts
This method return a list of RDF::SKOS::Concept objects, each for a concept in the SKOS.
Scheme-Related Methods
- schemes
-
@schemes = $skos->schemes
This will return a list of RDF::SKOS::Scheme objects which all represent one scheme within the SKOS.
- scheme
-
$scheme = $skos->scheme (ID)
Returns the scheme object for the one with that ID.
- topConcepts
-
@tops = $skos->topConcepts ('scheme_a')
Given the ID of a concept scheme, this will return a list of RDF::SKOS::Concept objects representing the top-level concepts in that scheme.
Concept-Related Methods
All these methods expect the concept ID to be passed in as the sole parameter:
@labels = $skos->prefLabels ('some-concept')
Out comes a list of tuples. Each tuple contains first the value, then the language tag, both as scalars.
- prefLabels
- altLabels
- notes
- scopeNotes
- definitions
- examples
- historyNotes
- editorialNotes
- changeNotes
Taxonometrical Methods
- narrower/broader
-
$cs = $skos->narrower ($ID)
$cs = $skos->narrowerTransitive ($ID)
$cs = $skos->broader ($ID)
$cs = $skos->broaderTransitive ($ID)
This method expects the ID of a concept and returns a list of RDF::SKOS::Concept objects which have a
narrower
relationship to that with ID. As the semantics of narrower involves that it is the inverse of broader also these relationships are respected.If you want narrower/broader to be interpreted transitively, then use the variant
narrowerTransitive
. That not only interprets everything transitively, it also picks up the narrowTransitive relationships inside the SKOS object.NOTE: I understand that this deviates somewhat from the standard. But it makes life easier.
- narrowerTransitive
-
See above
- broader
-
See above
- broaderTransitive
-
See above
Associative Methods
-
This method expects the ID of a concept and returns a list of RDF::SKOS::Concept objects which have a
related
relationship to that identified with ID. Note that related is always symmetric, not not automatically transitive. If you want transitivity to be honored, then use the variantrelatedTransitive
.NOTE: This interpretation is fully SKOS compliant.
-
See above
AUTHOR
Robert Barta, <drrho at cpan.org>
BUGS
Please report any bugs or feature requests to bug-rdf-skos at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=RDF-SKOS. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
COPYRIGHT & LICENSE
Copyright 2009 Robert Barta, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.