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

Java Pipe类代码示例

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

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



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

示例1: csvBatchImporterTest

import com.tinkerpop.pipes.Pipe; //导入依赖的package包/类
@Test
public void csvBatchImporterTest() throws java.lang.Exception
{

    CSVBatchImporter importer = new CSVBatchImporter();

    importer.setDbName("__TEST__1");
    try {
        importer.importCSVFiles(
                "test/src/resources/nodes.csv",
                "test/src/resources/edges.csv");
    }
    catch (OSchemaException exception) {
        exception.printStackTrace();
        throw exception;
    }

    OrientGraph graph = new OrientGraph(
            "plocal:" + System.getProperty("ORIENTDB_HOME") + "/databases/" + "__TEST__1");

    Pipe pipe = Gremlin.compile("_().map");
    pipe.setStarts(graph.getVertices());
}
 
开发者ID:octopus-platform,项目名称:bjoern,代码行数:24,代码来源:IntegrationTestClass.java


示例2: asPipe

import com.tinkerpop.pipes.Pipe; //导入依赖的package包/类
@Override
public Pipe asPipe() {
    Map<BooleanClause.Occur, Collection<BooleanClause>> groupedClauses = groupClauses();

    Pipe andPipe = null;
    Collection<Pipe> andPipes = processAndClauses(groupedClauses);
    andPipes.addAll(processNotClauses(groupedClauses));
    if (! andPipes.isEmpty()) {
        andPipe = new AndFilterPipe(andPipes.toArray(new Pipe[andPipes.size()]));
    }

    Collection<Pipe> orPipes = processOrClauses(groupedClauses);
    if (! orPipes.isEmpty()) {
        if (andPipe != null) {
            orPipes.add(andPipe);
        }
        return new OrFilterPipe(orPipes.toArray(new Pipe[orPipes.size()]));
    } else {
        return andPipe;
    }
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:22,代码来源:BooleanQueryExpression.java


示例3: processOrClauses

import com.tinkerpop.pipes.Pipe; //导入依赖的package包/类
private Collection<Pipe> processOrClauses(Map<BooleanClause.Occur, Collection<BooleanClause>> groupedClauses) {
    Collection<BooleanClause> shouldClauses = groupedClauses.get(BooleanClause.Occur.SHOULD);
    Collection<Pipe> orPipes = new ArrayList<>();
    if (shouldClauses != null) {
        for (BooleanClause shouldClause : shouldClauses) {
            QueryExpression queryExpression = queryFactory.create(shouldClause.getQuery(), resourceDefinition);
            // don't negate expression if we negated MUST_NOT -> SHOULD
            if (negate && shouldClause.getOccur() != BooleanClause.Occur.MUST_NOT) {
                queryExpression.setNegate();
            }
            properties.addAll(queryExpression.getProperties());
            orPipes.add(queryExpression.asPipe());
        }
    }
    return orPipes;
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:17,代码来源:BooleanQueryExpression.java


示例4: getQueryPipe

import com.tinkerpop.pipes.Pipe; //导入依赖的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


示例5: TestAtlasEntityQuery

import com.tinkerpop.pipes.Pipe; //导入依赖的package包/类
public TestAtlasEntityQuery(QueryExpression queryExpression,
                            ResourceDefinition resourceDefinition,
                            Request request,
                            GremlinPipeline initialPipeline,
                            Pipe queryPipe,
                            Pipe notDeletedPipe,
                            AtlasGraph graph,
                            VertexWrapper vWrapper) {

    super(queryExpression, resourceDefinition, request);
    this.initialPipeline = initialPipeline;
    this.queryPipe = queryPipe;
    this.notDeletedPipe = notDeletedPipe;
    this.graph = graph;
    this.vWrapper = vWrapper;
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:17,代码来源:AtlasEntityQueryTest.java


示例6: processNextStart

import com.tinkerpop.pipes.Pipe; //导入依赖的package包/类
public List processNextStart() {
    if (this.starts instanceof Pipe) {
        this.starts.next();
        final List path = ((Pipe) this.starts).getCurrentPath();
        if (null == this.pathFunctions) {
            return path;
        } else {
            final List closedPath = new Path();
            int nextFunction = 0;
            for (final Object object : path) {
                closedPath.add(this.pathFunctions[nextFunction].compute(object));
                nextFunction = (nextFunction + 1) % this.pathFunctions.length;
            }
            return closedPath;
        }
    } else {
        throw new NoSuchElementException("The start of this pipe was not a pipe");
    }
}
 
开发者ID:BrynCooke,项目名称:totorom,代码行数:20,代码来源:PathPipe.java


示例7: processNextStart

import com.tinkerpop.pipes.Pipe; //导入依赖的package包/类
public List processNextStart() {
    if (this.starts instanceof Pipe) {
        this.starts.next();
        final List path = ((Pipe) this.starts).getCurrentPath();
        if (null == this.pathFunctions) {
            return path;
        } else {
            final List closedPath = new ArrayList();
            int nextFunction = 0;
            for (final Object object : path) {
                closedPath.add(this.pathFunctions[nextFunction].compute(object));
                nextFunction = (nextFunction + 1) % this.pathFunctions.length;
            }
            return closedPath;
        }
    } else {
        throw new NoSuchElementException("The start of this pipe was not a pipe");
    }
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:20,代码来源:PathPipe.java


示例8: processNextStart

import com.tinkerpop.pipes.Pipe; //导入依赖的package包/类
public S processNextStart() {
    final S s = this.starts.next();
    final List path = ((Pipe) this.starts).getCurrentPath();
    Tree<Object> depth = this.tree;
    for (int i = 0; i < path.size(); i++) {
        Object object = path.get(i);
        if (null != this.branchFunctions) {
            object = this.branchFunctions.get(this.currentFunction).compute(object);
            this.currentFunction = (this.currentFunction + 1) % this.branchFunctions.size();
        }

        if (!depth.containsKey(object))
            depth.put(object, new Tree());

        depth = depth.get(object);
    }
    return s;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:19,代码来源:TreePipe.java


示例9: removePreviousPipes

import com.tinkerpop.pipes.Pipe; //导入依赖的package包/类
/**
 * A utility method to remove all the pipes back some partition step and return them as a list.
 *
 * @param namedStep the name of the step previous to remove from the pipeline
 * @return the removed pipes
 */
public static List<Pipe> removePreviousPipes(final Pipeline pipeline, final String namedStep) {
    final List<Pipe> previousPipes = new ArrayList<Pipe>();
    for (int i = pipeline.size() - 1; i >= 0; i--) {
        final Pipe pipe = pipeline.get(i);
        if (pipe instanceof AsPipe && ((AsPipe) pipe).getName().equals(namedStep)) {
            break;
        } else {
            previousPipes.add(0, pipe);
        }
    }
    for (int i = 0; i < previousPipes.size(); i++) {
        pipeline.remove(pipeline.size() - 1);
    }

    if (pipeline.size() == 1)
        pipeline.setStarts(pipeline.getStarts());

    return previousPipes;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:26,代码来源:FluentUtility.java


示例10: processNextStart

import com.tinkerpop.pipes.Pipe; //导入依赖的package包/类
public S processNextStart() {
    while (true) {
        final S s = this.starts.next();
        if (this.starts instanceof Pipe) {
            final List path = ((Pipe) this.starts).getCurrentPath();
            this.set.clear();
            this.set.addAll(path);
            if (path.size() == this.set.size()) {
                return s;
            }
        } else {
            return s;
        }
    }

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


示例11: processNextStart

import com.tinkerpop.pipes.Pipe; //导入依赖的package包/类
public S processNextStart() {
    int counter = 0;
    while (true) {
        counter++;
        final Pipe currentPipe = this.pipes.get(this.current);
        if (currentPipe.hasNext()) {
            final S s = (S) currentPipe.next();
            this.current = (this.current + 1) % this.total;
            return s;
        } else if (counter == this.total) {
            throw FastNoSuchElementException.instance();
        } else {
            this.current = (this.current + 1) % this.total;
        }
    }
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:17,代码来源:FairMergePipe.java


示例12: writeResult

import com.tinkerpop.pipes.Pipe; //导入依赖的package包/类
public void writeResult(Object result) throws IOException
{
	if (result == null)
	{
		writeMessage("");
	} else if (result instanceof Pipe)
	{
		StringBuilder sBuilder = new StringBuilder();
		Iterable<?> iterable = (Iterable<?>) result;
		for (Object obj : iterable)
		{
			if (obj != null)
			{
				sBuilder.append(obj.toString());
				sBuilder.append("\n");
			}
		}
		if (sBuilder.length() > 0)
		{
			sBuilder.deleteCharAt(sBuilder.length() - 1);
		}
		writeMessage(sBuilder.toString());
	} else
	{
		writeMessage(result.toString());
	}
}
 
开发者ID:octopus-platform,项目名称:bjoern,代码行数:28,代码来源:BjoernClientWriter.java


示例13: asPipe

import com.tinkerpop.pipes.Pipe; //导入依赖的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


示例14: asPipe

import com.tinkerpop.pipes.Pipe; //导入依赖的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


示例15: processAndClauses

import com.tinkerpop.pipes.Pipe; //导入依赖的package包/类
private Collection<Pipe> processAndClauses(Map<BooleanClause.Occur, Collection<BooleanClause>> groupedClauses) {
    Collection<BooleanClause> andClauses = groupedClauses.get(BooleanClause.Occur.MUST);
    Collection<Pipe> andPipes = new ArrayList<>();
    if (andClauses != null) {
        for (BooleanClause andClause : andClauses) {
            QueryExpression queryExpression = queryFactory.create(andClause.getQuery(), resourceDefinition);
            properties.addAll(queryExpression.getProperties());
            andPipes.add(queryExpression.asPipe());
        }
    }
    return andPipes;
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:13,代码来源:BooleanQueryExpression.java


示例16: processNotClauses

import com.tinkerpop.pipes.Pipe; //导入依赖的package包/类
private Collection<Pipe> processNotClauses(Map<BooleanClause.Occur, Collection<BooleanClause>> groupedClauses) {
    Collection<BooleanClause> notClauses = groupedClauses.get(BooleanClause.Occur.MUST_NOT);
    Collection<Pipe> notPipes = new ArrayList<>();
    if (notClauses != null) {
        for (BooleanClause notClause : notClauses) {
            QueryExpression queryExpression = queryFactory.create(notClause.getQuery(), resourceDefinition);
            queryExpression.setNegate();
            properties.addAll(queryExpression.getProperties());
            notPipes.add(queryExpression.asPipe());
        }
    }
    return notPipes;
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:14,代码来源:BooleanQueryExpression.java


示例17: asPipe

import com.tinkerpop.pipes.Pipe; //导入依赖的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


示例18: asPipe

import com.tinkerpop.pipes.Pipe; //导入依赖的package包/类
@Override
public Pipe asPipe() {
    //todo: encapsulate all of this path logic including path sep escaping and normalizing
    final int sepIdx = getField().indexOf(QueryFactory.PATH_SEP_TOKEN);
    final String edgeToken = getField().substring(0, sepIdx);
    GremlinPipeline pipeline = new GremlinPipeline();

    Relation relation = resourceDefinition.getRelations().get(fieldSegments[0]);
    if (relation != null) {
        pipeline = pipeline.outE();
        pipeline.add(relation.asPipe()).inV();
    } else {
        if (resourceDefinition.getProjections().get(fieldSegments[0]) != null) {
            return super.asPipe();
        } else {
            //todo: default Relation implementation
            pipeline = pipeline.outE().has("label", Text.REGEX, String.format(".*\\.%s", edgeToken)).inV();
        }
    }
    //todo: set resource definition from relation on underlying expression where appropriate
    String childFieldName = getField().substring(sepIdx + QueryFactory.PATH_SEP_TOKEN.length());
    underlyingExpression.setField(childFieldName);

    Pipe childPipe;
    if (childFieldName.contains(QueryFactory.PATH_SEP_TOKEN)) {
        childPipe = new ProjectionQueryExpression(underlyingExpression, resourceDefinition).asPipe();
    } else {
        childPipe = underlyingExpression.asPipe();
    }
    pipeline.add(childPipe);

    return negate ? new FilterFunctionPipe(new ExcludePipeFunction(pipeline)) : pipeline;
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:34,代码来源:ProjectionQueryExpression.java


示例19: executeQuery

import com.tinkerpop.pipes.Pipe; //导入依赖的package包/类
private List<Vertex> executeQuery() {
    GremlinPipeline pipeline = buildPipeline().as("root");
    Pipe expressionPipe = queryExpression.asPipe();

    // AlwaysQuery returns null for pipe
    return expressionPipe == null ? pipeline.toList() :
            pipeline.add(expressionPipe).back("root").toList();
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:9,代码来源:BaseQuery.java


示例20: buildPipeline

import com.tinkerpop.pipes.Pipe; //导入依赖的package包/类
protected GremlinPipeline buildPipeline() {
    GremlinPipeline pipeline = getRootVertexPipeline();
    Pipe queryPipe = getQueryPipe();
    if (queryPipe != null) {
        pipeline.add(queryPipe);
    }
    pipeline.add(getNotDeletedPipe());
    return pipeline;
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:10,代码来源:BaseQuery.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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