本文整理了Java中com.tinkerpop.blueprints.Direction.opposite()
方法的一些代码示例,展示了Direction.opposite()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Direction.opposite()
方法的具体详情如下:
包路径:com.tinkerpop.blueprints.Direction
类名称:Direction
方法名:opposite
暂无
代码示例来源:origin: org.jboss.windup.graph.frames/windup-frames
public Object processEdge(final Range annotation, final Method method, final Object[] arguments, final FramedGraph framedGraph, final Edge edge, final Direction direction) {
return framedGraph.frame(edge.getVertex(direction.opposite()), method.getReturnType());
}
代码示例来源:origin: com.tinkerpop/frames
public Object processEdge(final Range annotation, final Method method, final Object[] arguments, final FramedGraph framedGraph, final Edge edge, final Direction direction) {
return framedGraph.frame(edge.getVertex(direction.opposite()), method.getReturnType());
}
代码示例来源:origin: com.tinkerpop/frames
private void removeEdges(final Direction direction, final String label, final Vertex element, final Vertex otherVertex, final FramedGraph framedGraph) {
for (final Edge edge : element.getEdges(direction, label)) {
if (null == otherVertex || edge.getVertex(direction.opposite()).equals(otherVertex)) {
framedGraph.removeEdge(edge);
}
}
}
}
代码示例来源:origin: org.jboss.windup.graph.frames/windup-frames
private void removeEdges(final Direction direction, final String label, final Vertex element, final Vertex otherVertex, final FramedGraph framedGraph) {
for (final Edge edge : element.getEdges(direction, label)) {
if (null == otherVertex || edge.getVertex(direction.opposite()).equals(otherVertex)) {
framedGraph.removeEdge(edge);
}
}
}
}
代码示例来源:origin: thinkaurelius/faunus
@Override
public void setup(final Reducer.Context context) throws IOException, InterruptedException {
this.direction = Direction.valueOf(context.getConfiguration().get(LinkMapReduce.DIRECTION));
this.direction = this.direction.opposite();
this.vertex = new FaunusVertex(context.getConfiguration().getBoolean(FaunusCompiler.PATH_ENABLED, false));
}
代码示例来源:origin: thinkaurelius/faunus
@Override
public void setup(final Reducer.Context context) throws IOException, InterruptedException {
this.direction = Direction.valueOf(context.getConfiguration().get(DIRECTION));
this.direction = this.direction.opposite();
this.vertex = new FaunusVertex(context.getConfiguration().getBoolean(FaunusCompiler.PATH_ENABLED, false));
}
代码示例来源:origin: thinkaurelius/faunus
@Override
public void setup(final Reducer.Context context) throws IOException, InterruptedException {
this.direction = Direction.valueOf(context.getConfiguration().get(DIRECTION));
if (!this.direction.equals(BOTH))
this.direction = this.direction.opposite();
this.labels = context.getConfiguration().getStrings(LABELS);
this.vertex = new FaunusVertex(context.getConfiguration().getBoolean(FaunusCompiler.PATH_ENABLED, false));
}
代码示例来源:origin: thinkaurelius/faunus
@Override
public void reduce(final LongWritable key, final Iterable<Holder<FaunusVertex>> values, final Reducer<LongWritable, Holder<FaunusVertex>, NullWritable, FaunusVertex>.Context context) throws IOException, InterruptedException {
long edgesAggregated = 0;
this.vertex.reuse(key.get());
for (final Holder<FaunusVertex> holder : values) {
if (holder.getTag() == 's') {
edgesAggregated = edgesAggregated + ((List) holder.get().getEdges(direction.opposite())).size();
this.vertex.addEdges(direction.opposite(), holder.get());
} else {
this.vertex.addAll(holder.get());
}
}
context.write(NullWritable.get(), this.vertex);
context.getCounter(Counters.EDGES_ADDED).increment(edgesAggregated);
}
}
代码示例来源:origin: thinkaurelius/faunus
@Override
public void map(final NullWritable key, final FaunusVertex value, final Mapper<NullWritable, FaunusVertex, LongWritable, Holder<FaunusVertex>>.Context context) throws IOException, InterruptedException {
long edgesInverted = 0;
for (final Edge edge : value.getEdges(this.direction)) {
final long id = (Long) edge.getVertex(this.direction.opposite()).getId();
this.longWritable.set(id);
this.shellVertex.reuse(id);
this.shellVertex.addEdge(this.direction.opposite(), (FaunusEdge) edge);
context.write(this.longWritable, this.vertexHolder.set('s', this.shellVertex));
edgesInverted++;
}
this.longWritable.set(value.getIdAsLong());
context.write(this.longWritable, this.vertexHolder.set('r', value));
context.getCounter(Counters.EDGES_COPIED).increment(edgesInverted);
}
代码示例来源:origin: org.hawkular.titan/titan-core
@Override
public EdgeLabel make() {
TypeDefinitionMap definition = makeDefinition();
Preconditions.checkArgument(unidirectionality==Direction.BOTH || !getMultiplicity().isUnique(unidirectionality.opposite()),
"Unidirectional labels cannot have restricted multiplicity at the other end");
Preconditions.checkArgument(unidirectionality==Direction.BOTH || !hasSortKey() ||
!getMultiplicity().isUnique(unidirectionality),
"Unidirectional labels with restricted multiplicity cannot have a sort key");
Preconditions.checkArgument(unidirectionality!=Direction.IN || definition.getValue(HIDDEN,Boolean.class));
definition.setValue(UNIDIRECTIONAL, unidirectionality);
return tx.makeEdgeLabel(getName(), definition);
}
代码示例来源:origin: com.orientechnologies/orientdb-graphdb
public boolean filter(final OrientEdge iObject) {
if (targetVertex != null && !targetVertex.equals(iObject.getVertex(connection.getKey().opposite())))
return false;
return this.sourceVertex.settings.isUseVertexFieldsForEdgeLabels() || iObject.isLabeled(labels);
}
代码示例来源:origin: thinkaurelius/faunus
private void writeEdges(final Vertex vertex, final Direction direction, final DataOutput out) throws IOException {
final CounterMap<String> map = new CounterMap<String>();
for (final Edge edge : vertex.getEdges(direction)) {
map.incr(edge.getLabel(), 1);
}
WritableUtils.writeVInt(out, map.size());
for (final Map.Entry<String, Long> entry : map.entrySet()) {
out.writeUTF(entry.getKey());
WritableUtils.writeVInt(out, entry.getValue().intValue());
for (final Edge edge : vertex.getEdges(direction, entry.getKey())) {
WritableUtils.writeVLong(out, elementIdHandler.convertIdentifier(edge));
out.writeBoolean(false);
WritableUtils.writeVLong(out, 0);
writeProperties(edge, out);
WritableUtils.writeVLong(out, elementIdHandler.convertIdentifier(edge.getVertex(direction.opposite())));
}
}
}
代码示例来源:origin: com.orientechnologies/orientdb-graphdb
if (iVertexToRemove.equals(OrientEdge.getConnection(curr, direction.opposite()))) {
it.remove();
if (iAlsoInverse)
if (iVertexToRemove.equals(OrientEdge.getConnection(curr, direction.opposite()))) {
it.remove();
if (iAlsoInverse)
代码示例来源:origin: com.orientechnologies/orientdb-graphdb
@Override
public OIdentifiable getGraphElementRecord(final Object iObject) {
final ORecord rec = ((OIdentifiable) iObject).getRecord();
if (rec == null || !(rec instanceof ODocument))
return null;
final ODocument value = (ODocument) rec;
final OIdentifiable v;
OImmutableClass immutableClass = ODocumentInternal.getImmutableSchemaClass(value);
if (immutableClass.isVertexType()) {
// DIRECT VERTEX
v = value;
} else if (immutableClass.isEdgeType()) {
// EDGE
if (vertex.settings.isUseVertexFieldsForEdgeLabels() || OrientEdge.isLabeled(OrientEdge.getRecordLabel(value), iLabels))
v = OrientEdge.getConnection(value, connection.getKey().opposite());
else
v = null;
} else
throw new IllegalStateException("Invalid content found between connections: " + value);
return v;
}
代码示例来源:origin: org.hawkular.titan/titan-core
int vertexcompare = AbstractElement.compare(r1.getVertex(EdgeDirection.position(dir1.opposite())),
r2.getVertex(EdgeDirection.position(dir1.opposite())));
if (vertexcompare != 0) return vertexcompare;
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-orient-graph
@Override
public Vertex createWrapper(final Object iObject) {
if (iObject instanceof OrientVertex)
return (OrientVertex) iObject;
final ODocument value = ((OIdentifiable) iObject).getRecord();
final OrientVertex v;
if (value.getSchemaClass().isSubClassOf(OrientVertex.CLASS_NAME)) {
// DIRECT VERTEX
v = new OrientVertex(vertex.graph, value);
} else if (value.getSchemaClass().isSubClassOf(OrientEdge.CLASS_NAME)) {
// EDGE
if (vertex.graph.isUseVertexFieldsForEdgeLabels() || OrientEdge.isLabeled(OrientEdge.getRecordLabel(value), iLabels))
v = new OrientVertex(vertex.graph, OrientEdge.getConnection(value, connection.getKey().opposite()));
else
v = null;
} else
throw new IllegalStateException("Invalid content found between connections:" + value);
return v;
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-orient-graph
OrientEdge.getRecordLabel(fieldRecord), iLabels)) {
final OIdentifiable vertexDoc = OrientEdge.getConnection(
fieldRecord, connection.getKey().opposite());
if (vertexDoc == null) {
fieldRecord.reload();
"Cannot load edge " + fieldRecord
+ " to get the "
+ connection.getKey().opposite()
+ " vertex");
return;
代码示例来源:origin: com.orientechnologies/orientdb-graphdb
OIdentifiable vertexDoc = OrientEdge.getConnection(fieldRecord, connection.getKey().opposite());
if (vertexDoc == null) {
vertexDoc = OrientEdge.getConnection(fieldRecord, connection.getKey().opposite());
.warn(this, "Cannot load edge " + fieldRecord + " to get the " + connection.getKey().opposite() + " vertex");
return;
代码示例来源:origin: com.orientechnologies/orientdb-graphdb
Object targetVertex = OrientEdge.getConnection(fieldRecord, connection.getKey().opposite());
代码示例来源:origin: org.hawkular.titan/titan-core
TitanVertex oth = edge.getVertex(dir.opposite());
assert oth instanceof TitanSchemaVertex;
TypeDefinitionDescription desc = edge.getProperty(BaseKey.SchemaDefinitionDesc);
内容来源于网络,如有侵权,请联系作者删除!