当前位置: 首页>>代码示例>>Java>>正文


Java OrientGraphNoTx类代码示例

本文整理汇总了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();
	}
}
 
开发者ID:maltesander,项目名称:rest-jersey2-json-jwt-authentication,代码行数:20,代码来源:OrientDbConnection.java

示例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");
	}

}
 
开发者ID:gentics,项目名称:mesh,代码行数:22,代码来源:OrientDBDatabase.java

示例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();
	}
 
开发者ID:besil,项目名称:orientsna,代码行数:20,代码来源:GraphLoader.java

示例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);

	}
}
 
开发者ID:octopus-platform,项目名称:bjoern,代码行数:21,代码来源:DataDependencePlugin.java

示例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();
}
 
开发者ID:octopus-platform,项目名称:bjoern,代码行数:19,代码来源:VSAPlugin.java

示例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();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:18,代码来源:LuceneSpatialMiscFunctionsTest.java

示例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();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:17,代码来源:LuceneSpatialMiscFunctionsTest.java

示例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();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:22,代码来源:LuceneSpatialMiscFunctionsTest.java

示例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();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:25,代码来源:LuceneSpatialWithinTest.java

示例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();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:23,代码来源:LuceneSpatialContainsTest.java

示例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();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:22,代码来源:LuceneSpatialIntersectsTest.java

示例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();
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:19,代码来源:LuceneSpatialDWithinTest.java

示例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();
		}
	}
 
开发者ID:RISCOSS,项目名称:riscoss-corporate,代码行数:33,代码来源:AuthManager.java

示例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();
	}
}
 
开发者ID:RISCOSS,项目名称:riscoss-corporate,代码行数:23,代码来源:AdminManager.java

示例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;
}
 
开发者ID:JaewookByun,项目名称:epcis,代码行数:25,代码来源:TransformationQueryOrientDBTest.java


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