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


Java Binding.get方法代码示例

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


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

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入方法依赖的package包/类
public static Row<NodeId> convertToRow(Binding binding, NodeTable nodeTable, RowBuilder<NodeId> builder) {
    if ( binding instanceof BindingRow )
        return ((BindingRow)binding).getRow() ;
    builder.reset() ;
    Iterator<Var> vIter = binding.vars() ; 
    for ( ; vIter.hasNext() ; ) {
        Var v = vIter.next() ;
        Node n = binding.get(v) ;
        if ( n == null )
            continue ;
        NodeId nid = nodeTable.getNodeIdForNode(n) ;
        if ( NodeId.isDoesNotExist(nid) )
            // FIXME ???
            continue; 
        builder.add(v, nid) ;
    }
    return builder.build() ; 
}
 
开发者ID:afs,项目名称:quack,代码行数:19,代码来源:ELibTDB.java

示例4: next

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入方法依赖的package包/类
public Triple next() {
	Binding b = wrapped.next();
	return new Triple(
			b.get(TripleRelation.SUBJECT), 
			b.get(TripleRelation.PREDICATE), 
			b.get(TripleRelation.OBJECT));
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:8,代码来源:TripleQueryIter.java

示例5: map1

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入方法依赖的package包/类
public Domain map1(Binding binding) {
	Domain d = new Domain(variables.length);
	for (int i = 0; i < variables.length; i++) {
		Var v = Var.alloc(variables[i]);
		Node value = binding.get(v);
		int index = ((Integer) indexes.get(v)).intValue();
		d.setElement(index, value);
	}
	return d;
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:11,代码来源:D2RQQueryHandler.java

示例6: execute

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入方法依赖的package包/类
@Override
	/*
	 * (non-Javadoc)
	 * @see backtype.storm.task.IBolt#execute(backtype.storm.tuple.Tuple)
	 * We assume that each tuple here is a set of graphs, result of the windowing bolt.
	 */
	public void execute(Tuple input) {
		ArrayList<Graph> graphList = (ArrayList<Graph>) input.getValue(0);
		//Graph graph = (Graph) input.getValue(0);
		QueryIterator queryIter = null;
		for (Graph g : graphList) {
			queryIter = Algebra.exec(this.opBGP, g); 
			while (queryIter.hasNext()) {
				Binding binding = queryIter.nextBinding();
				Values values = new Values();
				for (String str : this.outputFields) {
					Var aux = Var.alloc(str);
//					Var obsValue = Var.alloc("obsValue");
//					Var time = Var.alloc("time");
//					Var location = Var.alloc("location");
					Node auxNode = binding.get(aux);
//					Node obsValueNode = binding.get(obsValue);
//					Node timeNode = binding.get(time);
//					Node locationNode = binding.get(location);
	//				System.out.println(obsId + ": " + FmtUtils.stringForNode(obsIdNode) + ", " + 
	//						obsValue + ": " + FmtUtils.stringForNode(obsValueNode) + ", " + time + ": " + FmtUtils.stringForNode(timeNode)
	//						+ ", " + location + ": " + FmtUtils.stringForNode(locationNode));
					values.add(FmtUtils.stringForNode(auxNode));
				}	
				collector.emit(values);
//				collector.emit(new Values(FmtUtils.stringForNode(obsIdNode), FmtUtils.stringForNode(obsValueNode), 
//							FmtUtils.stringForNode(timeNode), FmtUtils.stringForNode(locationNode)));
			}
		}
		collector.ack(input);
	}
 
开发者ID:allaves,项目名称:storm-query-operators,代码行数:37,代码来源:OpBGPBolt.java

示例7: map1

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入方法依赖的package包/类
public Object map1(Object o) 
{
	Binding binding = (Binding) o;
	Domain d = new Domain(variables.length);
	for (int i = 0; i < variables.length; i++) 
	{
		Var v = Var.alloc(variables[i]);
		Node value = binding.get(v);
		int index = ((Integer) indexes.get(v)).intValue();
		d.setElement(index, value);
	}
	return d;
}
 
开发者ID:vaibhavkhadilkar,项目名称:D2RQ-Update,代码行数:14,代码来源:D2RQRWQueryHandler.java


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