Search in sources :

Example 1 with ElementHelper

use of org.apache.tinkerpop.gremlin.structure.util.ElementHelper in project unipop by unipop-graph.

the class UniGraph method addVertex.

@Override
public Vertex addVertex(final Object... keyValues) {
    ElementHelper.legalPropertyKeyValueArray(keyValues);
    Optional<String> labelValue = ElementHelper.getLabelValue(keyValues);
    labelValue.ifPresent(ElementHelper::validateLabel);
    return controllerManager.getControllers(AddVertexQuery.AddVertexController.class).stream().map(controller -> controller.addVertex(new AddVertexQuery(ConversionUtils.asMap(keyValues), null))).filter(Objects::nonNull).findFirst().get();
}
Also used : Configuration(org.apache.commons.configuration.Configuration) java.util(java.util) TraversalStrategies(org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies) GraphComputer(org.apache.tinkerpop.gremlin.process.computer.GraphComputer) PropertyTypeFactory(org.unipop.util.PropertyTypeFactory) ElementHelper(org.apache.tinkerpop.gremlin.structure.util.ElementHelper) StandardStrategyProvider(org.unipop.process.strategyregistrar.StandardStrategyProvider) StringUtils(org.apache.commons.lang3.StringUtils) PredicatesHolderFactory(org.unipop.query.predicates.PredicatesHolderFactory) org.apache.tinkerpop.gremlin.structure(org.apache.tinkerpop.gremlin.structure) TraversalFilter(org.unipop.structure.traversalfilter.TraversalFilter) UnipopGraphProvider(org.unipop.test.UnipopGraphProvider) PredicatesHolder(org.unipop.query.predicates.PredicatesHolder) ConversionUtils(org.unipop.util.ConversionUtils) P(org.apache.tinkerpop.gremlin.process.traversal.P) PropertySchema(org.unipop.schema.property.PropertySchema) HasContainer(org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer) AddVertexQuery(org.unipop.query.mutation.AddVertexQuery) Collectors(java.util.stream.Collectors) ConfigurationControllerManager(org.unipop.query.controller.ConfigurationControllerManager) StrategyProvider(org.unipop.process.strategyregistrar.StrategyProvider) DefaultTraversalFilter(org.unipop.structure.traversalfilter.DefaultTraversalFilter) Stream(java.util.stream.Stream) ControllerManager(org.unipop.query.controller.ControllerManager) StringFactory(org.apache.tinkerpop.gremlin.structure.util.StringFactory) SearchQuery(org.unipop.query.search.SearchQuery) GraphTraversalSource(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource) org.unipop.schema.property.type(org.unipop.schema.property.type) AddVertexQuery(org.unipop.query.mutation.AddVertexQuery) ElementHelper(org.apache.tinkerpop.gremlin.structure.util.ElementHelper)

Aggregations

java.util (java.util)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 Configuration (org.apache.commons.configuration.Configuration)1 StringUtils (org.apache.commons.lang3.StringUtils)1 GraphComputer (org.apache.tinkerpop.gremlin.process.computer.GraphComputer)1 P (org.apache.tinkerpop.gremlin.process.traversal.P)1 TraversalStrategies (org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies)1 GraphTraversalSource (org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource)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 StandardStrategyProvider (org.unipop.process.strategyregistrar.StandardStrategyProvider)1 StrategyProvider (org.unipop.process.strategyregistrar.StrategyProvider)1 ConfigurationControllerManager (org.unipop.query.controller.ConfigurationControllerManager)1 ControllerManager (org.unipop.query.controller.ControllerManager)1 AddVertexQuery (org.unipop.query.mutation.AddVertexQuery)1 PredicatesHolder (org.unipop.query.predicates.PredicatesHolder)1 PredicatesHolderFactory (org.unipop.query.predicates.PredicatesHolderFactory)1