• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VertexProperty类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.tinkerpop.gremlin.structure.VertexProperty的典型用法代码示例。如果您正苦于以下问题:Java VertexProperty类的具体用法?Java VertexProperty怎么用?Java VertexProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VertexProperty类属于org.apache.tinkerpop.gremlin.structure包,在下文中一共展示了VertexProperty类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getBaseConfiguration

import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入依赖的package包/类
@Override
public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName,
                                                final LoadGraphWith.GraphData loadGraphWith) {
    final TinkerGraph.DefaultIdManager idManager = TinkerGraph.DefaultIdManager.UUID;
    final String idMaker = idManager.name();
    return new HashMap<String, Object>() {{
        put(Graph.GRAPH, TinkerGraph.class.getName());
        put(TinkerGraph.GREMLIN_TINKERGRAPH_VERTEX_ID_MANAGER, idMaker);
        put(TinkerGraph.GREMLIN_TINKERGRAPH_EDGE_ID_MANAGER, idMaker);
        put(TinkerGraph.GREMLIN_TINKERGRAPH_VERTEX_PROPERTY_ID_MANAGER, idMaker);
        if (requiresListCardinalityAsDefault(loadGraphWith, test, testMethodName))
            put(TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.list.name());
        if (requiresPersistence(test, testMethodName)) {
            put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_FORMAT, "gryo");
            final File tempDir = TestHelper.makeTestDataPath(test, "temp");
            put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_LOCATION,
                    tempDir.getAbsolutePath() + File.separator + testMethodName + ".kryo");
        }
    }};
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:21,代码来源:TinkerGraphUUIDProvider.java


示例2: getBaseConfiguration

import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入依赖的package包/类
@Override
public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName,
                                                final LoadGraphWith.GraphData loadGraphWith) {
    final TinkerGraph.DefaultIdManager idManager = selectIdMakerFromGraphData(loadGraphWith);
    final String idMaker = (idManager.equals(TinkerGraph.DefaultIdManager.ANY) ? selectIdMakerFromTest(test, testMethodName) : idManager).name();
    return new HashMap<String, Object>() {{
        put(Graph.GRAPH, TinkerGraph.class.getName());
        put(TinkerGraph.GREMLIN_TINKERGRAPH_VERTEX_ID_MANAGER, idMaker);
        put(TinkerGraph.GREMLIN_TINKERGRAPH_EDGE_ID_MANAGER, idMaker);
        put(TinkerGraph.GREMLIN_TINKERGRAPH_VERTEX_PROPERTY_ID_MANAGER, idMaker);
        if (requiresListCardinalityAsDefault(loadGraphWith, test, testMethodName))
            put(TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.list.name());
        if (requiresPersistence(test, testMethodName)) {
            put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_FORMAT, "gryo");
            final File tempDir = TestHelper.makeTestDataPath(test, "temp");
            put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_LOCATION,
                    tempDir.getAbsolutePath() + File.separator + testMethodName + ".kryo");
        }
    }};
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:21,代码来源:TinkerGraphProvider.java


示例3: testGetPropertyKeysOnVertex

import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入依赖的package包/类
@Test
public void testGetPropertyKeysOnVertex() {
  Vertex vertex = createVertex();
  // Test that the following properties exists on the vertex.
  Map<String, String> expected = MapUtils.map(
          T("value", "value")
  );

  Set<String> keys = vertex.keys();
  Set<VertexProperty<Object>> properties = SetUtils.set(vertex.properties());

  assertEquals(expected.size(), keys.size());
  assertEquals(expected.size(), properties.size());

  for (Map.Entry<String, String> entry : expected.entrySet()) {
    assertTrue(keys.contains(entry.getKey()));

    VertexProperty<Object> property = vertex.property(entry.getKey());
    assertNotNull(property.id());
    assertEquals(entry.getValue(), property.value());
    assertEquals(property.key(), property.label());
    assertEquals(StringFactory.propertyString(property), property.toString());
    assertSame(vertex, property.element());
  }
}
 
开发者ID:mnemonic-no,项目名称:act-platform,代码行数:26,代码来源:ObjectVertexTest.java


示例4: insertList

import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入依赖的package包/类
private static void insertList(final List list, final String listKey, final GraphTraversal traversal) {
    if (list.get(0) instanceof List)
        throw new IllegalArgumentException("Lists can not contain nested lists");
    char state = list.get(0) instanceof Map ? 'o' : 'p';
    for (int i = 1; i < list.size(); i++) {
        if (list.get(i) instanceof Map && 'p' == state)
            throw new IllegalArgumentException("Lists can only support all objects or all primitives");
        else if (list.get(i) instanceof List)
            throw new IllegalArgumentException("Lists can not contain nested lists");
        else if (!(list.get(i) instanceof Map) && 'o' == state)
            throw new IllegalArgumentException("Lists can only support all objects or all primitives");
    }
    for (final Object object : list) {
        if ('p' == state)
            traversal.property(VertexProperty.Cardinality.list, listKey, object);
        else {
            traversal.map(insertMap((Map) object, new DefaultGraphTraversal()));
            traversal.addE(listKey).from("a").select("a");
        }
    }
}
 
开发者ID:okram,项目名称:mongodb-gremlin,代码行数:22,代码来源:MongoDBStrategy.java


示例5: TinkerGraph

import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入依赖的package包/类
/**
 * An empty private constructor that initializes {@link TinkerGraph}.
 */
private TinkerGraph(final Configuration configuration, boolean usesSpecializedElements) {
    this.configuration = configuration;
    this.usesSpecializedElements = usesSpecializedElements;
    vertexIdManager = selectIdManager(configuration, GREMLIN_TINKERGRAPH_VERTEX_ID_MANAGER, Vertex.class);
    edgeIdManager = selectIdManager(configuration, GREMLIN_TINKERGRAPH_EDGE_ID_MANAGER, Edge.class);
    vertexPropertyIdManager = selectIdManager(configuration, GREMLIN_TINKERGRAPH_VERTEX_PROPERTY_ID_MANAGER, VertexProperty.class);
    defaultVertexPropertyCardinality = VertexProperty.Cardinality.valueOf(
            configuration.getString(GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.single.name()));

    graphLocation = configuration.getString(GREMLIN_TINKERGRAPH_GRAPH_LOCATION, null);
    graphFormat = configuration.getString(GREMLIN_TINKERGRAPH_GRAPH_FORMAT, null);

    if ((graphLocation != null && null == graphFormat) || (null == graphLocation && graphFormat != null))
        throw new IllegalStateException(String.format("The %s and %s must both be specified if either is present",
                GREMLIN_TINKERGRAPH_GRAPH_LOCATION, GREMLIN_TINKERGRAPH_GRAPH_FORMAT));

    if (graphLocation != null) loadGraph();
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:22,代码来源:TinkerGraph.java


示例6: deserializersTestsVertexProperty

import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入依赖的package包/类
@Test
public void deserializersTestsVertexProperty() {
    final TinkerGraph tg = TinkerGraph.open();

    final Vertex v = tg.addVertex("vertexTest");

    final GraphWriter writer = getWriter(defaultMapperV2d0);
    final GraphReader reader = getReader(defaultMapperV2d0);

    final VertexProperty prop = v.property("born", LocalDateTime.of(1971, 1, 2, 20, 50));

    try (final ByteArrayOutputStream out = new ByteArrayOutputStream()) {
        writer.writeObject(out, prop);
        final String json = out.toString();

        final VertexProperty vPropRead = (VertexProperty)reader.readObject(new ByteArrayInputStream(json.getBytes()), Object.class);
        //only classes and ids are checked, that's ok, full vertex property ser/de
        //is checked elsewhere.
        assertEquals(prop, vPropRead);
    } catch (IOException e) {
        e.printStackTrace();
        fail("Should not have thrown exception: " + e.getMessage());
    }
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:25,代码来源:TinkerGraphGraphSONSerializerV2d0Test.java


示例7: shouldPersistToGryoAndHandleMultiProperties

import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入依赖的package包/类
@Test
public void shouldPersistToGryoAndHandleMultiProperties() {
    final String graphLocation = TestHelper.makeTestDataDirectory(TinkerGraphTest.class) + "shouldPersistToGryoMulti.kryo";
    final File f = new File(graphLocation);
    if (f.exists() && f.isFile()) f.delete();

    final Configuration conf = new BaseConfiguration();
    conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_FORMAT, "gryo");
    conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_LOCATION, graphLocation);
    final TinkerGraph graph = TinkerGraph.open(conf);
    TinkerFactory.generateTheCrew(graph);
    graph.close();

    conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.list.toString());
    final TinkerGraph reloadedGraph = TinkerGraph.open(conf);
    IoTest.assertCrewGraph(reloadedGraph, false);
    reloadedGraph.close();
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:19,代码来源:TinkerGraphTest.java


示例8: execute

import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入依赖的package包/类
@Override
public void execute(final Vertex vertex, Messenger<Double> messenger, final Memory memory) {
    if (memory.isInitialIteration()) {
        messenger.sendMessage(this.countMessageScope, 1.0d);
    } else if (1 == memory.getIteration()) {
        double initialPageRank = (null == this.initialRankTraversal ?
                1.0d :
                TraversalUtil.apply(vertex, this.initialRankTraversal.get()).doubleValue()) / this.vertexCountAsDouble;
        double edgeCount = IteratorUtils.reduce(messenger.receiveMessages(), 0.0d, (a, b) -> a + b);
        vertex.property(VertexProperty.Cardinality.single, this.property, initialPageRank);
        vertex.property(VertexProperty.Cardinality.single, EDGE_COUNT, edgeCount);
        if (!this.terminate(memory)) // don't send messages if this is the last iteration
            messenger.sendMessage(this.incidentMessageScope, initialPageRank / edgeCount);
    } else {
        double newPageRank = IteratorUtils.reduce(messenger.receiveMessages(), 0.0d, (a, b) -> a + b);
        newPageRank = (this.alpha * newPageRank) + ((1.0d - this.alpha) / this.vertexCountAsDouble);
        vertex.property(VertexProperty.Cardinality.single, this.property, newPageRank);
        if (!this.terminate(memory)) // don't send messages if this is the last iteration
            messenger.sendMessage(this.incidentMessageScope, newPageRank / vertex.<Double>value(EDGE_COUNT));
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:22,代码来源:PageRankVertexProgram.java


示例9: createXOManager

import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入依赖的package包/类
@Before
   public void createXOManager() throws SQLException, IOException, ServiceException {
AccountManagerTester.cleanupDatabase();
xoManager = xoManagerFactory.createXOManager();
GraphTraversal<Vertex, Vertex> vertices = ((Graph) ductileGraph).traversal().V();
int counter = 0;
while (vertices.hasNext()) {
    Vertex vertex = vertices.next();
    counter++;
    Iterator<VertexProperty<Object>> properties = vertex.properties();
    while (properties.hasNext()) {
	VertexProperty<Object> property = properties.next();
	System.out.println(property.key() + ": " + property.value());
    }
}
assertEquals(7, counter);
   }
 
开发者ID:PureSolTechnologies,项目名称:Purifinity,代码行数:18,代码来源:XOEntitiesIT.java


示例10: shouldReadWriteVertexPropertyNoMetaProperties

import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入依赖的package包/类
@Test
@LoadGraphWith(LoadGraphWith.GraphData.MODERN)
public void shouldReadWriteVertexPropertyNoMetaProperties() throws Exception {
    try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
        final GraphWriter writer = writerMaker.apply(graph);
        final VertexProperty p = g.V(convertToVertexId("marko")).next().property("name");
        writer.writeVertexProperty(os, p);

        final AtomicBoolean called = new AtomicBoolean(false);
        final GraphReader reader = readerMaker.apply(graph);
        try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
            reader.readVertexProperty(bais, propertyAttachable -> {
                assertEquals(p.value(), propertyAttachable.get().value());
                assertEquals(p.key(), propertyAttachable.get().key());
                assertEquals(0, IteratorUtils.count(propertyAttachable.get().properties()));
                called.set(true);
                return propertyAttachable.get();
            });
        }

        assertTrue(called.get());
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:24,代码来源:IoPropertyTest.java


示例11: addVertex

import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入依赖的package包/类
@Override
public Vertex addVertex(final Object... keyValues) {
    ElementHelper.legalPropertyKeyValueArray(keyValues);
    Object idValue = vertexIdManager.convert(ElementHelper.getIdValue(keyValues).orElse(null));
    final String label = ElementHelper.getLabelValue(keyValues).orElse(Vertex.DEFAULT_LABEL);

    if (null != idValue) {
        if (this.vertices.containsKey(idValue))
            throw Exceptions.vertexWithIdAlreadyExists(idValue);
    } else {
        idValue = vertexIdManager.getNextId(this);
    }

    final Vertex vertex = new TinkerVertex(idValue, label, this);
    this.vertices.put(vertex.id(), vertex);

    ElementHelper.attachProperties(vertex, VertexProperty.Cardinality.list, keyValues);
    return vertex;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:20,代码来源:TinkerGraph.java


示例12: getVertexProperty

import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入依赖的package包/类
@Override
public <V> VertexProperty<V> getVertexProperty(final Neo4jVertex vertex, final String key) {
    final Neo4jNode node = vertex.getBaseVertex();
    if (node.hasProperty(key)) {
        if (node.getProperty(key).equals(VERTEX_PROPERTY_TOKEN)) {
            if (node.degree(Neo4jDirection.OUTGOING, Graph.Hidden.hide(key)) > 1)
                throw Vertex.Exceptions.multiplePropertiesExistForProvidedKey(key);
            else {
                return (VertexProperty<V>) new Neo4jVertexProperty<>(vertex, node.relationships(Neo4jDirection.OUTGOING, Graph.Hidden.hide(key)).iterator().next().end());
            }
        } else {
            return new Neo4jVertexProperty<>(vertex, key, (V) node.getProperty(key));
        }
    } else
        return VertexProperty.<V>empty();
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:17,代码来源:MultiMetaNeo4jTrait.java


示例13: readStarGraphVertex

import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入依赖的package包/类
/**
 * A helper function for reading a serialized {@link StarGraph} from a {@link Map} generated by
 * {@link StarGraphGraphSONSerializer}.
 */
public static StarGraph readStarGraphVertex(final Map<String, Object> vertexData) throws IOException {
    final StarGraph starGraph = StarGraph.open();
    starGraph.addVertex(T.id, vertexData.get(GraphSONTokens.ID), T.label, vertexData.get(GraphSONTokens.LABEL));
    if (vertexData.containsKey(GraphSONTokens.PROPERTIES)) {
        final Map<String, List<Map<String, Object>>> properties = (Map<String, List<Map<String, Object>>>) vertexData.get(GraphSONTokens.PROPERTIES);
        for (Map.Entry<String, List<Map<String, Object>>> property : properties.entrySet()) {
            for (Map<String, Object> p : property.getValue()) {
                final StarGraph.StarVertexProperty vp = (StarGraph.StarVertexProperty) starGraph.getStarVertex().property(VertexProperty.Cardinality.list, property.getKey(), p.get(GraphSONTokens.VALUE), T.id, p.get(GraphSONTokens.ID));
                if (p.containsKey(GraphSONTokens.PROPERTIES)) {
                    final Map<String, Object> edgePropertyData = (Map<String, Object>) p.get(GraphSONTokens.PROPERTIES);
                    for (Map.Entry<String, Object> epd : edgePropertyData.entrySet()) {
                        vp.property(epd.getKey(), epd.getValue());
                    }
                }
            }
        }
    }

    return starGraph;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:25,代码来源:StarGraphGraphSONSerializer.java


示例14: stageVertexProperty

import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入依赖的package包/类
/**
 * This is a helper method for dealing with vertex property cardinality and typically used in {@link Vertex#property(org.apache.tinkerpop.gremlin.structure.VertexProperty.Cardinality, String, Object, Object...)}.
 * If the cardinality is list, simply return {@link Optional#empty}.
 * If the cardinality is single, delete all existing properties of the provided key and return {@link Optional#empty}.
 * If the cardinality is set, find one that has the same key/value and attached the properties to it and return it. Else, if no equal value is found, return {@link Optional#empty}.
 *
 * @param vertex      the vertex to stage a vertex property for
 * @param cardinality the cardinality of the vertex property
 * @param key         the key of the vertex property
 * @param value       the value of the vertex property
 * @param keyValues   the properties of vertex property
 * @param <V>         the type of the vertex property value
 * @return a vertex property if it has been found in set with equal value
 */
public static <V> Optional<VertexProperty<V>> stageVertexProperty(final Vertex vertex, final VertexProperty.Cardinality cardinality, final String key, final V value, final Object... keyValues) {
    if (cardinality.equals(VertexProperty.Cardinality.single))
        vertex.properties(key).forEachRemaining(VertexProperty::remove);
    else if (cardinality.equals(VertexProperty.Cardinality.set)) {
        final Iterator<VertexProperty<V>> itty = vertex.properties(key);
        while (itty.hasNext()) {
            final VertexProperty<V> property = itty.next();
            if (property.value().equals(value)) {
                ElementHelper.attachProperties(property, keyValues);
                return Optional.of(property);
            }
        }
    } // do nothing on Cardinality.list
    return Optional.empty();
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:30,代码来源:ElementHelper.java


示例15: DetachedVertexProperty

import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入依赖的package包/类
protected DetachedVertexProperty(final VertexProperty<V> vertexProperty, final boolean withProperties) {
    super(vertexProperty);
    this.value = vertexProperty.value();
    this.vertex = DetachedFactory.detach(vertexProperty.element(), false);

    // only serialize properties if requested, the graph supports it and there are meta properties present.
    // this prevents unnecessary object creation of a new HashMap which will just be empty.  it will use
    // Collections.emptyMap() by default
    if (withProperties && vertexProperty.graph().features().vertex().supportsMetaProperties()) {
        final Iterator<Property<Object>> propertyIterator = vertexProperty.properties();
        if (propertyIterator.hasNext()) {
            this.properties = new HashMap<>();
            propertyIterator.forEachRemaining(property -> this.properties.put(property.key(), Collections.singletonList(DetachedFactory.detach(property))));
        }
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:17,代码来源:DetachedVertexProperty.java


示例16: create

import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入依赖的package包/类
public static <V> Function<Attachable<V>, V> create(final Host hostVertexOrGraph) {
    return (Attachable<V> attachable) -> {
        final Object base = attachable.get();
        if (base instanceof Vertex) {
            return hostVertexOrGraph instanceof Graph ?
                    (V) Method.createVertex((Attachable<Vertex>) attachable, (Graph) hostVertexOrGraph) :
                    (V) Method.createVertex((Attachable<Vertex>) attachable, (Vertex) hostVertexOrGraph);
        } else if (base instanceof Edge) {
            return hostVertexOrGraph instanceof Graph ?
                    (V) Method.createEdge((Attachable<Edge>) attachable, (Graph) hostVertexOrGraph) :
                    (V) Method.createEdge((Attachable<Edge>) attachable, (Vertex) hostVertexOrGraph);
        } else if (base instanceof VertexProperty) {
            return hostVertexOrGraph instanceof Graph ?
                    (V) Method.createVertexProperty((Attachable<VertexProperty>) attachable, (Graph) hostVertexOrGraph) :
                    (V) Method.createVertexProperty((Attachable<VertexProperty>) attachable, (Vertex) hostVertexOrGraph);
        } else if (base instanceof Property) {
            return hostVertexOrGraph instanceof Graph ?
                    (V) Method.createProperty((Attachable<Property>) attachable, (Graph) hostVertexOrGraph) :
                    (V) Method.createProperty((Attachable<Property>) attachable, (Vertex) hostVertexOrGraph);
        } else
            throw Attachable.Exceptions.providedAttachableMustContainAGraphObject(attachable);
    };
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:24,代码来源:Attachable.java


示例17: createProperty

import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入依赖的package包/类
public static Property createProperty(final Attachable<Property> attachableProperty, final Vertex hostVertex) {
    final Property baseProperty = attachableProperty.get();
    final Element baseElement = baseProperty.element();
    if (baseElement instanceof Vertex) {
        return Method.createVertexProperty((Attachable) attachableProperty, hostVertex);
    } else if (baseElement instanceof Edge) {
        final Iterator<Edge> edgeIterator = hostVertex.edges(Direction.OUT);
        if (edgeIterator.hasNext())
            return edgeIterator.next().property(baseProperty.key(), baseProperty.value());
        throw new IllegalStateException("Could not find edge to create the property on");
    } else { // vertex property
        final Iterator<VertexProperty<Object>> vertexPropertyIterator = hostVertex.properties(((VertexProperty) baseElement).key());
        while (vertexPropertyIterator.hasNext()) {
            final VertexProperty<Object> vp = vertexPropertyIterator.next();
            if (ElementHelper.areEqual(vp, baseElement))
                return vp.property(baseProperty.key(), baseProperty.value());
        }
        throw new IllegalStateException("Could not find vertex property to create the attachable property on");
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:21,代码来源:Attachable.java


示例18: apply

import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入依赖的package包/类
@Override
public Map<String, List<Property>> apply(final Traverser<Map<String, List<Property>>> mapTraverser) {
    final Map<String,List<Property>> values = mapTraverser.get();
    final Map<String,List<Property>> filtered = new HashMap<>();

    // note the final filter that removes the partitionKey from the outgoing Map
    values.entrySet().forEach(p -> {
        final List l = p.getValue().stream().filter(property -> {
            if (property instanceof VertexProperty) {
                final Iterator<String> itty = ((VertexProperty) property).values(partitionKey);
                return itty.hasNext() && readPartitions.contains(itty.next());
            } else {
                return true;
            }
        }).filter(property -> !property.key().equals(partitionKey)).collect(Collectors.toList());
        if (l.size() > 0) filtered.put(p.getKey(), l);
    });

    return filtered;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:21,代码来源:PartitionStrategy.java


示例19: tryWriteMetaProperties

import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入依赖的package包/类
private static void tryWriteMetaProperties(final VertexProperty property, final JsonGenerator jsonGenerator,
                                           final SerializerProvider serializerProvider,
                                           final TypeSerializer typeSerializer, final boolean normalize) throws IOException {
    // when "detached" you can't check features of the graph it detached from so it has to be
    // treated differently from a regular VertexProperty implementation.
    if (property instanceof DetachedVertexProperty) {
        // only write meta properties key if they exist
        if (property.properties().hasNext()) {
            writeMetaProperties(property, jsonGenerator, serializerProvider, typeSerializer, normalize);
        }
    } else {
        // still attached - so we can check the features to see if it's worth even trying to write the
        // meta properties key
        if (property.graph().features().vertex().supportsMetaProperties() && property.properties().hasNext()) {
            writeMetaProperties(property, jsonGenerator, serializerProvider, typeSerializer, normalize);
        }
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:19,代码来源:GraphSONSerializers.java


示例20: createTheCrew

import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入依赖的package包/类
public static TinkerGraph createTheCrew() {
    final Configuration conf = getNumberIdManagerConfiguration();
    conf.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.list.name());
    final TinkerGraph g = TinkerGraph.open(conf);
    generateTheCrew(g);
    return g;
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:8,代码来源:TinkerFactory.java



注:本文中的org.apache.tinkerpop.gremlin.structure.VertexProperty类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IntProperty类代码示例发布时间:2022-05-21
下一篇:
Java JmsAutoConfiguration类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap