当前位置: 首页>>代码示例>>Java>>正文


Java Pipe类代码示例

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


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


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