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


Java MapBindingSet.getValue方法代码示例

本文整理汇总了Java中org.openrdf.query.impl.MapBindingSet.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java MapBindingSet.getValue方法的具体用法?Java MapBindingSet.getValue怎么用?Java MapBindingSet.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openrdf.query.impl.MapBindingSet的用法示例。


在下文中一共展示了MapBindingSet.getValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: update

import org.openrdf.query.impl.MapBindingSet; //导入方法依赖的package包/类
@Override
public void update(final AggregationElement aggregation, final AggregationState state, final VisibilityBindingSet childBindingSet) {
    checkArgument(aggregation.getAggregationType() == AggregationType.MIN, "The MinFunction only accepts MIN AggregationElements.");
    requireNonNull(state);
    requireNonNull(childBindingSet);

    // Only update the min if the child contains the binding that we are finding the min value for.
    final String aggregatedName = aggregation.getAggregatedBindingName();
    if(childBindingSet.hasBinding(aggregatedName)) {
        final MapBindingSet result = state.getBindingSet();
        final String resultName = aggregation.getResultBindingName();
        final boolean newBinding = !result.hasBinding(resultName);

        Value min;
        if(newBinding) {
            min = childBindingSet.getValue(aggregatedName);
        } else {
            final Value oldMin = result.getValue(resultName);
            final Value chidlMin = childBindingSet.getValue(aggregatedName);
            min = compare.compare(chidlMin, oldMin) < 0 ? chidlMin : oldMin;
        }

        result.addBinding(resultName, min);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:26,代码来源:MinFunction.java

示例2: update

import org.openrdf.query.impl.MapBindingSet; //导入方法依赖的package包/类
@Override
public void update(final AggregationElement aggregation, final AggregationState state, final VisibilityBindingSet childBindingSet) {
    checkArgument(aggregation.getAggregationType() == AggregationType.MAX, "The MaxFunction only accepts MAX AggregationElements.");
    requireNonNull(state);
    requireNonNull(childBindingSet);

    // Only update the max if the child contains the binding that we are finding the max value for.
    final String aggregatedName = aggregation.getAggregatedBindingName();
    if(childBindingSet.hasBinding(aggregatedName)) {
        final MapBindingSet result = state.getBindingSet();
        final String resultName = aggregation.getResultBindingName();
        final boolean newBinding = !result.hasBinding(resultName);

        Value max;
        if(newBinding) {
            max = childBindingSet.getValue(aggregatedName);
        } else {
            final Value oldMax = result.getValue(resultName);
            final Value childMax = childBindingSet.getValue(aggregatedName);
            max = compare.compare(childMax, oldMax) > 0 ? childMax : oldMax;
        }

        result.addBinding(resultName, max);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:26,代码来源:MaxFunction.java

示例3: update

import org.openrdf.query.impl.MapBindingSet; //导入方法依赖的package包/类
@Override
public void update(final AggregationElement aggregation, final AggregationState state, final VisibilityBindingSet childBindingSet) {
    checkArgument(aggregation.getAggregationType() == AggregationType.COUNT, "The CountFunction only accepts COUNT AggregationElements.");
    requireNonNull(state);
    requireNonNull(childBindingSet);

    // Only add one to the count if the child contains the binding that we are counting.
    final String aggregatedName = aggregation.getAggregatedBindingName();
    if(childBindingSet.hasBinding(aggregatedName)) {
        final MapBindingSet result = state.getBindingSet();
        final String resultName = aggregation.getResultBindingName();
        final boolean newBinding = !result.hasBinding(resultName);

        if(newBinding) {
            // Initialize the binding.
            result.addBinding(resultName, new IntegerLiteralImpl(BigInteger.ONE));
        } else {
            // Update the existing binding.
            final Literal count = (Literal) result.getValue(resultName);
            final BigInteger updatedCount = count.integerValue().add( BigInteger.ONE );
            result.addBinding(resultName, new IntegerLiteralImpl(updatedCount));
        }
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:25,代码来源:CountFunction.java


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