/*** * This method will copy properties of publication source in publication target and will override all the other properties of Target publication. * This method will ignore experiments * @param source * @param target */ public static void copyAndOverridePublicationProperties(Publication source, Publication target){ if (source != null && target != null){ target.setCurationDepth(source.getCurationDepth()); target.setJournal(source.getJournal()); target.setReleasedDate(source.getReleasedDate()); target.setTitle(source.getTitle()); target.setPublicationDate(source.getPublicationDate()); target.setSource(source.getSource()); // copy collections target.getAnnotations().clear(); target.getAnnotations().addAll(source.getAnnotations()); target.getIdentifiers().clear(); target.getIdentifiers().addAll(source.getIdentifiers()); target.getAuthors().clear(); target.getAuthors().addAll(source.getAuthors()); target.getXrefs().clear(); target.getXrefs().addAll(source.getXrefs()); } }
hashcode = 31*hashcode + (pub.getImexId() != null ? pub.getImexId().hashCode() : 0); if (pub.getImexId() != null){ hashcode = 31*hashcode + pub.getImexId().hashCode(); else if (pub.getPubmedId() != null){ hashcode = 31*hashcode + pub.getPubmedId().hashCode(); else if (pub.getDoi() != null){ hashcode = 31*hashcode + pub.getDoi().hashCode(); else if (!pub.getIdentifiers().isEmpty()){ List<Xref> list1 = new ArrayList<Xref>(pub.getIdentifiers()); hashcode = 31*hashcode + (pub.getTitle() != null ? pub.getTitle().toLowerCase().trim().hashCode() : 0); List<String> authors = pub.getAuthors(); for (String author : authors){ hashcode = 31*hashcode + author.toLowerCase().trim().hashCode(); hashcode = 31*hashcode + (pub.getJournal() != null ? pub.getJournal().toLowerCase().trim().hashCode() : 0); hashcode = 31*hashcode + (pub.getPublicationDate() != null ? pub.getPublicationDate().hashCode() : 0);
public static Xref getPubmedReference(Publication pub){ if (pub == null){ return null; } else if (pub.getPubmedId() == null){ return null; } else{ return XrefUtils.collectFirstIdentifierWithDatabaseAndId(pub.getIdentifiers(), Xref.PUBMED_MI, Xref.PUBMED, pub.getPubmedId()); } }
public static Xref getDoiReference(Publication pub){ if (pub == null){ return null; } else if (pub.getDoi() == null){ return null; } else{ return XrefUtils.collectFirstIdentifierWithDatabaseAndId(pub.getIdentifiers(), Xref.DOI_MI, Xref.DOI, pub.getDoi()); } } }
@Override public void onImexIdAssigned(Publication intactPublication, String imex) { String pubId = intactPublication.getPubmedId() != null ? intactPublication.getPubmedId() : intactPublication.getDoi(); if (pubId == null && !intactPublication.getIdentifiers().isEmpty()){ Xref id = intactPublication.getXrefs().iterator().next(); pubId = id.getId(); } NewAssignedImexEvent evt = new NewAssignedImexEvent(this, pubId, imex, null, null); getImexCentralManager().fireOnNewImexAssigned(evt); }
try { Publication pub = new Publication(); pub.setTitle(publication.getTitle()); pub.setImexAccession(publication.getImexId()); for (Xref id : publication.getIdentifiers()){ Identifier identifier = buildIdentifier(id.getId(), id.getDatabase().getShortName()); if (identifier != null){ if (publication.getPublicationDate() != null){ GregorianCalendar c = new GregorianCalendar(); c.setTime(publication.getPublicationDate()); try { XMLGregorianCalendar date2 = DatatypeFactory.newInstance().newXMLGregorianCalendar(c); if (publication.getReleasedDate() != null){ GregorianCalendar c = new GregorianCalendar(); c.setTime(publication.getReleasedDate()); try { XMLGregorianCalendar date2 = DatatypeFactory.newInstance().newXMLGregorianCalendar(c); if (!publication.getAuthors().isEmpty()){ StringBuffer buffer = new StringBuffer(); Iterator<String> authorIterator = publication.getAuthors().iterator(); while (authorIterator.hasNext()){ buffer.append(authorIterator.next()); if (publication.getSource() != null){ pub.setAdminGroupList(new Publication.AdminGroupList()); pub.getAdminGroupList().getGroup().add(publication.getSource().getShortName().toUpperCase());
public void write(Publication object) throws IOException { if (!object.getIdentifiers().isEmpty()){ MIJsonUtils.writePropertyKey("pubid", writer); MIJsonUtils.writeOpenArray(writer); Iterator<Xref> identifierIterator = object.getIdentifiers().iterator(); while (identifierIterator.hasNext()){ getIdentifierWriter().write(identifierIterator.next()); if (identifierIterator.hasNext()){ MIJsonUtils.writeSeparator(writer); } } if (object.getImexId() != null){ MIJsonUtils.writeSeparator(writer); MIJsonUtils.writeProperty("imex", JSONValue.escape(object.getImexId()), writer); } MIJsonUtils.writeEndArray(writer); } else if (object.getImexId() != null){ MIJsonUtils.writePropertyKey("pubid", writer); MIJsonUtils.writeOpenArray(writer); MIJsonUtils.writeProperty("imex", JSONValue.escape(object.getImexId()), writer); MIJsonUtils.writeEndArray(writer); } // publication source if (object.getSource() != null){ MIJsonUtils.writeSeparator(writer); MIJsonUtils.writePropertyKey("sourceDatabase", writer); getCvWriter().write(object.getSource()); } }
final Collection<psidev.psi.mi.jami.model.Xref> dbReferences = pub.getIdentifiers(); Collection<Annotation> emails = AnnotationUtils.collectAllAnnotationsHavingTopic(pub.getAnnotations(), Annotation.CONTACT_EMAIL_MI, Annotation.CONTACT_EMAIL); int countValidEmail = 0; List<String> authorList = pub.getAuthors(); String publicationTitle = pub.getTitle();
public psidev.psi.mi.jami.model.Publication fetchByIdentifier( String identifier, String source ) throws BridgeFailedException { for ( psidev.psi.mi.jami.model.Publication p : allPublications ) { for (Xref i : p.getIdentifiers()){ if( XrefUtils.doesXrefHaveDatabaseAndId(i, null, source, identifier) ) { return p; } } if (p.getImexId() != null && p.getImexId().equalsIgnoreCase(identifier)){ return p; } } return null; }
CurationDepth depth1 = publication1.getCurationDepth(); CurationDepth depth2 = publication2.getCurationDepth(); Source source1 = publication1.getSource(); Source source2 = publication2.getSource(); Date date1 = publication1.getReleasedDate(); Date date2 = publication2.getReleasedDate();
private Publication createPublicationFrom(Result result){ Publication publication = new DefaultPublication(); publication.setPubmedId(result.getPmid()); publication.setDoi(result.getDOI()); publication.setTitle(result.getTitle()); publication.setJournal(result.getJournalInfo().getJournal().getTitle()); publication.setPublicationDate(date.getTime()); publication.getAuthors().add(authors.getLastName()+' '+authors.getInitials()+'.');
private void checkPublication(Collection<ValidatorMessage> messages, Publication p, Experiment parent) throws ValidatorException { Collection<ValidatorMessage> confMessages = this.publicationRuleWrapper.check(p); // validate with other rules if any if (!getObjectRules().isEmpty()){ messages.addAll(super.validate(p)); } // add context for (ValidatorMessage message : confMessages){ ((MiContext)message.getContext()).addAssociatedContext(RuleUtils.buildContext(parent, "experiment")); messages.add(message); } // validate identifier for (Xref ref : p.getIdentifiers()){ checkXref(messages, ref, p, "publication"); } // validate xref for (Xref ref : p.getXrefs()){ checkXref(messages, ref, p, "publication"); } // validate annotations for (Annotation a : p.getAnnotations()){ checkAnnotation(messages, a, p, "publication"); } }
public void onImexIdentifierUpdate(Publication publication, Xref oldId) { if (oldId == null){ publicationChangeLogger.log(Level.INFO, "The IMEx identifier has been initialised for the publication " + publication.toString()); } else if (publication.getImexId() == null){ publicationChangeLogger.log(Level.INFO, "The IMEx identifier has been reset for the publication " + publication.toString()); } else { publicationChangeLogger.log(Level.INFO, "The IMEx identifier " + oldId + " has been updated with " + publication.getImexId() + " in the publication " + publication.toString()); } }
public void createPublication( psidev.psi.mi.jami.model.Publication publication ) throws BridgeFailedException { psidev.psi.mi.jami.model.Publication existingP = null; for ( psidev.psi.mi.jami.model.Publication p : allPublications ) { for (Xref i : p.getIdentifiers()){ if( !publication.getIdentifiers().isEmpty() && publication.getIdentifiers().iterator().next().getId().equals( i.getId() ) ) { existingP = p; break; } } } if (existingP == null){ allPublications.add(publication); } else { allPublications.remove(existingP); allPublications.add(publication); } }
public void onSourceUpdated(Publication publication, Source oldSource) { if (oldSource == null){ publicationChangeLogger.log(Level.INFO, "The source has been initialised for the publication " + publication.toString()); } else if (publication.getSource() == null){ publicationChangeLogger.log(Level.INFO, "The source has been reset for the publication " + publication.toString()); } else { publicationChangeLogger.log(Level.INFO, "The source " + oldSource + " has been updated with " + publication.getSource() + " in the publication " + publication.toString()); } }
if (!pub.getAuthors().isEmpty()){ String first = pub.getAuthors().iterator().next(); escapeAndWriteString(first); if (!first.contains(MitabUtils.AUTHOR_SUFFIX)){ getWriter().write(MitabUtils.AUTHOR_SUFFIX); if (pub.getPublicationDate() != null){ getWriter().write("("); getWriter().write(MitabUtils.PUBLICATION_YEAR_FORMAT.format(pub.getPublicationDate())); getWriter().write(")"); else if (pub.getPublicationDate() != null){ getWriter().write(MitabUtils.PUBLICATION_YEAR_FORMAT.format(pub.getPublicationDate()));
public psidev.psi.mi.jami.model.Publication fetchPublicationImexAccession( String identifier, String source, boolean create ) throws BridgeFailedException { final psidev.psi.mi.jami.model.Publication p = fetchByIdentifier(identifier, source); if (p != null){ if( create ) { if( p.getImexId() != null) { throw new IllegalStateException( "Publication already has an IMEx id: " + p.getImexId() ); } // assigning new IMEx ID p.assignImexId("IM-" + imexIdSequence); imexIdSequence++; } } else { ImexCentralFault imexFault = new ImexCentralFault(); imexFault.setFaultCode(6); IcentralFault fault = new IcentralFault("No publication record found", imexFault); throw new BridgeFailedException(fault); } return p; } }
protected void writeInteractionAnnotationTagsFrom(Publication pub) throws IOException { boolean isFirst = true; switch (pub.getCurationDepth()){ case IMEx: isFirst = false; if (!pub.getAnnotations().isEmpty()){ Iterator<Annotation> publicationAnnotationIterator = pub.getAnnotations().iterator();
public void onPublicationDateUpdated(Publication publication, Date oldDate) { if (oldDate == null){ publicationChangeLogger.log(Level.INFO, "The publication date has been initialised for the publication " + publication.toString()); } else if (publication.getPublicationDate() == null){ publicationChangeLogger.log(Level.INFO, "The publication date has been reset for the publication " + publication.toString()); } else { publicationChangeLogger.log(Level.INFO, "The publication date " + oldDate + " has been updated with " + publication.getPublicationDate() + " in the publication " + publication.toString()); } }
public void onTitleUpdated(Publication publication, String oldTitle) { if (oldTitle == null){ publicationChangeLogger.log(Level.INFO, "The title has been initialised for the publication " + publication.toString()); } else if (publication.getTitle() == null){ publicationChangeLogger.log(Level.INFO, "The title has been reset for the publication " + publication.toString()); } else { publicationChangeLogger.log(Level.INFO, "The title " + oldTitle + " has been updated with " + publication.getTitle() + " in the publication " + publication.toString()); } }