Package org.openbel.framework.common.protonetwork.model.AnnotationDefinitionTable

Examples of org.openbel.framework.common.protonetwork.model.AnnotationDefinitionTable.TableAnnotationDefinition


        // handle annotation definitions
        if (hasItems(doc.getDefinitions())) {
            for (AnnotationDefinition ad : doc.getDefinitions()) {
                AnnotationDefinitionTable adt =
                        pn.getAnnotationDefinitionTable();
                adt.addAnnotationDefinition(new TableAnnotationDefinition(ad),
                        0);
            }
        }

        // handle statement groups
View Full Code Here


        Set<Annotation> annotationMapValues = new HashSet<Annotation>(
                annotationMap.values());
        for (Annotation a : annotationMapValues) {
            int adid =
                    adt.getDefinitionIndex().get(
                            new TableAnnotationDefinition(a.getDefinition()));
            int aid = avt.addAnnotationValue(adid, a.getValue());
            valueDefinitions.add(new AnnotationPair(adid, aid));
        }

        return valueDefinitions;
View Full Code Here

        final CommonModelFactory af = CommonModelFactory.getInstance();

        // handle citation name (always exists)
        CitationNameAnnotationDefinition cnad =
                new CitationNameAnnotationDefinition();
        adt.addAnnotationDefinition(new TableAnnotationDefinition(
                cnad), 0);
        annotationMap.put(
                CitationNameAnnotationDefinition.ANNOTATION_DEFINITION_ID,
                af.createAnnotation(citation.getName(), cnad));

        // handle citation id (if not null)
        if (citation.getReference() != null) {
            CitationReferenceAnnotationDefinition ciad =
                    new CitationReferenceAnnotationDefinition();
            adt.addAnnotationDefinition(new TableAnnotationDefinition(ciad),
                    0);
            annotationMap
                    .put(CitationReferenceAnnotationDefinition.ANNOTATION_DEFINITION_ID,
                            af.createAnnotation(citation.getReference(), ciad));
        }

        // handle citation comment (if not null)
        if (citation.getComment() != null) {
            CitationCommentAnnotationDefinition cdad =
                    new CitationCommentAnnotationDefinition();
            adt.addAnnotationDefinition(new TableAnnotationDefinition(cdad),
                    0);
            annotationMap
                    .put(CitationCommentAnnotationDefinition.ANNOTATION_DEFINITION_ID,
                            af.createAnnotation(citation.getComment(), cdad));
        }

        // handle citation date (if not null)
        if (citation.getDate() != null) {
            CitationDateAnnotationDefinition cdtad =
                    new CitationDateAnnotationDefinition();
            adt.addAnnotationDefinition(
                    new TableAnnotationDefinition(cdtad), 0);
            annotationMap.put(
                    CitationDateAnnotationDefinition.ANNOTATION_DEFINITION_ID,
                    af.createAnnotation(
                            datef.format(citation.getDate().getTime()),
                            cdtad));
        }

        // handle citation authors (if not null)
        if (citation.getAuthors() != null) {
            CitationAuthorsAnnotationDefinition cuad =
                    new CitationAuthorsAnnotationDefinition();
            adt.addAnnotationDefinition(new TableAnnotationDefinition(cuad),
                    0);
            annotationMap
                    .put(CitationAuthorsAnnotationDefinition.ANNOTATION_DEFINITION_ID,
                            af.createAnnotation(PackUtils.packValues(citation
                                    .getAuthors()), cuad));
        }

        // handle citation type (if not null)
        if (citation.getType() != null) {
            CitationTypeAnnotationDefinition ctad =
                    new CitationTypeAnnotationDefinition();
            adt.addAnnotationDefinition(new TableAnnotationDefinition(ctad),
                    0);
            annotationMap.put(
                    CitationTypeAnnotationDefinition.ANNOTATION_DEFINITION_ID,
                    af.createAnnotation(citation.getType().getDisplayValue(),
                            ctad));
View Full Code Here

            Evidence evidence, Map<String, Annotation> annotationMap) {
        AnnotationDefinitionTable adt =
                protoNetwork.getAnnotationDefinitionTable();
        EvidenceAnnotationDefinition ead =
                new EvidenceAnnotationDefinition();
        adt.addAnnotationDefinition(new TableAnnotationDefinition(ead), 0);
        annotationMap.put(
                EvidenceAnnotationDefinition.ANNOTATION_DEFINITION_ID,
                CommonModelFactory.getInstance().createAnnotation(
                        evidence.getValue(), ead));
    }
View Full Code Here

                new HashSet<StatementAnnotationMapTable.AnnotationPair>();

        if (hasItems(aps)) {
            for (AnnotationPair ap : aps) {
                // add original annotation definition to acquire new id
                TableAnnotationDefinition ad =
                        protoNetwork2
                                .getAnnotationDefinitionTable()
                                .getIndexDefinition().get(
                                        ap.getAnnotationDefinitionId());
                int newadid = protoNetwork1.getAnnotationDefinitionTable()
View Full Code Here

        PreparedStatement adps =
                getPreparedStatement(ANNOTATION_DEFINITION_SQL);

        for (Map.Entry<Integer, TableAnnotationDefinition> ade : adt
                .getIndexDefinition().entrySet()) {
            TableAnnotationDefinition ad = ade.getValue();
            adps.setInt(1, (ade.getKey() + 1));
            adps.setString(2, ad.getName());

            if (AnnotationDefinitionTable.URL_ANNOTATION_TYPE_ID == ad
                    .getAnnotationType()) {
                adps.setNull(3, Types.VARCHAR);
                adps.setNull(4, Types.VARCHAR);
            } else {
                adps.setString(3, StringUtils.abbreviate(ad.getDescription(),
                        MAX_MEDIUM_VARCHAR_LENGTH));
                adps.setString(4, StringUtils.abbreviate(ad.getUsage(),
                        MAX_MEDIUM_VARCHAR_LENGTH));
            }

            final int oid;
            final String domain = ad.getAnnotationDomain();
            final Integer objectId = valueIndexMap.get(domain);
            if (objectId != null) {
                oid = objectId;
            } else {
                oid = saveObject(1, domain);
                valueIndexMap.put(domain, oid);
            }

            adps.setInt(5, oid);
            adps.setInt(6, ad.getAnnotationType());
            adps.addBatch();
        }

        adps.executeBatch();
View Full Code Here

TOP

Related Classes of org.openbel.framework.common.protonetwork.model.AnnotationDefinitionTable.TableAnnotationDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.