org.openrdf.query.Binding.getName()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(95)

本文整理了Java中org.openrdf.query.Binding.getName()方法的一些代码示例,展示了Binding.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Binding.getName()方法的具体详情如下:
包路径:org.openrdf.query.Binding
类名称:Binding
方法名:getName

Binding.getName介绍

[英]Gets the name of the binding (e.g. the variable name).
[中]获取绑定的名称(例如变量名)。

代码示例

代码示例来源:origin: org.openrdf.sesame/sesame-query

/**
 * Adds a binding to the binding set.
 * 
 * @param binding
 *        The binding to add to the binding set.
 */
public void addBinding(Binding binding) {
  bindings.put(binding.getName(), binding);
}

代码示例来源:origin: org.openrdf.sesame/sesame-store

/**
 * Adds a binding to the solution.
 * 
 * @param binding
 *        The binding to add to the solution.
 */
public void addBinding(Binding binding) {
  bindings.put(binding.getName(), binding);
}

代码示例来源:origin: blazegraph/database

/**
 * Return an ordered collection of the distinct variable names used in the
 * given caller's solution set.
 * 
 * @param bindingSets
 *            The solution set.
 * 
 * @return The distinct, ordered collection of variables used.
 */
protected LinkedHashSet<String> getDistinctVars(final BindingSet[] bindingSets) {
  final LinkedHashSet<String> vars = new LinkedHashSet<String>();
  for (BindingSet bindingSet : bindingSets) {
    for (Binding binding : bindingSet) {
      vars.add(binding.getName());
    }
  }
  return vars;
}

代码示例来源:origin: com.blazegraph/bigdata-core

/**
 * Return an ordered collection of the distinct variable names used in the
 * given caller's solution set.
 * 
 * @param bindingSets
 *            The solution set.
 * 
 * @return The distinct, ordered collection of variables used.
 */
protected LinkedHashSet<String> getDistinctVars(final BindingSet[] bindingSets) {
  final LinkedHashSet<String> vars = new LinkedHashSet<String>();
  for (BindingSet bindingSet : bindingSets) {
    for (Binding binding : bindingSet) {
      vars.add(binding.getName());
    }
  }
  return vars;
}

代码示例来源:origin: org.openrdf.sesame/sesame-query

@Override
public final int hashCode() {
  int hashCode = 0;
  for (Binding binding : this) {
    hashCode ^= binding.getName().hashCode() ^ binding.getValue().hashCode();
  }
  return hashCode;
}

代码示例来源:origin: org.openrdf.sesame/sesame-query

@Override
public boolean equals(Object o) {
  if (o instanceof Binding) {
    Binding other = (Binding)o;
    return name.equals(other.getName()) && value.equals(other.getValue());
  }
  return false;
}

代码示例来源:origin: org.openrdf.sesame/sesame-store

@Override
public boolean equals(Object o)
{
  if (o instanceof Binding) {
    Binding other = (Binding)o;
    return name.equals(other.getName()) && value.equals(other.getValue());
  }
  return false;
}

代码示例来源:origin: net.fortytwo.smsn/smsn-p2p

public JSONObject toJSON(final BindingSet solution, final Long expirationTime) throws JSONException {
  JSONObject j = new JSONObject();
  JSONObject solutionObj = new JSONObject();
  for (Binding b : solution) {
    solutionObj.put(b.getName(), toJSON(b.getValue()));
  }
  j.put("solution", solutionObj);
  j.put("expirationTime", expirationTime);
  return j;
}

代码示例来源:origin: synchrony/smsn

public JSONObject toJSON(final BindingSet solution, final Long expirationTime) throws JSONException {
  JSONObject j = new JSONObject();
  JSONObject solutionObj = new JSONObject();
  for (Binding b : solution) {
    solutionObj.put(b.getName(), toJSON(b.getValue()));
  }
  j.put("solution", solutionObj);
  j.put("expirationTime", expirationTime);
  return j;
}

代码示例来源:origin: net.fortytwo.extendo/extendo-p2p

public JSONObject toJSON(final BindingSet bs) throws JSONException {
  JSONObject j = new JSONObject();
  for (Binding b : bs) {
    j.put(b.getName(), toJSON(b.getValue()));
  }
  return j;
}

代码示例来源:origin: org.openrdf.sesame/sesame-queryalgebra-evaluation

/**
 * Adds a new binding to the binding set. The binding's name must not already
 * be part of this binding set.
 * 
 * @param binding
 *        The binding to add this this BindingSet.
 */
public void addBinding(Binding binding) {
  addBinding(binding.getName(), binding.getValue());
}

代码示例来源:origin: org.openrdf.sesame/sesame-repository-sparql

/**
 * Adds a new binding to the binding set. The binding's name must not already
 * be part of this binding set.
 * 
 * @param binding
 *        The binding to add this this BindingSet.
 */
public void addBinding(Binding binding) {
  addBinding(binding.getName(), binding.getValue());
}

代码示例来源:origin: org.openrdf.sesame/sesame-repository-sparql

public void setBinding(Binding binding) {
  setBinding(binding.getName(), binding.getValue());
}

代码示例来源:origin: org.openrdf.sesame/sesame-queryalgebra-evaluation

public void setBinding(Binding binding) {
  setBinding(binding.getName(), binding.getValue());
}

代码示例来源:origin: org.openrdf.sesame/sesame-store

@Override
public boolean equals(Object other) {
  if (this == other) {
    return true;
  }
  else if (other instanceof BindingSet) {
    int otherSize = 0;
    // Compare other's bindings to own
    for (Binding binding : (BindingSet)other) {
      Value ownValue = getValue(binding.getName());
      if (!binding.getValue().equals(ownValue)) {
        // Unequal bindings for this name
        return false;
      }
      otherSize++;
    }
    // All bindings have been matched, sets are equal if this solution
    // doesn't have any additional bindings.
    return otherSize == bindings.size();
  }
  return false;
}

代码示例来源:origin: org.openrdf.sesame/sesame-query

@Override
public boolean equals(Object other) {
  if (this == other) {
    return true;
  }
  if (other == null || !(other instanceof BindingSet)) {
    return false;
  }
  BindingSet that = (BindingSet)other;
  
  if (this.size() != that.size()) {
    return false;
  }
  // Compare other's bindings to own
  for (Binding binding : that) {
    Value ownValue = getValue(binding.getName());
    if (!binding.getValue().equals(ownValue)) {
      // Unequal bindings for this name
      return false;
    }
  }
  return true;
}

代码示例来源:origin: org.openrdf.sesame/sesame-sail-spin

private static void addBindings(Resource subj, Resource opResource, ParsedOperation parsedOp, Operation op,
    TripleSource tripleSource, SpinParser parser)
  throws OpenRDFException
{
  if (!parser.isThisUnbound(opResource, tripleSource)) {
    op.setBinding(THIS_VAR, subj);
  }
  if (parsedOp instanceof ParsedTemplate) {
    for (Binding b : ((ParsedTemplate)parsedOp).getBindings()) {
      op.setBinding(b.getName(), b.getValue());
    }
  }
}

代码示例来源:origin: org.openrdf.elmo/elmo-repository

@Override
  protected BindingSet convert(BindingSet bindingSet)
  {
    MapBindingSet result = new MapBindingSet(bindingSet.size());
    for (Binding binding : bindingSet) {
      String name = binding.getName();
      Value value = binding.getValue();
      if (value instanceof URI) {
        value = new AURI(name, (URI)value, node);
      }
      else if (value instanceof BNode) {
        value = new ABNode(name, (BNode)value, node);
      }
      binding = new BindingImpl(name, value);
      result.addBinding(binding);
    }
    return result;
  }
}

代码示例来源:origin: org.apache.rya/rya.pcj.fluo.app

@Override
public void write(final Kryo kryo, final Output output, final VisibilityBindingSet visBindingSet) {
  output.writeString(visBindingSet.getVisibility());
  // write the number count for the reader.
  output.writeInt(visBindingSet.size());
  for (final Binding binding : visBindingSet) {
    output.writeString(binding.getName());
    final RyaType ryaValue = RdfToRyaConversions.convertValue(binding.getValue());
    final String valueString = ryaValue.getData();
    final URI type = ryaValue.getDataType();
    output.writeString(valueString);
    output.writeString(type.toString());
  }
}

代码示例来源:origin: org.openrdf.sesame/sesame-http-protocol

public void execute(RepositoryConnection con)
  throws RepositoryException
{
  try {
    Update preparedUpdate = con.prepareUpdate(QueryLanguage.SPARQL, getUpdateString(), getBaseURI());
    preparedUpdate.setIncludeInferred(isIncludeInferred());
    preparedUpdate.setDataset(getDataset());
    
    if (getBindings() != null) {
      for (Binding binding : getBindings()) {
        preparedUpdate.setBinding(binding.getName(), binding.getValue());
      }
    }
    
    preparedUpdate.execute();
  }
  catch (MalformedQueryException e) {
    throw new RepositoryException(e);
  }
  catch (UpdateExecutionException e) {
    throw new RepositoryException(e);
  }
  
}

相关文章