RDF::T...ference(3pm)
π RDF::Trine::Store::LanguagePreference β the group chat guide π
okay so bestie, imagine a whole RDF store but it's got β¨opinionsβ¨ about which language it wants to show you. That's this. It's a proxy for filtering language tagged literals, living in the RDF::Trine::Store::LanguagePreference corner of the RDF::Trine universe. (The manual page calls it RDF::T...ference(3pm), and it's a User Contributed Perl Documentation page, iykyk.)
πΈ VERSION πΈ
This doc describes RDF::Trine::Store::LanguagePreference version 1.019. no cap. π
π¦ SYNOPSIS π¦
use RDF::Trine::Store::LanguagePreference;
that's it. that's the whole vibe. one line and you're in. π
β¨ DESCRIPTION β¨
RDF::Trine::Store::LanguagePreference gives you a RDF::Trine::Store API that filters the statements some underlying store object hands over, based on what language preferences the user has going on. Where do those prefs come from? Literally anywhere β like an Accept-Language HTTP header value, for example. It's giving "I only want to see the triples in my language, thank you very much". π«Ά
π METHODS π
So beyond the methods we're about to list, this class also inherits methods from the RDF::Trine::Store class. Family inheritance but make it RDF. π
new ( $store, { $lang1 => $q1, $lang2 => $q2, ... } )β hands you a brand new storage object that acts as a proxy for the$storeobject, filtering language literals according to the language preferences you expressed. main character proxy energy. πnew_with_config ( $hashref )β returns a new storage object, configured with a hashref that has certain keys as arguments.- the
storetypekey must beLanguagePreferencefor this backend, no exceptions bestie. - and you also gotta use these keys:
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]. And the tea here: the referent may be changed between operations to change the set of preferred languages used in statement matching. so you can swap the vibe mid-run. π§
- the
new_with_config ( \%config )β returns a newRDF::Trine::Storeobject based on the supplied configuration hashref. (yes it's listed twice, that's just how it is, we don't question the ancestors.)language_preferencesβ returns a hash of the language preference quality values.language_preference( $lang )β returns the quality value preference for the given language.update_language_preference( $lang => $qvalue )β updates the quality value preference for the given language. glow-up for your language prefs. β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 beundefto match any value.undefis the "idc, anything works" of arguments. π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 beundefto match any value.qvalueForLanguage ( $language, \%cache )β returns the q-value for$languagebased on the current language preference.%cacheis used across multiple calls to this method for performance reasons β it's the little reusing-things hack, iconic. π₯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. subclasses get to customize their whole personality here. πavailableLanguagesForStatement( $statement )β returns a list of language tags that are available in the underlying store for the given statement object. For example, if$statementrepresented 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'). multilingual queen behavior, we love to see it. π
languagePreferenceAllowsStatement ( $statement, \%cache )β returns true if the$statementis allowed by the current language preference.%cacheis used across multiple calls to this method for performance reasons.supports ( [ $feature ] )β if$featureis specified, returns true if the feature is supported by the store, false otherwise. If$featureis not specified, returns a list of supported features. it's giving "ask me what I can do". π
π BUGS π
Please report any bugs or feature requests to through the GitHub web interface at <https://github.com/kasei/perlrdf/issues>. not me asking you to file an issue but like... do it bestie, they wanna know. π
π AUTHOR π
Gregory Todd Williams "<gwilliams@cpan.org>". legend. π
π 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. periodt. π
okay that's the whole page, you're basically an expert now. This was perl v5.38.2, dated 2024-01-13, straight from the RDF::T...ference(3pm) manual. go forth and filter those literals, bestie π¦β¨π
π¦ where this page comes from
- debian trixie: librdf-trine-perl 1.019-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: librdf-trine-perl 1.019-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: librdf-trine-perl 1.019-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: librdf-trine-perl 1.019-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms