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

Examples of org.openbel.framework.common.protonetwork.model.StatementTable.TableStatement


                    "NestedSubjectTermIndex", "NestedRelationship",
                    "NestedObjectTermIndex");

            List<TableStatement> statements = statementTable.getStatements();
            for (int i = 0; i < statements.size(); i++) {
                TableStatement statement = statements.get(i);

                String si = String.valueOf(i);
                if (statement.getRelationshipName() == null) {
                    tdvWriter.writeNext(new String[] {
                            si,
                            String.valueOf(statement.getSubjectTermId()),
                            "-", "-", "-", "-", "-" });

                    allWriter.writeNext(new String[] {
                            si,
                            String.valueOf(statement.getSubjectTermId()),
                            "-", "-", "-", "-", "-" });
                } else if (statement.getObjectTermId() != null) {
                    tdvWriter.writeNext(new String[] {
                            si,
                            String.valueOf(statement.getSubjectTermId()),
                            statement.getRelationshipName(),
                            String.valueOf(statement.getObjectTermId()),
                            "-", "-", "-" });

                    allWriter.writeNext(new String[] {
                            si,
                            String.valueOf(statement.getSubjectTermId()),
                            statement.getRelationshipName(),
                            String.valueOf(statement.getObjectTermId()),
                            "-", "-", "-" });
                } else {
                    tdvWriter.writeNext(new String[] {
                            si,
                            String.valueOf(statement.getSubjectTermId()),
                            statement.getRelationshipName(),
                            String.valueOf(statement.getObjectTermId()),
                            String.valueOf(statement.getNestedSubject()),
                            statement.getNestedRelationship(),
                            String.valueOf(statement.getNestedObject()) });

                    allWriter.writeNext(new String[] {
                            si,
                            String.valueOf(statement.getSubjectTermId()),
                            statement.getRelationshipName(),
                            String.valueOf(statement.getObjectTermId()),
                            String.valueOf(statement.getNestedSubject()),
                            statement.getNestedRelationship(),
                            String.valueOf(statement.getNestedObject()) });
                }
            }

            tdvWriter.close();
        } catch (IOException e) {
View Full Code Here


        final Map<Integer, Integer> termNodeMap = pnt.getTermNodeIndex();
        final StatementTable st = pn.getStatementTable();
        final ProtoEdgeTable pet = pn.getProtoEdgeTable();
        final List<TableStatement> stmts = st.getStatements();
        for (int i = 0, n = stmts.size(); i < n; i++) {
            final TableStatement ts = stmts.get(i);
            final int subjectTerm = ts.getSubjectTermId();
            if (ts.getObjectTermId() != null) {
                final int objectTerm = ts.getObjectTermId();

                // find proto node index for subject / object terms
                final int source = termNodeMap.get(subjectTerm);
                final int target = termNodeMap.get(objectTerm);

                // create proto edge and add to table
                pet.addEdges(i, new ProtoEdgeTable.TableProtoEdge(source, ts
                        .getRelationshipName(), target));
            }
        }

        return pn;
View Full Code Here

        final StatementTable st = pn.getStatementTable();

        if (statement.getObject() == null) {
            // definitional statement
            sid =
                    st.addStatement(new TableStatement(subjectTerm), statement,
                            did);
        } else if (statement.getObject().getStatement() == null) {
            // simple statement
            int objectTerm = buildProtoNetwork(pn, statement.getObject()
                    .getTerm());
            sid = st.addStatement(new TableStatement(subjectTerm, statement
                    .getRelationshipType().getDisplayValue(),
                    objectTerm), statement, did);
        } else {
            // nested statement
            final Statement nested = statement.getObject().getStatement();
            int nestedSubject = buildProtoNetwork(pn, nested.getSubject());
            int nestedObject = buildProtoNetwork(pn, nested.getObject()
                    .getTerm());
            sid = st.addStatement(
                    new TableStatement(subjectTerm, statement
                            .getRelationshipType().getDisplayValue(),
                            nestedSubject, nested.getRelationshipType()
                                    .getDisplayValue(), nestedObject),
                    statement, did);
        }
View Full Code Here

                        .get(statementIndex);
        if (statement.getRelationshipName() == null) {
            // merge definitional statement, no create of proto edge
            newStatementIndex =
                    protoNetwork1.getStatementTable().addStatement(
                            new TableStatement(
                                    newSubjectTermId, null, null), stmtToMerge,
                            documentId);
        } else if (statement.getObjectTermId() != null) {
            // merge simple statement
            Integer newObjectTermId = mergeTerm(
                    Integer.valueOf(statement.getObjectTermId()),
                    protoNetwork1, protoNetwork2, documentId, termMap);

            newStatementIndex = protoNetwork1.getStatementTable().addStatement(
                    new TableStatement(newSubjectTermId,
                            statement.getRelationshipName(), newObjectTermId),
                    stmtToMerge, documentId);
        } else {
            // merge nested statement, no creation of proto edge

            // merge nested subject
            Integer newNestedSubjectTermId = mergeTerm(
                    Integer.valueOf(statement.getNestedSubject()),
                    protoNetwork1, protoNetwork2, documentId, termMap);
            // merge nested object
            Integer newNestedObjectTermId = mergeTerm(
                    Integer.valueOf(statement.getNestedObject()),
                    protoNetwork1, protoNetwork2, documentId, termMap);

            newStatementIndex = protoNetwork1.getStatementTable().addStatement(
                    new TableStatement(newSubjectTermId,
                            statement.getRelationshipName(),
                            newNestedSubjectTermId,
                            statement.getNestedRelationship(),
                            newNestedObjectTermId),
                    stmtToMerge, documentId);
View Full Code Here

        final Map<Integer, Integer> sdm = st.getStatementDocument();
        final Map<Integer, Statement> _stmts = st.getIndexedStatements();

        PreparedStatement sps = getPreparedStatement(STATEMENT_SQL);
        for (int i = 0, n = ts.size(); i < n; i++) {
            final TableStatement stmt = ts.get(i);

            // XXX offset
            sps.setInt(1, i + 1);
            // XXX offset
            sps.setInt(2, sdm.get(i) + 1);
            // XXX offset
            sps.setInt(3, stmt.getSubjectTermId() + 1);

            if (stmt.getRelationshipName() == null) {
                // load definitional statement
                sps.setNull(4, Types.INTEGER);
                sps.setNull(5, Types.INTEGER);
                sps.setNull(6, Types.INTEGER);
                sps.setNull(7, Types.INTEGER);
                sps.setNull(8, Types.INTEGER);
            } else if (stmt.getObjectTermId() != null) {
                // load simple statement
                RelationshipType r = RelationshipType.getRelationshipType(stmt
                        .getRelationshipName());
                sps.setInt(4, r.getValue());

                // XXX offset
                sps.setInt(5, stmt.getObjectTermId() + 1);
                sps.setNull(6, Types.INTEGER);
                sps.setNull(7, Types.INTEGER);
                sps.setNull(8, Types.INTEGER);
            } else {
                // load nested statement
                RelationshipType r = RelationshipType.getRelationshipType(stmt
                        .getRelationshipName());
                sps.setInt(4, r.getValue());

                // set null for object term since this is a nested statement
                sps.setNull(5, Types.INTEGER);

                // XXX offset
                sps.setInt(6, stmt.getNestedSubject() + 1);

                RelationshipType nr = RelationshipType.getRelationshipType(stmt
                        .getNestedRelationship());

                sps.setInt(7, nr.getValue());

                // XXX offset
                sps.setInt(8, stmt.getNestedObject() + 1);
            }

            // set bel statement text
            Statement s = _stmts.get(i);
            sps.setString(9, s.toBELShortForm());
View Full Code Here

TOP

Related Classes of org.openbel.framework.common.protonetwork.model.StatementTable.TableStatement

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.