/** * Convert an annotatedObject annotations in to confidence value in PSI. * * @param session * @param parent the Element to which we will attach the generated confidence. * @param annotatedObject the object from which we get the annotations. * * @return the generated confidence or null if none could be generated. */ public Element create( UserSessionDownload session, Element parent, AnnotatedObject annotatedObject ) { Element element = null; if ( annotatedObject instanceof Interaction ) { element = create( session, parent, annotatedObject, CvTopic.AUTHOR_CONFIDENCE ); } else if ( annotatedObject instanceof Experiment ) { element = create( session, parent, annotatedObject, CvTopic.CONFIDENCE_MAPPING ); } else { // error, type not supported. throw new UnsupportedOperationException( "a confidence can only be generated for an interaction or an experiemnt." ); } return element; }
private Element createConfidenceElement(UserSessionDownload session, CvObject unit, Object value) { Element confidenceElement = session.createElement(CONFIDENCE_TAG_NAME); // 2. Generating Unit... Element unitElement = session.createElement(CONFIDENCE_UNIT_TAG_NAME); createNames(session, unitElement, unit); confidenceElement.appendChild(unitElement); // TODO check if it has MI reference, if so export them as xref of the confidence.unit. // 3. Generating value... Element valueElement = session.createElement(CONFIDENCE_VALUE_TAG_NAME); Text valueTextElement = session.createTextNode((String)value); valueElement.appendChild(valueTextElement); confidenceElement.appendChild(valueElement); return confidenceElement; } }
/** * Gives the right version of the Psi XML generator according to the user's session * * @param session the user session that will indicate which version of the Psi generator is required * * @return */ public static Confidence2xmlI getInstance( UserSessionDownload session ) { if ( session.getPsiVersion().equals( PsiVersion.VERSION_1 ) ) { return Confidence2xmlPSI1.getInstance(); } else if ( session.getPsiVersion().equals( PsiVersion.VERSION_2 ) ) { return Confidence2xmlPSI2.getInstance(); } else if ( session.getPsiVersion().equals( PsiVersion.VERSION_25 ) ) { return Confidence2xmlPSI25.getInstance(); } else { throw new IllegalStateException( "We do not support PSI version " + session.getPsiVersion() ); } } }
Element confidenceElement = createConfidenceElement(session, confidence.getCvConfidenceType(), confidence.getValue()); confidenceListElement.appendChild(confidenceElement); Element confidenceElement = createConfidenceElement(session, annotation.getCvTopic(), annotation.getAnnotationText());
createNames( session, unitElement, annotation.getCvTopic() ); confidenceElement.appendChild( unitElement );
/** * Gives the right version of the Psi XML generator according to the user's session * * @param session the user session that will indicate which version of the Psi generator is required * * @return */ public static Confidence2xmlI getInstance( UserSessionDownload session ) { if ( session.getPsiVersion().equals( PsiVersion.VERSION_1 ) ) { return Confidence2xmlPSI1.getInstance(); } else if ( session.getPsiVersion().equals( PsiVersion.VERSION_2 ) ) { return Confidence2xmlPSI2.getInstance(); } else if ( session.getPsiVersion().equals( PsiVersion.VERSION_25 ) ) { return Confidence2xmlPSI25.getInstance(); } else { throw new IllegalStateException( "We do not support PSI version " + session.getPsiVersion() ); } } }
createNames( session, unitElement, annotation.getCvTopic() ); confidenceElement.appendChild( unitElement );
/** * Gives the right version of the Psi XML generator according to the user's session * * @param session the user session that will indicate which version of the Psi generator is required * * @return */ public static Confidence2xmlI getInstance( UserSessionDownload session ) { if ( session.getPsiVersion().equals( PsiVersion.VERSION_1 ) ) { return Confidence2xmlPSI1.getInstance(); } else if ( session.getPsiVersion().equals( PsiVersion.VERSION_2 ) ) { return Confidence2xmlPSI2.getInstance(); } else if ( session.getPsiVersion().equals( PsiVersion.VERSION_25 ) ) { return Confidence2xmlPSI25.getInstance(); } else { throw new IllegalStateException( "We do not support PSI version " + session.getPsiVersion() ); } } }
/** * Convert an annotatedObject annotations in to confidence value in PSI. * * @param session * @param parent the Element to which we will attach the generated confidence. * @param annotatedObject the object from which we get the annotations. * * @return the generated confidence or null if none could be generated. */ public Element create( UserSessionDownload session, Element parent, AnnotatedObject annotatedObject ) { Element element = null; if ( annotatedObject instanceof Interaction ) { element = create( session, parent, annotatedObject, CvTopic.AUTHOR_CONFIDENCE ); } else if ( annotatedObject instanceof Experiment ) { element = create( session, parent, annotatedObject, CvTopic.CONFIDENCE_MAPPING ); } else { // error, type not supported. throw new UnsupportedOperationException( "a confidence can only be generated for an interaction or an experiemnt." ); } return element; }
/** * Convert an annotatedObject annotations in to confidence value in PSI. * * @param session * @param parent the Element to which we will attach the generated confidence. * @param annotatedObject the object from which we get the annotations. * * @return the generated confidence or null if none could be generated. */ public Element create( UserSessionDownload session, Element parent, AnnotatedObject annotatedObject ) { Element element = null; if ( annotatedObject instanceof Interaction ) { element = create( session, parent, annotatedObject, CvTopic.AUTHOR_CONFIDENCE ); } else if ( annotatedObject instanceof Experiment ) { element = create( session, parent, annotatedObject, CvTopic.CONFIDENCE_MAPPING ); } else { // error, type not supported. throw new UnsupportedOperationException( "a confidence can only be generated for an interaction or an experiemnt." ); } return element; }