本文整理汇总了Java中com.tinkerpop.blueprints.impls.neo4j2.Neo4j2Edge类的典型用法代码示例。如果您正苦于以下问题:Java Neo4j2Edge类的具体用法?Java Neo4j2Edge怎么用?Java Neo4j2Edge使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Neo4j2Edge类属于com.tinkerpop.blueprints.impls.neo4j2包,在下文中一共展示了Neo4j2Edge类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get_all_reaches_edges_with_member_access
import com.tinkerpop.blueprints.impls.neo4j2.Neo4j2Edge; //导入依赖的package包/类
public static List<Long> get_all_reaches_edges_with_member_access(Joern_db joern_db)
{
List<Long> edges = Pipeline.Vs().outE("REACHES").filter(
new PipeFunction<Neo4j2Edge,Boolean>()
{
public Boolean compute(Neo4j2Edge it)
{
String var = (String)(it.getProperty("var"));
return var.indexOf('.') != -1;
}
}
).id().toList();
return edges;
// List<Long> ids = new ArrayList<Long>();
// for(Neo4j2Edge e : edges)
// {
//Long it = e.getId();
// ids.add(it);
// }
// return ids;
// edges = joern_db.runGremlinQuery("g.V.outE(DATA_FLOW_EDGE).has('var').filter{it.var.contains('.')}.id")
// return edges
}
示例2: is_same_edge
import com.tinkerpop.blueprints.impls.neo4j2.Neo4j2Edge; //导入依赖的package包/类
static Boolean is_same_edge(Neo4j2Edge e1, Neo4j2Edge e2)
{
Neo4j2Vertex e1_s = e1.getProperty("start_node");
Neo4j2Vertex e2_s = e2.getProperty("start_node");
if((Long)e1_s.getId() != (Long)e2_s.getId()) return false;
Neo4j2Vertex e1_e = e1.getProperty("end_node");
Neo4j2Vertex e2_e = e2.getProperty("end_node");
if((Long)e1_e.getId() != (Long)e2_e.getId()) return false;
if(!e1.getProperty("type").equals(e2.getProperty("type"))) return false;
Set<String> p1 = e1.getPropertyKeys();
Set<String> p2 = e2.getPropertyKeys();
if(p1.size() != p2.size()) return false;
for(String it : p1)
{
if(!p2.contains(it)) return false;
if(!e1.getProperty(it).equals(e1.getProperty(it))) return false;
}
return true;
}
示例3: entityRepresentation
import com.tinkerpop.blueprints.impls.neo4j2.Neo4j2Edge; //导入依赖的package包/类
@Override
public Map<String, Object> entityRepresentation(Object entity) {
Map<String, Object> result = new HashMap<>();
if (entity instanceof Neo4j2Vertex) {
result.put(NODE_COLUMN_NAME, ((Neo4j2Vertex) entity).getRawVertex());
return result;
} else if (entity instanceof Neo4j2Edge) {
result.put(EDGE_COLUMN_NAME, ((Neo4j2Edge) entity).getRawEdge());
return result;
} else if (entity instanceof Neo4j2Graph) {
result.put(GRAPH_COLUMN_NAME, ((Neo4j2Graph) entity).getRawGraph().toString());
return result;
} else {
return super.entityRepresentation(entity);
}
}
示例4: getSingleRepresentation
import com.tinkerpop.blueprints.impls.neo4j2.Neo4j2Edge; //导入依赖的package包/类
static Representation getSingleRepresentation( Object result )
{
if ( result == null )
{
return ObjectToRepresentationConverter.getSingleRepresentation( result );
}
if (result instanceof Neo4j2Vertex)
{
return new NodeRepresentation( ((Neo4j2Vertex) result).getRawVertex() );
}
if ( result instanceof Neo4j2Edge)
{
return new RelationshipRepresentation( ((Neo4j2Edge) result).getRawEdge() );
}
if ( result instanceof Neo4j2Graph)
{
return ValueRepresentation.string( ((Neo4j2Graph) result).getRawGraph().toString() );
}
return ObjectToRepresentationConverter.getSingleRepresentation( result );
}
示例5: replace_for_edge
import com.tinkerpop.blueprints.impls.neo4j2.Neo4j2Edge; //导入依赖的package包/类
public static void replace_for_edge(Joern_db joern_db, Long edge_id)
{
List<Neo4j2Edge> ret = Pipeline.e(edge_id).toList();
String before = ret.get(0).getProperty("var");
String after = before.replaceAll("\\.", "->");
System.out.print("replacing in edge ");
System.out.println(edge_id);
System.out.println("\t" + before);
System.out.println("\t" + after);
// joern_db.runGremlinQuery("g.e(%s).setProperty('var', '%s')" % (edge_id, after))
joern_db.g.getEdge(edge_id).setProperty("var", after);
// print joern_db.runGremlinQuery("g.e(%s).var" % edge_id)
}
示例6: remove_duplicates
import com.tinkerpop.blueprints.impls.neo4j2.Neo4j2Edge; //导入依赖的package包/类
static List<Neo4j2Edge> remove_duplicates(List<Neo4j2Edge> list)
{
ArrayList<Neo4j2Edge> result = new ArrayList<>();
HashSet<Neo4j2Edge> set = new HashSet<>();
for(Neo4j2Edge it : list)
{
if(!set.contains(it))
{
result.add(it);
set.add(it);
}
}
return result;
}
示例7: remove_duplicated_edges_of_node
import com.tinkerpop.blueprints.impls.neo4j2.Neo4j2Edge; //导入依赖的package包/类
public static void remove_duplicated_edges_of_node(Joern_db joern_db, Long node_id)
{
// List<Neo4j2Edge> edges = joern_db.runGremlinQuery("g.v(%s).outE().gather{it}" % (node_id))
List<Neo4j2Edge> edges = Pipeline.v(node_id).outE().toList(); // left out the gather...
if(edges.size() == 0)
{
return;
}
edges = remove_duplicates(edges);
// print edges
HashSet<Long> edges_to_remove = new HashSet<>();
for(int i = 0, i_end = edges.size(); i < i_end; ++i)
{
// print "edges[" + str(i) + "]: ", edges[i]._id
// print "edges[" + str(i) + "] start: ", edges[i].start_node._id
// print "edges[" + str(i) + "] end: ", edges[i].end_node._id
// print "edges[" + str(i) + "] type: ", edges[i].type
// print "edges[" + str(i) + "] properties: ", edges[i].properties
for(int j = i+1, j_end = edges.size(); j < j_end; ++j)
{
if(is_same_edge(edges.get(i), edges.get(j)))
{
//# remove_edge[k] # run gremlin-query
// print "I'd remove edge", edges[k]._id, "; equal to", edges[i]._id
// print "Remove edge", edges[k]._id, ":", edges[k].start_node._id, "->", edges[k].end_node._id, ":", edges[k].properties["var"]
edges_to_remove.add((Long)edges.get(j).getId());
}
}
}
// print "edges_to_remove:", edges_to_remove
remove_edges_from_db(joern_db, edges_to_remove);
}
示例8: start
import com.tinkerpop.blueprints.impls.neo4j2.Neo4j2Edge; //导入依赖的package包/类
public Pipeline start(Neo4j2Edge object)
{
return (Pipeline)(super.start(object));
}