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


Java Binding.isEmpty方法代码示例

本文整理汇总了Java中com.hp.hpl.jena.sparql.engine.binding.Binding.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java Binding.isEmpty方法的具体用法?Java Binding.isEmpty怎么用?Java Binding.isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hp.hpl.jena.sparql.engine.binding.Binding的用法示例。


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

示例1: extendWith

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入方法依赖的package包/类
/**
 * Joins this NodeRelation with a Binding. Any row in this
 * NodeRelation that is incompatible with the binding will be
 * dropped, and any compatible row will be extended with
 * FixedNodeMakers whose node is taken from the binding.
 * 
 * FIXME: This doesn't behave correctly when a node maker is available for a given variable but produces unbound results. Everything is compatible with unbound.
 * FIXME: This ignores the condition of the binding maker, if any is present.
 * 
 * @param binding A binding to join with this NodeRelation
 * @return The joined NodeRelation
 */
public static NodeRelation extendWith(NodeRelation table, Binding binding) {
	if (binding.isEmpty()) return table;
	Map<Var,NodeMaker> extraVars = new HashMap<Var,NodeMaker>();
	NodeRelation result = table;
	for (Iterator<Var> it = binding.vars(); it.hasNext();) {
		Var var = it.next();
		Node value = binding.get(var);
		if (table.getBindingMaker().has(var)) {
			result = NodeRelationUtil.select(result, var, value);
		} else {
			extraVars.put(var, new FixedNodeMaker(value));
		}
	}
	if (!extraVars.isEmpty()) {
		extraVars.putAll(result.getBindingMaker().getNodeMakers());
		result = new NodeRelation(result.getSQLConnection(), result.getBaseTabular(), 
				new BindingMaker(extraVars, result.getBindingMaker().getConditionColumn()));
	}
	return result;
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:33,代码来源:NodeRelationUtil.java

示例2: extendWith

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入方法依赖的package包/类
/**
 * Joins this NodeRelation with a Binding. Any row in this
 * NodeRelation that is incompatible with the binding will be
 * dropped, and any compatible row will be extended with
 * FixedNodeMakers whose node is taken from the binding.
 * 
 * @param binding A binding to join with this NodeRelation
 * @return The joined NodeRelation
 */
public NodeRelation extendWith(Binding binding) {
	if (binding.isEmpty()) return this;
	MutableRelation mutator = new MutableRelation(baseRelation());
	Map<Var,NodeMaker> columns = new HashMap<Var,NodeMaker>();
	for (Var variable: variables()) {
		columns.put(variable, nodeMaker(variable));
	}
	for (Iterator<Var> it = binding.vars(); it.hasNext();) {
		Var var = it.next();
		Node value = binding.get(var);
		if (columns.containsKey(var)) {
			columns.put(var, columns.get(var).selectNode(value, mutator));
		} else {
			columns.put(var, new FixedNodeMaker(value, false));
		}
	}
	return new NodeRelation(mutator.immutableSnapshot(), columns);
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:28,代码来源:NodeRelation.java

示例3: if

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入方法依赖的package包/类
private QueryIterator executePlan$(PhysicalPlan<NodeId> plan, Binding input) {
    if ( plan.executesToNothing() ) {
        executePlanToNothing(plan) ;
        return QueryIterNullIterator.create(execCxt) ;
    }

    RowList<NodeId> rows ;
    if ( input.isEmpty() )
        rows = RowLib.identityRowList() ;
    else {
        final RowBuilder<NodeId> builder = new RowBuilderBase<NodeId>() ; // Reuse?
        builder.reset() ;
        Row<NodeId> row = ELibTDB.convertToRow(input, accessor.getNodeTable(), builder) ;
        Set<Var> vars = Collections.emptySet() ; // Reuse?
        rows = RowLib.createRowList(vars, Iter.singleton(row)) ;
    }
    
    RowList<NodeId> results = executePlan(plan, rows) ; 
    // And include the input bindings not passed on.
    Iterator<Binding> bIter = convertToBindings(results.iterator(), input, accessor.getNodeTable()) ;
    return new QueryIterPlainWrapper(bIter, execCxt) ;
}
 
开发者ID:afs,项目名称:quack,代码行数:23,代码来源:OpExecutorQuackTDB.java

示例4: convertToBindings

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入方法依赖的package包/类
/** Convert rows to bindings for a give parent, that may, or may not,
 *  have equivalent bindings of variables in the rows */ 
private static Iterator<Binding> convertToBindings(Iterator<Row<NodeId>> iter, final Binding parent, final NodeTable nodeTable) {
    Transform<Row<NodeId>, Binding> conv = new Transform<Row<NodeId>, Binding>() {
        @Override
        public Binding convert(Row<NodeId> row) {
            if ( parent.isEmpty() )
                return new BindingRow(row, nodeTable) ;
            
            // Temporary fix.  Proper fix is to change BindingBase to allow multiple occurrences in a controlled way. 
            BindingMap b = BindingFactory.create() ;
            if ( ! parent.isEmpty() ) {
                for ( Iterator<Var> vars = parent.vars() ; vars.hasNext() ; ) {
                    Var v = vars.next() ;
                    if ( ! row.contains(v) )
                        b.add(v, parent.get(v)) ;
                }
            }
            return new BindingRow(b, row, nodeTable) ;
        }
    } ;
    return Iter.map(iter, conv) ;
}
 
开发者ID:afs,项目名称:quack,代码行数:24,代码来源:OpExecutorQuackTDB.java


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