1RDF::Trine::Store::LangUusaegrePCroenfterriebnuctee(d3R)PDeFr:l:TDroicnuem:e:nSttaotrieo:n:LanguagePreference(3)
2
3
4
6 RDF::Trine::Store::LanguagePreference - RDF Store proxy for filtering
7 language tagged literals
8
10 This document describes RDF::Trine::Store::LanguagePreference version
11 1.019
12
14 use RDF::Trine::Store::LanguagePreference;
15
17 RDF::Trine::Store::LanguagePreference provides a RDF::Trine::Store API
18 to filter the statements made available from some underlying store
19 object based on a users' language preferences (e.g. coming from an
20 Accept-Language HTTP header value).
21
23 Beyond the methods documented below, this class inherits methods from
24 the RDF::Trine::Store class.
25
26 "new ( $store, { $lang1 => $q1, $lang2 => $q2, ... } )"
27 Returns a new storage object that will act as a proxy for the
28 $store object, filtering language literals based on the expressed
29 language preferences.
30
31 "new_with_config ( $hashref )"
32 Returns a new storage object configured with a hashref with certain
33 keys as arguments.
34
35 The "storetype" key must be "LanguagePreference" for this backend.
36
37 The following key must also be used:
38
39 "store"
40 A configuration hash for the underlying store object.
41
42 "preferred_languages"
43 A hash reference mapping language tags to quality values in the
44 range [0, 1]. The referent may be changed between operations
45 to change the set of preferred languages used in statement
46 matching.
47
48 "new_with_config ( \%config )"
49 Returns a new RDF::Trine::Store object based on the supplied
50 configuration hashref.
51
52 "language_preferences"
53 Returns a hash of the language preference quality values.
54
55 "language_preference( $lang )"
56 Return the quality value preference for the given language.
57
58 "update_language_preference( $lang => $qvalue )"
59 Update the quality value preference for the given language.
60
61 "get_statements ( $subject, $predicate, $object [, $context] )"
62 Returns a stream object of all statements matching the specified
63 subject, predicate and objects. Any of the arguments may be undef
64 to match any value.
65
66 "count_statements ( $subject, $predicate, $object, $context )"
67 Returns a count of all the statements matching the specified
68 subject, predicate, object, and context. Any of the arguments may
69 be undef to match any value.
70
71 "qvalueForLanguage ( $language, \%cache )"
72 Returns the q-value for $language based on the current language
73 preference. %cache is used across multiple calls to this method for
74 performance reasons.
75
76 "siteQValueForLanguage ( $language )"
77 Returns an implementation-specific q-value preference for the given
78 $language. This method may be overridden by subclasses to control
79 the default preferred language.
80
81 "availableLanguagesForStatement( $statement )"
82 Returns a list of language tags that are available in the
83 underlying store for the given statement object. For example, if
84 $statement represented the triple:
85
86 dbpedia:Los_Angeles rdf:label "Los Angeles"@en
87
88 and the underlying store contains the triples:
89
90 dbpedia:Los_Angeles rdf:label "Los Angeles"@en
91 dbpedia:Los_Angeles rdf:label "ロサンゼルス"@ja
92 dbpedia:Los_Angeles rdf:label "Лос-Анджелес"@ru
93
94 then the return value would be "('en', 'ja', 'ru')".
95
96 "languagePreferenceAllowsStatement ( $statement, \%cache )"
97 Returns true if the $statement is allowed by the current language
98 preference. %cache is used across multiple calls to this method for
99 performance reasons.
100
101 "supports ( [ $feature ] )"
102 If $feature is specified, returns true if the feature is supported
103 by the store, false otherwise. If $feature is not specified,
104 returns a list of supported features.
105
107 Please report any bugs or feature requests to through the GitHub web
108 interface at <https://github.com/kasei/perlrdf/issues>.
109
111 Gregory Todd Williams "<gwilliams@cpan.org>"
112
114 Copyright (c) 2006-2012 Gregory Todd Williams. This program is free
115 software; you can redistribute it and/or modify it under the same terms
116 as Perl itself.
117
118
119
120perl v5.32.0 2020-R0D7F-:2:8Trine::Store::LanguagePreference(3)