本文整理了Java中pl.edu.icm.model.bwmeta.y.YAttribute
类的一些代码示例,展示了YAttribute
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YAttribute
类的具体详情如下:
包路径:pl.edu.icm.model.bwmeta.y.YAttribute
类名称:YAttribute
暂无
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
private void proceedReferenceAuthorZblFingerPrint(YAttribute ya,
LinkedList<PredicateAndObject> pao) {
for(YAttribute inner : ya.getAttributes()){
if(YConstants.AT_ZBL_AUTHOR_FINGERPRINT.equals(inner.getKey()) && !"-".equals(inner.getValue())){/*5.1*/
String zblfingerprint=inner.getValue();
pao.add(new PredicateAndObject(RelConstants.RL_IS_PERSON, RelConstants.NS_ZBL_PERSON + zblfingerprint));
}
}
}
代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core
private YAttribute extractEmailAttributes(PersonInfoViewObject personViewObject) {
final String email = personViewObject.getEmail();
if(StringUtils.isNotBlank(email))
return new YAttribute(AttributeConstants.CONTACT_EMAIL, email);
else
return null;
}
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
private static YAttribute extractOneReferenceTextAttributeScNode(YAttribute ya) {
if(! ll.contains(ya.getKey())) return ya;
for(Part p:ya.getRichValue().toParts()){
if(p instanceof Node){
if("sc".equals(((Node)p).getTag()))
return new YAttribute(ya.getKey(),new YRichText(((Node)p).getParts().get(0).toString()));
}else if(p instanceof Leaf)
return new YAttribute(ya.getKey(),new YRichText(((Leaf)p).toPlainText()));
}
return ya;
}
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
public void updateWithAttribute(YAttribute src, Map<String, String> relfields, String attrName, String fieldName) {
List<YAttribute> attrs = src.getAttributes(attrName);
if (attrs != null && attrs.size() > 0) {
relfields.put(fieldName, attrs.get(0).getValue().trim());
}
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
/**
* transplantation form RelationStatementBuilder
* @param ya
* @param paos_ref
* @param refno
* @return
*/
private boolean parseReferenceText(YAttribute ya, LinkedList<PredicateAndObject> paos_ref, int refno) {
if(YConstants.AT_REFERENCE_TEXT.equals(ya.getKey())){/*3*/
parseReferenceText(ya.getValue(), paos_ref, refno);
return true;
}else return false;
}
代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core
private Set<String> getAffiliationsNamesFromAttributes(List<YAttribute> attributes) {
Set<String> affNames = new HashSet<>();
for (YAttribute attribute : attributes) {
String name = attribute.getValue();
if (StringUtils.isNotBlank(name)) {
affNames.add(name);
}
}
return affNames;
}
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
@SuppressWarnings("deprecation")
public static void updateYRelationWithZblContributor(YRelation relye, YContributor c) {
YAttribute ya = null;
if (c.getOneName("canonical") != null)
ya = new YAttribute(YConstants.AT_REFERENCE_PARSED_AUTHOR, c.getOneName("canonical").getText().toString());
if (c.getAttributes(YConstants.AT_ZBL_AUTHOR_FINGERPRINT).size() > 0)
ya.addAttribute(YConstants.AT_ZBL_AUTHOR_FINGERPRINT, c.getAttributes(YConstants.AT_ZBL_AUTHOR_FINGERPRINT)
.get(0).getValue());
if (c.getOneName("forenames") != null)
ya.addAttribute(YConstants.AT_REFERENCE_PARSED_AUTHOR_FORENAMES, c.getOneName("forenames").getText()
.toString());
ya.addAttribute(YConstants.AT_REFERENCE_PARSED_AUTHOR_SURNAME, c.getOneName("surname").getText().toString());
relye.addAttribute(ya);
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
public static void updateYRelationWithZblNames(YRelation relye, YElement zblye) {
for (YName n : zblye.getNames()) {
YAttribute ya = new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_NAME, "");
ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_LANGUAGE, n.getLanguage().getName()));
ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_TYPE, n.getType()));
ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_VALUE, n.getText()));
relye.addAttribute(ya);
}
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-content
StringBuilder fn = separateAuthorForenamesList.get(s1);
String sn = separateAuthorSurnamesList.get(s1);
YAttribute ya = new YAttribute();
ya.setValue(separateAuthorForenamesList.get(s1)+" "+separateAuthorSurnamesList.get(s1));
ya.setKey(YConstants.AT_REFERENCE_PARSED_AUTHOR);
if(separateAuthorForenamesList.get(s1)!=null && separateAuthorForenamesList.get(s1).length()>0) ya.addAttribute(new YAttribute(YConstants.AT_REFERENCE_PARSED_AUTHOR_FORENAMES, separateAuthorForenamesList.get(s1).toString()));
if(separateAuthorSurnamesList.get(s1)!=null && separateAuthorSurnamesList.get(s1).length()>0) ya.addAttribute(new YAttribute(YConstants.AT_REFERENCE_PARSED_AUTHOR_SURNAME, separateAuthorSurnamesList.get(s1)));
parsed.addAttribute(ya);
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
private static YElement putRelationReferenceToLeafsIntoNodes(YElement yelement) {
for(YRelation yr : yelement.getRelations()){
for(YAttribute ya : yr.getAttributes()){
if(! ll.contains(ya.getKey()))continue;
removeGivenTag("sc", ya.getRichValue().toParts());
ya.setValue(new YRichText(extractLeafs(removeNodeWithGivenTag("ext-link", ya.getRichValue().toParts()))));
}
}
return yelement;
}
代码示例来源:origin: pl.edu.icm.synat/synat-core-services-impl
private List<YAttribute> processAttributes(String key, Object value) {
List<YAttribute> attributes = new ArrayList<>();
if(value instanceof String){
YAttribute attribute = new YAttribute();
attribute.setValue(value.toString());
attribute.setKey(key);
attributes.add(attribute);
} else if(value instanceof List){
for(Object object:((BasicDBList) value)){
attributes.addAll(processAttributes(key, object));
}
} else if(value instanceof DBObject) {
YAttribute attribute = getConverter().read(YAttribute.class, (DBObject) value);
attribute.setKey(key);
attributes.add(attribute);
}
return attributes;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
YAttribute ySurname = new YAttribute(YConstants.AT_REFERENCE_PARSED_AUTHOR_SURNAME, author);
YAttribute yForenames = new YAttribute(YConstants.AT_REFERENCE_PARSED_AUTHOR_FORENAMES, author);
YAttribute yAuthor = new YAttribute();
yAuthor.setKey(YConstants.AT_REFERENCE_PARSED_AUTHOR);
yAuthor.addAttribute(ySurname);
yAuthor.addAttribute(yForenames);
YAttribute yTitle = new YAttribute(YConstants.AT_REFERENCE_PARSED_TITLE, title);
relation.addAttribute(yTitle);
YAttribute yYear = new YAttribute(YConstants.AT_REFERENCE_PARSED_YEAR, year);
relation.addAttribute(yYear);
YAttribute yJournal = new YAttribute(YConstants.AT_REFERENCE_PARSED_JOURNAL, journal);
relation.addAttribute(yJournal);
YAttribute yVolume = new YAttribute(YConstants.AT_REFERENCE_PARSED_VOLUME, volume);
relation.addAttribute(yVolume);
YAttribute yIssue = new YAttribute(YConstants.AT_REFERENCE_PARSED_ISSUE, issue);
relation.addAttribute(yIssue);
YAttribute yPublisher = new YAttribute(YConstants.AT_REFERENCE_PARSED_PUBLISHER, publisher);
relation.addAttribute(yPublisher);
YAttribute yPages = new YAttribute(YConstants.AT_REFERENCE_PARSED_PAGES, pages);
relation.addAttribute(yPages);
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
/**
* TODO, so far: ignore
* @param ya
* @param paos_ref
* @param refno
* @return
*/
private boolean parseReferenceType(YAttribute ya, LinkedList<PredicateAndObject> paos_ref, int refno) {
if(YConstants.AT_REFERENCE_PARSED_TYPE.equals(ya.getKey())){/*2*/
return true;
}else return false;
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
public static boolean sanitizeCategoryRefs(YElement article) {
if (article == null || article.getCategoryRefs().isEmpty())
return false;
boolean warning = false;
List<YCategoryRef> cleanRefs = new ArrayList<YCategoryRef>();
for (YCategoryRef ref : article.getCategoryRefs()) {
if (ref == null || ref.getCode() == null || ref.getCode().trim().isEmpty())
continue;
ref.setCode(ref.getCode().trim());
List<YCategoryRef> refs = sanitizeCategoryRef(ref);
warning = warning || isChanged(ref, refs);
cleanRefs.addAll(refs);
}
article.setCategoryRefs(cleanRefs);
if (!warning)
return false;
YAttribute attr = article.getOneAttribute(Warnings.WARNINGS);
if (attr == null) {
attr = new YAttribute(Warnings.WARNINGS, (String) null);
article.addAttribute(attr);
}
if (attr.getOneAttribute(Warnings.WARNINGS_CHECK_CATEGORY_REFS) == null)
attr.addAttribute(Warnings.WARNINGS_CHECK_CATEGORY_REFS, "");
return true;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-content
Statements s_ref = new Statements();s_ref.setSubject(RelConstants.NS_REFERENCE+item.getId().substring(0)+"#r"+refno);
LinkedList<PredicateAndObject> paos_ref = new LinkedList<PredicateAndObject>();
if(ya.getValue()!=null && ya.getValue().length()>0){
paos_ref.add(new PredicateAndObject(RelConstants.RL_TEXT, ya.getValue()));
if(parser!=null){
try {
YRelation parsed = parser.parse(ya.getValue());
if(parsed!=null){
String title = parsed.getOneAttributeSimpleValue(YConstants.AT_REFERENCE_PARSED_TITLE);
int innerContrib = 0;
for(YAttribute contrib : parsedContrib){
String forename = contrib.getOneAttributeValue(YConstants.AT_REFERENCE_PARSED_AUTHOR_FORENAMES);
String surname = contrib.getOneAttributeValue(YConstants.AT_REFERENCE_PARSED_AUTHOR_SURNAME);
String contrId = RelConstants.NS_CONTRIBUTOR+item.getId().substring(0)
+"#r"+refno+"#c"+innerContrib;
代码示例来源:origin: pl.edu.icm.synat/synat-core-services-impl
private Object getAttributeValue(YAttribute attribute){
if(attribute.getAttributes() == null || attribute.getAttributes().isEmpty()){
YRichText richText = attribute.getRichValue();
Object richTextObject = converter.convertToMongoType(richText);
return richTextObject;
} else {
DBObject attributeValue = (DBObject) converter.convertToMongoType(attribute, ClassTypeInformation.from(attribute.getClass()));
attributeValue.removeField("key");
return attributeValue;
}
}
代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core
private String getXMLFragmentFrom(YAttribute referanceText) {
if(referanceText == null){
return "";
} else {
YRichText yrichText = referanceText.getRichValue();
final String result = YRTHelper.toXmlFragment(yrichText, "");
return result;
}
}
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
public boolean updateWithAttribute(YRelation rel, Map<String, String> relfields, String attrName, String fieldName) {
List<YAttribute> attrs = rel.getAttributes(attrName);
if (attrs != null && attrs.size() > 0) {
relfields.put(fieldName, attrs.get(0).getValue().trim());
return true;
}
return false;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
/**
* transplantation form RelationStatementBuilder
* @param ya
* @param paos_ref
* @param refno
* @param sb
* @return
* @throws YaddaException
*/
private boolean parseReferenceText(YAttribute ya, LinkedList<PredicateAndObject> paos_ref, int refno, StringBuffer sb) throws YaddaException {
if(YConstants.AT_REFERENCE_TEXT.equals(ya.getKey())){/*3*/
sb.append(ya.getValue().toString());
paos_ref.add(new PredicateAndObject(RelConstants.RL_TEXT, ya.getValue().toString()));
//further parsing of reference-parsed-text is done in parseReferences() method,
//hence parsing here is not allowed
return true;
}else return false;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
ya = new YAttribute(YConstants.TG_CATEGORY,"");
for(YCategoryRef r : zblye.getCategoryRefs()){
ya.addAttribute(new YAttribute(r.getClassification(), r.getCode()));
ya = new YAttribute(YConstants.AT_REFERENCE_PARSED_AUTHOR,c.getOneName("canonical").getText().toString());
if(c.getAttributes(YConstants.AT_ZBL_AUTHOR_FINGERPRINT).size()>0)
ya.addAttribute(YConstants.AT_ZBL_AUTHOR_FINGERPRINT , c.getAttributes(YConstants.AT_ZBL_AUTHOR_FINGERPRINT).get(0).getValue());
if(c.getOneName("forenames")!=null)
ya.addAttribute(YConstants.AT_REFERENCE_PARSED_AUTHOR_FORENAMES , c.getOneName("forenames").getText().toString() );
ya.addAttribute(YConstants.AT_REFERENCE_PARSED_AUTHOR_SURNAME , c.getOneName("surname").getText().toString() );
relye.addAttribute(ya);
ya = new YAttribute(YConstants.TG_CATEGORY,"");
for(YId i : zblye.getIds()){
if(i.getScheme().equals(YConstants.EXT_SCHEME_ISSN)){
ya.addAttribute(new YAttribute(YConstants.EXT_SCHEME_ISSN, i.getValue()));
}else if(i.getScheme().equals(YConstants.EXT_SCHEME_ISBN)){
ya.addAttribute(new YAttribute(YConstants.EXT_SCHEME_ISBN, i.getValue()));
} else if(i.getScheme().equals(YConstants.EXT_SCHEME_ZBL)){
ya.addAttribute(new YAttribute(YConstants.EXT_SCHEME_ZBL, i.getValue()));
} else if(i.getScheme().equals(YConstants.EXT_SCHEME_ZBL)){
ya.addAttribute(new YAttribute(YConstants.EXT_SCHEME_ZBL, i.getValue()));
ya = new YAttribute(YConstants.AT_REFERENCE_PARSED_ID_ISSN,i.getValue());
relye.addAttribute(ya);
} else if(i.getScheme().equals(YConstants.EXT_SCHEME_ISBN)){
ya = new YAttribute(YConstants.AT_REFERENCE_PARSED_ID_ISBN,i.getValue());
relye.addAttribute(ya);
} else if(i.getScheme().equals(YConstants.EXT_SCHEME_ZBL)){
内容来源于网络,如有侵权,请联系作者删除!