本文整理汇总了Java中org.openrdf.query.algebra.ValueConstant.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java ValueConstant.getValue方法的具体用法?Java ValueConstant.getValue怎么用?Java ValueConstant.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openrdf.query.algebra.ValueConstant
的用法示例。
在下文中一共展示了ValueConstant.getValue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: meet
import org.openrdf.query.algebra.ValueConstant; //导入方法依赖的package包/类
@Override
public void meet(final Filter node) throws Exception {
super.meet(node);
final ValueExpr arg = node.getCondition();
if (arg instanceof FunctionCall) {
final FunctionCall fc = (FunctionCall) arg;
if (RANGE.stringValue().equals(fc.getURI())) {
//range(?var, start, end)
final List<ValueExpr> valueExprs = fc.getArgs();
if (valueExprs.size() != 3) {
throw new QueryEvaluationException("org.apache:range must have 3 parameters: variable, start, end");
}
final Var var = (Var) valueExprs.get(0);
final ValueConstant startVc = (ValueConstant) valueExprs.get(1);
final ValueConstant endVc = (ValueConstant) valueExprs.get(2);
final Value start = startVc.getValue();
final Value end = endVc.getValue();
rangeValues.put(var, new RangeValue(start, end));
node.setCondition(new ValueConstant(BooleanLiteralImpl.TRUE));
}
}
}
示例2: getTimeUnit
import org.openrdf.query.algebra.ValueConstant; //导入方法依赖的package包/类
private static TimeUnit getTimeUnit(ValueConstant val) {
Preconditions.checkArgument(val.getValue() instanceof URI);
URI uri = (URI) val.getValue();
Preconditions.checkArgument(uri.getNamespace().equals(temporalNameSpace));
switch (uri.getLocalName()) {
case "days":
return TimeUnit.DAYS;
case "hours":
return TimeUnit.HOURS;
case "minutes":
return TimeUnit.MINUTES;
default:
throw new IllegalArgumentException("Invalid time unit for Periodic Function.");
}
}
示例3: extractConstructVar
import org.openrdf.query.algebra.ValueConstant; //导入方法依赖的package包/类
private static Var extractConstructVar(final Map<String, ExtensionElem> extensions,
final ProjectionElem projection) {
final ExtensionElem extension = extensions.get(projection.getSourceName());
String name = projection.getSourceName();
if (name.startsWith("-anon-")) {
name += "-construct";
}
if (extension == null || extension.getExpr() instanceof BNodeGenerator) {
final Var var = new Var(name);
var.setAnonymous(name.startsWith("-anon-"));
return var;
} else if (extension.getExpr() instanceof ValueConstant) {
final ValueConstant constant = (ValueConstant) extension.getExpr();
return new Var(name, constant.getValue());
} else {
throw new UnsupportedOperationException(
"Unsupported extension in construct query: " + extension);
}
}
示例4: parseTemporalDuration
import org.openrdf.query.algebra.ValueConstant; //导入方法依赖的package包/类
private static double parseTemporalDuration(ValueConstant valConst) {
Value val = valConst.getValue();
Preconditions.checkArgument(val instanceof Literal);
Literal literal = (Literal) val;
String stringVal = literal.getLabel();
URI dataType = literal.getDatatype();
Preconditions.checkArgument(dataType.equals(XMLSchema.DECIMAL) || dataType.equals(XMLSchema.DOUBLE)
|| dataType.equals(XMLSchema.FLOAT) || dataType.equals(XMLSchema.INTEGER) || dataType.equals(XMLSchema.INT));
return Double.parseDouble(stringVal);
}
示例5: filterCommonVars
import org.openrdf.query.algebra.ValueConstant; //导入方法依赖的package包/类
private static List<List<String>> filterCommonVars(List<QueryModelNode> vars1, List<QueryModelNode> vars2) {
List<List<String>> varList = Lists.newArrayList();
List<String> varList1 = Lists.newArrayList();
List<String> varList2 = Lists.newArrayList();
for (int i = 0; i < vars1.size(); i++) {
if ((vars1.get(i) instanceof ValueConstant) && (vars2.get(i) instanceof Var)) {
ValueConstant vc = (ValueConstant) vars1.get(i);
String s = vc.getValue().toString();
if(vc.getValue() instanceof Literal) {
s = s.substring(1, s.length() - 1);
}
s = "-const-" + s;
varList1.add(s);
varList2.add(((Var)vars2.get(i)).getName());
} else if(!(vars1.get(i) instanceof ValueConstant)){
if (!((Var) vars1.get(i)).isConstant() && (vars2.get(i) instanceof Var)
&& !((Var) vars2.get(i)).isConstant()) {
varList1.add(((Var) vars1.get(i)).getName());
varList2.add(((Var) vars2.get(i)).getName());
} else if (((Var) vars1.get(i)).isConstant() && (vars2.get(i) instanceof Var)
&& !((Var) vars2.get(i)).isConstant()) {
varList1.add(((Var) vars1.get(i)).getName());
varList2.add(((Var) vars2.get(i)).getName());
}
}
}
varList.add(varList1);
varList.add(varList2);
return varList;
}
示例6: meet
import org.openrdf.query.algebra.ValueConstant; //导入方法依赖的package包/类
public void meet(ValueConstant val) {
String s = val.getValue().toString();
if (val.getValue() instanceof Literal) {
s = s.substring(1, s.length() - 1);
}
s = "-const-" + s;
valMap.put(s, val.getValue());
}
示例7: meet
import org.openrdf.query.algebra.ValueConstant; //导入方法依赖的package包/类
@Override
public void meet(Compare arg0) throws Exception {
ValueExpr left = arg0.getLeftArg();
if (!(left instanceof Var))
return;
Var var = (Var) left;
if (!var.equals(inXSDDateTimeVar))
return;
CompareOp op = arg0.getOperator();
ValueExpr right = arg0.getRightArg();
if (!(right instanceof ValueConstant)) {
if (log.isLoggable(Level.SEVERE))
log.severe("Expected value constant for time filter [right = "
+ right + "]");
return;
}
ValueConstant constant = (ValueConstant) right;
Value value = constant.getValue();
if (!(value instanceof Literal)) {
if (log.isLoggable(Level.SEVERE))
log.severe("Expected literal value [value = " + value + "]");
return;
}
Literal literal = (Literal)value;
if (!literal.getDatatype().equals(XMLSchema.DATETIME)) {
if (log.isLoggable(Level.SEVERE))
log.severe("Expected XSD date time literal datatype [literal = " + literal + "]");
return;
}
if (op.equals(CompareOp.GE)) {
timeFrom = dtf.parseDateTime(literal.getLabel());
} else if (op.equals(CompareOp.LT)) {
timeTo = dtf.parseDateTime(literal.getLabel());
} else {
if (log.isLoggable(Level.SEVERE))
log.severe("Expected either >= or < operator in time filter");
}
}
示例8: meet
import org.openrdf.query.algebra.ValueConstant; //导入方法依赖的package包/类
@Override
public void meet(ValueConstant arg0) throws SparqlParserException
{
Value value = arg0.getValue();
visitValue(value);
}