本文整理了Java中pl.edu.icm.model.bwmeta.y.YElement.addDescription()
方法的一些代码示例,展示了YElement.addDescription()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YElement.addDescription()
方法的具体详情如下:
包路径:pl.edu.icm.model.bwmeta.y.YElement
类名称:YElement
方法名:addDescription
暂无
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
@Override
protected boolean enhanceMetadata(BxDocument document, YElement metadata) {
String text = "";
for (BxPage page : filterPages(document)) {
for (BxZone zone : filterZones(page)) {
String[] lines = zone.toText().split("\n");
for (String line : lines) {
if (line.toLowerCase().startsWith("keywords")
|| line.toLowerCase().startsWith("key words")) {
break;
}
text += "\n" + line;
}
}
}
text = text.trim();
if (!text.isEmpty()) {
Matcher matcher = PREFIX.matcher(text);
if (matcher.find()) {
text = text.substring(matcher.end()).trim();
}
metadata.addDescription(new YDescription().setType(YConstants.DS_ABSTRACT).setText(text));
return true;
}
return false;
}
代码示例来源:origin: pl.edu.icm.synat/synat-sdk-sample-services
private List<String> trySoncaKeywords(YElement element, String finalText) {
try {
YDescription description = new YDescription(YLanguage.Polish, finalText);
element.addDescription(description);
YElement enrich = soncaMetadataEnricher.enrich(Lists.newArrayList(element));
List<YTagList> tagLists = enrich.getTagLists("sonca.keywords");
YTagList polishTagList = null;
for (YTagList yTagList : tagLists) {
if (yTagList.getLanguage() == YLanguage.Polish) {
polishTagList = yTagList;
}
}
if (polishTagList != null) {
return polishTagList.getValues();
} else {
return new ArrayList<String>();
}
} catch (Exception e) {
e.printStackTrace();
return new ArrayList<String>();
}
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
public void convertDescription(BibEntry source, YElement yElement) {
//note
String note = source.getFirstFieldValue(BibEntry.FIELD_NOTE);
if (note != null) {
yElement.addDescription(new YDescription().setType(YConstants.DS_NOTE).setText(note));
}
//abstract
String abstractField = source.getFirstFieldValue(BibEntry.FIELD_ABSTRACT);
if (abstractField != null) {
yElement.addDescription(new YDescription().setType(YConstants.DS_ABSTRACT).setText(abstractField));
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-importer-direct
continue;
element.addDescription(description);
代码示例来源:origin: pl.edu.icm.synat/synat-importer-yadda
private YElement prepareYElement(String id, Properties prop) {
YElement yElement = new YElement();
yElement.setId(id);
if (!prop.getProperty("title").isEmpty()) {
yElement.addName(new YName(prepareProperty("title", prop)));
}
yElement.addDescription(new YDescription(YLanguage.Undetermined, prepareProperty("description", prop), DescriptionTypes.DS_SUMMARY));
if (!prop.getProperty("key-words").isEmpty()) {
List<String> tags = new ArrayList<String>(Arrays.asList(prepareProperty("key-words", prop).split(",")));
yElement.addTagList(new YTagList().setType(TagTypes.TG_KEYWORD).setValues(tags));
}
if (!prop.getProperty("supplier").isEmpty()) {
yElement.addAttribute("copyright-holder", prepareProperty("supplier", prop));
}
if (!prop.getProperty("duration").isEmpty()) {
yElement.addAttribute("duration", prepareProperty("duration", prop));
}
yElement.addLanguage(YLanguage.Undetermined);
return yElement;
}
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
private void updateArticleDescription(ZentralBlattRecord src, YElement yelement) {
if (src.hasField("ab")) {
String abText = src.getField("ab").trim();
if (isValidDescription(abText)) {
YDescription desc = new YDescription();
desc.setType(isSummary(abText) ? YConstants.DS_SUMMARY : YConstants.DS_ABSTRACT);
desc.setText(filterAbstractPrefixes(abText));
yelement.addDescription(desc);
}
}
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
parent).addDescription(y.description(getYLang(aabstract), textOfElement(aabstract), DescriptionTypes.DS_ABSTRACT)).addLanguage(getYLang(ameta));
代码示例来源:origin: pl.edu.icm.synat/synat-process-common
private boolean addMetadataIfNeeded(HarvestingResult harvestingResult, YElement element) {
boolean metadataModified = false;
if (shouldAbstractBeAdded(harvestingResult, element)) {
Node htmlNode = new Node(BaseYModelUtils.XHTML_NAMESPACE, BaseYModelUtils.HTML_TAG);
htmlNode.addPart(new Leaf(StringUtils.trim(harvestingResult.getDesciption())));
YRichText richText = new YRichText(Arrays.asList(htmlNode));
YDescription newAbstract = new YDescription(YLanguage.Undetermined, richText, DescriptionTypes.DS_ABSTRACT);
element.addDescription(newAbstract);
metadataModified = true;
}
if (shouldImpactFactorBeAdded(harvestingResult, element)) {
element.addAttribute(new YAttribute(YModelUtils.IMPACT_FACTOR, harvestingResult.getImpactFactor().toEngineeringString()));
metadataModified = true;
}
if (shouldFrequencyBeAdded(harvestingResult, element)) {
element.addAttribute(new YAttribute(YModelUtils.FREQUENCY, harvestingResult.getFrequency()));
metadataModified = true;
}
List<YCategoryRef> refs = element.getCategoryRefs();
if (shouldCategoryRefsBeAdded(harvestingResult, refs)) {
refs.addAll(harvestingResult.getCategories());
metadataModified = true;
}
if (shouldTitlesBeAdded(harvestingResult, element)) {
metadataModified |= addTitleHistory(harvestingResult.getOtherTitles(), element);
}
return metadataModified;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
parent).addDescription(y.description(getYLang(aabstract), textOfElement(aabstract), DS_ABSTRACT)).addLanguage(getYLang(ameta));
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
for (LocalizedData<String> description : resource.getDescriptions()) {
if (StringUtils.isNotEmpty(description.getData())) {
yElement.addDescription(new YDescription(description.getLanguage().getyLanguage(), extractor.extractFrom(description.getData())));
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
article.addDescription(y.description(JDOMHelper.getYLang(aabstract), JDOMHelper.textOfElement(aabstract), DS_ABSTRACT));
article.addDescription(y.description(JDOMHelper.getYLang(tr), JDOMHelper.textOfElement(tr), "trans-abstract"));
代码示例来源:origin: pl.edu.icm.synat/synat-importer-speech-to-text
private void prepareYElementFromApi(Video video, YElement yElement) throws ParseException {
yElement.addName(new YName(video.getSnippet().getTitle()));
yElement.addDescription(new YDescription(YLanguage.Undetermined, video.getSnippet().getDescription()
, DescriptionTypes.DS_SUMMARY));
prepareDate(video, yElement);
String license = video.getStatus().getLicense();
if(null != license && license.contains("creativeCommon")) {
yElement.addTagList(new YTagList().setType(YModelUtils.LICENSE).addValue("cc0"));
}
prepareContent(video, yElement);
List<String> tags = video.getSnippet().getTags();
if (CollectionUtils.isNotEmpty(tags)) {
yElement.addTagList(new YTagList().setType(TagTypes.TG_KEYWORD).setValues(tags));
}
YCurrent currentLevel = new YCurrent().setLevel(VideoConstants.VIDEO_CURRENT_LEVEL);
yElement.addStructure(new YStructure()
.setHierarchy(HierarchyWithLevelIds.EXT_HIERARCHY_PUBLICATION)
.setCurrent(currentLevel));
prepareAttributes(video, yElement);
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
private YElement initArticleinBookElement(org.jdom.Element ameta, YElement parent, NlmIdGenerator idGenerator) {
org.jdom.Element atitles = JDOMHelper.optDescendant(ameta, "title-group");
org.jdom.Element atitle = JDOMHelper.optDescendant(atitles, "article-title");
org.jdom.Element aabstract = JDOMHelper.getChild(ameta, "abstract");
Element articleId = JDOMHelper.getChildWithGivenAttributeValue(ameta, "article-id", "pub-id-type", "eudml-id");
String eudmlId=articleId==null?null:articleId.getValue();
String id=idGenerator.getBookArticleId(eudmlId);
YElement article = factory.element(NlmToYConstants.EXT_HIERARCHY_MBOOK_ARTICLE, NlmToYConstants.EXT_LEVEL_MBOOK_ARTICLE_ARTICLE,
y.canonicalName(JDOMHelper.getYLang(atitle), JDOMHelper.textOfElement(atitle)),
parent, id)
.addDescription(y.description(JDOMHelper.getYLang(aabstract),
JDOMHelper.textOfElement(aabstract), DescriptionTypes.DS_ABSTRACT))
.addLanguage(JDOMHelper.getYLang(ameta));
List<org.jdom.Element> trs = JDOMHelper.optChildren(atitles, "trans-title-group");
for (org.jdom.Element tr : trs) {
article.addName(y.name(JDOMHelper.getYLang(tr), JDOMHelper.textOfElement(JDOMHelper.getChild(tr, "trans-title")), NameTypes.NM_ALTERNATIVE));
}
return article;
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
book.addDescription(y.description(JDOMHelper.getYLang(babstract),
JDOMHelper.textOfElement(babstract), DescriptionTypes.DS_ABSTRACT)).addLanguage(JDOMHelper.getYLang(bmeta));
book.addDescription(y.description(JDOMHelper.getYLang(tr), JDOMHelper.textOfElement(tr), "trans-abstract"));
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
if(abstrakt!=null){
if(abstrakt.getAbstractText()!=null){
article.addDescription(new YDescription(YLanguage.English,xmc.getArticle().getAbstract().getAbstractText(),DescriptionTypes.DS_ABSTRACT));
if(otherAbstrakt!=null){
if(otherAbstrakt.getAbstractText()!=null){
article.addDescription(new YDescription(YLanguage.Undetermined,otherAbstrakt.getAbstractText(),DescriptionTypes.DS_ABSTRACT));
if(generalNotes!=null){
for(String note:generalNotes){
article.addDescription(new YDescription(YLanguage.Undetermined,note, DescriptionTypes.DS_NOTE));
内容来源于网络,如有侵权,请联系作者删除!