本文整理汇总了Java中com.thinkaurelius.titan.graphdb.database.StandardTitanGraph类的典型用法代码示例。如果您正苦于以下问题:Java StandardTitanGraph类的具体用法?Java StandardTitanGraph怎么用?Java StandardTitanGraph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StandardTitanGraph类属于com.thinkaurelius.titan.graphdb.database包,在下文中一共展示了StandardTitanGraph类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: loadRelationTypes
import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; //导入依赖的package包/类
/**
* Given a path for Titan config file, connects and gets the internal Titan types,
* converting them to MizoTitanRelationTypes mapped by type-ids
* @param titanConfigPath Path to Titan's config path
* @return Mapping between relation type-ids to InternalRelationType instances
*/
protected static HashMap<Long, MizoTitanRelationType> loadRelationTypes(String titanConfigPath) {
TitanGraph g = TitanFactory.open(titanConfigPath);
StandardTitanTx tx = (StandardTitanTx)g.buildTransaction().readOnly().start();
HashMap<Long, MizoTitanRelationType> relations = Maps.newHashMap();
tx.query()
.has(BaseKey.SchemaCategory, Contain.IN, Lists.newArrayList(TitanSchemaCategory.values()))
.vertices()
.forEach(v -> {
if (v instanceof InternalRelationType)
relations.put(v.longId(), new MizoTitanRelationType((InternalRelationType)v));
});
tx.close();
try {
((StandardTitanGraph)g).getBackend().close();
} catch (BackendException e) {
e.printStackTrace();
}
return relations;
}
开发者ID:imri,项目名称:mizo,代码行数:31,代码来源:MizoRDD.java
示例2: testGraphConfigUsedByThreadBoundTx
import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; //导入依赖的package包/类
@Test
public void testGraphConfigUsedByThreadBoundTx() {
close();
WriteConfiguration wc = getConfiguration();
wc.set(ConfigElement.getPath(CASSANDRA_READ_CONSISTENCY), "ALL");
wc.set(ConfigElement.getPath(CASSANDRA_WRITE_CONSISTENCY), "LOCAL_QUORUM");
graph = (StandardTitanGraph) TitanFactory.open(wc);
StandardTitanTx tx = (StandardTitanTx)graph.getCurrentThreadTx();
assertEquals("ALL",
tx.getTxHandle().getBaseTransactionConfig().getCustomOptions()
.get(AbstractCassandraStoreManager.CASSANDRA_READ_CONSISTENCY));
assertEquals("LOCAL_QUORUM",
tx.getTxHandle().getBaseTransactionConfig().getCustomOptions()
.get(AbstractCassandraStoreManager.CASSANDRA_WRITE_CONSISTENCY));
}
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:18,代码来源:CassandraGraphTest.java
示例3: testGraphConfigUsedByTx
import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; //导入依赖的package包/类
@Test
public void testGraphConfigUsedByTx() {
close();
WriteConfiguration wc = getConfiguration();
wc.set(ConfigElement.getPath(CASSANDRA_READ_CONSISTENCY), "TWO");
wc.set(ConfigElement.getPath(CASSANDRA_WRITE_CONSISTENCY), "THREE");
graph = (StandardTitanGraph) TitanFactory.open(wc);
StandardTitanTx tx = (StandardTitanTx)graph.newTransaction();
assertEquals("TWO",
tx.getTxHandle().getBaseTransactionConfig().getCustomOptions()
.get(AbstractCassandraStoreManager.CASSANDRA_READ_CONSISTENCY));
assertEquals("THREE",
tx.getTxHandle().getBaseTransactionConfig().getCustomOptions()
.get(AbstractCassandraStoreManager.CASSANDRA_WRITE_CONSISTENCY));
tx.rollback();
}
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:19,代码来源:CassandraGraphTest.java
示例4: testCustomConfigUsedByTx
import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; //导入依赖的package包/类
@Test
public void testCustomConfigUsedByTx() {
close();
WriteConfiguration wc = getConfiguration();
wc.set(ConfigElement.getPath(CASSANDRA_READ_CONSISTENCY), "ALL");
wc.set(ConfigElement.getPath(CASSANDRA_WRITE_CONSISTENCY), "ALL");
graph = (StandardTitanGraph) TitanFactory.open(wc);
StandardTitanTx tx = (StandardTitanTx)graph.buildTransaction()
.customOption(ConfigElement.getPath(CASSANDRA_READ_CONSISTENCY), "ONE")
.customOption(ConfigElement.getPath(CASSANDRA_WRITE_CONSISTENCY), "TWO").start();
assertEquals("ONE",
tx.getTxHandle().getBaseTransactionConfig().getCustomOptions()
.get(AbstractCassandraStoreManager.CASSANDRA_READ_CONSISTENCY));
assertEquals("TWO",
tx.getTxHandle().getBaseTransactionConfig().getCustomOptions()
.get(AbstractCassandraStoreManager.CASSANDRA_WRITE_CONSISTENCY));
tx.rollback();
}
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:22,代码来源:CassandraGraphTest.java
示例5: testValueOrdering
import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; //导入依赖的package包/类
@Test
public void testValueOrdering() {
StandardTitanGraph graph = (StandardTitanGraph) StorageSetup.getInMemoryGraph();
TitanManagement mgmt = graph.openManagement();
EdgeLabel father = mgmt.makeEdgeLabel("father").multiplicity(Multiplicity.MANY2ONE).make();
for (int i=1;i<=5;i++) mgmt.makePropertyKey("key" + i).dataType(Integer.class).make();
mgmt.commit();
TitanVertex v1 = graph.addVertex(), v2 = graph.addVertex();
TitanEdge e1 = v1.addEdge("father",v2);
for (int i=1;i<=5;i++) e1.property("key"+i,i);
graph.tx().commit();
e1.remove();
graph.tx().commit();
}
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:19,代码来源:EdgeSerializerTest.java
示例6: clear
import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; //导入依赖的package包/类
/**
* Clears out the entire graph. This will delete ALL of the data stored in this graph and the data will NOT be
* recoverable. This method is intended only for development and testing use.
*
* @param graph
* @throws IllegalArgumentException if the graph has not been shut down
* @throws com.thinkaurelius.titan.core.TitanException if clearing the storage is unsuccessful
*/
public static final void clear(TitanGraph graph) {
Preconditions.checkNotNull(graph);
Preconditions.checkArgument(graph instanceof StandardTitanGraph,"Invalid graph instance detected: %s",graph.getClass());
StandardTitanGraph g = (StandardTitanGraph)graph;
Preconditions.checkArgument(!g.isOpen(),"Graph needs to be shut down before it can be cleared.");
final GraphDatabaseConfiguration config = g.getConfiguration();
BackendOperation.execute(new Callable<Boolean>(){
@Override
public Boolean call() throws Exception {
config.getBackend().clearStorage();
return true;
}
@Override
public String toString() { return "ClearBackend"; }
},new StandardDuration(20, TimeUnit.SECONDS));
}
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:25,代码来源:TitanCleanup.java
示例7: StandardTransactionBuilder
import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; //导入依赖的package包/类
public StandardTransactionBuilder(GraphDatabaseConfiguration graphConfig, StandardTitanGraph graph, Configuration customOptions) {
Preconditions.checkNotNull(graphConfig);
Preconditions.checkNotNull(graph);
if (graphConfig.isReadOnly()) readOnly();
if (graphConfig.isBatchLoading()) enableBatchLoading();
this.graph = graph;
this.defaultSchemaMaker = graphConfig.getDefaultSchemaMaker();
this.assignIDsImmediately = graphConfig.hasFlushIDs();
this.forceIndexUsage = graphConfig.hasForceIndexUsage();
this.groupName = graphConfig.getMetricsPrefix();
this.propertyPrefetching = graphConfig.hasPropertyPrefetching();
this.writableCustomOptions = null;
this.customOptions = customOptions;
vertexCacheSize(graphConfig.getTxVertexCacheSize());
dirtyVertexSize(graphConfig.getTxDirtyVertexSize());
// KAFKA PRODUCER
this.logIdentifier = null;
boolean logAll = graphConfig.getLogAllTransactions();
if (logAll) {
this.logIdentifier = graphConfig.getAllLogTransactionName();
}
}
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:27,代码来源:StandardTransactionBuilder.java
示例8: ManagementSystem
import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; //导入依赖的package包/类
public ManagementSystem(StandardTitanGraph graph, KCVSConfiguration config, Log sysLog,
ManagementLogger mgmtLogger, SchemaCache schemaCache) {
Preconditions.checkArgument(config != null && graph != null && sysLog != null && mgmtLogger != null);
this.graph = graph;
this.baseConfig = config;
this.sysLog = sysLog;
this.mgmtLogger = mgmtLogger;
this.schemaCache = schemaCache;
this.transactionalConfig = new TransactionalConfiguration(baseConfig);
this.modifyConfig = new ModifiableConfiguration(ROOT_NS,
transactionalConfig, BasicConfiguration.Restriction.GLOBAL);
this.userConfig = new UserModifiableConfiguration(modifyConfig, configVerifier);
this.updatedTypes = new HashSet<TitanSchemaVertex>();
this.updatedTypeTriggers = new HashSet<Callable<Boolean>>();
this.graphShutdownRequired = false;
this.transaction = (StandardTitanTx) graph.buildTransaction().disableBatchLoading().start();
this.txStartTime = graph.getConfiguration().getTimestampProvider().getTime();
this.isOpen = true;
}
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:22,代码来源:ManagementSystem.java
示例9: clear
import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; //导入依赖的package包/类
/**
* Clears out the entire graph. This will delete ALL of the data stored in this graph and the data will NOT be
* recoverable. This method is intended only for development and testing use.
*
* @param graph
* @throws IllegalArgumentException if the graph has not been shut down
* @throws com.thinkaurelius.titan.core.TitanException if clearing the storage is unsuccessful
*/
public static final void clear(TitanGraph graph) {
Preconditions.checkNotNull(graph);
Preconditions.checkArgument(graph instanceof StandardTitanGraph,"Invalid graph instance detected: %s",graph.getClass());
StandardTitanGraph g = (StandardTitanGraph)graph;
Preconditions.checkArgument(!g.isOpen(),"Graph needs to be shut down before it can be cleared.");
final GraphDatabaseConfiguration config = g.getConfiguration();
BackendOperation.execute(new Callable<Boolean>(){
@Override
public Boolean call() throws Exception {
config.getBackend().clearStorage();
return true;
}
@Override
public String toString() { return "ClearBackend"; }
}, Duration.ofSeconds(20));
}
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:25,代码来源:TitanCleanup.java
示例10: StandardTransactionBuilder
import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; //导入依赖的package包/类
/**
* Constructs a new TitanTransaction configuration with default configuration parameters.
*/
public StandardTransactionBuilder(GraphDatabaseConfiguration graphConfig, StandardTitanGraph graph) {
Preconditions.checkNotNull(graphConfig);
Preconditions.checkNotNull(graph);
if (graphConfig.isReadOnly()) readOnly();
if (graphConfig.isBatchLoading()) enableBatchLoading();
this.graph = graph;
this.defaultSchemaMaker = graphConfig.getDefaultSchemaMaker();
this.assignIDsImmediately = graphConfig.hasFlushIDs();
this.forceIndexUsage = graphConfig.hasForceIndexUsage();
this.groupName = graphConfig.getMetricsPrefix();
// KAFKA PRODUCER
boolean logAll = graphConfig.getLogAllTransactions();
if (logAll)
this.logIdentifier = graphConfig.getAllLogTransactionName();
else
this.logIdentifier = null;
this.propertyPrefetching = graphConfig.hasPropertyPrefetching();
this.writableCustomOptions = GraphDatabaseConfiguration.buildGraphConfiguration();
this.customOptions = new MergedConfiguration(writableCustomOptions, graphConfig.getConfiguration());
vertexCacheSize(graphConfig.getTxVertexCacheSize());
dirtyVertexSize(graphConfig.getTxDirtyVertexSize());
}
开发者ID:graben1437,项目名称:titan1.0.1.kafka,代码行数:29,代码来源:StandardTransactionBuilder.java
示例11: testCustomConfigUsedByTx
import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; //导入依赖的package包/类
@Test
public void testCustomConfigUsedByTx() {
close();
WriteConfiguration wc = getConfiguration();
wc.set(ConfigElement.getPath(CASSANDRA_READ_CONSISTENCY), "ALL");
wc.set(ConfigElement.getPath(CASSANDRA_WRITE_CONSISTENCY), "ALL");
graph = (StandardTitanGraph) TitanFactory.open(wc);
StandardTitanTx tx = (StandardTitanTx)graph.buildTransaction()
.setCustomOption(ConfigElement.getPath(CASSANDRA_READ_CONSISTENCY), "ONE")
.setCustomOption(ConfigElement.getPath(CASSANDRA_WRITE_CONSISTENCY), "TWO").start();
assertEquals("ONE",
tx.getTxHandle().getBaseTransactionConfig().getCustomOptions()
.get(AbstractCassandraStoreManager.CASSANDRA_READ_CONSISTENCY));
assertEquals("TWO",
tx.getTxHandle().getBaseTransactionConfig().getCustomOptions()
.get(AbstractCassandraStoreManager.CASSANDRA_WRITE_CONSISTENCY));
tx.rollback();
}
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:22,代码来源:CassandraGraphTest.java
示例12: testValueOrdering
import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; //导入依赖的package包/类
@Test
public void testValueOrdering() {
StandardTitanGraph graph = (StandardTitanGraph) StorageSetup.getInMemoryGraph();
TitanManagement mgmt = graph.getManagementSystem();
EdgeLabel father = mgmt.makeEdgeLabel("father").multiplicity(Multiplicity.MANY2ONE).make();
for (int i=1;i<=5;i++) mgmt.makePropertyKey("key" + i).dataType(Integer.class).make();
mgmt.commit();
TitanVertex v1 = graph.addVertex(null), v2 = graph.addVertex(null);
TitanEdge e1 = v1.addEdge("father",v2);
for (int i=1;i<=5;i++) e1.setProperty("key"+i,i);
graph.commit();
e1.remove();
graph.commit();
}
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:19,代码来源:EdgeSerializerTest.java
示例13: setup
import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; //导入依赖的package包/类
@Override
public void setup(
final Mapper<NullWritable, FaunusVertex, NullWritable, NullWritable>.Context context) throws IOException {
Configuration hadoopConf = DEFAULT_COMPAT.getContextConfiguration(context);
ModifiableHadoopConfiguration faunusConf = ModifiableHadoopConfiguration.of(hadoopConf);
BasicConfiguration titanConf = faunusConf.getOutputConf();
indexName = faunusConf.get(TitanHadoopConfiguration.INDEX_NAME);
indexType = faunusConf.get(TitanHadoopConfiguration.INDEX_TYPE);
try {
Preconditions.checkNotNull(indexName, "Need to provide at least an index name for re-index job");
log.info("Read index information: name={} type={}", indexName, indexType);
graph = (StandardTitanGraph)TitanFactory.open(titanConf);
SchemaContainer schema = new SchemaContainer(graph);
FaunusSchemaManager typeManager = FaunusSchemaManager.getTypeManager(titanConf);
typeManager.setSchemaProvider(schema);
log.info("Opened graph {}", graph);
mgmt = (ManagementSystem) graph.getManagementSystem();
validateIndexStatus();
} catch (final Exception e) {
if (null != mgmt && mgmt.isOpen())
mgmt.rollback();
DEFAULT_COMPAT.incrementContextCounter(context, Counters.FAILED_TRANSACTIONS, 1L);
throw new IOException(e.getMessage(), e);
}
}
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:27,代码来源:TitanIndexRepairMapper.java
示例14: StandardTransactionBuilder
import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; //导入依赖的package包/类
/**
* Constructs a new TitanTransaction configuration with default configuration parameters.
*/
public StandardTransactionBuilder(GraphDatabaseConfiguration graphConfig, StandardTitanGraph graph) {
Preconditions.checkNotNull(graphConfig);
Preconditions.checkNotNull(graph);
if (graphConfig.isReadOnly()) readOnly();
if (graphConfig.isBatchLoading()) enableBatchLoading();
this.graph = graph;
this.defaultSchemaMaker = graphConfig.getDefaultSchemaMaker();
this.assignIDsImmediately = graphConfig.hasFlushIDs();
this.forceIndexUsage = graphConfig.hasForceIndexUsage();
this.groupName = graphConfig.getMetricsPrefix();
this.logIdentifier = null;
this.propertyPrefetching = graphConfig.hasPropertyPrefetching();
this.writableCustomOptions = GraphDatabaseConfiguration.buildConfiguration();
this.customOptions = new MergedConfiguration(writableCustomOptions, graphConfig.getConfiguration());
setVertexCacheSize(graphConfig.getTxVertexCacheSize());
setDirtyVertexSize(graphConfig.getTxDirtyVertexSize());
}
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:21,代码来源:StandardTransactionBuilder.java
示例15: ManagementSystem
import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; //导入依赖的package包/类
public ManagementSystem(StandardTitanGraph graph, KCVSConfiguration config, Log sysLog,
ManagementLogger mgmtLogger, SchemaCache schemaCache) {
Preconditions.checkArgument(config!=null && graph!=null && sysLog!=null && mgmtLogger!=null);
this.graph = graph;
this.baseConfig = config;
this.sysLog = sysLog;
this.mgmtLogger = mgmtLogger;
this.schemaCache = schemaCache;
this.transactionalConfig = new TransactionalConfiguration(baseConfig);
this.modifyConfig = new ModifiableConfiguration(ROOT_NS,
transactionalConfig, BasicConfiguration.Restriction.GLOBAL);
this.userConfig = new UserModifiableConfiguration(modifyConfig,configVerifier);
this.updatedTypes = new HashSet<TitanSchemaVertex>();
this.updatedTypeTriggers = new HashSet<Callable<Boolean>>();
this.graphShutdownRequired = false;
this.transaction = (StandardTitanTx) graph.buildTransaction().disableBatchLoading().start();
this.txStartTime = graph.getConfiguration().getTimestampProvider().getTime();
this.isOpen = true;
}
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:22,代码来源:ManagementSystem.java
示例16: initialize
import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; //导入依赖的package包/类
@Before
public void initialize() {
ModifiableConfiguration config = GraphDatabaseConfiguration.buildGraphConfiguration();
config.set(GraphDatabaseConfiguration.STORAGE_BACKEND,"inmemory");
config.set(GraphDatabaseConfiguration.CUSTOM_ATTRIBUTE_CLASS, TClass1.class.getName(), "attribute1");
config.set(GraphDatabaseConfiguration.CUSTOM_SERIALIZER_CLASS, TClass1Serializer.class.getName(), "attribute1");
config.set(GraphDatabaseConfiguration.CUSTOM_ATTRIBUTE_CLASS, TEnum.class.getName(), "attribute4");
config.set(GraphDatabaseConfiguration.CUSTOM_SERIALIZER_CLASS, TEnumSerializer.class.getName(), "attribute4");
graph = (StandardTitanGraph) TitanFactory.open(config);
}
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:11,代码来源:SerializerGraphConfiguration.java
示例17: UpdateStatusTrigger
import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; //导入依赖的package包/类
private UpdateStatusTrigger(StandardTitanGraph graph, TitanSchemaVertex vertex, SchemaStatus newStatus, Iterable<PropertyKeyVertex> keys) {
this.graph = graph;
this.schemaVertexId = vertex.longId();
this.newStatus = newStatus;
this.propertyKeys = Sets.newHashSet(Iterables.transform(keys, new Function<PropertyKey, Long>() {
@Nullable
@Override
public Long apply(@Nullable PropertyKey propertyKey) {
return propertyKey.longId();
}
}));
}
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:13,代码来源:ManagementSystem.java
示例18: ManagementLogger
import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; //导入依赖的package包/类
public ManagementLogger(StandardTitanGraph graph, Log sysLog, SchemaCache schemaCache, TimestampProvider times) {
this.graph = graph;
this.schemaCache = schemaCache;
this.sysLog = sysLog;
this.times = times;
Preconditions.checkNotNull(times);
}
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:8,代码来源:ManagementLogger.java
示例19: StandardLogProcessorFramework
import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; //导入依赖的package包/类
public StandardLogProcessorFramework(StandardTitanGraph graph) {
Preconditions.checkArgument(graph!=null && graph.isOpen());
this.graph = graph;
this.serializer = graph.getDataSerializer();
this.times = graph.getConfiguration().getTimestampProvider();
this.processorLogs = new HashMap<String, Log>();
}
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:8,代码来源:StandardLogProcessorFramework.java
示例20: startTransaction
import com.thinkaurelius.titan.graphdb.database.StandardTitanGraph; //导入依赖的package包/类
public static StandardTitanTx startTransaction(StandardTitanGraph graph) {
StandardTransactionBuilder txb = graph.buildTransaction().readOnly();
txb.setPreloadedData(true);
txb.checkInternalVertexExistence(false);
txb.dirtyVertexSize(0);
txb.vertexCacheSize(0);
return (StandardTitanTx)txb.start();
}
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:9,代码来源:VertexJobConverter.java
注:本文中的com.thinkaurelius.titan.graphdb.database.StandardTitanGraph类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论