All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.umlg.sqlg.test.reducing.TestMax Maven / Gradle / Ivy

There is a newer version: 3.1.1
Show newest version
package org.umlg.sqlg.test.reducing;

import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Assert;
import org.junit.Test;
import org.umlg.sqlg.test.BaseTest;

import java.util.Map;

/**
 * @author Pieter Martin (https://github.com/pietermartin)
 *         Date: 2017/05/02
 */
public class TestMax extends BaseTest {

    @Test
    public void g_V_hasLabelXsoftwareX_group_byXnameX_byXbothE_weight_maxX() {
        loadModern();
        final Traversal> traversal = this.sqlgGraph.traversal()
                .V().hasLabel("software")
                .group().by("name").by(
                        __.bothE().values("weight").max()
                );
        printTraversalForm(traversal);
        Assert.assertTrue(traversal.hasNext());
        final Map map = traversal.next();
        Assert.assertFalse(traversal.hasNext());
        Assert.assertEquals(2, map.size());
        Assert.assertEquals(1.0, map.get("ripple"));
        Assert.assertEquals(0.4, map.get("lop"));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy