RDF::T...ference(3pm)

πŸ“¦
version 1.019 Β· 7 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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 $store object, 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 storetype key must be LanguagePreference for 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. 🧚
  • new_with_config ( \%config ) β€” returns a new RDF::Trine::Store object 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 be undef to match any value. undef is 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 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 β€” 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 $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'). multilingual queen behavior, we love to see it. 🌍

  • 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. 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 (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