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


Java Var.hasValue方法代码示例

本文整理汇总了Java中org.openrdf.query.algebra.Var.hasValue方法的典型用法代码示例。如果您正苦于以下问题:Java Var.hasValue方法的具体用法?Java Var.hasValue怎么用?Java Var.hasValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openrdf.query.algebra.Var的用法示例。


在下文中一共展示了Var.hasValue方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: meet

import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
@Override
public void meet(Var node) throws RuntimeException {
	if (node.hasValue()) {
		// bound variable (constant)
		Value value = node.getValue();
		if (value instanceof URI)
			buffer.append("<").append(value).append(">");
		else
			buffer.append(value);
	} else {
		// unbound variable
		if (node.isAnonymous())
			buffer.append("[]");
		else
			buffer.append("?").append(node.getName());
	}
}
 
开发者ID:goerlitz,项目名称:rdffederator,代码行数:18,代码来源:SparqlPrinter.java

示例2: getConstantVars

import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
protected List<Var> getConstantVars(Iterable<Var> vars) {
    List<Var> constantVars = new ArrayList<Var>();

    for (Var var : vars) {
        if (var.hasValue()) {
            constantVars.add(var);
        }
    }

    return constantVars;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:12,代码来源:QueryJoinOptimizer.java

示例3: getUnboundVars

import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
protected List<Var> getUnboundVars(Iterable<Var> vars) {
    List<Var> unboundVars = new ArrayList<Var>();

    for (Var var : vars) {
        if (!var.hasValue() && !this.boundVars.contains(var.getName())) {
            unboundVars.add(var);
        }
    }

    return unboundVars;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:12,代码来源:QueryJoinOptimizer.java

示例4: meet

import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
@Override
public void meet(final Var node) {
    final String oldName = node.getName();
    if (rule.varMap.containsKey(oldName)) {
        node.setName(rule.varMap.get(oldName).getName());
    }
    else {
        if (node.hasValue() || node.equals(SUBJ_VAR) || node.equals(PRED_VAR) || node.equals(OBJ_VAR) || node.equals(CON_VAR)) {
            return;
        }
        node.setName(UNDEFINED_VAR.getName());
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:14,代码来源:CopyRule.java

示例5: CopyRule

import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
/**
 * Instantiate a rule containing a StatementPattern, renaming any variables to canonical
 * subject/predicate/object forms and saving the mappings from the original variable names.
 * @param sp StatementPattern defining a set of triples to match
 */
public CopyRule(final StatementPattern sp) throws QueryRulesetException {
    statement = sp;
    final Var subjVar = statement.getSubjectVar();
    final Var predVar = statement.getPredicateVar();
    final Var objVar = statement.getObjectVar();
    final Var conVar = statement.getContextVar();
    int variables = 0;
    if (subjVar == null || !subjVar.hasValue()) {
        sp.setSubjectVar(SUBJ_VAR);
        if (subjVar != null) {
            varMap.put(subjVar.getName(), SUBJ_VAR);
        }
        variables++;
    }
    if (predVar == null || !predVar.hasValue()) {
        sp.setPredicateVar(PRED_VAR);
        if (predVar != null) {
            varMap.put(predVar.getName(), PRED_VAR);
        }
        variables++;
    }
    if (objVar == null || !objVar.hasValue()) {
        sp.setObjectVar(OBJ_VAR);
        if (objVar != null) {
            varMap.put(objVar.getName(), OBJ_VAR);
        }
        variables++;
    }
    if (variables == 3) {
        throw new QueryRulesetException("Statement pattern with no constants would match every statement:\n" + sp);
    }
    if (conVar != null && !conVar.hasValue()) {
        sp.setContextVar(CON_VAR);
        varMap.put(conVar.getName(), CON_VAR);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:42,代码来源:CopyRule.java

示例6: varIsGeneralization

import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
/**
 * Determine whether the first variable is at least as general as the second.
 */
private static boolean varIsGeneralization(final Var first, final Var second) {
    if (first == null || !first.hasValue()) {
        // if first is a variable, it is at least as general
        return true;
    }
    // Otherwise, it is only at least as general if they are the same value
    return second != null && first.getValue().equals(second.getValue());
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:12,代码来源:CopyRule.java

示例7: meet

import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
@Override
public void meet(Var var) {
    if (!var.hasValue()) {
        varNames.add(var.getName());
    }
    vars.add(var);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:8,代码来源:QueryVariableNormalizer.java

示例8: processPropertySearches

import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
private void processPropertySearches(final TupleExpr tupleExpr, final Collection<Var> searchProperties) {
    final MatchStatementVisitor matchStatements = new MatchStatementVisitor(searchProperties);
    tupleExpr.visit(matchStatements);
    for (final StatementPattern matchStatement: matchStatements.matchStatements) {
        final Var subject = matchStatement.getSubjectVar();
        if (subject.hasValue() && !(subject.getValue() instanceof Resource)) {
            throw new IllegalArgumentException("Query error: Found " + subject.getValue() + ", expected an URI or BNode");
        }
        Validate.isTrue(subject.hasValue() || subject.getName() != null);
        Validate.isTrue(!matchStatement.getObjectVar().hasValue() && matchStatement.getObjectVar().getName() != null);
        buildQuery(tupleExpr, matchStatement);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:14,代码来源:FilterFunctionOptimizer.java

示例9: meet

import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
@Override
public void meet(Var node) throws RuntimeException {
	if (node.hasValue()) {
		Value value = node.getValue();
		if (value instanceof URI)
			buffer.append("<").append(value).append(">");
		else
			buffer.append(node.getValue());
	} else
		buffer.append("?").append(node.getName());
}
 
开发者ID:goerlitz,项目名称:rdffederator,代码行数:12,代码来源:AnnotatingTreePrinter.java

示例10: containsVar

import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
private boolean containsVar(StatementPattern pattern, Var var) {
	String varName = var.getName();
	Var sVar = pattern.getSubjectVar();
	Var oVar = pattern.getObjectVar();
	return (!sVar.hasValue() && sVar.getName().equals(varName))
		|| (!oVar.hasValue() && oVar.getName().equals(varName));
}
 
开发者ID:goerlitz,项目名称:rdffederator,代码行数:8,代码来源:SubQueryBuilder.java

示例11: getValue

import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
private Value getValue(Var subjectVar) {
    return subjectVar.hasValue() ? subjectVar.getValue() : null;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:4,代码来源:StatementPatternStorage.java

示例12: getPredicateRestrictions

import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
public static Collection<URI> getPredicateRestrictions(Var predicate) {
    if (predicate.hasValue())
        return Collections.singleton((URI) predicate.getValue());
    return Collections.emptyList();
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:6,代码来源:IteratorFactory.java

示例13: meet

import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
@Override
public void meet(Var var) {
  if (var.hasValue()) {
    var.setValue(vf.asRdbmsValue(var.getValue()));
  }
}
 
开发者ID:esarbanis,项目名称:strabon,代码行数:7,代码来源:GeneralDBValueIdLookupOptimizer.java

示例14: getVarValue

import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
/**
 * Assigns BindingSet values for any {@link Var} whose {@link Value} is
 * null. Returns the {@link Value} associated with Var (if it has one),
 * otherwise returns the BindingSet Value corresponding to
 * {@link Var#getName()}. If no such Binding exits, this method returns
 * null.
 * 
 * @param var
 * @param bindings
 * @return Value
 */
private Value getVarValue(Var var, BindingSet bindings) {
    if (var == null) {
        return null;
    } else if (var.hasValue()) {
        return var.getValue();
    } else {
        return bindings.getValue(var.getName());
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:21,代码来源:StatementMetadataNode.java


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