• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PipeFunction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.tinkerpop.pipes.PipeFunction的典型用法代码示例。如果您正苦于以下问题:Java PipeFunction类的具体用法?Java PipeFunction怎么用?Java PipeFunction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PipeFunction类属于com.tinkerpop.pipes包,在下文中一共展示了PipeFunction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: get_all_reaches_edges_with_member_access

import com.tinkerpop.pipes.PipeFunction; //导入依赖的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
   }
 
开发者ID:RUB-SysSec,项目名称:EvilCoder,代码行数:26,代码来源:Replace_member_edges.java


示例2: functionToStatements

import com.tinkerpop.pipes.PipeFunction; //导入依赖的package包/类
public Pipeline functionToStatements()
{
 return (Pipeline)(this.transform(
          new PipeFunction<Neo4j2Vertex,List<Neo4j2Vertex>>()
           {
            public List<Neo4j2Vertex> compute(Neo4j2Vertex it)
             {
             List<Node> tmp = Joern_db.queryNodeIndex("isCFGNode:True AND functionId:" + it.getId().toString());
             List<Neo4j2Vertex> ret = new ArrayList<>();
               for(Node n : tmp)
                {
                 ret.add(new Neo4j2Vertex(n, Joern_db.g) );
                }
              return ret;
             }
           }
        ).scatter());
}
 
开发者ID:RUB-SysSec,项目名称:EvilCoder,代码行数:19,代码来源:Pipeline.java


示例3: getQueryPipe

import com.tinkerpop.pipes.PipeFunction; //导入依赖的package包/类
@Override
protected Pipe getQueryPipe() {
    GremlinPipeline p;
    if (guid.equals("*")) {
        p = new GremlinPipeline().has(Constants.ENTITY_TEXT_PROPERTY_KEY).
                hasNot(Constants.ENTITY_TYPE_PROPERTY_KEY, "Taxonomy").outE();
    } else {
        p = new GremlinPipeline().has(Constants.GUID_PROPERTY_KEY, guid).outE();
    }
    //todo: this is basically the same pipeline used in TagRelation.asPipe()
    p.add(new FilterFunctionPipe<>(new PipeFunction<Edge, Boolean>() {
        @Override
        public Boolean compute(Edge edge) {
            String type = edge.getVertex(Direction.OUT).getProperty(Constants.ENTITY_TYPE_PROPERTY_KEY);
            VertexWrapper v = new TermVertexWrapper(edge.getVertex(Direction.IN));
            return edge.getLabel().startsWith(type) && v.getPropertyKeys().contains("available_as_tag");
        }
    }));

    return p.inV();
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:22,代码来源:AtlasEntityTagQuery.java


示例4: getTagProjection

import com.tinkerpop.pipes.PipeFunction; //导入依赖的package包/类
private RelationProjection getTagProjection() {
    Relation traitRelation = new TagRelation();
    RelationProjection tagProjection = new RelationProjection("tags", Collections.singleton("name"),
            traitRelation, Projection.Cardinality.MULTIPLE);
    tagProjection.addPipe(new TransformFunctionPipe<>(
            new PipeFunction<Collection<ProjectionResult>, Collection<ProjectionResult>>() {
                @Override
                public Collection<ProjectionResult> compute(Collection<ProjectionResult> results) {
                    for (ProjectionResult result : results) {
                        for (Map<String, Object> properties : result.getPropertyMaps()) {
                            properties.put("href", String.format("v1/entities/%s/tags/%s",
                                    result.getStartingVertex().getProperty("id"), properties.get("name")));
                        }
                    }
                    return results;
                }
            }));
    return tagProjection;
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:20,代码来源:EntityResourceDefinition.java


示例5: getDefaultRelationProjection

import com.tinkerpop.pipes.PipeFunction; //导入依赖的package包/类
private RelationProjection getDefaultRelationProjection() {
    Relation genericRelation = new GenericRelation(this);
    RelationProjection relationProjection = new RelationProjection(
            "relations",
            Arrays.asList("type", "id", "name"),
            genericRelation, Projection.Cardinality.MULTIPLE);

    relationProjection.addPipe(new TransformFunctionPipe<>(
            new PipeFunction<Collection<ProjectionResult>, Collection<ProjectionResult>>() {
                @Override
                public Collection<ProjectionResult> compute(Collection<ProjectionResult> results) {
                    for (ProjectionResult result : results) {
                        for (Map<String, Object> properties : result.getPropertyMaps()) {
                            properties.put("href", String.format("v1/entities/%s", properties.get("id")));
                        }
                    }
                    return results;
                }
            }));
    return relationProjection;
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:22,代码来源:EntityResourceDefinition.java


示例6: getHierarchyProjection

import com.tinkerpop.pipes.PipeFunction; //导入依赖的package包/类
private Projection getHierarchyProjection() {
    final String projectionName = "hierarchy";
    return new Projection(projectionName, Projection.Cardinality.SINGLE,
            new TransformFunctionPipe<>(new PipeFunction<VertexWrapper, Collection<ProjectionResult>>() {
                @Override
                public Collection<ProjectionResult> compute(VertexWrapper start) {
                    Map<String, Object> map = new TreeMap<>(new ResourceComparator());

                    TermPath termPath = new TermPath(start.getVertex().<String>getProperty(
                            Constants.ENTITY_TYPE_PROPERTY_KEY));

                    map.put("path", termPath.getPath());
                    map.put("short_name", termPath.getShortName());
                    map.put("taxonomy", termPath.getTaxonomyName());

                    return Collections.singleton(new ProjectionResult(projectionName, start,
                            Collections.singleton(map)));
                }
            }));

}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:22,代码来源:TermResourceDefinition.java


示例7: testBulkLoading

import com.tinkerpop.pipes.PipeFunction; //导入依赖的package包/类
@Test
public void testBulkLoading() throws Exception {
    bulkLoadGraphOfTheGods(f1);
    clopen();
    assertEquals(12, new GremlinPipeline(g).V().count());
    assertEquals(17, new GremlinPipeline(g).E().count());
    new GremlinPipeline(g).V().sideEffect(new PipeFunction<Vertex, Vertex>() {
        @Override
        public Vertex compute(Vertex vertex) {
            assertEquals(2, vertex.getPropertyKeys().size());
            assertNotNull(vertex.getProperty("name"));
            return vertex;
        }
    }).iterate();
    assertEquals("saturn", new GremlinPipeline(g).V("name", "hercules").out("father").out("father").property("name").next());
    List names = new GremlinPipeline(g).V("name", "hercules").outE("battled").sideEffect(new PipeFunction<Edge, Edge>() {
        @Override
        public Edge compute(Edge edge) {
            assertNotNull(edge.getProperty("time"));
            return edge;
        }
    }).inV().property("name").toList();
    assertTrue(names.contains("nemean"));
    assertTrue(names.contains("hydra"));
    assertTrue(names.contains("cerberus"));
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:27,代码来源:TitanOutputFormatTest.java


示例8: testBulkVertexPropertyDeletions

import com.tinkerpop.pipes.PipeFunction; //导入依赖的package包/类
@Test
public void testBulkVertexPropertyDeletions() throws Exception {
    bulkLoadGraphOfTheGods(f1);
    new HadoopPipeline(f2).V().sideEffect("{it.removeProperty('name')}").submit();
    clopen();
    assertEquals(12, new GremlinPipeline(g).V().count());
    assertEquals(17, new GremlinPipeline(g).E().count());

    for (Vertex v : g.getVertices()) {
        assertNull(v.getProperty("name"));
        assertEquals(1, v.getPropertyKeys().size());
    }
    new GremlinPipeline(g).V("name", "hercules").outE("battled").sideEffect(new PipeFunction<Edge, Edge>() {
        @Override
        public Edge compute(Edge edge) {
            assertNotNull(edge.getProperty("time"));
            return edge;
        }
    }).iterate();
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:21,代码来源:TitanOutputFormatTest.java


示例9: sideEffect

import com.tinkerpop.pipes.PipeFunction; //导入依赖的package包/类
/**
 * Add sideEffect step to the traversal engine
 *
 * @param sideEffectFunction
 *            the function of the pipe
 * @return the extended Stream
 */
public CachedTraversalEngine sideEffect(final PipeFunction sideEffectFunction) {
	if (isPathEnabled) {
		List intermediate = (List) stream.map(e -> {
			sideEffectFunction.compute(e);
			return e;
		}).collect(Collectors.toList());
		if (isParallel) {
			stream = intermediate.parallelStream();
		} else {
			stream = intermediate.stream();
		}
	} else {
		stream = stream.map(e -> {
			sideEffectFunction.compute(e);
			return e;
		});
	}
	// Step Update
	final Class[] args = new Class[1];
	args[0] = PipeFunction.class;
	final Step step = new Step(this.getClass().getName(), "sideEffect", args, sideEffectFunction);
	stepList.add(step);
	return this;
}
 
开发者ID:JaewookByun,项目名称:epcis,代码行数:32,代码来源:CachedTraversalEngine.java


示例10: SelectPipe

import com.tinkerpop.pipes.PipeFunction; //导入依赖的package包/类
public SelectPipe(final Collection<String> stepNames, final List<AsPipe> allPreviousAsPipes, final PipeFunction... stepFunctions) {
    this.stepFunctions = stepFunctions;
    this.stepNames = stepNames;

    if (this.doFunctions = this.stepFunctions.length > 0)
        currentFunction = 0;

    final List<String> tempNames = new ArrayList<String>();
    for (final AsPipe asPipe : allPreviousAsPipes) {
        final String columnName = asPipe.getName();
        if (null == this.stepNames || this.stepNames.contains(columnName)) {
            tempNames.add(columnName);
            this.asPipes.add(asPipe);
        }
    }

    if (tempNames.size() > 0)
        this.columnNames = tempNames;
    else
        this.columnNames = null;

}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:23,代码来源:SelectPipe.java


示例11: TablePipe

import com.tinkerpop.pipes.PipeFunction; //导入依赖的package包/类
public TablePipe(final Table table, final Collection<String> stepNames, final List<AsPipe> allPreviousAsPipes, final PipeFunction... columnFunctions) {
    this.table = table;
    this.columnFunctions = columnFunctions;
    this.stepNames = stepNames;

    if (this.doFunctions = this.columnFunctions.length > 0)
        currentFunction = 0;

    final List<String> tempNames = new ArrayList<String>();
    for (final AsPipe asPipe : allPreviousAsPipes) {
        final String columnName = asPipe.getName();
        if (null == this.stepNames || this.stepNames.contains(columnName)) {
            tempNames.add(columnName);
            this.asPipes.add(asPipe);
        }
    }

    if (tempNames.size() > 0)
        table.setColumnNames(tempNames.toArray(new String[tempNames.size()]));

}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:22,代码来源:TablePipe.java


示例12: asPipe

import com.tinkerpop.pipes.PipeFunction; //导入依赖的package包/类
@Override
public Pipe asPipe() {
    return new FilterFunctionPipe<>(new PipeFunction<Edge, Boolean>() {
        @Override
        public Boolean compute(Edge edge) {
            String name = edge.getVertex(Direction.OUT).getProperty(Constants.ENTITY_TYPE_PROPERTY_KEY);
            if (edge.getLabel().startsWith(name)) {
                VertexWrapper v = new TermVertexWrapper(edge.getVertex(Direction.IN));
                return ! v.getPropertyKeys().contains("available_as_tag") && ! isDeleted(v.getVertex());
            } else {
                return false;
            }
        }
    });
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:16,代码来源:TraitRelation.java


示例13: asPipe

import com.tinkerpop.pipes.PipeFunction; //导入依赖的package包/类
@Override
public Pipe asPipe() {
    return new FilterFunctionPipe<>(new PipeFunction<Edge, Boolean>() {
        @Override
        public Boolean compute(Edge edge) {
            String name = edge.getVertex(Direction.OUT).getProperty(Constants.ENTITY_TYPE_PROPERTY_KEY);
            if (edge.getLabel().startsWith(name)) {
                VertexWrapper v = new TermVertexWrapper(edge.getVertex(Direction.IN));
                return v.getPropertyKeys().contains("available_as_tag") && ! isDeleted(v.getVertex());
            } else {
                return false;
            }
        }
    });
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:16,代码来源:TagRelation.java


示例14: asPipe

import com.tinkerpop.pipes.PipeFunction; //导入依赖的package包/类
public Pipe asPipe() {
    return new FilterFunctionPipe(new PipeFunction<Vertex, Boolean>() {
        @Override
        public Boolean compute(Vertex vertex) {
            return evaluate(new VertexWrapper(vertex, resourceDefinition));
        }
    });
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:9,代码来源:BaseQueryExpression.java


示例15: getTermProjection

import com.tinkerpop.pipes.PipeFunction; //导入依赖的package包/类
private Projection getTermProjection() {
    return new Projection("term", Projection.Cardinality.SINGLE,
            new TransformFunctionPipe<>(new PipeFunction<VertexWrapper, Collection<ProjectionResult>>() {
                @Override
                public Collection<ProjectionResult> compute(VertexWrapper start) {
                    Map<String, Object> map = new TreeMap<>(new ResourceComparator());

                    StringBuilder sb = new StringBuilder();
                    sb.append("v1/taxonomies/");

                    String fullyQualifiedName = start.getVertex().getProperty(Constants.ENTITY_TYPE_PROPERTY_KEY);
                    String[] paths = fullyQualifiedName.split("\\.");
                    // first path segment is the taxonomy
                    sb.append(paths[0]);

                    for (int i = 1; i < paths.length; ++i) {
                        String path = paths[i];
                        if (path != null && !path.isEmpty()) {
                            sb.append("/terms/");
                            sb.append(path);
                        }
                    }

                    map.put("href", sb.toString());
                    return Collections.singleton(new ProjectionResult("term", start,
                            Collections.singleton(map)));
                }
            }));
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:30,代码来源:EntityTagResourceDefinition.java


示例16: getSubTermProjection

import com.tinkerpop.pipes.PipeFunction; //导入依赖的package包/类
private Projection getSubTermProjection() {
    //todo: combine with other term projections
    final String termsProjectionName = "terms";
    return new Projection(termsProjectionName, Projection.Cardinality.SINGLE,
            new TransformFunctionPipe<>(new PipeFunction<VertexWrapper, Collection<ProjectionResult>>() {
                @Override
                public Collection<ProjectionResult> compute(VertexWrapper start) {
                    Map<String, Object> map = new TreeMap<>(new ResourceComparator());

                    StringBuilder sb = new StringBuilder();
                    sb.append("v1/taxonomies/");

                    TermPath termPath = new TermPath(start.getVertex().<String>getProperty(Constants.ENTITY_TYPE_PROPERTY_KEY));
                    String[] paths = termPath.getPathSegments();
                    sb.append(termPath.getTaxonomyName());

                    for (String path : paths) {
                        //todo: shouldn't need to check for null or empty after TermPath addition
                        if (path != null && !path.isEmpty()) {
                            sb.append("/terms/");
                            sb.append(path);
                        }
                    }
                    sb.append("/terms");

                    map.put("href", sb.toString());
                    return Collections.singleton(new ProjectionResult(termsProjectionName, start,
                            Collections.singleton(map)));
                }
            }));
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:32,代码来源:TermResourceDefinition.java


示例17: getTermsProjection

import com.tinkerpop.pipes.PipeFunction; //导入依赖的package包/类
private Projection getTermsProjection() {
    final String termsProjectionName = "terms";
    return new Projection(termsProjectionName, Projection.Cardinality.SINGLE,
            new TransformFunctionPipe<>(new PipeFunction<VertexWrapper, Collection<ProjectionResult>>() {
                private String baseHref = "v1/taxonomies/";
                @Override
                public Collection<ProjectionResult> compute(VertexWrapper v) {
                    Map<String, Object> map = new HashMap<>();
                    map.put("href", baseHref + v.getProperty("name") + "/terms");
                    return Collections.singleton(new ProjectionResult(termsProjectionName, v,
                            Collections.singleton(map)));
                }
            }));
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:15,代码来源:TaxonomyResourceDefinition.java


示例18: getInputSteps

import com.tinkerpop.pipes.PipeFunction; //导入依赖的package包/类
public static List<Vertex> getInputSteps( Graph g ) {
  GremlinPipeline<Vertex, Vertex> pipe = new GremlinPipeline<>( g );
  return pipe.V().filter( new PipeFunction<Vertex, Boolean>() {
    @Override
    public Boolean compute( Vertex vertex ) {
      return Iterables.isEmpty( vertex.getEdges( Direction.IN ) );
    }
  } ).toList();
}
 
开发者ID:mattyb149,项目名称:pdi-layout,代码行数:10,代码来源:GraphUtils.java


示例19: compareProperty

import com.tinkerpop.pipes.PipeFunction; //导入依赖的package包/类
private PipeFunction<Pair<Vertex, Vertex>, Integer> compareProperty( final String key ) {
  return new PipeFunction<Pair<Vertex, Vertex>, Integer>() {
    @Override public Integer compute( Pair<Vertex, Vertex> argument ) {
      return Integer.compare(
        argument.getA().<Integer>getProperty( key ),
        argument.getB().<Integer>getProperty( key )
      );
    }
  };
}
 
开发者ID:mattyb149,项目名称:pdi-layout,代码行数:11,代码来源:HorizontalLayoutTest.java


示例20: getVertexesForSubject

import com.tinkerpop.pipes.PipeFunction; //导入依赖的package包/类
public static List<Vertex> getVertexesForSubject(
		NerdleFact questionExtraction, TinkerGraph graph) {
	final List<NerdleArg> questionsArguments = questionExtraction
			.getArguments();
	final NerdlePredicate questionPredicate = questionExtraction
			.getPredicate();

	GremlinPipeline<Iterable<Vertex>, Vertex> pipeline = new GremlinPipeline<Iterable<Vertex>, Vertex>();
	pipeline.filter(new PipeFunction<Vertex, Boolean>() {

		@Override
		public Boolean compute(Vertex vertex) {

			NerdleFact transform = NerdleGraphTransformer.transform(vertex);

			for (NerdleArg arg : transform.getArguments()) {

				boolean match = FuzzyStringMatcher.fuzzyArgumentMatcher(
						questionsArguments, arg.getText());

				if (match)
					return true;

			}

			return false;

		}

	});

	pipeline.start(graph.getVertices(NerdleGraphTransformer.PROPERTY_LEMMA,
			questionPredicate.getLemma()));
	List<Vertex> list = pipeline.toList();
	return list;
}
 
开发者ID:impro3-nerdle,项目名称:nerdle,代码行数:37,代码来源:GraphMatcher.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SlidrConfig类代码示例发布时间:2022-05-22
下一篇:
Java AddBlockRequestProto类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap