本文整理汇总了Java中org.openrdf.query.algebra.Var.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Var.getName方法的具体用法?Java Var.getName怎么用?Java Var.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openrdf.query.algebra.Var
的用法示例。
在下文中一共展示了Var.getName方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ConstructProjection
import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
public ConstructProjection(Var subjectVar, Var predicateVar, Var objectVar) {
Preconditions.checkNotNull(subjectVar);
Preconditions.checkNotNull(predicateVar);
Preconditions.checkNotNull(objectVar);
subjName = subjectVar.getName();
predName = predicateVar.getName();
objName = objectVar.getName();
Preconditions.checkNotNull(subjName);
Preconditions.checkNotNull(predName);
Preconditions.checkNotNull(objName);
this.subjVar = subjectVar;
this.predVar = predicateVar;
this.objVar = objectVar;
if((subjVar.isAnonymous() || subjName.startsWith("-anon-")) && subjectVar.getValue() == null) {
subjValue = Optional.of(new BNodeImpl(""));
} else {
subjValue = Optional.ofNullable(subjectVar.getValue());
}
predValue = Optional.ofNullable(predicateVar.getValue());
objValue = Optional.ofNullable(objectVar.getValue());
}
示例2: meet
import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
@Override
public void meet(final Var n) {
final String name = n.getName();
if (n.getValue() != null) {
emit(n.getValue());
} else if (!n.isAnonymous()) {
emit("?" + n.getName());
} else {
final ValueExpr expr = getVarExpr(this.root, n.getName());
if (expr != null) {
emit(expr);
} else if (getVarRefs(this.root, n.getName()) <= 1) {
emit("[]");
} else {
emit("?").emit(sanitize(name));
}
}
}
示例3: createSpatialColumn
import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
/**
* 13/09/2011 Extra constructor to use in spatial cases
*
*/
public static GeneralDBColumnVar createSpatialColumn(String alias, Var v, Value value) {
GeneralDBColumnVar var = new GeneralDBColumnVar();
var.alias = alias;
var.column = "id";
var.name = v.getName();
var.anonymous = v.isAnonymous();
var.value = value;
var.types = ValueTypes.UNKNOWN;
if (value instanceof RdbmsResource) {
var.types = ValueTypes.RESOURCE;
}
var.setSpatial(true);
return var;
}
示例4: createObj
import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
/**
* Extra constructor to use in spatial cases
*
* @param isSpatial
* @return
*/
public static GeneralDBColumnVar createObj(String alias, Var v, Value value, boolean isSpatial) {
GeneralDBColumnVar var = new GeneralDBColumnVar();
var.alias = alias;
var.column = "obj";
var.name = v.getName();
var.anonymous = v.isAnonymous();
var.value = value;
var.types = ValueTypes.UNKNOWN;
if (value instanceof RdbmsURI) {
var.types = ValueTypes.URI;
} else if (value instanceof RdbmsResource) {
var.types = ValueTypes.RESOURCE;
}
var.setSpatial(isSpatial);
return var;
}
示例5: createCtx
import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
public static GeneralDBColumnVar createCtx(String alias, Var v, Resource resource) {
GeneralDBColumnVar var = new GeneralDBColumnVar();
var.alias = alias;
var.column = "ctx";
if (v == null) {
var.name = "__ctx" + Integer.toHexString(System.identityHashCode(var));
var.anonymous = true;
var.hidden = true;
} else {
var.name = v.getName();
var.anonymous = v.isAnonymous();
}
var.value = resource;
var.types = ValueTypes.RESOURCE;
if (resource instanceof RdbmsURI) {
var.types = ValueTypes.URI;
}
return var;
}
示例6: toStatementPatternString
import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
/**
* Provides a string representation of an SP which contains info about
* whether each component (subj, pred, obj) is constant and its data and
* data type if it is constant.
*
* @param sp - The statement pattern to convert. (not null)
* @return A String representation of the statement pattern that may be
* used to do triple matching.
*/
public static String toStatementPatternString(final StatementPattern sp) {
checkNotNull(sp);
final Var subjVar = sp.getSubjectVar();
String subj = subjVar.getName();
if(subjVar.getValue() != null) {
Value subjValue = subjVar.getValue();
if (subjValue instanceof BNode ) {
subj = subj + TYPE_DELIM + RyaSchema.BNODE_NAMESPACE + TYPE_DELIM + ((BNode) subjValue).getID();
} else {
subj = subj + TYPE_DELIM + URI_TYPE;
}
}
final Var predVar = sp.getPredicateVar();
String pred = predVar.getName();
if(predVar.getValue() != null) {
pred = pred + TYPE_DELIM + URI_TYPE;
}
final Var objVar = sp.getObjectVar();
String obj = objVar.getName();
if (objVar.getValue() != null) {
final RyaType rt = RdfToRyaConversions.convertValue(objVar.getValue());
obj = obj + TYPE_DELIM + rt.getDataType().stringValue();
}
return subj + DELIM + pred + DELIM + obj;
}
示例7: parseAndSetValues
import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
/**
*
* @param values - Values extracted from FunctionCall representing the PeriodicQuery Filter
* @param arg - Argument of the PeriodicQueryNode that will be created (PeriodicQueryNode is a UnaryTupleOperator)
* @return - PeriodicQueryNode to be inserted in place of the original FunctionCall
* @throws Exception
*/
private static PeriodicQueryNode parseAndSetValues(List<ValueExpr> values, TupleExpr arg) throws Exception {
// general validation of input
Preconditions.checkArgument(values.size() == 4);
Preconditions.checkArgument(values.get(0) instanceof Var);
Preconditions.checkArgument(values.get(1) instanceof ValueConstant);
Preconditions.checkArgument(values.get(2) instanceof ValueConstant);
Preconditions.checkArgument(values.get(3) instanceof ValueConstant);
// get temporal variable
Var var = (Var) values.get(0);
Preconditions.checkArgument(var.getValue() == null);
String tempVar = var.getName();
// get TimeUnit
TimeUnit unit = getTimeUnit((ValueConstant) values.get(3));
// get window and period durations
double windowDuration = parseTemporalDuration((ValueConstant) values.get(1));
double periodDuration = parseTemporalDuration((ValueConstant) values.get(2));
long windowMillis = convertToMillis(windowDuration, unit);
long periodMillis = convertToMillis(periodDuration, unit);
// period must evenly divide window at least once
Preconditions.checkArgument(windowMillis > periodMillis);
Preconditions.checkArgument(windowMillis % periodMillis == 0, "Period duration does not evenly divide window duration.");
// create PeriodicMetadata.Builder
return new PeriodicQueryNode(windowMillis, periodMillis, TimeUnit.MILLISECONDS, tempVar, arg);
}
示例8: 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());
}
}
示例9: meet
import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
@Override public void meet(final StatementPattern statement) {
final Var object = statement.getObjectVar();
if (propertyVars.contains(object)) {
if (usedVars.contains(object)) {
throw new IllegalArgumentException("Illegal search, variable is used multiple times as object: " + object.getName());
} else {
usedVars.add(object);
matchStatements.add(statement);
}
}
}
示例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));
}
示例11: createSubj
import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
public static GeneralDBColumnVar createSubj(String alias, Var v, Resource resource) {
GeneralDBColumnVar var = new GeneralDBColumnVar();
var.alias = alias;
var.column = "subj";
var.name = v.getName();
var.anonymous = v.isAnonymous();
var.value = resource;
var.types = ValueTypes.RESOURCE;
if (resource instanceof RdbmsURI) {
var.types = ValueTypes.URI;
}
return var;
}
示例12: GeneralDBValueColumnBase
import org.openrdf.query.algebra.Var; //导入方法依赖的package包/类
public GeneralDBValueColumnBase(Var var) {
this.name = var.getName();
}