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


Java TinkerGraph.getVertices方法代码示例

本文整理汇总了Java中com.tinkerpop.blueprints.impls.tg.TinkerGraph.getVertices方法的典型用法代码示例。如果您正苦于以下问题:Java TinkerGraph.getVertices方法的具体用法?Java TinkerGraph.getVertices怎么用?Java TinkerGraph.getVertices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.tinkerpop.blueprints.impls.tg.TinkerGraph的用法示例。


在下文中一共展示了TinkerGraph.getVertices方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import com.tinkerpop.blueprints.impls.tg.TinkerGraph; //导入方法依赖的package包/类
public static void main(String[] args) {
	if (args.length != 1) {
		System.err.println("Please enter a graph name.");
		System.err.println("graphs: memory-beta, simpsons, wookieepedia");
		System.err
				.println("Graph path should be set in the graphs.poperties file.");
		System.exit(1);
	}

	Gson gson = new Gson();
	TinkerGraph graph;
	try {
		graph = SingletonGraph.getInstance().getGraphs().get(args[0]);

		Iterable<Vertex> it = graph.getVertices();

		Iterator<Vertex> iterator = it.iterator();

		while (iterator.hasNext()) {
			Vertex answerVerbVertex = (Vertex) iterator.next();
			NerdleFact transform = NerdleGraphTransformer
					.transform(answerVerbVertex);

			if (transform.getSubject().getText().equals("Kang")) {
				System.out.println(gson.toJson(transform));
			}
		}

	} catch (ConfigurationException e) {
		e.printStackTrace();
	}

}
 
开发者ID:impro3-nerdle,项目名称:nerdle,代码行数:34,代码来源:GraphDebugger.java

示例2: causeExceptionIfGraphNotInitialized

import com.tinkerpop.blueprints.impls.tg.TinkerGraph; //导入方法依赖的package包/类
@Test(expected = IllegalStateException.class)
public void causeExceptionIfGraphNotInitialized() {
    TinkerGraph graph = new TinkerGraph();
    Configuration conf = new Configuration.ConfBuilder().build();
    ActiveVersionedGraph<TinkerGraph, Long> vg = new ActiveVersionedGraph.ActiveVersionedNonTransactionalGraphBuilder<TinkerGraph, Long>(
            graph, new LongGraphIdentifierBehavior()).init(false).conf(conf).build();

    graph.getVertices();
}
 
开发者ID:indexiatech,项目名称:antiquity,代码行数:10,代码来源:GraphInitTest.java

示例3: getMatchedFacts

import com.tinkerpop.blueprints.impls.tg.TinkerGraph; //导入方法依赖的package包/类
public static List<NerdleFact> getMatchedFacts(
		NerdleFact questionExtraction, TinkerGraph graph) {

	List<NerdleFact> result = new ArrayList<NerdleFact>();

	String questionSubject = questionExtraction.getSubject().getText();

	Iterable<Vertex> it = graph.getVertices(
			NerdleGraphTransformer.PROPERTY_LEMMA, questionExtraction
					.getPredicate().getLemma());

	Iterator<Vertex> iterator = it.iterator();

	while (iterator.hasNext()) {
		Vertex answerVerbVertex = (Vertex) iterator.next();

		NerdleFact answerFact = NerdleGraphTransformer
				.transform(answerVerbVertex);

		if (questionSubject != null && !questionSubject.isEmpty()) {
			if (!FuzzyStringMatcher.fuzzySubjectMatcher(questionSubject,
					answerFact.getSubject().getText())) {
				continue;
			}
		}

		for (NerdleArg questionExtractionArg : questionExtraction
				.getArguments()) {

			if (!FuzzyStringMatcher.fuzzyArgumentMatcher(
					answerFact.getArguments(),
					questionExtractionArg.getText())) {
				continue;
			}

		}

		result.add(answerFact);

	}

	return result;
}
 
开发者ID:impro3-nerdle,项目名称:nerdle,代码行数:44,代码来源:GraphExplorer.java


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