本文整理汇总了Java中org.eclipse.rdf4j.query.algebra.Var.hasValue方法的典型用法代码示例。如果您正苦于以下问题:Java Var.hasValue方法的具体用法?Java Var.hasValue怎么用?Java Var.hasValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.rdf4j.query.algebra.Var
的用法示例。
在下文中一共展示了Var.hasValue方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appendVarId
import org.eclipse.rdf4j.query.algebra.Var; //导入方法依赖的package包/类
/**
* Clone the specified variable and attach bindings, moreover change name of variable
* by appending "_varId" to it.
*
* @param sb
* @param var
* @param varNames
* @param bindings
*
* @return
*/
protected static Var appendVarId(Var var, String varID, Set<String> varNames, BindingSet bindings) {
Var res = var.clone();
if (!var.hasValue()) {
if (bindings.hasBinding(var.getName())) {
res.setValue( bindings.getValue(var.getName()) );
} else {
String newName = var.getName() + "_" + varID;
varNames.add(newName);
res.setName(newName);
}
}
return res;
}
示例2: append
import org.eclipse.rdf4j.query.algebra.Var; //导入方法依赖的package包/类
protected static void append(Var var, StringBuilder sb) {
if (var.hasValue()) {
appendValue(sb, var.getValue());
} else {
sb.append("?").append(var.getName());
}
}
示例3: toValue
import org.eclipse.rdf4j.query.algebra.Var; //导入方法依赖的package包/类
protected static Value toValue(Var var, BindingSet bindings) {
if (var.hasValue())
return var.getValue();
if (bindings.hasBinding(var.getName()))
return bindings.getValue(var.getName());
return null;
}
示例4: getVarValue
import org.eclipse.rdf4j.query.algebra.Var; //导入方法依赖的package包/类
/**
* Gets a value from a {@code Var} if it has a {@code Value}. If it does not then the method will attempt to get it
* from the bindings using the name of the Var
* @param var
* @param bindings
* @return the matching {@code Value} or {@code null} if var is {@code null}
*/
private static Value getVarValue(Var var, BindingSet bindings) {
if (var == null) {
return null;
} else if (var.hasValue()) {
return var.getValue();
} else {
return bindings.getValue(var.getName());
}
}
示例5: meet
import org.eclipse.rdf4j.query.algebra.Var; //导入方法依赖的package包/类
/**
* @inheritDoc
*/
@Override
public void meet(Var theVar)
throws Exception
{
if (theVar.isAnonymous() && !theVar.hasValue()) {
mBuffer.append("?").append(BaseTupleExprRenderer.scrubVarName(theVar.getName()));
}
else if (theVar.hasValue()) {
mBuffer.append(SPARQLQueryStringUtil.toSPARQL(theVar.getValue()));
}
else {
mBuffer.append("?").append(theVar.getName());
}
}
示例6: ctxOpen
import org.eclipse.rdf4j.query.algebra.Var; //导入方法依赖的package包/类
private void ctxOpen(TupleExpr theExpr) {
Var aContext = mContexts.get(theExpr);
if (aContext != null) {
mJoinBuffer.append(indent()).append("GRAPH ");
if (aContext.hasValue()) {
mJoinBuffer.append(SPARQLQueryStringUtil.toSPARQL(aContext.getValue()));
}
else {
mJoinBuffer.append("?").append(aContext.getName());
}
mJoinBuffer.append(" {\n");
mIndent += 2;
}
}
示例7: transformVar
import org.eclipse.rdf4j.query.algebra.Var; //导入方法依赖的package包/类
private Var transformVar(Var v, EquivalentIRI uri) {
if (!v.hasValue())
return v;
else {
Var v1 = new Var("const-" + uri.getTargetURI().toString(), uri.getTargetURI());
v1.setConstant(true);
return v1;
}
}
示例8: toString
import org.eclipse.rdf4j.query.algebra.Var; //导入方法依赖的package包/类
public static String toString(Var var) {
if (!var.hasValue())
return "?" + var.getName();
return getValueString(var.getValue());
}
示例9: hasFreeVars
import org.eclipse.rdf4j.query.algebra.Var; //导入方法依赖的package包/类
/**
* returns true iff there is at least one free variable, i.e. there is no binding
* for any variable
*
* @param stmt
* @param bindings
* @return
*/
public static boolean hasFreeVars(StatementPattern stmt, BindingSet bindings) {
for (Var var : stmt.getVarList()) {
if(!var.hasValue() && !bindings.hasBinding(var.getName()))
return true; // there is at least one free var
}
return false;
}
示例10: appendVar
import org.eclipse.rdf4j.query.algebra.Var; //导入方法依赖的package包/类
/**
* Append the variable to the provided StringBuilder.
*
* Cases:
* 1) unbound: check provided bindingset for possible match
* a) match found: append matching value
* b) no match: append ?varName and add to varNames
* 2) bound: append value
*
* @param sb
* @param var
* @param varNames
* @param bindings
*
* @return
* the stringbuilder
*/
protected static StringBuilder appendVar(StringBuilder sb, Var var, Set<String> varNames, BindingSet bindings) {
if (!var.hasValue()) {
if (bindings.hasBinding(var.getName()))
return appendValue(sb, bindings.getValue(var.getName()));
varNames.add(var.getName());
return sb.append("?").append(var.getName());
}
else
return appendValue(sb, var.getValue());
}
示例11: appendVarId
import org.eclipse.rdf4j.query.algebra.Var; //导入方法依赖的package包/类
/**
* Append the variable to the provided StringBuilder, however change name of variable
* by appending "_varId" to it.
*
* Cases:
* 1) unbound: check provided bindingset for possible match
* a) match found: append matching value
* b) no match: append ?varName_varId and add to varNames
* 2) bound: append value
*
* @param sb
* @param var
* @param varNames
* @param bindings
*
* @return
* the complemented string builder
*/
protected static StringBuilder appendVarId(StringBuilder sb, Var var, String varID, Set<String> varNames, BindingSet bindings) {
if (!var.hasValue()) {
if (bindings.hasBinding(var.getName()))
return appendValue(sb, bindings.getValue(var.getName()));
String newName = var.getName() + "_" + varID;
varNames.add(newName);
return sb.append("?").append(newName);
}
else
return appendValue(sb, var.getValue());
}
示例12: getVarValue
import org.eclipse.rdf4j.query.algebra.Var; //导入方法依赖的package包/类
/**
* Return the {@link Value} of the variable which is either taken from
* the variable itself (bound) or from the bindingsset (unbound).
*
* @param var
* @param bindings
* the bindings, must not be null, use {@link EmptyBindingSet} instead
*
* @return
* the value or null
*/
public static Value getVarValue(Var var, BindingSet bindings) {
if (var == null) {
return null;
} else if (var.hasValue()) {
return var.getValue();
} else {
return bindings.getValue(var.getName());
}
}
示例13: appendVar
import org.eclipse.rdf4j.query.algebra.Var; //导入方法依赖的package包/类
/**
* Clone the specified variable and attach bindings.
*
* @param sb
* @param var
* @param varNames
* @param bindings
*
* @return
*/
protected static Var appendVar(Var var, Set<String> varNames, BindingSet bindings) {
Var res = var.clone();
if (!var.hasValue()) {
if (bindings.hasBinding(var.getName()))
res.setValue( bindings.getValue(var.getName()) );
else
varNames.add(var.getName());
}
return res;
}