本文整理了Java中pl.edu.icm.model.bwmeta.y.YDescription.getLanguage()
方法的一些代码示例,展示了YDescription.getLanguage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YDescription.getLanguage()
方法的具体详情如下:
包路径:pl.edu.icm.model.bwmeta.y.YDescription
类名称:YDescription
方法名:getLanguage
暂无
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
/**
* Selects most apropriate (English if available) description.
*
* @param descriptions
* list of available descriptions
* @return best found description or null if list is empty
*/
protected static String selectBestDescription(List<YDescription> descriptions) {
if (descriptions == null || descriptions.size() == 0) {
return null;
}
for (YDescription description : descriptions) { // Search for English version
if (description.getLanguage().equals(YLanguage.English)) {
return description.getText();
}
}
return descriptions.get(0).getText();
}
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api
public static boolean acceptableDescription(YDescription yDescription, YLanguage language) {
if (language == null) {
return acceptableDescription(yDescription);
} else {
return yDescription.getLanguage().equals(language) && acceptableDescription(yDescription);
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
/**
* Method for preparation of Abstracts list, and additional flag if
* generated abstract was shortened for displaying, with specified languages
*
* @param yElement
* Ymodel element
* @param language
* language to display
* @return List of Abstracts in yElement
*/
@Override
public List<LocalizedData<CharSequence>> prepareAbstract(final YElement yElement, final Locale locale) {
final List<YLanguage> hasBeenList = new ArrayList<YLanguage>();
final List<LocalizedData<CharSequence>> abstracts = new ArrayList<LocalizedData<CharSequence>>();
final YLanguage yDefaultLanguage = YModelUtils.getDefaultLanguage(yElement);
if (yDefaultLanguage != null) {
addAbstract(abstracts, yElement, yDefaultLanguage, locale, hasBeenList);
}
for (final YDescription description : yElement.getDescriptions()) {
final YLanguage yLanguage = description.getLanguage();
if (hasBeenList.contains(yLanguage)) {
continue;
}
addAbstract(abstracts, yElement, yLanguage, locale, hasBeenList);
}
return abstracts;
}
代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core
protected List<LocalizedString> getDescription(YInstitution element,
IFilteringContext filteringContext, String type) {
List<LocalizedString> result = new ArrayList<LocalizedString>();
for (YDescription description : element.getDescriptions()) {
if (type.equals(description.getType())) {
result.add(new LocalizedString(languageDictionary.getShortDescription(
description.getLanguage().getShortCode()),
detailsFilter.filter(YRTHelper.toXmlFragment(description.getRichText()), InputType.RICH_TEXT,
filteringContext)));
}
}
return result;
}
代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core
protected List<LocalizedString> getDescription(YElement element,
IFilteringContext filteringContext, String type) {
List<LocalizedString> result = new ArrayList<LocalizedString>();
for (YDescription description : element.getDescriptions()) {
if (type.equals(description.getType())) {
result.add(new LocalizedString(languageDictionary.getShortDescription(
description.getLanguage().getShortCode()),
detailsFilter.filter(YRTHelper.toXmlFragment(description.getRichText()), InputType.RICH_TEXT,
filteringContext)));
}
}
return result;
}
代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core
private LocalizedString convertIntoLocalizedStringFrom(YDescription description){
return new LocalizedString(getLangCodeFor(description.getLanguage()), YRTHelper.toXmlFragmentWithoutNamespaces(description.getRichText()));
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
/**
* accomplished
*/
private void parseDescriptions() {
if(!in_item.getDescriptions().isEmpty()){
int descriptionid = 0;
for(YDescription yd : in_item.getDescriptions()){
descriptionid++;
Statements s_desc = new Statements();statements.add(s_desc);
s_desc.setSubject(RelConstants.NS_DESCRIPTION+in_item.getId()+"/"+descriptionid);
LinkedList<PredicateAndObject> paos_description = new LinkedList<PredicateAndObject>();
paos_description.add(new PredicateAndObject(RelConstants.RL_LANGUAGE, yd.getLanguage().getName()));
paos_description.add(new PredicateAndObject(RelConstants.RL_TYPE, yd.getType()));
paos_description.add(new PredicateAndObject(RelConstants.RL_TEXT, yd.getText()));
paos_doc.add(new PredicateAndObject(RelConstants.RL_HAS_DESCRIPTION , RelConstants.NS_DESCRIPTION+in_item.getId()+"/"+descriptionid));
}
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
private String extractTextFromYElement(final YElement yElement) throws IOException {
final String sep = " ";
final YLanguage lang = YLanguage.Polish;
StringBuilder builder = new StringBuilder();
for (YName data : yElement.getNames()) {
if(lang.equals(data.getLanguage())){
builder.append(data.getText());
builder.append(sep);
}
}
for (YDescription data : yElement.getDescriptions()) {
if(lang.equals(data.getLanguage())){
builder.append(data.getText());
builder.append(sep);
}
}
for(FilteredContentEntry<?> plainTextFile:ResourceDisplayUtilsImpl.fetchPlainTextContentEntries(yElement)){
if(plainTextFile.getSource() instanceof YContentFile){
YContentFile file = (YContentFile)plainTextFile.getSource();
ElementContent elementContent = repositoryFacade.fetchContent(yElement.getId(), file.getLocations().get(0));
builder.append(IOUtils.toString(elementContent.getStream()));
builder.append(sep);
}
}
return builder.toString().trim();
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
/**
* accomplished
*/
private void parseDescriptions() {
if(!in_item.getDescriptions().isEmpty()){
int descriptionid = 0;
for(YDescription yd : in_item.getDescriptions()){
descriptionid++;
Statements s_desc = new Statements();statements.add(s_desc);
s_desc.setSubject(RelConstants.NS_DESCRIPTION+in_item.getId()+"#"+descriptionid);
LinkedList<PredicateAndObject> paos_description = new LinkedList<PredicateAndObject>();
paos_description.add(new PredicateAndObject(RelConstants.RL_LANGUAGE, yd.getLanguage().getName()));
paos_description.add(new PredicateAndObject(RelConstants.RL_TYPE, yd.getType()));
paos_description.add(new PredicateAndObject(RelConstants.RL_TEXT, yd.getText()));
paos_doc.add(new PredicateAndObject(RelConstants.RL_HAS_DESCRIPTION , RelConstants.NS_DESCRIPTION+in_item.getId()+"#"+descriptionid));
}
}
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-cli
for (YDescription desc : elem.getDescriptions()) {
if (YConstants.DS_ABSTRACT.equalsIgnoreCase(desc.getType())) {
if (lang==null || lang.equals(desc.getLanguage())) {
textsTexts.add(new Pair<String, TextType>(normalize(desc.getText()), TextType.ABSTRACT));
hasAbstarct = true;
代码示例来源:origin: pl.edu.icm.yadda/yadda-cli
for (YDescription desc : elem.getDescriptions()) {
if (YConstants.DS_ABSTRACT.equalsIgnoreCase(desc.getType())) {
if (lang==null || lang.equals(desc.getLanguage())) {
textsTexts.add(new Pair<String, TextType>(normalize(desc.getText()), TextType.ABSTRACT));
hasAbstarct = true;
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
@Override
public boolean hasContentInLanguage(YElement yElement, YLanguage lang) {
for (YName data : yElement.getNames()) {
if (lang.equals(data.getLanguage())) {
return true;
}
}
for (YDescription data : yElement.getDescriptions()) {
if (lang.equals(data.getLanguage())) {
return true;
}
}
return false;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-polindex
if (YConstants.DS_ABSTRACT.equals(description.getType())) {
try {
LanguageEnum lang = LanguageEnum.fromValue(description.getLanguage().getShortCode());
if (lang != null) {
languagesList.getLanguage().add(lang);
logArticleWarning(yArticle.getId(), "abstract language {} can not be converted to polindex language", description.getLanguage().getShortCode());
代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core
if (description.getLanguage().getShortCode().equals(lang)) {
YRichText yRichText = description.getRichText();
if(isSimple(yRichText)){
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
result.addDescription(new LanguageData(description.getLanguage()), YModelUtils.yRichTextToString(description.getRichText()));
内容来源于网络,如有侵权,请联系作者删除!