本文整理汇总了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;
}
示例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);
}
示例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() ;
}
示例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));
}
示例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;
}
示例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);
}
示例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;
}