本文整理了Java中pl.edu.icm.model.bwmeta.y.YTagList.addValue()
方法的一些代码示例,展示了YTagList.addValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YTagList.addValue()
方法的具体详情如下:
包路径:pl.edu.icm.model.bwmeta.y.YTagList
类名称:YTagList
方法名:addValue
暂无
代码示例来源:origin: pl.edu.icm.synat/synat-process-common
private void prepareElementKeywords(YElement element, final String to, YTagList tags, YTagList orgTags) {
Object[] orgValuesArray = orgTags.getValues().toArray();
for (String tagValue : tags.getValues()) {
if (ArrayUtils.contains(orgValuesArray, tagValue)) {
continue;
}
orgTags.addValue(tagValue);
}
resizeAndSetValues(orgTags, maxKeywords);
}
代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core
private static void replaceKeywordsField(final YElement yElement, final String[] values) {
if (values != null && values.length > 0) {
final List<YTagList> tags = yElement.getTagLists();
final List<YTagList> toRemove = new ArrayList<YTagList>();
for (final YTagList tagList : tags) {
if (YConstants.TG_KEYWORD.equals(tagList.getType())) {
toRemove.add(tagList);
}
}
tags.removeAll(toRemove);
final Map<YLanguage, YTagList> langList = new HashMap<YLanguage, YTagList>();
for (final String value : values) {
final String[] langValue = StringUtils.split(value, " ", 2);
final YLanguage lang = determineLang(langValue);
if (lang != null) {
YTagList list = langList.get(lang);
if (list == null) {
list = new YTagList(lang, YConstants.TG_KEYWORD);
langList.put(lang, list);
}
list.addValue(langValue[1]);
}
}
tags.addAll(langList.values());
}
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
@Override
protected boolean enhanceMetadata(BxDocument document, YElement metadata) {
for (BxPage page : filterPages(document)) {
for (BxZone zone : filterZones(page)) {
YTagList tagList = new YTagList().setType(YConstants.TG_KEYWORD);
String text = zone.toText().replace("\n", " ");
text = PREFIX.matcher(text).replaceFirst("");
String separator = text.indexOf(";") > -1 ? ";" : ",";
for (String keyword : text.split(separator)) {
tagList.addValue(keyword.trim().replaceFirst("\\.$", ""));
}
metadata.addTagList(tagList);
return true;
}
}
return false;
}
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
protected void convertKeywords(BibEntry source, YElement yElement) {
String bibEntryKeywords = source.getFirstFieldValue(BibEntry.FIELD_KEYWORDS);
if (bibEntryKeywords != null) {
YTagList yTagList = new YTagList();
String[] split = bibEntryKeywords.split("; ");
yTagList.setType(YConstants.TG_KEYWORD);
for (String keyword : split) {
yTagList.addValue(keyword);
}
yElement.addTagList(yTagList);
}
}
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
/**
* Reads keywords from field [ut] and writes to yElement.
*
* @param src
* @param yelement
*/
private void updateArticleKeywords(ZentralBlattRecord src, YElement yelement) {
if (!src.hasField("ut")) {
return;
}
YTagList tags = new YTagList(YLanguage.Undetermined, YConstants.TG_KEYWORD);
String[] keywords = src.getField("ut").split(";");
for (String keyword : keywords) {
if (keyword.equals("-")) {
continue;
}
tags.addValue(keyword.trim());
}
yelement.addTagList(tags);
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
public void fillArticleInformation(YElement article, JSONObject message){
if (message.containsKey("title")) {
for (Object o : (JSONArray) message.get("title")) {
YName tit = new YName(o.toString());
article.addName(tit);
}
}
fillAuthorsInformation(article, message);
JSONArray tagList=(JSONArray)message.get("subject");
if (tagList!=null && tagList.size()>0) {
YTagList tl=new YTagList();
tl.setType(TagTypes.TG_KEYWORD);
for (Object o : (JSONArray) message.get("subject")) {
tl.addValue(o.toString());
}
article.addTagList(tl);
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-importer-direct
@Override
public void parseMetadata(YElement element, ContentMeta cm, YLanguage defaultLanguage) {
Map<YLanguage, YTagList> tags = new HashMap<YLanguage, YTagList>();
for (KeywordGroup kwd : cm.getKeywordGroup()) {
YLanguage yLanguage = YLanguage.byCode(kwd.getXmlLang(), defaultLanguage);
YTagList list = getTaglist(yLanguage, tags);
for (Keyword k : kwd.getKeyword()) {
if (StringUtils.isNotBlank(k.getContent())) {
list.addValue(k.getContent().trim());
}
}
}
for(YTagList tagList: tags.values()){
element.addTagList(tagList);
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
private void appendKeywords(ResourceData resource, YElement yElement) {
for (KeywordsData keywordsData : resource.getKeywords()) {
if (StringUtils.isNotEmpty(keywordsData.getContentString())) {
YTagList tagList = new YTagList(keywordsData.getLanguage().getyLanguage(), TagTypes.TG_KEYWORD);
for (Renderable tag : keywordsData.getData()) {
tagList.addValue(StringEscapeUtils.unescapeHtml(tag.toString()));//TODO QQQ
}
yElement.addTagList(tagList);
}
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api
protected void updateYElement(final DataSet dataSet, final YElement yElement) {
YStructure yStructure = new YStructure(DATA_SET_YSTRUCTURE);
YCurrent yCurrent = new YCurrent(DATA_SET_YLEVEL);
yStructure.setCurrent(yCurrent);
Collection<YStructure> structures = Collections.singletonList(yStructure);
yElement.setStructures(structures);
if (StringUtils.isNotBlank(dataSet.getId())) {
yElement.setId(DATA_SET_YELEMENT_ID_PREFIX + dataSet.getId());
}
if (StringUtils.isNotBlank(dataSet.getName())) {
yElement.setNames(Collections.singletonList(new YName(dataSet.getName())));
}
if (StringUtils.isNotBlank(dataSet.getDescription())) {
yElement.setDescriptions(Collections.singletonList(new YDescription(YLanguage.Undetermined, dataSet.getDescription())));
}
if (dataSet.getDefaultLicense() != null) {
YTagList tagList = new YTagList();
tagList.setType(YModelUtils.LICENSE);
tagList.addValue(dataSet.getDefaultLicense().getId());
yElement.addTagList(tagList);
}
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
private void updateKeywords(YElement article, org.jdom.Element kg) {
YTagList kwds = new YTagList(YLanguage.English, TagTypes.TG_KEYWORD);
List<org.jdom.Element> ks = JDOMHelper.getChildren(kg, "kwd");
for (org.jdom.Element k : ks) {
kwds.addValue(JDOMHelper.textOfElement(k));
}
Attribute kwdLang = kg.getAttribute("lang", Namespace.XML_NAMESPACE);
YLanguage lang = extractYLanguage(kwdLang);
if (lang != null) {
kwds.setLanguage(lang);
}
if (kwds.size() > 0) {
// System.out.println("[NlmToYTransformer] Adding keywords");
article.addTagList(kwds);
}
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
List<Element> ks = kg.getChildren("kwd");
for (Element k : ks) {
kwds.addValue(textOfElement(k));
kwds.addValue(k);
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
List<org.jdom.Element> ks = kg.getChildren("kwd");
for (org.jdom.Element k : ks) {
kwds.addValue(textOfElement(k));
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
tagList.setType(YModelUtils.LICENSE);
if (resource.getCopyright().equals(PortalResourceCopyright.PUBLIC_DOMAIN)) {
tagList.addValue(PortalResourceCopyright.PUBLIC_DOMAIN.toString());
} else {
tagList.addValue(resource.getLicensing());
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
tl.setType(TagTypes.TG_KEYWORD);
for (String s : at.getKeywords().split(",")) {
tl.addValue(s);
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!