org.eclipse.rdf4j.query.algebra.Group Java Examples

The following examples show how to use org.eclipse.rdf4j.query.algebra.Group. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GroupBlock.java    From semagrow with Apache License 2.0 6 votes vote down vote up
private Stream<Plan> getGroupPlan(CompilerContext context, Plan p) {

        Collection<GroupElem> groupElems = this.aggregations.entrySet().stream()
                .map(entry -> new GroupElem(entry.getKey(), entry.getValue()))
                .collect(Collectors.toList());

        Stream<Plan> stream1 = Stream.of(context.asPlan(new Group(p, getGroupedVariables(), groupElems)));

        RequestedPlanProperties props = new RequestedPlanProperties();
        props.setDataProperties(RequestedDataProperties.forGrouping(getGroupedVariables()));
        Collection<Plan> p1 = context.enforceProps(p, props);
        Stream<Plan> stream2 = p1.stream().flatMap(p2 ->
                Stream.of(context.asPlan(new StreamGroup(p2, getGroupedVariables(), groupElems))));

        return Stream.concat(stream1, stream2);
    }
 
Example #2
Source File: GroupIterator.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public GroupIterator(EvaluationStrategy strategy, Group group, BindingSet parentBindings,
		long iterationCacheSyncThreshold) throws QueryEvaluationException {
	this.strategy = strategy;
	this.group = group;
	this.parentBindings = parentBindings;
	this.iterationCacheSyncThreshold = iterationCacheSyncThreshold;

	if (this.iterationCacheSyncThreshold > 0) {
		try {
			this.tempFile = File.createTempFile("group-eval", null);
		} catch (IOException e) {
			throw new QueryEvaluationException("could not initialize temp db", e);
		}
		this.db = DBMaker.newFileDB(tempFile).deleteFilesAfterClose().closeOnJvmShutdown().make();
	} else {
		this.tempFile = null;
		this.db = null;
	}
}
 
Example #3
Source File: TupleExprBuilder.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public Group visit(ASTGroupClause node, Object data) throws VisitorException {
	TupleExpr tupleExpr = (TupleExpr) data;
	Group g = new Group(tupleExpr);
	int childCount = node.jjtGetNumChildren();

	List<String> groupBindingNames = new ArrayList<>();
	for (int i = 0; i < childCount; i++) {
		String name = (String) node.jjtGetChild(i).jjtAccept(this, g);
		groupBindingNames.add(name);
	}

	g.setGroupBindingNames(groupBindingNames);

	return g;
}
 
Example #4
Source File: SpinRenderer.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void meet(Group node) throws RDFHandlerException {
	group = node;
	Set<String> groupNames = node.getGroupBindingNames();
	if (!groupNames.isEmpty()) {
		Resource groupByList = valueFactory.createBNode();
		handler.handleStatement(valueFactory.createStatement(subject, SP.GROUP_BY_PROPERTY, groupByList));
		ListContext groupByCtx = newList(groupByList);
		for (String groupName : groupNames) {
			Resource var = getVar(groupName);
			listEntry(var);
		}
		endList(groupByCtx);
	}
}
 
Example #5
Source File: TopologyFactory.java    From rya with Apache License 2.0 5 votes vote down vote up
@Override
public void meet(final Group node) throws TopologyBuilderException {
    final String id = AGGREGATION_PREFIX + UUID.randomUUID();
    final Optional<Side> side = getSide(node);
    final AggregationProcessorSupplier supplier = new AggregationProcessorSupplier(id, node, (result) -> getResult(side, result));
    entries.add( new ProcessorEntry(node, id, side, supplier, Lists.newArrayList(node.getArg())) );
    idMap.put(node, id);
    super.meet(node);
}
 
Example #6
Source File: AggregationProcessorSupplier.java    From rya with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs an instance of {@link AggregationProcessor}.
 *
 * @param stateStoreName - The name of the Kafka Streams state store that this processor will use. (not null)
 * @param aggNode - The group by node that configures how the aggregations will be performed. (not null)
 * @param resultFactory - The factory that will format this processor's final results for the downstream
 *   processor. (not null)
 */
public AggregationProcessor(
        final String stateStoreName,
        final Group aggNode,
        final ProcessorResultFactory resultFactory) {
    super(resultFactory);
    this.stateStoreName = requireNonNull(stateStoreName);
    this.aggNode = requireNonNull(aggNode);
}
 
Example #7
Source File: AggregationProcessorSupplier.java    From rya with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs an instance of {@link AggregationProcessorSupplier}.
 *
 * @param stateStoreName - The name of the state store the processor will use. (not null)
 * @param aggNode - Defines which aggregations will be performed by the processor. (not null)
 * @param resultFactory - The factory that the supplied processors will use to create results. (not null)
 */
public AggregationProcessorSupplier(
        final String stateStoreName,
        final Group aggNode,
        final ProcessorResultFactory resultFactory) {
    super(resultFactory);
    this.stateStoreName = requireNonNull(stateStoreName);
    this.aggNode = requireNonNull(aggNode);
}
 
Example #8
Source File: AggregationsEvaluator.java    From rya with Apache License 2.0 5 votes vote down vote up
/**
 * Make an instance of {@link AggregationsEvaluator} based on a {@link Group} node.
 *
 * @param aggStateStore - The mechanism for storing aggregation state. (not null)
 * @param aggNode - Defines which aggregation functions need to be performed.
 * @param groupByVars - The names of the binding whose values are used to group aggregation results. (not null)
 * @return The evaluator that handles the node's aggregations.
 */
public static  AggregationsEvaluator make(final AggregationStateStore aggStateStore, final Group aggNode, final List<String> groupByVars) {
    requireNonNull(aggStateStore);
    requireNonNull(aggNode);
    requireNonNull(groupByVars);

    // The aggregations that need to be performed are the Group Elements.
    final List<AggregationElement> aggregations = new ArrayList<>();
    for(final GroupElem groupElem : aggNode.getGroupElements()) {
        // Figure out the type of the aggregation.
        final AggregateOperator operator = groupElem.getOperator();
        final Optional<AggregationType> type = AggregationType.byOperatorClass( operator.getClass() );

        // If the type is one we support, create the AggregationElement.
        if(type.isPresent()) {
            final String resultBindingName = groupElem.getName();

            final AtomicReference<String> aggregatedBindingName = new AtomicReference<>();
            groupElem.visitChildren(new AbstractQueryModelVisitor<RuntimeException>() {
                @Override
                public void meet(final Var node) {
                    aggregatedBindingName.set( node.getName() );
                }
            });

            aggregations.add( new AggregationElement(type.get(), aggregatedBindingName.get(), resultBindingName) );
        }
    }

    return new AggregationsEvaluator(aggStateStore, aggregations, groupByVars);
}
 
Example #9
Source File: HalyardTupleExprEvaluation.java    From Halyard with Apache License 2.0 5 votes vote down vote up
/**
 * Evaluate {@link Group} query model nodes
 * @param parent
 * @param group
 * @param bindings
 */
private void evaluateGroup(BindingSetPipe parent, Group group, BindingSet bindings) {
    //temporary solution using copy of the original iterator
    //re-writing this to push model is a bit more complex task
    try {
        HalyardStatementPatternEvaluation.enqueue(parent, new GroupIterator(parentStrategy, group, bindings), group);
    } catch (QueryEvaluationException e) {
        parent.handleException(e);
    }
}
 
Example #10
Source File: HalyardTupleExprEvaluation.java    From Halyard with Apache License 2.0 5 votes vote down vote up
/**
 * Switch logic for evaluation of any instance of a {@link UnaryTupleOperator} query model node
 * @param parent
 * @param expr
 * @param bindings
 */
private void evaluateUnaryTupleOperator(BindingSetPipe parent, UnaryTupleOperator expr, BindingSet bindings) {
    if (expr instanceof Projection) {
        evaluateProjection(parent, (Projection) expr, bindings);
    } else if (expr instanceof MultiProjection) {
        evaluateMultiProjection(parent, (MultiProjection) expr, bindings);
    } else if (expr instanceof Filter) {
        evaluateFilter(parent, (Filter) expr, bindings);
    } else if (expr instanceof Service) {
        evaluateService(parent, (Service) expr, bindings);
    } else if (expr instanceof Slice) {
        evaluateSlice(parent, (Slice) expr, bindings);
    } else if (expr instanceof Extension) {
        evaluateExtension(parent, (Extension) expr, bindings);
    } else if (expr instanceof Distinct) {
        evaluateDistinct(parent, (Distinct) expr, bindings);
    } else if (expr instanceof Reduced) {
        evaluateReduced(parent, (Reduced) expr, bindings);
    } else if (expr instanceof Group) {
        evaluateGroup(parent, (Group) expr, bindings);
    } else if (expr instanceof Order) {
        evaluateOrder(parent, (Order) expr, bindings);
    } else if (expr instanceof QueryRoot) {
        parentStrategy.sharedValueOfNow = null;
        evaluateTupleExpr(parent, ((QueryRoot) expr).getArg(), bindings);
    } else if (expr instanceof DescribeOperator) {
        evaluateDescribeOperator(parent, (DescribeOperator) expr, bindings);
    } else if (expr == null) {
        parent.handleException(new IllegalArgumentException("expr must not be null"));
    } else {
        parent.handleException(new QueryEvaluationException("Unknown unary tuple operator type: " + expr.getClass()));
    }
}
 
Example #11
Source File: GroupIteratorTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testSumNotZero() throws QueryEvaluationException {
	Group group = new Group(NONEMPTY_ASSIGNMENT);
	group.addGroupElement(new GroupElem("sum", new Sum(new Var("a"))));
	GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance());

	assertThat(gi.next().getBinding("sum").getValue()).isEqualTo(vf.createLiteral("45", XMLSchema.INTEGER));
}
 
Example #12
Source File: GroupIteratorTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testCountNotZero() throws QueryEvaluationException {
	Group group = new Group(NONEMPTY_ASSIGNMENT);
	group.addGroupElement(new GroupElem("count", new Count(new Var("a"))));
	GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance());

	assertThat(gi.next().getBinding("count").getValue()).isEqualTo(vf.createLiteral("9", XMLSchema.INTEGER));
}
 
Example #13
Source File: GroupIteratorTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testGroupConcatEmptySet() throws QueryEvaluationException {
	Group group = new Group(EMPTY_ASSIGNMENT);
	group.addGroupElement(new GroupElem("groupconcat", new GroupConcat(new Var("a"))));
	GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance());

	assertThat(gi.next().getBinding("groupconcat").getValue())
			.describedAs("GROUP_CONCAT on empty set should result in empty string")
			.isEqualTo(vf.createLiteral(""));
}
 
Example #14
Source File: StrictEvaluationStrategy.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(UnaryTupleOperator expr,
		BindingSet bindings) throws QueryEvaluationException {
	if (expr instanceof Projection) {
		return evaluate((Projection) expr, bindings);
	} else if (expr instanceof MultiProjection) {
		return evaluate((MultiProjection) expr, bindings);
	} else if (expr instanceof Filter) {
		return evaluate((Filter) expr, bindings);
	} else if (expr instanceof Service) {
		return evaluate((Service) expr, bindings);
	} else if (expr instanceof Slice) {
		return evaluate((Slice) expr, bindings);
	} else if (expr instanceof Extension) {
		return evaluate((Extension) expr, bindings);
	} else if (expr instanceof Distinct) {
		return evaluate((Distinct) expr, bindings);
	} else if (expr instanceof Reduced) {
		return evaluate((Reduced) expr, bindings);
	} else if (expr instanceof Group) {
		return evaluate((Group) expr, bindings);
	} else if (expr instanceof Order) {
		return evaluate((Order) expr, bindings);
	} else if (expr instanceof QueryRoot) {
		// new query, reset shared return value for successive calls of
		// NOW()
		this.sharedValueOfNow = null;
		return evaluate(expr.getArg(), bindings);
	} else if (expr instanceof DescribeOperator) {
		return evaluate((DescribeOperator) expr, bindings);
	} else if (expr == null) {
		throw new IllegalArgumentException("expr must not be null");
	} else {
		throw new QueryEvaluationException("Unknown unary tuple operator type: " + expr.getClass());
	}
}
 
Example #15
Source File: GroupIteratorTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testAvgEmptySet() throws QueryEvaluationException {
	Group group = new Group(EMPTY_ASSIGNMENT);
	group.addGroupElement(new GroupElem("avg", new Avg(new Var("a"))));
	GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance());

	assertThat(gi.next().getBinding("avg").getValue())
			.describedAs("AVG on empty set should result in 0")
			.isEqualTo(vf.createLiteral("0", XMLSchema.INTEGER));
}
 
Example #16
Source File: GroupIteratorTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testMaxEmptySet_DefaultGroup() throws QueryEvaluationException {
	Group group = new Group(EMPTY_ASSIGNMENT);
	group.addGroupElement(new GroupElem("max", new Max(new Var("a"))));
	GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance());

	assertThat(gi.hasNext()).isTrue();
	assertThat(gi.next().size()).isEqualTo(0);
}
 
Example #17
Source File: GroupIteratorTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testMaxEmptySet_Grouped() throws QueryEvaluationException {
	Group group = new Group(EMPTY_ASSIGNMENT);
	group.addGroupElement(new GroupElem("max", new Max(new Var("a"))));
	group.addGroupBindingName("x"); // we are grouping by variable x

	GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance());

	assertThat(gi.hasNext()).isFalse();
}
 
Example #18
Source File: GroupIteratorTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testMinEmptySet() throws QueryEvaluationException {
	Group group = new Group(EMPTY_ASSIGNMENT);
	group.addGroupElement(new GroupElem("min", new Min(new Var("a"))));
	GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance());

	assertThat(gi.hasNext()).isTrue();
	assertThat(gi.next().size()).isEqualTo(0);
}
 
Example #19
Source File: GroupIteratorTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testSampleEmptySet() throws QueryEvaluationException {
	Group group = new Group(EMPTY_ASSIGNMENT);
	group.addGroupElement(new GroupElem("sample", new Sample(new Var("a"))));
	GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance());

	assertThat(gi.hasNext()).isTrue();
	assertThat(gi.next().size()).isEqualTo(0);
}
 
Example #20
Source File: GroupIteratorTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testAvgNotZero() throws QueryEvaluationException {
	Group group = new Group(NONEMPTY_ASSIGNMENT);
	group.addGroupElement(new GroupElem("avg", new Avg(new Var("a"))));
	GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance());

	assertThat(gi.next().getBinding("avg").getValue()).isEqualTo(vf.createLiteral("5", XMLSchema.DECIMAL));
}
 
Example #21
Source File: TupleExprBuilder.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public Group getGroup() {
	return group;
}
 
Example #22
Source File: TupleExprBuilder.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void meet(Group group) {
	this.group = group;
}
 
Example #23
Source File: TupleExprBuilder.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private TupleExpr processOrderClause(ASTOrderClause orderNode, TupleExpr tupleExpr, Group group)
		throws VisitorException {
	if (orderNode != null) {
		@SuppressWarnings("unchecked")
		List<OrderElem> orderElements = (List<OrderElem>) orderNode.jjtAccept(this, null);

		for (OrderElem orderElem : orderElements) {
			// retrieve any aggregate operators from the order element.
			AggregateCollector collector = new AggregateCollector();
			collector.meet(orderElem);

			Extension extension = new Extension();

			for (AggregateOperator operator : collector.getOperators()) {
				Var var = createAnonVar();

				// replace occurrence of the operator in the order condition
				// with the variable.
				AggregateOperatorReplacer replacer = new AggregateOperatorReplacer(operator, var);
				replacer.meet(orderElem);

				// create an extension linking the operator to the variable
				// name.
				String alias = var.getName();

				ExtensionElem pe = new ExtensionElem(operator, alias);
				extension.addElement(pe);

				// add the aggregate operator to the group.
				GroupElem ge = new GroupElem(alias, operator);
				group.addGroupElement(ge);
			}

			if (!extension.getElements().isEmpty()) {
				extension.setArg(tupleExpr);
				tupleExpr = extension;
			}
		}

		tupleExpr = new Order(tupleExpr, orderElements);

	}
	return tupleExpr;
}
 
Example #24
Source File: AbstractQueryModelVisitor.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void meet(Group node) throws X {
	meetUnaryTupleOperator(node);
}
 
Example #25
Source File: SparqlFluoQueryBuilder.java    From rya with Apache License 2.0 4 votes vote down vote up
@Override
public void meet(final Reduced node) {
    //create id, initialize ConstructQueryMetadata builder, register ConstructQueryMetadata
    //builder with FluoQueryBuilder, and add metadata that we currently have
    final String constructId = nodeIds.getOrMakeId(node);

    ConstructQueryMetadata.Builder constructBuilder = fluoQueryBuilder.getConstructQueryBuilder().orNull();
    if(constructBuilder == null) {
        constructBuilder = ConstructQueryMetadata.builder();
        constructBuilder.setNodeId(constructId);
        fluoQueryBuilder.setConstructQueryMetadata(constructBuilder);
    }

    //get child node
    QueryModelNode child = node.getArg();
    Preconditions.checkArgument(child instanceof Projection || child instanceof MultiProjection);
    final UnaryTupleOperator unary = (UnaryTupleOperator) child;

    //get ProjectionElemList to build ConstructGraph
    final List<ProjectionElemList> projections = new ArrayList<>();
    if(unary instanceof Projection) {
        projections.add(((Projection) unary).getProjectionElemList());
    } else {
        projections.addAll(((MultiProjection)unary).getProjections());
    }

    //get ExtensionElems to build ConstructGraph
    final QueryModelNode grandChild = unary.getArg();
    Preconditions.checkArgument(grandChild instanceof Extension);
    final Extension extension = (Extension) grandChild;
    final List<ExtensionElem> extensionElems = extension.getElements();
    final ConstructGraph graph = getConstructGraph(projections, extensionElems);
    constructBuilder.setConstructGraph(graph);

    //set child to the next node we care about in Fluo
    //if Extension's arg is a Group node, then it is an Aggregation, so set child to Extension
    //otherwise set child to Extension's child (only care about Extensions if they are Aggregations)
    if(extension.getArg() instanceof Group) {
        child = extension;
    } else {
        child = extension.getArg();
    }

    //Set the child node in the ConstructQueryMetadataBuilder
    final String childNodeId = nodeIds.getOrMakeId(child);
    constructBuilder.setChildNodeId(childNodeId);

    // Update the child node's metadata.
    final Set<String> childVars = getVars((TupleExpr)child);
    final VariableOrder childVarOrder = new VariableOrder(childVars);
    setChildMetadata(fluoQueryBuilder, childNodeId, childVarOrder, constructId);

    //fast forward visitor to next node we care about
    child.visit(this);
}
 
Example #26
Source File: PeriodicQueryUtil.java    From rya with Apache License 2.0 4 votes vote down vote up
public void meet(Group node) {
    relocationParent = node;
    super.meet(node);
}
 
Example #27
Source File: GroupIterator.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public GroupIterator(EvaluationStrategy strategy, Group group, BindingSet parentBindings)
		throws QueryEvaluationException {
	this(strategy, group, parentBindings, 0);
}
 
Example #28
Source File: StrictEvaluationStrategy.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(Group node, BindingSet bindings)
		throws QueryEvaluationException {
	return new GroupIterator(this, node, bindings, iterationCacheSyncThreshold);
}
 
Example #29
Source File: TopologyFactory.java    From rya with Apache License 2.0 4 votes vote down vote up
@Override
public TopologyBuilder build(
        final String sparqlQuery,
        final String statementsTopic,
        final String resultsTopic,
        final BNodeIdFactory bNodeIdFactory)
        throws MalformedQueryException, TopologyBuilderException {
    requireNonNull(sparqlQuery);
    requireNonNull(statementsTopic);
    requireNonNull(resultsTopic);

    final ParsedQuery parsedQuery = new SPARQLParser().parseQuery(sparqlQuery, null);
    final TopologyBuilder builder = new TopologyBuilder();

    final TupleExpr expr = parsedQuery.getTupleExpr();
    final QueryVisitor visitor = new QueryVisitor(bNodeIdFactory);
    expr.visit(visitor);

    processorEntryList = visitor.getProcessorEntryList();
    final Map<TupleExpr, String> idMap = visitor.getIDs();
    // add source node
    builder.addSource(SOURCE, new StringDeserializer(), new VisibilityStatementDeserializer(), statementsTopic);

    // processing the processor entry list in reverse order means we go from leaf
    // nodes -> parent nodes.
    // So, when the parent processing nodes get added, the upstream
    // processing node will already exist.

    ProcessorEntry entry = null;
    for (int ii = processorEntryList.size() - 1; ii >= 0; ii--) {
        entry = processorEntryList.get(ii);
        //statement patterns need to be connected to the Source.
        if(entry.getNode() instanceof StatementPattern) {
            builder.addProcessor(entry.getID(), entry.getSupplier(), SOURCE);
        } else {
            final List<TupleExpr> parents = entry.getUpstreamNodes();
            final String[] parentIDs = new String[parents.size()];
            for (int id = 0; id < parents.size(); id++) {
                parentIDs[id] = idMap.get(parents.get(id));
            }
            builder.addProcessor(entry.getID(), entry.getSupplier(), parentIDs);
        }

        // Add a state store for any node type that requires one.
        if (entry.getNode() instanceof Join ||  entry.getNode() instanceof LeftJoin || entry.getNode() instanceof Group) {
            // Add a state store for the join processor.
            final StateStoreSupplier joinStoreSupplier =
                    Stores.create( entry.getID() )
                        .withStringKeys()
                        .withValues(new VisibilityBindingSetSerde())
                        .persistent()
                        .build();
            builder.addStateStore(joinStoreSupplier, entry.getID());
        }
    }

    if (entry == null) {
        throw new TopologyBuilderException("No valid processor entries found.");
    }

    // Add a formatter that converts the ProcessorResults into the output format.
    final SinkEntry<?,?> sinkEntry = visitor.getSinkEntry();
    builder.addProcessor("OUTPUT_FORMATTER", sinkEntry.getFormatterSupplier(), entry.getID());

    // Add the sink.
    builder.addSink(SINK, resultsTopic, sinkEntry.getKeySerializer(), sinkEntry.getValueSerializer(), "OUTPUT_FORMATTER");

    return builder;
}
 
Example #30
Source File: SpinRenderer.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void meet(Group node) throws RDFHandlerException {
	// skip over GroupElem - leave this to the GroupVisitor later
	node.getArg().visit(this);
	hasGroup = true;
}