本文整理了Java中pl.edu.icm.model.bwmeta.y.YElement.getDescriptions()
方法的一些代码示例,展示了YElement.getDescriptions()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YElement.getDescriptions()
方法的具体详情如下:
包路径:pl.edu.icm.model.bwmeta.y.YElement
类名称:YElement
方法名:getDescriptions
暂无
代码示例来源:origin: pl.edu.icm.synat/synat-process-common
private boolean hasAbstract(YElement element) {
boolean hasAbstract = false;
for (YDescription entry : element.getDescriptions()) {
if (DescriptionTypes.DS_ABSTRACT.equals(entry.getType())) {
hasAbstract = true;
}
}
return hasAbstract;
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
protected void fillDescriptions(YElement yElement, List<YExportable> referedElements, Map<String, List<StringWithAttributes>> ret) {
// description element
if (!yElement.getDescriptions().isEmpty()) {
ret.put(E_DESCRIPTION, new ArrayList<StringWithAttributes>());
}
for (YDescription yDescription : yElement.getDescriptions()) {
ret.get(E_DESCRIPTION).add(new StringWithAttributes(yDescription.getText()));
}
}
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
@Override
public String constructFieldValue(List<YElement> yelements) {
List<YElement> articles = YElementsParsingToolbox
.filterYElementsOfStructureLevel(yelements,
YConstants.EXT_LEVEL_JOURNAL_ARTICLE);
if (articles.size() == 0) {
return null;
}
if (articles.size() > 1) {
log.error("More than one article found in package of yelements!");
}
YElement article = articles.get(0);
return selectBestDescription(article.getDescriptions());
}
代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core
private List<YDescription> removeAbstractsFromDescriptions() {
List<YDescription> yDescriptions = new ArrayList<>();
for (YDescription yDesc : safe(article.getDescriptions())) {
if(!yDesc.getType().equals(YConstants.DS_ABSTRACT)) {
yDescriptions.add(yDesc);
}
}
return yDescriptions;
}
代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core
private static void replaceDescriptionsField(final YElement yElement, final String[] values) {
if (values != null && values.length > 0) {
final List<YDescription> descriptions = yElement.getDescriptions();
// remove abstracts
final List<YDescription> removed = clear(descriptions, YConstants.DS_ABSTRACT);
if (removed.size() != values.length) {
log.warn("Different count of field:{} values from search-{} and bwmeta-{}. Some values may be lost.",
new Object[] { IndexFields.F_DESCRIPTIONS, values.length, removed.size() });
}
// add highlighted values
for (final String value : values) {
final String[] langValue = StringUtils.split(value, " ", 2);
final YLanguage lang = determineLang(langValue);
if (lang != null) {
descriptions.add(new YDescription(lang, langValue[1], YConstants.DS_ABSTRACT));
}
}
}
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
@Override
void compare(YElement expected, YElement actual, EvalResult result) {
Map<String, YDescription> actYDescMap = new HashMap<String, YDescription>();
for (YDescription ydescr : actual.getDescriptions()) {
String type = ydescr.getType();
actYDescMap.put(type, ydescr);
}
for (YDescription ydescr : expected.getDescriptions()) {
String type = ydescr.getType();
if (actYDescMap.containsKey(type)) {
if (ydescr.getText().equals(actYDescMap.get(type).getText())) {
result.append(type, ResultStatus.RECOGNIZED, 1);
} else {
result.append(type, ResultStatus.FAILED, 1);
}
actYDescMap.remove(type);
} else {
result.append(type, ResultStatus.FAILED, 1);
}
}
for (String type : actYDescMap.keySet()) {
result.append(type, ResultStatus.REDUNDANT, 1);
}
}
},
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
private static YElement correctDescriptionsByScRemoval(YElement yelement) {
for(YDescription yd : yelement.getDescriptions()){
removeGivenTag("sc", yd.getRichText().toParts());
}
return yelement;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
private static YElement correctDescriptionsByScRemoval(YElement yelement) {
for(YDescription yd : yelement.getDescriptions()){
removeGivenTag("sc", yd.getRichText().toParts());
}
return yelement;
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
protected void fillDescriptions(HtmlMetaHeaders metadata, YElement yElement) {
for (YDescription yDescription : yElement.getDescriptions()) {
if (DescriptionTypes.DS_ABSTRACT.equals(yDescription.getType())) {
metadata.addMetadataName(DCTERMS_NAMESPACE + SEPARATOR + T_ABSTRACT, yDescription.getText());
} else {
metadata.addMetadataName(DC_NAMESPACE + SEPARATOR + DublinCoreStrings.E_DESCRIPTION, yDescription.getText());
}
}
}
代码示例来源: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/yadda-analysis-impl
protected void convertDescription(YElement yElement, BibEntry bibEntry) {
List<YDescription> descriptions = yElement.getDescriptions();
for (YDescription description : descriptions) {
if (description.getType().equals(YConstants.DS_ABSTRACT)) {
bibEntry.setField(BibEntry.FIELD_ABSTRACT, description.getText());
}
if (description.getType().equals(YConstants.DS_NOTE)) {
bibEntry.setField(BibEntry.FIELD_NOTE, description.getText());
}
}
}
代码示例来源: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-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/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.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.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.synat/synat-process-common
return false;
if (!element.getDescriptions().isEmpty() && hasCover(element)) {
return false;
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
private YElement buildArticleElement(JournalArticle article, YElement parentElement, CrossrefIdGenerator generator) {
if (article == null) {
return null;
}
YStructure structure = buildStructureFromParent(parentElement, HierarchyWithLevelIds.EXT_HIERARCHY_JOURNAL, HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_ARTICLE);
YElement element = new YElement();
element.addStructure(structure);
updatePages(article.getPages(), structure.getCurrent());
List<YName> elementTitles = convertTitles(article.getTitles().toArray(new Titles[0]));
element.getNames().addAll(elementTitles);
if (article.getContributors() != null) {
element.getContributors().addAll(convert(article.getContributors(), element));
}
element.getRelations().addAll(convertCitationList(article.getCitationList()));
element.getDates().addAll(convertDates(article.getPublicationDates()));
for (Abstract abs : article.getAbstracts()) {
element.getDescriptions().add(convert(abs));
}
String elementId = generator.generateJournalArticleId(article.getDoiData().getDoi());
element.setId(elementId);
return element;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-polindex
for (YDescription description:yArticle.getDescriptions()) {
if (YConstants.DS_ABSTRACT.equals(description.getType())) {
try {
代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core
relation.getTarget().getValue());
for (YDescription description : contentElement.getDescriptions()) {
if (description.getLanguage().getShortCode().equals(lang)) {
YRichText yRichText = description.getRichText();
内容来源于网络,如有侵权,请联系作者删除!