Search in sources :

Example 1 with AddEdgeQuery

use of org.unipop.query.mutation.AddEdgeQuery in project unipop by unipop-graph.

the class UniVertex method addEdge.

@Override
public Edge addEdge(final String label, final Vertex vertex, final Object... keyValues) {
    if (null == vertex)
        throw Graph.Exceptions.argumentCanNotBeNull("vertex");
    ElementHelper.legalPropertyKeyValueArray(keyValues);
    ElementHelper.validateLabel(label);
    Map<String, Object> stringObjectMap = ConversionUtils.asMap(keyValues);
    stringObjectMap.put(T.label.toString(), label);
    return graph.getControllerManager().getControllers(AddEdgeQuery.AddEdgeController.class).stream().map(controller -> controller.addEdge(new AddEdgeQuery(this, vertex, new HashMap<>(stringObjectMap), null))).filter(e -> e != null).findFirst().get();
}
Also used : java.util(java.util) HasContainer(org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ElementHelper(org.apache.tinkerpop.gremlin.structure.util.ElementHelper) Collectors(java.util.stream.Collectors) AddEdgeQuery(org.unipop.query.mutation.AddEdgeQuery) PredicatesHolderFactory(org.unipop.query.predicates.PredicatesHolderFactory) NotImplementedException(org.apache.commons.lang.NotImplementedException) org.apache.tinkerpop.gremlin.structure(org.apache.tinkerpop.gremlin.structure) StringFactory(org.apache.tinkerpop.gremlin.structure.util.StringFactory) PropertyQuery(org.unipop.query.mutation.PropertyQuery) PredicatesHolder(org.unipop.query.predicates.PredicatesHolder) ConversionUtils(org.unipop.util.ConversionUtils) P(org.apache.tinkerpop.gremlin.process.traversal.P) SearchVertexQuery(org.unipop.query.search.SearchVertexQuery) AddEdgeQuery(org.unipop.query.mutation.AddEdgeQuery) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Aggregations

java.util (java.util)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Collectors (java.util.stream.Collectors)1 NotImplementedException (org.apache.commons.lang.NotImplementedException)1 P (org.apache.tinkerpop.gremlin.process.traversal.P)1 HasContainer (org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer)1 org.apache.tinkerpop.gremlin.structure (org.apache.tinkerpop.gremlin.structure)1 ElementHelper (org.apache.tinkerpop.gremlin.structure.util.ElementHelper)1 StringFactory (org.apache.tinkerpop.gremlin.structure.util.StringFactory)1 AddEdgeQuery (org.unipop.query.mutation.AddEdgeQuery)1 PropertyQuery (org.unipop.query.mutation.PropertyQuery)1 PredicatesHolder (org.unipop.query.predicates.PredicatesHolder)1 PredicatesHolderFactory (org.unipop.query.predicates.PredicatesHolderFactory)1 SearchVertexQuery (org.unipop.query.search.SearchVertexQuery)1 ConversionUtils (org.unipop.util.ConversionUtils)1