本文整理了Java中org.apache.tinkerpop.gremlin.process.traversal.Traversal.asAdmin()
方法的一些代码示例,展示了Traversal.asAdmin()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Traversal.asAdmin()
方法的具体详情如下:
包路径:org.apache.tinkerpop.gremlin.process.traversal.Traversal
类名称:Traversal
方法名:asAdmin
[英]Get access to administrative methods of the traversal via its accompanying Traversal.Admin.
[中]通过伴随的遍历访问遍历的管理方法。管理
代码示例来源:origin: thinkaurelius/titan
private static FulgoraElementTraversal<Vertex,Edge> getReverseTraversal(final MessageScope.Local<?> scope,
final TitanTransaction graph, @Nullable final Vertex start) {
Traversal.Admin<Vertex,Edge> incident = scope.getIncidentTraversal().get().asAdmin();
FulgoraElementTraversal<Vertex,Edge> result = FulgoraElementTraversal.of(graph);
for (Step step : incident.getSteps()) result.addStep(step);
Step<Vertex,?> startStep = result.getStartStep();
assert startStep instanceof VertexStep;
((VertexStep) startStep).reverseDirection();
if (start!=null) result.addStep(0, new StartStep<>(incident, start));
result.asAdmin().setStrategies(FULGORA_STRATEGIES);
return result;
}
代码示例来源:origin: thinkaurelius/titan
public static boolean validTitanOrder(OrderGlobalStep ostep, Traversal rootTraversal,
boolean isVertexOrder) {
for (Comparator comp : (List<Comparator>) ostep.getComparators()) {
if (!(comp instanceof ElementValueComparator)) return false;
ElementValueComparator evc = (ElementValueComparator) comp;
if (!(evc.getValueComparator() instanceof Order)) return false;
TitanTransaction tx = TitanTraversalUtil.getTx(rootTraversal.asAdmin());
String key = evc.getPropertyKey();
PropertyKey pkey = tx.getPropertyKey(key);
if (pkey == null || !(Comparable.class.isAssignableFrom(pkey.dataType()))) return false;
if (isVertexOrder && pkey.cardinality() != Cardinality.SINGLE) return false;
}
return true;
}
代码示例来源:origin: JanusGraph/janusgraph
private static FulgoraElementTraversal<Vertex,Edge> getReverseTraversal(final MessageScope.Local<?> scope,
final JanusGraphTransaction graph, @Nullable final Vertex start) {
Traversal.Admin<Vertex,Edge> incident = scope.getIncidentTraversal().get().asAdmin();
FulgoraElementTraversal<Vertex,Edge> result = FulgoraElementTraversal.of(graph);
for (Step step : incident.getSteps()) result.addStep(step);
Step<Vertex,?> startStep = result.getStartStep();
assert startStep instanceof VertexStep;
((VertexStep) startStep).reverseDirection();
if (start!=null) result.addStep(0, new StartStep<>(incident, start));
result.asAdmin().setStrategies(FULGORA_STRATEGIES);
return result;
}
代码示例来源:origin: JanusGraph/janusgraph
static boolean validJanusGraphOrder(OrderGlobalStep orderGlobalStep, Traversal rootTraversal,
boolean isVertexOrder) {
final List<Pair<Traversal.Admin, Object>> comparators = orderGlobalStep.getComparators();
for(final Pair<Traversal.Admin, Object> comp : comparators) {
final String key;
if (comp.getValue0() instanceof ElementValueTraversal &&
comp.getValue1() instanceof Order) {
key = ((ElementValueTraversal) comp.getValue0()).getPropertyKey();
} else if (comp.getValue1() instanceof ElementValueComparator) {
final ElementValueComparator evc = (ElementValueComparator) comp.getValue1();
if (!(evc.getValueComparator() instanceof Order)) return false;
key = evc.getPropertyKey();
} else {
// do not fold comparators that include nested traversals that are not simple ElementValues
return false;
}
final JanusGraphTransaction tx = JanusGraphTraversalUtil.getTx(rootTraversal.asAdmin());
final PropertyKey pKey = tx.getPropertyKey(key);
if (pKey == null
|| !(Comparable.class.isAssignableFrom(pKey.dataType()))
|| (isVertexOrder && pKey.cardinality() != Cardinality.SINGLE)) {
return false;
}
}
return true;
}
代码示例来源:origin: apache/tinkerpop
public void printTraversalForm(final Traversal traversal) {
logger.info(String.format("Testing: %s", name.getMethodName()));
logger.info(" pre-strategy:" + traversal);
if (!traversal.asAdmin().isLocked()) traversal.asAdmin().applyStrategies();
logger.info(" post-strategy:" + traversal);
verifyUniqueStepIds(traversal.asAdmin());
}
代码示例来源:origin: apache/tinkerpop
/**
* Profile the traversal.
*
* @return the updated traversal with respective {@link ProfileSideEffectStep}.
*/
public default Traversal<S, TraversalMetrics> profile() {
this.asAdmin().getBytecode().addStep(Symbols.profile);
return this.asAdmin()
.addStep(new ProfileSideEffectStep<>(this.asAdmin(), ProfileSideEffectStep.DEFAULT_METRICS_KEY))
.addStep(new SideEffectCapStep<Object, TraversalMetrics>(this.asAdmin(), ProfileSideEffectStep.DEFAULT_METRICS_KEY));
}
代码示例来源:origin: apache/tinkerpop
public static <A, B, C extends Traversal<A, B>> C addRepeatToTraversal(final C traversal, final Traversal.Admin<B, B> repeatTraversal) {
final Step<?, B> step = traversal.asAdmin().getEndStep();
if (step instanceof RepeatStep && null == ((RepeatStep) step).repeatTraversal) {
((RepeatStep<B>) step).setRepeatTraversal(repeatTraversal);
} else {
final RepeatStep<B> repeatStep = new RepeatStep<>(traversal.asAdmin());
repeatStep.setRepeatTraversal(repeatTraversal);
traversal.asAdmin().addStep(repeatStep);
}
return traversal;
}
代码示例来源:origin: apache/tinkerpop
public Builder source(final Traversal<Vertex, ?> sourceVertexFilter) {
if (null == sourceVertexFilter) throw Graph.Exceptions.argumentCanNotBeNull("sourceVertexFilter");
PureTraversal.storeState(this.configuration, SOURCE_VERTEX_FILTER, sourceVertexFilter.asAdmin());
return this;
}
代码示例来源:origin: apache/tinkerpop
public static <A, B, C extends Traversal<A, B>> C addRepeatToTraversal(final C traversal, final String loopName, final Traversal.Admin<B, B> repeatTraversal) {
addRepeatToTraversal(traversal, repeatTraversal);
final Step<?, B> step = traversal.asAdmin().getEndStep();
((RepeatStep) step).loopName = loopName;
return traversal;
}
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(MODERN)
public void g_V_out_group_byXlabelX_selectXpersonX_unfold_outXcreatedX_name_limitX2X() {
final Traversal<Vertex, String> traversal = get_g_V_out_group_byXlabelX_selectXpersonX_unfold_outXcreatedX_name_limitX2X();
printTraversalForm(traversal);
checkResults(Arrays.asList("ripple", "lop"), traversal);
checkSideEffects(traversal.asAdmin().getSideEffects());
}
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(MODERN)
public void g_V_both_groupCountXaX_byXlabelX_asXbX_barrier_whereXselectXaX_selectXsoftwareX_isXgtX2XXX_selectXbX_name() {
final Traversal<Vertex, String> traversal = get_g_V_both_groupCountXaX_byXlabelX_asXbX_barrier_whereXselectXaX_selectXsoftwareX_isXgtX2XXX_selectXbX_name();
printTraversalForm(traversal);
checkResults(Arrays.asList("lop", "lop", "lop", "peter", "marko", "marko", "marko", "ripple", "vadas", "josh", "josh", "josh"), traversal);
checkSideEffects(traversal.asAdmin().getSideEffects(), "a", HashMap.class);
}
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(MODERN)
public void g_V_groupXmX_byXnameX_byXinXknowsX_nameX_capXmX() {
final Traversal<Vertex, Map<String, String>> traversal = get_g_V_groupXmX_byXnameX_byXinXknowsX_nameX_capXmX();
printTraversalForm(traversal);
final Map<String, String> map = traversal.next();
assertFalse(traversal.hasNext());
assertEquals(2, map.size());
assertEquals("marko", map.get("vadas"));
assertEquals("marko", map.get("josh"));
checkSideEffects(traversal.asAdmin().getSideEffects(), "m", HashMap.class);
}
代码示例来源:origin: thinkaurelius/titan
metrics = (TraversalMetrics) t.asAdmin().getSideEffects().get("~metrics").get();
verifyMetrics(metrics.getMetrics(0), true, false);
verifyMetrics(metrics.getMetrics(1), true, true);
metrics = (TraversalMetrics) t.asAdmin().getSideEffects().get("~metrics").get();
verifyMetrics(metrics.getMetrics(0), true, false);
verifyMetrics(metrics.getMetrics(1), true, true);
metrics = (TraversalMetrics) t.asAdmin().getSideEffects().get("~metrics").get();
metrics = (TraversalMetrics) t.asAdmin().getSideEffects().get("~metrics").get();
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(MODERN)
public void g_V_group_byXnameX_by() {
final Traversal<Vertex, Map<String, Collection<Vertex>>> traversal = get_g_V_group_byXnameX_by();
printTraversalForm(traversal);
assertCommonA(traversal);
checkSideEffects(traversal.asAdmin().getSideEffects());
}
代码示例来源:origin: apache/tinkerpop
/**
* Provides a execute a specified traversal on a single element within a stream.
*
* @param localTraversal the traversal to execute locally
* @return the traversal with the appended {@link LocalStep}
* @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#local-step" target="_blank">Reference Documentation - Local Step</a>
* @since 3.0.0-incubating
*/
public default <E2> GraphTraversal<S, E2> local(final Traversal<?, E2> localTraversal) {
this.asAdmin().getBytecode().addStep(Symbols.local, localTraversal);
return this.asAdmin().addStep(new LocalStep<>(this.asAdmin(), localTraversal.asAdmin()));
}
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(MODERN)
public void g_V_outXcreatedX_groupCount_byXnameX() {
final Traversal<Vertex, Map<String, Long>> traversal = get_g_V_outXcreatedX_groupCount_byXnameX();
printTraversalForm(traversal);
assertCommonA(traversal);
checkSideEffects(traversal.asAdmin().getSideEffects());
}
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(MODERN)
public void g_V_outXcreatedX_groupCountXaX_byXnameX_capXaX() {
final Traversal<Vertex, Map<String, Long>> traversal = get_g_V_outXcreatedX_groupCountXaX_byXnameX_capXaX();
printTraversalForm(traversal);
assertCommonA(traversal);
checkSideEffects(traversal.asAdmin().getSideEffects(), "a", HashMap.class);
}
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(MODERN)
public void g_V_unionXoutXknowsX__outXcreatedX_inXcreatedXX_groupCount_selectXvaluesX_unfold_sum() {
final Traversal<Vertex, Long> traversal = get_g_V_unionXoutXknowsX__outXcreatedX_inXcreatedXX_groupCount_selectXvaluesX_unfold_sum();
printTraversalForm(traversal);
assertEquals(12l, traversal.next().longValue());
assertFalse(traversal.hasNext());
checkSideEffects(traversal.asAdmin().getSideEffects());
}
代码示例来源:origin: apache/tinkerpop
@Test
@LoadGraphWith(MODERN)
public void g_V_groupCount_byXbothE_countX() {
final Traversal<Vertex, Map<Long, Long>> traversal = get_g_V_groupCount_byXbothE_countX();
printTraversalForm(traversal);
checkMap(new HashMap<Long, Long>() {{
put(1l, 3l);
put(3l, 3l);
}}, traversal.next());
checkSideEffects(traversal.asAdmin().getSideEffects());
}
代码示例来源:origin: JanusGraph/janusgraph
metrics = t.asAdmin().getSideEffects().get("~metrics");
metrics = t.asAdmin().getSideEffects().get("~metrics");
metrics = t.asAdmin().getSideEffects().get("~metrics");
metrics = t.asAdmin().getSideEffects().get("~metrics");
内容来源于网络,如有侵权,请联系作者删除!