本文整理了Java中pl.edu.icm.model.bwmeta.y.YElement.getTagLists()
方法的一些代码示例,展示了YElement.getTagLists()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YElement.getTagLists()
方法的具体详情如下:
包路径:pl.edu.icm.model.bwmeta.y.YElement
类名称:YElement
方法名:getTagLists
暂无
代码示例来源:origin: pl.edu.icm.synat/synat-process-common
private boolean hasKeywords(YElement element) {
if (element.getTagLists().isEmpty()) {
return false;
}
if (element.getTagLists(TagTypes.TG_KEYWORD).isEmpty()) {
return false;
}
return true;
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
protected void fillSubjects(YElement yElement, List<YExportable> referedElements, Map<String, List<StringWithAttributes>> ret) {
// subject element
if (!yElement.getTagLists().isEmpty()) {
ret.put(E_SUBJECT, new ArrayList<StringWithAttributes>());
}
for (YTagList yTagList : yElement.getTagLists()) {
for (String tag : yTagList.getValues()) {
ret.get(E_SUBJECT).add(new StringWithAttributes(tag));
}
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-process-common
private void prepareKeywords(YElement enrichedElement, final String from, YElement element, final String to) {
if (element.getTagLists(to).isEmpty()) {
for (YTagList tags : enrichedElement.getTagLists(from)) {
prepareElementKeywords(element, to, tags);
}
} else {
prepareTagsWithExistedTags(enrichedElement, from, element, to);
}
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
private static void updateYElementTagsWithZblTags(YElement ye, YElement zblye) {
for (YTagList tl : zblye.getTagLists())
ye.addTagList(tl);
}
代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core
private List<YTagList> removeKeywordsFromTags() {
List<YTagList> tagListsList = new ArrayList<>();
for (YTagList yTagList : safe(article.getTagLists())) {
if(!yTagList.getType().equals(YConstants.TG_KEYWORD)) {
tagListsList.add(yTagList);
}
}
return tagListsList;
}
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api
public static LicensingData prepareLicensingData(final YElement yElement, LicenseDictionaryService licenseDictionaryService) {
if (CollectionUtils.isNotEmpty(yElement.getTagLists(LICENSE))) {
List<String> licenses = mergeYTagList(yElement.getTagLists(LICENSE));
for (String licensingId : licenses) {
LicensingData license = licenseDictionaryService.getLicensingDatabyId(licensingId);
if (license != null) {
return license;
}
}
final String licensingId = licenses.get(0);
return new LicensingData(licensingId);
}
return null;
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
@Override
public HtmlMetaHeaders prepareKeywordsMetadata(final YElement yElement) {
HtmlMetaHeaders keywordsMetadata = new HtmlMetaHeaders();
StringBuilder keywordsSb = new StringBuilder();
for (YTagList tagList : yElement.getTagLists(TG_KEYWORD)) {
for (String keyword : tagList.getValues()) {
keywordsSb.append((keywordsSb.length() == 0) ? keyword : ", " + keyword);
}
keywordsMetadata.addMetadataName("keywords", keywordsSb.toString());
}
return keywordsMetadata;
}
代码示例来源: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.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-portal-core
protected void fillSubjects(HtmlMetaHeaders metadata, YElement yElement) {
for (YTagList yTagList : yElement.getTagLists()) {
for (String value : yTagList.getValues()) {
metadata.addMetadataName(DC_NAMESPACE + SEPARATOR + DublinCoreStrings.E_SUBJECT, value);
}
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-process-common
/**
* Modifies input {@code element} {@code YElement} if {@code enrichedYElement} {@code YElement}
* is enriched. The {@code YTagList} with {@code TagTypes.TG_KEYWORD}.
* The {@code maxKeywords} is used to estimate {@code YTagList} {@code YTagList#getValues()} amount.
* @param element, will be updated with classification.
* @param enrichedYElement, should has classification.
* @return {@code true} if meta data was modify
* {@code false} otherwise.
*/
protected boolean modifyIfNeeded(YElement element, final YElement enrichedYElement) {
if ( ! enrichedYElement.getTagLists(TG_SONCA_KEYWORDS).isEmpty()) {
prepareKeywords(enrichedYElement, TG_SONCA_KEYWORDS, element, TagTypes.TG_KEYWORD);
element.addAttribute(AT_CLASSIFICATION_OECD_BY, "Sonca");
return true;
}
return false;
}
代码示例来源: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
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/yaddaweb-lite-core
List<SubjectSet> subjects = new LinkedList<SubjectSet>();
Map<String, List<ViewSubject> > keywordsMap = new HashMap<String, List<ViewSubject>>();
for (YTagList tags : element.getTagLists()) {
if (YConstants.TG_SUBJECT_PRIMARY.equals(tags.getType())
|| YConstants.TG_SUBJECT_SECONDARY.equals(tags.getType())) {
代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core
List<KeywordSet> keywords = new LinkedList<KeywordSet>();
Map<String, List<ViewKeyword> > keywordsMap = new HashMap<String, List<ViewKeyword>>();
for (YTagList tags : element.getTagLists()) {
if (YConstants.TG_KEYWORD.equals(tags.getType())) {
List<ViewKeyword> words = new ArrayList<ViewKeyword>();
代码示例来源: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-portal-core
/**
* Method for preparation of keywords list
*
* @param yElement
* Ymodel element
* @return List of keywords in yElement
*/
@Override
public List<KeywordsData> prepareKeywords(YElement yElement, Locale locale) {
final YLanguage yDefaultLanguage = YModelUtils.getDefaultLanguage(yElement);
List<KeywordsData> keywords = new ArrayList<KeywordsData>();
for (YTagList tagList : yElement.getTagLists()) {
final YLanguage yLanguage = tagList.getLanguage();
final KeywordsData localizedKeywordsData = makeLocalizedKeywordsData(tagList, yLanguage, locale);
if (null != localizedKeywordsData && yLanguage.equals(yDefaultLanguage)) {
keywords.add(localizedKeywordsData);
}
}
for (YTagList tagList : yElement.getTagLists()) {
final YLanguage yLanguage = tagList.getLanguage();
final KeywordsData localizedKeywordsData = makeLocalizedKeywordsData(tagList, yLanguage, locale);
if (null != localizedKeywordsData && !yLanguage.equals(yDefaultLanguage)) {
keywords.add(localizedKeywordsData);
}
}
return keywords;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
/**
* accomplished
*/
private void proceedTags() {/*9*/
int tagid=0;
for(YTagList yt : in_item.getTagLists()){
YLanguage lang = yt.getLanguage();
String id = null;
for(String tag : yt.getValues()){
id = RelConstants.NS_TAG+"-"+in_item.getId()+"-"+tagid;
paos_doc.add(new PredicateAndObject(RelConstants.RL_TAG, id));
tagid++;
Statements t_affil = new Statements();
t_affil.setSubject(id);
LinkedList<PredicateAndObject> paos_affil = new LinkedList<PredicateAndObject>();
paos_affil.add(new PredicateAndObject(RelConstants.RL_TYPE, tag.toLowerCase()));
paos_affil.add(new PredicateAndObject(RelConstants.RL_TEXT, tag.toLowerCase()));
paos_affil.add(new PredicateAndObject(RelConstants.RL_LANGUAGE, lang.toString()));
t_affil.setContinuations(paos_affil);
statements.add(t_affil);
}
}
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
/**
* accomplished
*/
private void proceedTags() {/*9*/
int tagid=0;
for(YTagList yt : in_item.getTagLists()){
YLanguage lang = yt.getLanguage();
String id = null;
for(String tag : yt.getValues()){
id = RelConstants.NS_TAG+in_item.getId()+"/t"+tagid;
paos_doc.add(new PredicateAndObject(RelConstants.RL_TAG, id));
tagid++;
Statements t_affil = new Statements();
t_affil.setSubject(id);
LinkedList<PredicateAndObject> paos_affil = new LinkedList<PredicateAndObject>();
// paos_affil.add(new PredicateAndObject(RelConstants.RL_TYPE, tag.toLowerCase()));
paos_affil.add(new PredicateAndObject(RelConstants.RL_TEXT, tag.toLowerCase()));
paos_affil.add(new PredicateAndObject(RelConstants.RL_LANGUAGE, lang.toString()));
t_affil.setContinuations(paos_affil);
statements.add(t_affil);
}
}
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
public static void updateYRelationWithZblTags(YRelation relye, YElement zblye) {
for (YTagList tl : zblye.getTagLists()) {
YAttribute ya = new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_TAG, "");
ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_TYPE, tl.getType()));
ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_LANGUAGE, tl.getLanguage().getName()));
for (String t : tl.getValues()) {
ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_VALUE, t));
}
relye.addAttribute(ya);
}
}
内容来源于网络,如有侵权,请联系作者删除!