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

Examples of org.openbel.framework.common.protonetwork.model.ProtoEdgeTable$TableProtoEdge


     * Test adding distinct edges in a single call.  Based on BEL statement:
     * <p><tt>deg(p(1)) -> p(2)</tt></p>
     */
    @Test
    public void testDistinctEdgesSingleCall() {
        final ProtoEdgeTable tbl = new ProtoEdgeTable();

        final TableProtoEdge edge1 = new TableProtoEdge(1, "INCREASES", 2);
        final TableProtoEdge edge2 =
                new TableProtoEdge(1, "DIRECTLY_DECREASES", 3);

        // for statement 0 add both edges in one call
        tbl.addEdges(0, edge1, edge2);

        // we should have one statement (0)
        assertThat(tbl.getStatementEdges().size(), is(1));

        // we should have two edges (0 and 1)
        assertThat(tbl.getProtoEdges().size(), is(2));

        // edge 0 and 1 should associate with statement 0
        Iterator<Integer> stit = tbl.getStatementEdges().get(0).iterator();
        assertThat(stit.next(), is(0));
        assertThat(stit.next(), is(1));

        // both edges should not be equivalent
        assertThat(tbl.getEquivalences().get(0), is(0));
        assertThat(tbl.getEquivalences().get(1), is(1));
    }
View Full Code Here


     * statement:
     * <p><tt>deg(p(1)) -> p(2)</tt></p>
     */
    @Test
    public void testDistinctEdgesSubsequentCall() {
        final ProtoEdgeTable tbl = new ProtoEdgeTable();

        final TableProtoEdge edge1 = new TableProtoEdge(1, "INCREASES", 2);
        final TableProtoEdge edge2 =
                new TableProtoEdge(1, "DIRECTLY_DECREASES", 3);

        // for statement 0 add both edges in subsequent calls
        tbl.addEdges(0, edge1);
        tbl.addEdges(0, edge2);

        // we should have one statement (0)
        assertThat(tbl.getStatementEdges().size(), is(1));

        // we should have two edges (0 and 1)
        assertThat(tbl.getProtoEdges().size(), is(2));

        // edge 0 and 1 should associate with statement 0
        Iterator<Integer> stit = tbl.getStatementEdges().get(0).iterator();
        assertThat(stit.next(), is(0));
        assertThat(stit.next(), is(1));

        // both edges should not be equivalent
        assertThat(tbl.getEquivalences().get(0), is(0));
        assertThat(tbl.getEquivalences().get(1), is(1));
    }
View Full Code Here

     * <tt>complex(p(1),p(2))</tt>
     * </p>
     */
    @Test
    public void testDuplicateEdges() {
        final ProtoEdgeTable tbl = new ProtoEdgeTable();

        // for statement 0, add edge triple "1 HAS_COMPONENT 2"
        final TableProtoEdge edge1 = new TableProtoEdge(1, "HAS_COMPONENT", 2);
        tbl.addEdges(0, edge1);

        // for statement 1, add the same edge
        final TableProtoEdge edge2 = new TableProtoEdge(1, "HAS_COMPONENT", 2);
        tbl.addEdges(1, edge2);

        // we should have two statements (0 and 1)
        assertThat(tbl.getStatementEdges().size(), is(2));

        // we should have two edges (0 and 1)
        assertThat(tbl.getProtoEdges().size(), is(2));

        // edge 0 should associate with statement 0
        assertThat(tbl.getStatementEdges().get(0).iterator().next(), is(0));

        // edge 1 should associate with statement 1
        assertThat(tbl.getStatementEdges().get(1).iterator().next(), is(1));

        // both edges should be equivalent
        assertThat(tbl.getEquivalences().get(0), is(0));
        assertThat(tbl.getEquivalences().get(1), is(0));
    }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public int equivalence() {
        ProtoNodeTable pnt = network.getProtoNodeTable();
        ProtoEdgeTable pet = network.getProtoEdgeTable();

        List<TableProtoEdge> edges = pet.getProtoEdges();
        Map<Integer, Set<Integer>> edgeStmts = pet.getEdgeStatements();
        Map<Integer, Integer> eqn = pnt.getEquivalences();
        Map<Integer, Integer> eqe = pet.getEquivalences();

        return equivalenceInternal(edges, edgeStmts, eqn, eqe);
    }
View Full Code Here

        // add object as term and proto node
        final Term object = stmt.getObject().getTerm();
        final Integer objectIndex = createNode(object, supporting, pn, pnb);

        final ProtoEdgeTable pet = pn.getProtoEdgeTable();
        pet.addEdges(supporting, new ProtoEdgeTable.TableProtoEdge(sourceIndex,
                stmt.getRelationshipType().getDisplayValue(), objectIndex));
    }
View Full Code Here

                            newNestedObjectTermId),
                    stmtToMerge, documentId);
        }

        // remap edges for statement, if any exist
        ProtoEdgeTable et = protoNetwork2.getProtoEdgeTable();
        Map<Integer, Set<Integer>> stmtEdges = et.getStatementEdges();
        Set<Integer> edgeIndices = stmtEdges.get(statementIndex);
        if (hasItems(edgeIndices)) {
            remapEdges(protoNetwork1, protoNetwork2, documentId, termMap,
                    newStatementIndex, et.getProtoEdges(), edgeIndices);
        }

        // remap annotation definition + value
        Set<AnnotationPair> aps = protoNetwork2
                .getStatementAnnotationMapTable()
View Full Code Here

            }

            remappedEdges[i++] = new TableProtoEdge(newSource, edge.getRel(),
                    newTarget);
        }
        ProtoEdgeTable edgeTable = protoNetwork1.getProtoEdgeTable();
        edgeTable.addEdges(newStatementIndex, remappedEdges);
    }
View Full Code Here

TOP

Related Classes of org.openbel.framework.common.protonetwork.model.ProtoEdgeTable$TableProtoEdge

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.