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


Java Binding类代码示例

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


Binding类属于com.hp.hpl.jena.sparql.engine.binding包,在下文中一共展示了Binding类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入依赖的package包/类
/**
 * Creates an instance, or a simpler QueryIterator
 * if optimization is possible (e.g., the relation is empty).
 * @return A query iterator over the contents of the relation
 */
public static QueryIterator create(SQLConnection connection, DatabaseOp table, 
		Collection<BindingMaker> bindingMakers, ExecutionContext execCxt) {
	if (OpUtil.isEmpty(table) || bindingMakers.isEmpty()) {
		return new QueryIterNullIterator(execCxt);
	}
	if (OpUtil.isTrivial(table)) {
		ArrayList<Binding> bindingList = new ArrayList<Binding>();
		for (BindingMaker bindingMaker: bindingMakers) {
			Binding t = bindingMaker.makeBinding(ResultRow.NO_ATTRIBUTES);
			if (t == null) continue;
			bindingList.add(t);
		}
		return new QueryIterPlainWrapper(bindingList.iterator(), execCxt);				
	}
	return new QueryIterTableSQL(connection, table, bindingMakers, execCxt);
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:22,代码来源:QueryIterTableSQL.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.
 * 
 * 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

示例3: makeBinding

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入依赖的package包/类
public Binding makeBinding(ResultRow row) {
	if (conditionColumn != null) {
		String value = row.get(conditionColumn);
		if (value == null || "false".equals(value) || "0".equals(value) || "".equals(value)) {
			return null;
		}
	}
	BindingMap result = new BindingHashMap();
	for (Var variableName: nodeMakers.keySet()) {
		Node node = nodeMakers.get(variableName).makeNode(row);
		if (node == null) {
			return null;
		}
		result.add(Var.alloc(variableName), node);
	}
	return result;
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:18,代码来源:BindingMaker.java

示例4: prepareBindings

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入依赖的package包/类
public BindingQueryPlan prepareBindings(GraphQuery q, Node[] variables) {   
	this.variables = variables;
	this.indexes = new HashMap<Node,Integer>();
	for (int i = 0; i < variables.length; i++) {
		indexes.put(variables[i], new Integer(i));
	}
	BasicPattern pattern = new BasicPattern();
	for (Triple t: q.getPattern()) {
		pattern.add(t);
	}
	Plan plan = QueryEngineD2RQ.getFactory().create(new OpBGP(pattern), dataset, null, null);
	final ExtendedIterator<Domain> queryIterator = new Map1Iterator<Binding,Domain>(new BindingToDomain(), plan.iterator());
	return new BindingQueryPlan() {
		public ExtendedIterator<Domain> executeBindings() {
			return queryIterator;
		}
	};
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:19,代码来源:D2RQQueryHandler.java

示例5: makeBinding

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入依赖的package包/类
public Binding makeBinding(ResultRow row) {
	if (condition != null) {
		String value = row.get(condition);
		if (value == null || "false".equals(value) || "0".equals(value) || "".equals(value)) {
			return null;
		}
	}
	BindingMap result = new BindingHashMap();
	for (Var variableName: nodeMakers.keySet()) {
		Node node = nodeMakers.get(variableName).makeNode(row);
		if (node == null) {
			return null;
		}
		result.add(Var.alloc(variableName), node);
	}
	return result;
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:18,代码来源:BindingMaker.java

示例6: eval

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入依赖的package包/类
@Override
public QueryIterator eval(QueryIterator input, final ExecutionContext execCxt) {
	return new QueryIterRepeatApply(input, execCxt) {
		@Override
		protected QueryIterator nextStage(Binding binding) {
			QueryIterConcat resultIt = new QueryIterConcat(execCxt);
			Collection<NodeRelation> tables = new ArrayList<NodeRelation>();
			for (OpTableSQL tableOp: tableOps) {
				tables.add(tableOp.table().extendWith(binding));
			}
			for (CompatibleRelationGroup group: CompatibleRelationGroup.groupNodeRelations(tables)) {
				resultIt.add(QueryIterTableSQL.create(group.baseRelation(), group.bindingMakers(), execCxt));
			}
			return resultIt;
		}
	};
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:18,代码来源:OpUnionTableSQL.java

示例7: create

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入依赖的package包/类
/**
 * Creates an instance, or a simpler QueryIterator
 * if optimization is possible (e.g., the relation is empty).
 * @return A query iterator over the contents of the relation
 */
public static QueryIterator create(Relation relation, 
		Collection<BindingMaker> bindingMakers, ExecutionContext execCxt) {
	if (relation.equals(Relation.EMPTY) || relation.condition().isFalse() || bindingMakers.isEmpty()) {
		return new QueryIterNullIterator(execCxt);
	}
	if (relation.isTrivial()) {
		ArrayList<Binding> bindingList = new ArrayList<Binding>();
		for (BindingMaker bindingMaker: bindingMakers) {
			Binding t = bindingMaker.makeBinding(ResultRow.NO_ATTRIBUTES);
			if (t == null) continue;
			bindingList.add(t);
		}
		return new QueryIterPlainWrapper(bindingList.iterator(), execCxt);				
	}
	return new QueryIterTableSQL(relation, bindingMakers, execCxt);
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:22,代码来源:QueryIterTableSQL.java

示例8: 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

示例9: prepareBindings

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入依赖的package包/类
public BindingQueryPlan prepareBindings(Query q, Node[] variables) {   
	this.variables = variables;
	this.indexes = new HashMap<Node,Integer>();
	for (int i = 0; i < variables.length; i++) {
		indexes.put(variables[i], new Integer(i));
	}
	BasicPattern pattern = new BasicPattern();
	for (Triple t: q.getPattern()) {
		pattern.add(t);
	}
	Plan plan = QueryEngineD2RQ.getFactory().create(new OpBGP(pattern), dataset, null, null);
	final ExtendedIterator<Domain> queryIterator = new Map1Iterator<Binding,Domain>(new BindingToDomain(), plan.iterator());
	return new BindingQueryPlan() {
		public ExtendedIterator<Domain> executeBindings() {
			return queryIterator;
		}
	};
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:19,代码来源:D2RQQueryHandler.java

示例10: verifyValue

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入依赖的package包/类
@Override
protected QueryIterator verifyValue(Binding binding, Graph graph, Node product, Geometry geometry, Node object,
		ExecutionContext execCxt) {
	boolean b = false;
	try {
		if (product.getLocalName().equals("IfcWallStandardCase_5397")){
			System.out.println("");
		}
		HashSet<Geometry> allGeometries=getProcessableElements(graph);
		b = new ExternalQuadTreeImpl(geometry, allGeometries).getIsExternal();
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	Node node = NodeFactory.createLiteral(Boolean.toString(b), null, XSDDatatype.XSDboolean);
	if (node.equals(object)) {
		return IterLib.result(binding, execCxt);
	} else {
		return IterLib.noResults(execCxt);
	}
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:22,代码来源:IsOutsidePF.java

示例11: execEvaluated

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入依赖的package包/类
public QueryIterator execEvaluated(Binding binding, Node product,
		 Node predicate, Node object,
		ExecutionContext execCxt) {
	Graph graph = execCxt.getActiveGraph();
	Geometry geometry=getGeometry(product,graph);
	if(geometry==null){
		return IterLib.noResults(execCxt);
	}
	if (Var.isVar(product))
		throw new ARQInternalErrorException(
				this.getClass().getName()+": Subject are variables without binding");
	if (Var.isVar(object))
		return getValue(binding, graph, product,geometry,
				Var.alloc(object), execCxt);
	else
		return verifyValue(binding, graph, product,geometry,object,
				execCxt);

}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:20,代码来源:FunctionBaseProduct.java

示例12: verifyValue

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入依赖的package包/类
@Override
protected QueryIterator verifyValue(Binding binding, Graph graph, Node product, Geometry geometry, Node object,
		ExecutionContext execCxt) {
	String obj;
	try{
	obj=(String)object.getLiteralValue();
	}catch (Exception e){
		return IterLib.noResults(execCxt);
	}
	String b=computeValue(geometry);
	if(b==null){
		return IterLib.noResults(execCxt);
	}
	if(b.equals(obj)){
		return IterLib.result(binding, execCxt);
	}
	return IterLib.noResults(execCxt);
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:19,代码来源:FunctionBaseProductEwktValue.java

示例13: execEvaluated

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入依赖的package包/类
public QueryIterator execEvaluated(Binding binding, Node product,
		 Node predicate, Node object,
		ExecutionContext execCxt) {
	Graph graph = execCxt.getActiveGraph();
	Geometry geometry=getGeometry(product,graph);
	if (Var.isVar(product))
		throw new ARQInternalErrorException(
				this.getClass().getName()+": Subject are variables without binding");
	if (Var.isVar(object))
		return getValue(binding, graph, product,geometry,
				Var.alloc(object), execCxt);
	else
		return verifyValue(binding, graph, product,geometry,object,
				execCxt);

}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:17,代码来源:FunctionBaseProductOnGraph.java

示例14: verify

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入依赖的package包/类
protected QueryIterator verify(Binding binding, Graph queryGraph, Node matchSubject, Node predicate,
		Node matchObject, ExecutionContext execCxt) {
	Geometry s=getGeometry(matchSubject, execCxt.getActiveGraph());
	Geometry o=getGeometry(matchObject, execCxt.getActiveGraph());
	try {
		if(evaluateSpatialRelation(s,o)){
			return IterLib.result(binding, execCxt);
		}
		else{
			return IterLib.noResults(execCxt);
		}
	} catch (GeometryException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}return IterLib.noResults(execCxt);
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:17,代码来源:FunctionBaseSpatialRelation.java

示例15: filter

import com.hp.hpl.jena.sparql.engine.binding.Binding; //导入依赖的package包/类
@Override
public Table filter(ExprList expressions, Table table)
{
    if ( debug )
    {
    	Log.debug(this,"Restriction") ;
    	Log.debug(this,expressions.toString()) ;
        dump(table) ;
    }
    QueryIterator iter = table.iterator(execCxt) ;
    List<Binding> output = new ArrayList<Binding>() ;
    for ( ; iter.hasNext() ; )
    {
        Binding b = iter.nextBinding() ;
        if ( expressions.isSatisfied(b, execCxt) )
            output.add(b) ;
    }
    return new TableN(new QueryIterPlainWrapper(output.iterator(), execCxt)) ;
}
 
开发者ID:peterjohnlawrence,项目名称:com.inova8.remediator,代码行数:20,代码来源:EvaluatorSimple.java


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