本文整理了Java中org.apache.jena.sparql.engine.binding.Binding.vars()
方法的一些代码示例,展示了Binding.vars()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Binding.vars()
方法的具体详情如下:
包路径:org.apache.jena.sparql.engine.binding.Binding
类名称:Binding
方法名:vars
[英]Iterate over all variables of this binding.
[中]迭代此绑定的所有变量。
代码示例来源:origin: apache/jena
@Override
public Iterator<Var> vars()
{
return binding.vars() ;
}
代码示例来源:origin: apache/jena
private static boolean isRoot(Binding binding) {
return !binding.vars().hasNext() ;
}
代码示例来源:origin: apache/jena
@Override
public void addBinding(Binding binding) {
for (Iterator<Var> names = binding.vars(); names.hasNext();) {
Var v = names.next() ;
if ( !vars.contains(v) )
vars.add(v) ;
}
rows.add(binding) ;
}
代码示例来源:origin: apache/jena
public static boolean disjoint(Binding binding1, Binding binding2)
{
Iterator<Var> iterVar1 = binding1.vars() ;
for ( ; iterVar1.hasNext() ; )
{
Var v = iterVar1.next() ;
if ( binding2.contains(v) )
return false ;
}
return true ;
}
}
代码示例来源:origin: apache/jena
public void add(Binding binding)
{
Iterator<Var> iter = binding.vars() ;
while(iter.hasNext())
{
Var v = iter.next() ;
if ( ! vars.contains(v) )
throw new ARQException("Variable "+v+" not already declared for ElementData") ;
}
rows.add(binding) ;
}
代码示例来源:origin: apache/jena
private List<Var> actualVars() {
if ( actualVars == null ) {
actualVars = new ArrayList<>() ;
Iterator<Var> iter = binding.vars() ;
for ( ; iter.hasNext() ; ) {
Var v = iter.next() ;
if ( accept(v) )
actualVars.add(v) ;
}
}
return actualVars ;
}
代码示例来源:origin: apache/jena
@Override
public Iterator<String> varNames()
{
List<String> x = new ArrayList<>() ;
for ( Iterator<Var> iter = binding.vars() ; iter.hasNext(); )
{
Var v = iter.next();
x.add(v.getVarName()) ;
}
return x.iterator() ;
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public static Map<Var, Node> toMap(Binding binding) {
Map<Var, Node> result = new HashMap<Var, Node>();
Iterator<Var> it = binding.vars();
while(it.hasNext()) {
Var v = it.next();
Node n = binding.get(v);
result.put(v, n);
}
return result;
}
代码示例来源:origin: apache/jena
public static void addAll(BindingMap dest, Binding src) {
Iterator<Var> iter = src.vars();
for ( ; iter.hasNext() ; ) {
Var v = iter.next();
Node n = src.get(v);
dest.add(v, n);
}
}
代码示例来源:origin: SmartDataAnalytics/Sparqlify
public static Pair<List<String>, List<String>> getValues(Binding binding)
{
List<String> keys = new ArrayList<String>();
List<String> values = new ArrayList<String>();
Iterator<Var> it = binding.vars();
while(it.hasNext()) {
Var key = it.next();
keys.add(key.getName());
values.add(binding.get(key).toString());
}
return Pair.create(keys, values);
}
代码示例来源:origin: com.marklogic/marklogic-jena
static void bindVariables(SPARQLQueryDefinition qdef, Binding initial, MarkLogicDatasetGraph markLogicDatasetGraph) {
if (initial == null) {
}
else {
Iterator<Var> varsIterator = initial.vars();
while (initial != null && varsIterator.hasNext()) {
Var v = varsIterator.next();
Node bindingValue = initial.get(v);
MarkLogicDatasetGraph.bindObject(qdef, v.getName(), bindingValue);
}
}
}
代码示例来源:origin: apache/jena
/** Iterate over all the names of variables. */
@Override
final public Iterator<Var> vars() {
// Hidesight - replace with accumulator style vars1(accumulator)
Iterator<Var> iter = vars1();
if ( parent != null )
iter = IteratorConcat.concat(parent.vars(), iter);
return iter;
}
代码示例来源:origin: apache/jena
public static int hashCode(Binding bind) {
int hash = 0xC0;
for ( Iterator<Var> iter = bind.vars() ; iter.hasNext() ; ) {
Var var = iter.next();
Node node = bind.get(var);
hash ^= var.hashCode();
hash ^= node.hashCode();
}
return hash;
}
代码示例来源:origin: apache/jena
public static boolean compatible(Binding bindingLeft, Binding bindingRight)
{
// Test to see if compatible: Iterate over variables in left
for ( Iterator<Var> vIter = bindingLeft.vars() ; vIter.hasNext() ; )
{
Var v = vIter.next();
Node nLeft = bindingLeft.get(v) ;
Node nRight = bindingRight.get(v) ;
if ( nRight != null && ! nRight.equals(nLeft) )
return false ;
}
return true ;
}
代码示例来源:origin: apache/jena
/**
* Create a new Binding as a copy of an existing one. Additionally, it guarantees to
* touch each element of the binding
*/
public static Binding copy(Binding b) {
Iterator<Var> vIter = b.vars();
BindingMap b2 = create();
while (vIter.hasNext()) {
Var v = vIter.next();
b2.add(v, b.get(v));
}
return b2;
}
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public static Binding transformKeys(Binding binding, NodeTransform transform) {
Iterator<Var> it = binding.vars();
BindingHashMap result = new BindingHashMap();
while(it.hasNext()) {
Var o = it.next();
Node node = binding.get(o);
Var n = (Var)transform.apply(o);
result.add(n, node);
}
return result;
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
@Override
public Flowable<Entry<Node, Node>> apply(Range<Long> range) {
Query query = concept.asQuery();
QueryUtils.applyRange(query, range);
//Query query = createQueryCount(concept, itemLimit, rowLimit, resultVar)
return ReactiveSparqlUtils.execSelect(() -> qef.createQueryExecution(query))
.map(b -> b.get(b.vars().next()))
.map(node -> Maps.immutableEntry(node, node));
// apply(range);
// Map<Node, Node> map = fetchMap(range);
// return map.entrySet().stream();
}
代码示例来源:origin: apache/jena
public static Binding transform(Binding b, NodeTransform transform) {
BindingMap b2 = BindingFactory.create() ;
List<Var> vars = Iter.toList(b.vars()) ;
for ( Var v : vars ) {
Var v2 = (Var)transform.apply(v) ;
b2.add(v2, b.get(v));
}
return b2 ;
}
代码示例来源:origin: apache/jena
@Override
public QueryIterator eval(Op op, DatasetGraph dsg, Binding binding, Context context)
{
if ( binding.vars().hasNext() )
op = Substitute.substitute(op, binding) ;
ExecutionContext execCxt = new ExecutionContext(context, dsg.getDefaultGraph(), dsg, QC.getFactory(context)) ;
Evaluator eval = EvaluatorFactory.create(execCxt) ;
Table table = Eval.eval(eval, op) ;
QueryIterator qIter = table.iterator(execCxt) ;
return QueryIteratorCheck.check(qIter, execCxt) ;
}
代码示例来源:origin: apache/jena
private static void output(Binding binding, IndentedWriter out, SerializationContext sCxt) {
out.print("(row") ;
for (Iterator<Var> iter = binding.vars(); iter.hasNext();) {
Var v = iter.next() ;
Node n = binding.get(v) ;
out.print(" ") ;
out.print(Plan.startMarker2) ;
out.print(FmtUtils.stringForNode(v)) ;
out.print(" ") ;
out.print(FmtUtils.stringForNode(n)) ;
out.print(Plan.finishMarker2) ;
}
out.print(")") ;
}
}
内容来源于网络,如有侵权,请联系作者删除!