Class LanguageFilteringUtils
- java.lang.Object
-
- edu.cornell.mannlib.vitro.webapp.rdfservice.filter.LanguageFilteringUtils
-
public class LanguageFilteringUtils extends Object
Some methods that will come in handy when dealing with Language Filtering
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<Locale>languagesToLocales(List<String> langs)Take a List of language strings and convert to a List of Locale.static LocalelanguageToLocale(String langStr)Take a language string and convert to a Locale.static List<String>localesToLanguages(Enumeration<?> locales)Take an Enumeration of Locale objects, such as we might get from a request, and convert to a List of language strings, such as are needed by the LanguageFilteringRDFService.static StringlocaleToLanguage(Locale locale)Take a Locale object, such as we might get from a request, and convert to a language string used in RDF.static org.apache.jena.ontology.OntModelwrapOntModelInALanguageFilter(org.apache.jena.ontology.OntModel rawModel, javax.servlet.ServletRequest req)Add a Language Filtering layer to an OntModel
-
-
-
Method Detail
-
localeToLanguage
public static String localeToLanguage(Locale locale)
Take a Locale object, such as we might get from a request, and convert to a language string used in RDF. While converting, change all underscores (as in Locale names) to hyphens (as in RDF language specifiers).
-
languageToLocale
public static Locale languageToLocale(String langStr)
Take a language string and convert to a Locale. While converting, change all hyphens (as in RDF language specifiers) to underscores (as in Locale names). Ensure language string is lowercase and country abbreviation is uppercase.
-
localesToLanguages
public static List<String> localesToLanguages(Enumeration<?> locales)
Take an Enumeration of Locale objects, such as we might get from a request, and convert to a List of language strings, such as are needed by the LanguageFilteringRDFService. While converting, change all underscores (as in Locale names) to hyphens (as in RDF language specifiers).
-
languagesToLocales
public static List<Locale> languagesToLocales(List<String> langs)
Take a List of language strings and convert to a List of Locale. While converting, change all hyphens (as in RDF language specifiers) to under scores (as in Locale names). Ensure language string is lowercase and country abbreviation is uppercase.
-
wrapOntModelInALanguageFilter
public static org.apache.jena.ontology.OntModel wrapOntModelInALanguageFilter(org.apache.jena.ontology.OntModel rawModel, javax.servlet.ServletRequest req)Add a Language Filtering layer to an OntModel
-
-