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
@cs = $c->narrower
@cs = $c->narrowerTransitive
@cs = $c->broader
@cs = $c->broaderTransitive

# associated
@cs = $c->related
@cs = $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

!!! DEVELOPER RELEASE (THERE MAY BE DRAGONS) !!!

!!! PLEASE SEE THE README FOR LIMITATIONS !!!

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

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.

  • And most of the SKOS constraints are not yet honored.

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.

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.

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

Returns the list of preferred labels.

altLabels

Returns the list of alternative labels.

hiddenLabels

Returns the list of hidden labels.

notes

Returns the list of notes.

NOTE: No property subclassing is honored, so scopeNotes are NOT included (yet).

scopeNotes

Returns the list of scope notes.

definitions

Returns the list of definitions.

examples

Returns the list of examples.

historyNotes

Returns the list of history notes.

editorialNotes

Returns the list of editorial notes.

changeNotes

Returns the list of change notes.

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 variant relatedTransitive.

NOTE: This interpretation is fully SKOS compliant.

relatedTransitive

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.