RDF::Trine::Store::LanguagePreference(3pm)

NAME
RDF::Trine::Store::LanguagePreference - RDF Store proxy for filtering language tagged literals

VERSION
This document describes RDF::Trine::Store::LanguagePreference version 1.019

SYNOPSIS
 use RDF::Trine::Store::LanguagePreference;

DESCRIPTION
RDF::Trine::Store::LanguagePreference provides a RDF::Trine::Store API to filter the statements made available from some underlying store object based on a users' language preferences (e.g. coming from an Accept-Language HTTP header value).

METHODS
Beyond the methods documented below, this class inherits methods from the RDF::Trine::Store class.

"new ( $store, { $lang1 => $q1, $lang2 => $q2, ... } )"
    Returns a new storage object that will act as a proxy for the $store object, filtering language literals based on the expressed language preferences.

"new_with_config ( $hashref )"
    Returns a new storage object configured with a hashref with certain keys as arguments.

    The "storetype" key must be "LanguagePreference" for this backend.

    The following key must also be used:

    "store"
        A configuration hash for the underlying store object.

    "preferred_languages"
        A hash reference mapping language tags to quality values in the range [0, 1]. The referent may be changed between operations to change the set of preferred languages used in statement matching.

"new_with_config ( \%config )"
    Returns a new RDF::Trine::Store object based on the supplied configuration hashref.

"language_preferences"
    Returns a hash of the language preference quality values.

language_preference( $lang )
    Return the quality value preference for the given language.

"update_language_preference( $lang => $qvalue )"
    Update the quality value preference for the given language.

"get_statements ( $subject, $predicate, $object [, $context] )"
    Returns a stream object of all statements matching the specified subject, predicate and objects. Any of the arguments may be undef to match any value.

"count_statements ( $subject, $predicate, $object, $context )"
    Returns a count of all the statements matching the specified subject, predicate, object, and context. Any of the arguments may be undef to match any value.

"qvalueForLanguage ( $language, \%cache )"
    Returns the q-value for $language based on the current language preference. %cache is used across multiple calls to this method for performance reasons.

"siteQValueForLanguage ( $language )"
    Returns an implementation-specific q-value preference for the given $language. This method may be overridden by subclasses to control the default preferred language.

availableLanguagesForStatement( $statement )
    Returns a list of language tags that are available in the underlying store for the given statement object. For example, if $statement represented the triple:

     dbpedia:Los_Angeles rdf:label "Los Angeles"@en

    and the underlying store contains the triples:

     dbpedia:Los_Angeles rdf:label "Los Angeles"@en
     dbpedia:Los_Angeles rdf:label "ロサンゼルス"@ja
     dbpedia:Los_Angeles rdf:label "Лос-Анджелес"@ru

    then the return value would be "('en', 'ja', 'ru')".

"languagePreferenceAllowsStatement ( $statement, \%cache )"
    Returns true if the $statement is allowed by the current language preference. %cache is used across multiple calls to this method for performance reasons.

"supports ( [ $feature ] )"
    If $feature is specified, returns true if the feature is supported by the store, false otherwise. If $feature is not specified, returns a list of supported features.

BUGS
Please report any bugs or feature requests to through the GitHub web interface at <https://github.com/kasei/perlrdf/issues>.

AUTHOR
Gregory Todd Williams "<gwilliams@cpan.org>"

COPYRIGHT
Copyright (c) 2006-2012 Gregory Todd Williams. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.