本文整理汇总了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();
}
}
示例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();
}
示例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;
}