- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中pl.edu.icm.model.bwmeta.y.YTagList
类的一些代码示例,展示了YTagList
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YTagList
类的具体详情如下:
包路径:pl.edu.icm.model.bwmeta.y.YTagList
类名称:YTagList
暂无
代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core
public Set<TagsInfo> getTagsInfo(AbstractElementInfo<?> abstractElementInfo, String tagType){
Map<String, Set<String>> langsTagsMap = new HashMap<String, Set<String>>();
for(YTagList tagList : abstractElementInfo.getTagLists()){
if(tagType.equals(tagList.getType())){
String lang = languageExtractor.extractLanguageCode(tagList.getLanguage());
Set<String> tags = new TreeSet<String>(tagList.getValues());
if(langsTagsMap.containsKey(lang))
langsTagsMap.get(lang).addAll(tags);
else
langsTagsMap.put(lang, tags);
}
}
Set<TagsInfo> infos = convertIntoSetTagsInfo(langsTagsMap);
return infos;
}
代码示例来源: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.synat/synat-process-common
private void resizeAndSetValues(YTagList orgTags, final int maxSize) {
if (orgTags.getValues().size() < maxSize) {
orgTags.setValues(orgTags.getValues());
} else {
orgTags.setValues(orgTags.getValues().subList(BEG, maxSize));
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-importer-direct
private YTagList getTaglist(YLanguage yLanguage, Map<YLanguage, YTagList> tags) {
if(tags.containsKey(yLanguage)){
return tags.get(yLanguage);
}
YTagList tagList = new YTagList();
tagList.setLanguage(yLanguage);
tagList.setType(TagTypes.TG_KEYWORD);
tags.put(yLanguage, tagList);
return tagList;
}
代码示例来源: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.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.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.synat/synat-business-services-api
public static List<String> mergeYTagList(List<YTagList> tagList) {
List<String> result = new LinkedList<>();
for (YTagList tags : tagList) {
result.addAll(tags.getValues());
}
return result;
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
YTagList kwds = new YTagList(YLanguage.Undetermined, TagTypes.TG_KEYWORD);
@SuppressWarnings("unchecked")
List<Element> kgs = ameta.getChildren("kwd-group");
List<Element> ks = kg.getChildren("kwd");
for (Element k : ks) {
kwds.addValue(textOfElement(k));
kwds.addValue(k);
if (kwds.size() > 0) {
article.addTagList(kwds);
代码示例来源: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.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/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.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.bwmeta/bwmeta-2-foreign-transformers
protected void fillRights(YElement yElement, List<YExportable> referedElements, Map<String, List<StringWithAttributes>> ret) {
//copyrigths
//rights
if (yElement.getOneAttributeSimpleValue(CommonAttributeTypes.AT_COPYRIGHT_HOLDER) != null) {
if (!ret.containsKey(E_RIGHTS)) {
ret.put(E_RIGHTS, new ArrayList<StringWithAttributes>());
}
ret.get(E_RIGHTS).add(new StringWithAttributes(yElement.getOneAttributeSimpleValue(CommonAttributeTypes.AT_COPYRIGHT_HOLDER)));
}
//From synat;)
YTagList licenses = yElement.getTagList("License");
if (licenses != null) {
for (String licenseText : licenses.getValues()) {
if (!ret.containsKey(E_RIGHTS)) {
ret.put(E_RIGHTS, new ArrayList<StringWithAttributes>());
}
StringWithAttributes swa = new StringWithAttributes(licenseText);
if (licenses.setLanguage(YLanguage.Sandawe) != null && StringUtils.isNotBlank(licenses.getLanguage().getShortCode())) {
swa.addAttribute("lang", licenses.getLanguage().getShortCode());
}
ret.get(E_RIGHTS).add(swa);
}
}
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
@Override
void compare(YElement expected, YElement actual, EvalResult result) {
Map<String, List<String>> actTagLists = new HashMap<String, List<String>>();
for (YTagList yTagList : actual.getTagLists()) {
String type = yTagList.getType();
List<String> values = yTagList.getValues();
actTagLists.put(type, values);
}
for (YTagList yTagList : expected.getTagLists()) {
String type = yTagList.getType();
if (actTagLists.containsKey(type)) {
compareLists(yTagList.getValues(), actTagLists.get(type), type, result);
actTagLists.remove(type);
} else {
result.append(type, ResultStatus.FAILED, yTagList.size());
}
}
for (String type : actTagLists.keySet()) {
result.append(type, ResultStatus.REDUNDANT, actTagLists.get(type).size());
}
}
},
代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core
protected String getMergedKeywords(YElement element) {
StringBuffer result = new StringBuffer();
boolean comma = false;
for (YTagList tags : element.getTagLists()) {
if (YConstants.TG_KEYWORD.equals(tags.getType())) {
for (String s : tags.getValues()) {
if (comma) {
result.append(", ");
} else {
comma = true;
}
result.append(s);
}
}
}
String stringResult = result.toString();
if (stringResult.isEmpty())
return null;
return stringResult;
}
代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core
public YTagList createYTagList(TagsInfoViewObject keyword) {
YLanguage language = YLanguage.byCode(keyword.getLang(), YLanguage.English);
YTagList tagList = new YTagList(language, YConstants.TG_KEYWORD);
tagList.setValues(keyword.getTags());
return tagList;
}
代码示例来源: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);
YTagList kwList = article.getTagList(YConstants.TG_KEYWORD);
if (kwList == null || kwList.size()==0) {
return null;
}
StringBuilder keywords = new StringBuilder();
for (String kw: kwList.getValues()) {
keywords.append(kw);
keywords.append(YElementToZentralBlattConverter.SUGGESTED_MULTIVALUE_FIELD_SEPARATOR);
}
return keywords.toString();
}
代码示例来源:origin: pl.edu.icm.synat/synat-process-common
private void prepareTagsWithExistedTags(YElement enrichedElement,
final String from, YElement element, final String to) {
for (YTagList tags : enrichedElement.getTagLists(from)) {
for (YTagList orgTags : element.getTagLists(to)) {
if ( ! tags.getLanguage().equals(orgTags.getLanguage())) {
continue;
}
prepareElementKeywords(element, to, tags, orgTags);
}
}
}
代码示例来源: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);
}
}
本文整理了Java中pl.edu.icm.model.bwmeta.y.YTagList.addValue()方法的一些代码示例,展示了YTagList.addValue()的具体用法。这些代码示例主
本文整理了Java中pl.edu.icm.model.bwmeta.y.YTagList.size()方法的一些代码示例,展示了YTagList.size()的具体用法。这些代码示例主要来源于Gith
本文整理了Java中pl.edu.icm.model.bwmeta.y.YTagList.getLanguage()方法的一些代码示例,展示了YTagList.getLanguage()的具体用法。这
本文整理了Java中pl.edu.icm.model.bwmeta.y.YTagList.setValues()方法的一些代码示例,展示了YTagList.setValues()的具体用法。这些代码示
本文整理了Java中pl.edu.icm.model.bwmeta.y.YTagList.getType()方法的一些代码示例,展示了YTagList.getType()的具体用法。这些代码示例主要来
本文整理了Java中pl.edu.icm.model.bwmeta.y.YTagList.setType()方法的一些代码示例,展示了YTagList.setType()的具体用法。这些代码示例主要来
本文整理了Java中pl.edu.icm.model.bwmeta.y.YTagList.setLanguage()方法的一些代码示例,展示了YTagList.setLanguage()的具体用法。这
本文整理了Java中pl.edu.icm.model.bwmeta.y.YTagList.getValues()方法的一些代码示例,展示了YTagList.getValues()的具体用法。这些代码示
本文整理了Java中pl.edu.icm.model.bwmeta.y.YTagList.()方法的一些代码示例,展示了YTagList.()的具体用法。这些代码示例主要来源于Github/Stack
我是一名优秀的程序员,十分优秀!