ai.grakn.GraknComputer Maven / Gradle / Ivy
/*
* GRAKN.AI - THE KNOWLEDGE GRAPH
* Copyright (C) 2018 Grakn Labs Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
package ai.grakn;
import ai.grakn.concept.LabelId;
import org.apache.tinkerpop.gremlin.process.computer.ComputerResult;
import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
import org.apache.tinkerpop.gremlin.process.computer.MapReduce;
import org.apache.tinkerpop.gremlin.process.computer.VertexProgram;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
import java.util.Set;
/**
*
* {@link GraphComputer} Used For Analytics Algorithms
*
*
* Wraps a Tinkerpop {@link GraphComputer} which enables the execution of pregel programs.
* These programs are defined either via a {@link MapReduce} or a {@link VertexProgram}.
*
*
* A {@link VertexProgram} is a computation executed on each vertex in parallel.
* Vertices communicate with each other through message passing.
*
*
* {@link MapReduce} processed the vertices in a parallel manner by aggregating values emitted by vertices.
* MapReduce can be executed alone or used to collect the results after executing a VertexProgram.
*
*
* @author duckofyork
* @author sheldonkhall
* @author fppt
*/
public interface GraknComputer {
/**
* Execute the given vertex program using a graph computer.
*
* @param includesRolePlayerEdges whether the graph computer should include {@link ai.grakn.util.Schema.EdgeLabel#ROLE_PLAYER} edges
* @param types instance types in the subgraph
* @param program the vertex program
* @param mapReduce a list of mapReduce job
* @return the result of the computation
* @see ComputerResult
*/
@CheckReturnValue
ComputerResult compute(@Nullable VertexProgram program, @Nullable MapReduce mapReduce,
@Nullable Set types, Boolean includesRolePlayerEdges);
/**
* Execute the given vertex program using a graph computer.
*
* @param types instance types in the subgraph
* @param program the vertex program
* @param mapReduce a list of mapReduce job
* @return the result of the computation
* @see ComputerResult
*/
@CheckReturnValue
ComputerResult compute(@Nullable VertexProgram program, @Nullable MapReduce mapReduce,
@Nullable Set types);
/**
* Kill all the jobs the graph computer has
*/
void killJobs();
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy