[ https://issues.apache.org/jira/browse/MARMOTTA-155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13763831#comment-13763831 ]
Peter Ansell commented on MARMOTTA-155: --------------------------------------- If the Kiwi ValueFactory implementation is always used, you will not require a new LanguageHandler, as long as BasicParserSettings.VERIFY_LANGUAGE_TAGS is always false, or at least non-fatal. The method that I implemented for SES-1826 using Java-7 used a different method. The patch for Sesame Literals.getLocale was: try { String lang = l.getLanguage(); if (lang != null) { - LanguageTag tag = new LanguageTag(lang); - result = tag.toLocale(); + Locale.Builder builder = new Locale.Builder(); + builder.setLanguageTag(lang); + result = builder.build(); } } - catch (LanguageTagSyntaxException e) { + catch (IllformedLocaleException e) { result = fallback; } https://github.com/ansell/openrdf-sesame/commit/3b880697b2177129f51f28a06e9fb858f91bb2bb The reasoning, according to the javadoc for forLanguageTag, is that any ill-formed BCP-47 language tags are converted silently to a conforming tag, including stripping parts of the language tag where necessary. Locale.Builder allows you to get an exception (IllformedLocaleException in the example above) and respond to it. http://docs.oracle.com/javase/7/docs/api/java/util/Locale.html#forLanguageTag%28java.lang.String%29 > 3-char lang-tags are not accepted > --------------------------------- > > Key: MARMOTTA-155 > URL: https://issues.apache.org/jira/browse/MARMOTTA-155 > Project: Marmotta > Issue Type: Bug > Components: Triple Store > Affects Versions: 3.0-incubating > Reporter: Jakob Frank > Assignee: Sergio Fernández > Labels: kiwi, rdf > Fix For: 3.1-incubating > > Attachments: MARMOTTA-155.ttl > > Original Estimate: 4h > Remaining Estimate: 4h > > Currently the triple-store does not accept 3-char language tags. But they are > used: > 17:17:47.556 WARN - not adding triple (http://sws.geonames.org/719819/, > http://www.geonames.org/ontology#alternateName, "ܡܓܪ"@arc) [null]: an > exception occurred (Invalid locale format: arc) > 17:17:47.579 WARN - not adding triple (http://sws.geonames.org/719819/, > http://www.geonames.org/ontology#alternateName, "Hongrie"@frp) [null] > : an exception occurred (Invalid locale format: frp) > 17:17:47.579 WARN - not adding triple (http://sws.geonames.org/719819/, > http://www.geonames.org/ontology#alternateName, "Hongrie"@nrm) [null] > : an exception occurred (Invalid locale format: nrm) > 17:17:47.583 WARN - not adding triple (http://sws.geonames.org/719819/, > http://www.geonames.org/ontology#alternateName, "Hungari"@tpi) [null] > : an exception occurred (Invalid locale format: tpi) > 17:17:47.597 WARN - not adding triple (http://sws.geonames.org/719819/, > http://www.geonames.org/ontology#alternateName, "Hungary"@pam) [null] > : an exception occurred (Invalid locale format: pam) > 17:17:47.597 WARN - not adding triple (http://sws.geonames.org/719819/, > http://www.geonames.org/ontology#alternateName, "Hungary"@sco) [null] > : an exception occurred (Invalid locale format: sco) > 17:17:47.599 WARN - not adding triple (http://sws.geonames.org/719819/, > http://www.geonames.org/ontology#alternateName, "Hungarya"@war) [null > ]: an exception occurred (Invalid locale format: war) > 17:17:47.602 WARN - not adding triple (http://sws.geonames.org/719819/, > http://www.geonames.org/ontology#alternateName, "Hungría"@ast) [null] > : an exception occurred (Invalid locale format: ast) > 17:17:47.615 WARN - not adding triple (http://sws.geonames.org/719819/, > http://www.geonames.org/ontology#alternateName, "Madźarska"@hsb) [nul > l]: an exception occurred (Invalid locale format: hsb) > 17:17:47.633 WARN - not adding triple (http://sws.geonames.org/719819/, > http://www.geonames.org/ontology#alternateName, "Ungariya"@rmy) [null > ]: an exception occurred (Invalid locale format: rmy) > 17:17:47.633 WARN - not adding triple (http://sws.geonames.org/719819/, > http://www.geonames.org/ontology#alternateName, "Ungarn"@bar) [null]: > an exception occurred (Invalid locale format: bar) > 17:17:47.637 WARN - not adding triple (http://sws.geonames.org/719819/, > http://www.geonames.org/ontology#alternateName, "Ungarn"@nds) [null]: > an exception occurred (Invalid locale format: nds) > 17:17:47.644 WARN - not adding triple (http://sws.geonames.org/719819/, > http://www.geonames.org/ontology#alternateName, "Ungherìa"@pms) [null > ]: an exception occurred (Invalid locale format: pms) > 17:17:47.644 WARN - not adding triple (http://sws.geonames.org/719819/, > http://www.geonames.org/ontology#alternateName, "Unghirìa"@scn) [null > ]: an exception occurred (Invalid locale format: scn) > 17:17:47.644 WARN - not adding triple (http://sws.geonames.org/719819/, > http://www.geonames.org/ontology#alternateName, "Ungria"@tet) [null]: > an exception occurred (Invalid locale format: tet) > 17:17:47.661 WARN - not adding triple (http://sws.geonames.org/719819/, > http://www.geonames.org/ontology#alternateName, "Венгрия"@udm) [null] > : an exception occurred (Invalid locale format: udm) -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira