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

The following examples show how to use org.eclipse.rdf4j.query.algebra.Max. 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: GroupIterator.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private Aggregate create(AggregateOperator operator)
		throws ValueExprEvaluationException, QueryEvaluationException {
	if (operator instanceof Count) {
		return new CountAggregate((Count) operator);
	} else if (operator instanceof Min) {
		return new MinAggregate((Min) operator);
	} else if (operator instanceof Max) {
		return new MaxAggregate((Max) operator);
	} else if (operator instanceof Sum) {
		return new SumAggregate((Sum) operator);
	} else if (operator instanceof Avg) {
		return new AvgAggregate((Avg) operator);
	} else if (operator instanceof Sample) {
		return new SampleAggregate((Sample) operator);
	} else if (operator instanceof GroupConcat) {
		return new ConcatAggregate((GroupConcat) operator);
	}
	return null;
}
 
Example #2
Source File: SpinRenderer.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void meet(Max node) throws RDFHandlerException {
	handler.handleStatement(valueFactory.createStatement(subject, RDF.TYPE, SP.MAX_CLASS));
	if (node.isDistinct()) {
		handler.handleStatement(
				valueFactory.createStatement(subject, SP.DISTINCT_PROPERTY, BooleanLiteral.TRUE));
	}
	Resource oldSubject = subject;
	super.meet(node);
	handler.handleStatement(valueFactory.createStatement(oldSubject, SP.EXPRESSION_PROPERTY, subject));
	subject = oldSubject;
}
 
Example #3
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 #4
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 #5
Source File: SPARQLValueExprRenderer.java    From semagrow with Apache License 2.0 5 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
public void meet(Max theOp)
        throws Exception
{
    unaryMeet("max", theOp);
}
 
Example #6
Source File: GroupIterator.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public MaxAggregate(Max operator) {
	super(operator);
}
 
Example #7
Source File: AbstractQueryModelVisitor.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void meet(Max node) throws X {
	meetUnaryValueOperator(node);
}
 
Example #8
Source File: SparqlValueExprRenderer.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
public void meet(Max theOp) throws Exception {
	unaryMeet("max", theOp);
}
 
Example #9
Source File: SerqlValueExprRenderer.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
public void meet(Max theOp) throws Exception {
	unaryMeet("max", theOp);
}
 
Example #10
Source File: TupleExprBuilder.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public Object visit(ASTMax node, Object data) throws VisitorException {
	ValueExpr ve = castToValueExpr(node.jjtGetChild(0).jjtAccept(this, data));

	return new Max(ve, node.isDistinct());
}
 
Example #11
Source File: TupleExprBuilder.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void meet(Max node) throws VisitorException {
	super.meet(node);
	meetAggregate(node);
}
 
Example #12
Source File: TupleExprBuilder.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void meet(Max node) throws VisitorException {
	super.meet(node);
	meetAggregate(node);
}