本文整理汇总了Java中org.neo4j.tinkerpop.api.Neo4jGraphAPI类的典型用法代码示例。如果您正苦于以下问题:Java Neo4jGraphAPI类的具体用法?Java Neo4jGraphAPI怎么用?Java Neo4jGraphAPI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Neo4jGraphAPI类属于org.neo4j.tinkerpop.api包,在下文中一共展示了Neo4jGraphAPI类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setProperty
import org.neo4j.tinkerpop.api.Neo4jGraphAPI; //导入依赖的package包/类
@Override
public <V> Property<V> setProperty(final Neo4jVertexProperty vertexProperty, final String key, final V value) {
final Neo4jNode vertexPropertyNode = Neo4jHelper.getVertexPropertyNode(vertexProperty);
if (null != vertexPropertyNode) {
vertexPropertyNode.setProperty(key, value);
return new Neo4jProperty<>(vertexProperty, key, value);
} else {
final Neo4jNode vertexNode = ((Neo4jVertex) vertexProperty.element()).getBaseVertex();
final Neo4jNode newVertexPropertyNode = ((WrappedGraph<Neo4jGraphAPI>) vertexProperty.element().graph()).getBaseGraph().createNode(VERTEX_PROPERTY_LABEL, vertexProperty.label());
newVertexPropertyNode.setProperty(T.key.getAccessor(), vertexProperty.key());
newVertexPropertyNode.setProperty(T.value.getAccessor(), vertexProperty.value());
newVertexPropertyNode.setProperty(vertexProperty.key(), vertexProperty.value());
newVertexPropertyNode.setProperty(key, value);
vertexNode.connectTo(newVertexPropertyNode, Graph.Hidden.hide(vertexProperty.key()));
vertexNode.setProperty(vertexProperty.key(), VERTEX_PROPERTY_TOKEN);
Neo4jHelper.setVertexPropertyNode(vertexProperty, newVertexPropertyNode);
return new Neo4jProperty<>(vertexProperty, key, value);
}
}
示例2: initialize
import org.neo4j.tinkerpop.api.Neo4jGraphAPI; //导入依赖的package包/类
private void initialize(final Neo4jGraphAPI baseGraph, final Configuration configuration) {
this.configuration.copy(configuration);
this.baseGraph = baseGraph;
this.neo4jGraphVariables = new Neo4jGraphVariables(this);
this.tx().readWrite();
final Optional<Boolean> hasMultiProperties = this.neo4jGraphVariables.get(Graph.Hidden.hide(CONFIG_MULTI_PROPERTIES));
final Optional<Boolean> hasMetaProperties = this.neo4jGraphVariables.get(Graph.Hidden.hide(CONFIG_META_PROPERTIES));
boolean supportsMetaProperties = hasMetaProperties.orElse(this.configuration.getBoolean(CONFIG_META_PROPERTIES, false));
boolean supportsMultiProperties = hasMultiProperties.orElse(this.configuration.getBoolean(CONFIG_MULTI_PROPERTIES, false));
if (supportsMultiProperties != supportsMetaProperties)
throw new IllegalArgumentException(this.getClass().getSimpleName() + " currently supports either both meta-properties and multi-properties or neither");
if (!hasMultiProperties.isPresent())
this.neo4jGraphVariables.set(Graph.Hidden.hide(CONFIG_MULTI_PROPERTIES), supportsMultiProperties);
if (!hasMetaProperties.isPresent())
this.neo4jGraphVariables.set(Graph.Hidden.hide(CONFIG_META_PROPERTIES), supportsMetaProperties);
this.trait = supportsMultiProperties ? MultiMetaNeo4jTrait.instance() : NoMultiNoMetaNeo4jTrait.instance();
if (supportsMultiProperties)
LOGGER.warn(this.getClass().getSimpleName() + " multi/meta-properties feature is considered experimental and should not be used in a production setting until this warning is removed");
this.tx().commit();
}
示例3: shouldTraverseWithoutLabels
import org.neo4j.tinkerpop.api.Neo4jGraphAPI; //导入依赖的package包/类
@Test
public void shouldTraverseWithoutLabels() {
final Neo4jGraphAPI service = this.getGraph().getBaseGraph();
final Neo4jTx tx = service.tx();
final Neo4jNode n = service.createNode();
tx.success();
tx.close();
final Neo4jTx tx2 = service.tx();
assertEquals(0, IteratorUtils.count(n.labels().iterator()));
assertEquals(1, IteratorUtils.count(graph.vertices()));
graph.tx().close();
tx2.close();
}
示例4: getOrCreateGraph
import org.neo4j.tinkerpop.api.Neo4jGraphAPI; //导入依赖的package包/类
private static Neo4jGraph getOrCreateGraph(final GraphDatabaseService database) {
if (neo4jGraph == null) {
synchronized (LOCK) {
if (neo4jGraph == null) {
final Neo4jGraphAPI neo4jGraphAPI = new Neo4jGraphAPIImpl(database);
neo4jGraph = Neo4jGraph.open(neo4jGraphAPI);
}
}
}
return neo4jGraph;
}
示例5: Neo4jGraph
import org.neo4j.tinkerpop.api.Neo4jGraphAPI; //导入依赖的package包/类
protected Neo4jGraph(final Neo4jGraphAPI baseGraph, final Configuration configuration) {
this.initialize(baseGraph, configuration);
}
示例6: open
import org.neo4j.tinkerpop.api.Neo4jGraphAPI; //导入依赖的package包/类
/**
* Construct a Neo4jGraph instance using an existing Neo4j raw instance.
*/
public static Neo4jGraph open(final Neo4jGraphAPI baseGraph) {
return new Neo4jGraph(baseGraph, EMPTY_CONFIGURATION);
}
示例7: getBaseGraph
import org.neo4j.tinkerpop.api.Neo4jGraphAPI; //导入依赖的package包/类
@Override
public Neo4jGraphAPI getBaseGraph() {
return this.baseGraph;
}
示例8: getBaseGraph
import org.neo4j.tinkerpop.api.Neo4jGraphAPI; //导入依赖的package包/类
protected Neo4jGraphAPI getBaseGraph() {
return ((Neo4jGraph) this.graph).getBaseGraph();
}