本文整理汇总了Java中com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx类的典型用法代码示例。如果您正苦于以下问题:Java OrientGraphNoTx类的具体用法?Java OrientGraphNoTx怎么用?Java OrientGraphNoTx使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OrientGraphNoTx类属于com.tinkerpop.blueprints.impls.orient包,在下文中一共展示了OrientGraphNoTx类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setSettings
import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入依赖的package包/类
private void setSettings() {
// settings
factory.setUseLightweightEdges( true );
factory.setUseClassForEdgeLabel( false );
factory.setUseVertexFieldsForEdgeLabels( false );
OrientGraphNoTx noTx = null;
try{
noTx = factory.getNoTx();
// TODO: add admin user for testing
createAdminUser();
}
finally {
if( noTx != null )
noTx.shutdown();
}
}
示例2: clear
import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入依赖的package包/类
@Override
public void clear() {
if (log.isDebugEnabled()) {
log.debug("Clearing graph");
}
OrientGraphNoTx tx2 = factory.getNoTx();
tx2.declareIntent(new OIntentNoCache());
try {
for (Vertex vertex : tx2.getVertices()) {
vertex.remove();
}
} finally {
tx2.declareIntent(null);
tx2.shutdown();
}
if (log.isDebugEnabled()) {
log.debug("Cleared graph");
}
}
示例3: addEdges
import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入依赖的package包/类
private void addEdges(OrientGraphNoTx graph, File edges) throws IOException {
BufferedReader brd = new BufferedReader(new FileReader(edges));
LineReader reader = new LineReader(brd, ",");
int c = 0;
for(String[] split : reader) {
if (++c % 100 == 0)
System.out.println(c);
Integer fromID = Integer.parseInt(split[0]);
Integer toID = Integer.parseInt(split[1]);
Vertex from = graph.getVertices(NODE_ID_KEY, fromID).iterator().next();
Vertex to = graph.getVertices(NODE_ID_KEY, toID).iterator().next();
// from.addEdge(EDGE_LABEL, to);
graph.addEdge("class:"+EDGE_LABEL, from, to, null);
}
brd.close();
}
示例4: execute
import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入依赖的package包/类
@Override
public void execute() throws Exception {
OrientGraphNoTx graph = orientConnector.getNoTxGraphInstance();
ReachingDefinitionAnalyser analyser = new ReachingDefinitionAnalyser(
DefinitionProvider::generatedDefinitions,
DefinitionProvider::killedDefinitions);
for (Function function : LookupOperations.getFunctions(graph)) {
Instruction entry = Traversals
.functionToEntryInstruction(function);
if (null == entry) {
continue;
}
Map<Vertex, Set<ReachingDefinitionAnalyser.Definition>>
reachingDefinitions = analyser
.analyse(entry);
DataDependenceCreator
.createFromReachingDefinitions(reachingDefinitions);
}
}
示例5: execute
import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入依赖的package包/类
@Override
public void execute() throws Exception
{
OrientGraphNoTx graph = orientConnector.getNoTxGraphInstance();
VSA vsa = new VSA();
for (Function function : LookupOperations.getFunctions(graph))
{
try
{
logger.info(function.toString());
vsa.performIntraProceduralVSA(function);
} catch (Exception e)
{
logger.error("Error for function " + function + ": " + e.getMessage());
}
}
graph.shutdown();
}
示例6: testStEquals
import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入依赖的package包/类
@Test
public void testStEquals() {
OrientGraphNoTx graph = new OrientGraphNoTx("memory:functionsTest");
try {
ODatabaseDocumentTx db = graph.getRawGraph();
List<ODocument> execute = db.command(
new OCommandSQL(
"SELECT ST_Equals(ST_GeomFromText('LINESTRING(0 0, 10 10)'), ST_GeomFromText('LINESTRING(0 0, 5 5, 10 10)'))"))
.execute();
ODocument next = execute.iterator().next();
Assert.assertEquals(next.field("ST_Equals"), true);
} finally {
graph.drop();
}
}
示例7: testAsBinary
import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入依赖的package包/类
@Test(enabled = false)
public void testAsBinary() {
OrientGraphNoTx graph = new OrientGraphNoTx("memory:functionsTest");
try {
ODatabaseDocumentTx db = graph.getRawGraph();
List<ODocument> execute = db.command(new OCommandSQL("SELECT ST_AsBinary(ST_GeomFromText('LINESTRING(0 0, 10 10)'))"))
.execute();
ODocument next = execute.iterator().next();
// TODO CHANGE
Assert.assertNull(next.field("ST_AsBinary"));
} finally {
graph.drop();
}
}
示例8: testDisjoint
import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入依赖的package包/类
@Test
public void testDisjoint() {
OrientGraphNoTx graph = new OrientGraphNoTx("memory:functionsTest");
try {
ODatabaseDocumentTx db = graph.getRawGraph();
List<ODocument> execute = db.command(new OCommandSQL("SELECT ST_Disjoint('POINT(0 0)', 'LINESTRING ( 2 0, 0 2 )');"))
.execute();
ODocument next = execute.iterator().next();
Assert.assertEquals(next.field("ST_Disjoint"), true);
execute = db.command(new OCommandSQL("SELECT ST_Disjoint('POINT(0 0)', 'LINESTRING ( 0 0, 0 2 )');")).execute();
next = execute.iterator().next();
Assert.assertEquals(next.field("ST_Disjoint"), false);
} finally {
graph.drop();
}
}
示例9: testWithinNoIndex
import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入依赖的package包/类
@Test
public void testWithinNoIndex() {
OrientGraphNoTx graph = new OrientGraphNoTx("memory:functionsTest");
try {
ODatabaseDocumentTx db = graph.getRawGraph();
List<ODocument> execute = db
.command(
new OCommandSQL(
"select ST_Within(smallc,smallc) as smallinsmall,ST_Within(smallc, bigc) As smallinbig, ST_Within(bigc,smallc) As biginsmall "
+ "from (SELECT ST_Buffer(ST_GeomFromText('POINT(50 50)'), 20) As smallc,ST_Buffer(ST_GeomFromText('POINT(50 50)'), 40) As bigc)"))
.execute();
ODocument next = execute.iterator()
.next();
Assert.assertEquals(next.field("smallinsmall"), false);
Assert.assertEquals(next.field("smallinbig"), true);
Assert.assertEquals(next.field("biginsmall"), false);
} finally {
graph.drop();
}
}
示例10: testContainsNoIndex
import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入依赖的package包/类
@Test
public void testContainsNoIndex() {
OrientGraphNoTx graph = new OrientGraphNoTx("memory:functionsTestNoIndex");
try {
ODatabaseDocumentTx db = graph.getRawGraph();
List<ODocument> execute = db
.command(
new OCommandSQL(
"select ST_Contains(smallc,smallc) as smallinsmall,ST_Contains(smallc, bigc) As smallinbig, ST_Contains(bigc,smallc) As biginsmall from (SELECT ST_Buffer(ST_GeomFromText('POINT(50 50)'), 20) As smallc,ST_Buffer(ST_GeomFromText('POINT(50 50)'), 40) As bigc)"))
.execute();
ODocument next = execute.iterator().next();
Assert.assertEquals(next.field("smallinsmall"), true);
Assert.assertEquals(next.field("smallinbig"), false);
Assert.assertEquals(next.field("biginsmall"), true);
} finally {
graph.drop();
}
}
示例11: testIntersectsNoIndex
import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入依赖的package包/类
@Test
public void testIntersectsNoIndex() {
OrientGraphNoTx graph = new OrientGraphNoTx("memory:functionsTest");
try {
ODatabaseDocumentTx db = graph.getRawGraph();
List<ODocument> execute = db.command(new OCommandSQL("SELECT ST_Intersects('POINT(0 0)', 'LINESTRING ( 2 0, 0 2 )')"))
.execute();
ODocument next = execute.iterator().next();
Assert.assertEquals(next.field("ST_Intersects"), false);
execute = db.command(new OCommandSQL("SELECT ST_Intersects('POINT(0 0)', 'LINESTRING ( 0 0, 0 2 )')")).execute();
next = execute.iterator().next();
Assert.assertEquals(next.field("ST_Intersects"), true);
} finally {
graph.drop();
}
}
示例12: testDWithinNoIndex
import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入依赖的package包/类
@Test
public void testDWithinNoIndex() {
OrientGraphNoTx graph = new OrientGraphNoTx("memory:functionsTest");
try {
ODatabaseDocumentTx db = graph.getRawGraph();
List<ODocument> execute = db.command(
new OCommandSQL("SELECT ST_DWithin(ST_GeomFromText('POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))'), "
+ "ST_GeomFromText('POLYGON((12 0, 14 0, 14 6, 12 6, 12 0))'), 2.0d) as distance")).execute();
ODocument next = execute.iterator().next();
Assert.assertEquals(next.field("distance"), true);
} finally {
graph.drop();
}
}
示例13: reused
import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入依赖的package包/类
/**
* Logs in on the DB
* @param username
* @param password
* @return the new token
* @throws Exception
*/
@POST @Path("/login")
@Info("This function authenticates the user and returns a token that can be reused (untile the session expires) to call functions that require authentication")
public String login(
@HeaderParam("username") String username,
@HeaderParam("password") String password ) throws Exception {
// System.out.println("#### DB address "+new File(DBConnector.db_addr).getAbsolutePath()+" ####");
OrientGraphNoTx graph = new OrientGraphFactory( DBConnector.db_addr, username, password ).getNoTx();
try {
String token = getStringToken( graph );
// System.out.println( "Login succeeded. Token:" );
// System.out.println( token );
// System.out.println( EncodingUtil.encrypt( username + "\n" + password ) );
return new JsonPrimitive( token ).toString();
}
finally {
if( graph != null )
graph.getRawGraph().close();
}
}
示例14: deleteUser
import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入依赖的package包/类
@DELETE @Path("/users/{user}/delete")
@Info("Deletes completely a user account from every domain and from the database")
public void deleteUser(
@HeaderParam("token") @Info("The authentication token") String token,
@PathParam("user") @Info("Name of the user dto be deleted") String username
) {
OrientGraphNoTx graph = new OrientGraphFactory( DBConnector.db_addr ).getNoTx();
try {
OSecurity security = graph.getRawGraph().getMetadata().getSecurity();
security.dropUser( username );
}
finally {
if( graph != null )
graph.getRawGraph().close();
}
}
示例15: doTransformationQuery
import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx; //导入依赖的package包/类
@SuppressWarnings({ "unused", "rawtypes" })
public double doTransformationQuery(OrientGraphNoTx graph, Vertex source) throws IOException {
ArrayList<Long> timeList = new ArrayList<Long>();
for (int i = 0; i < iterationCount; i++) {
long pre = System.currentTimeMillis();
StaticPersistentOrientBreadthFirstSearch tBFS = new StaticPersistentOrientBreadthFirstSearch();
Map vSet = tBFS.compute(graph, source, null, TemporalType.TIMESTAMP, AC.$gt, null, null, null, null,
null, null, Position.first);
long aft = System.currentTimeMillis();
long elapsedTime = aft - pre;
// System.out.println(vSet);
// System.out.println("Elapsed Time: " + elapsedTime);
timeList.add(elapsedTime);
}
double total = timeList.parallelStream().mapToDouble(t -> {
return t.longValue();
}).sum();
return total / iterationCount;
}