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


Java ProjectionElem.getSourceName方法代码示例

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


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

示例1: meet

import org.openrdf.query.algebra.ProjectionElem; //导入方法依赖的package包/类
@Override
public void meet(final ProjectionElem n) {

    final String source = n.getSourceName();
    final String target = n.getTargetName();
    final ValueExpr expr = n.getSourceExpression() == null ? null : n
            .getSourceExpression().getExpr();

    if (target.startsWith("-")) {
        if (expr != null) {
            emit("(").emit(expr).emit(" AS ?").emit(sanitize(target)).emit(")");
        }
    } else if (expr != null) {
        emit("(").emit(expr).emit(" AS ?").emit(target).emit(")");
    } else if (!equalOrNull(source, target)) {
        emit("(?").emit(source).emit(" AS ?").emit(target).emit(")");
    } else {
        emit("?").emit(target);
    }
}
 
开发者ID:dkmfbk,项目名称:knowledgestore,代码行数:21,代码来源:SPARQLRenderer.java

示例2: extractConstructVar

import org.openrdf.query.algebra.ProjectionElem; //导入方法依赖的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);
    }
}
 
开发者ID:dkmfbk,项目名称:knowledgestore,代码行数:20,代码来源:SPARQLRenderer.java

示例3: project

import org.openrdf.query.algebra.ProjectionElem; //导入方法依赖的package包/类
/**
 * Applies the projection to a value. If the result has a blank node whose ID is not mapped to a value in
 * {@code blankNodes}, then a random UUID will be used.
 *
 * @param bs - The value the projection will be applied to. (not null)
 * @param blankNodes - A map from node source names to the blank nodes that will be used for those names. (not null)
 * @return A new value that is the result of the projection.
 */
public VisibilityBindingSet project(final VisibilityBindingSet bs, final Map<String, BNode> blankNodes) {
    requireNonNull(bs);
    requireNonNull(blankNodes);

    // Apply the projection elements against the original binding set.
    final MapBindingSet result = new MapBindingSet();
    for (final ProjectionElem elem : projectionElems.getElements()) {
        final String sourceName = elem.getSourceName();

        Value value = null;

        // If the binding set already has the source name, then use the target name.
        if (bs.hasBinding(sourceName)) {
            value = bs.getValue(elem.getSourceName());
        }

        // If the source name represents a constant value, then use the constant.
        else if(constantSources.containsKey(sourceName)) {
            value = constantSources.get(sourceName);
        }

        // If the source name represents an anonymous value, then create a Blank Node.
        else if(anonymousSources.contains(sourceName)) {
            if(blankNodes.containsKey(sourceName)) {
                value = blankNodes.get(sourceName);
            } else {
                value = vf.createBNode( UUID.randomUUID().toString() );
            }
        }

        // Only add the value if there is one. There may not be one if a binding is optional.
        if(value != null) {
            result.addBinding(elem.getTargetName(), value);
        }
    }

    return new VisibilityBindingSet(result, bs.getVisibility());
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:47,代码来源:ProjectionEvaluator.java

示例4: getConstructGraphVarOrder

import org.openrdf.query.algebra.ProjectionElem; //导入方法依赖的package包/类
private static VariableOrder getConstructGraphVarOrder(final List<ProjectionElemList> projections) {
    final Set<String> varOrders = new HashSet<>();

    for(final ProjectionElemList elems: projections) {
        for(final ProjectionElem elem: elems.getElements()) {
            final String name = elem.getSourceName();
            if(!name.startsWith("-const-") && !name.startsWith("-anon-")) {
                varOrders.add(name);
            }
        }
    }

    return new VariableOrder(varOrders);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:15,代码来源:SparqlFluoQueryBuilder.java

示例5: meet

import org.openrdf.query.algebra.ProjectionElem; //导入方法依赖的package包/类
@Override
public void meet(ProjectionElemList node) {
    List<ProjectionElem> proj = node.getElements();
    for (ProjectionElem s : proj) {
        if (varChanges.containsKey(s.getSourceName())) {
            String name = s.getSourceName();
            s.setSourceName(varChanges.get(name));
            s.setTargetName(varChanges.get(name));
           
        }
    }

}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:14,代码来源:QueryVariableNormalizer.java

示例6: recordConsequent

import org.openrdf.query.algebra.ProjectionElem; //导入方法依赖的package包/类
private void recordConsequent(ProjectionElemList variables, List<ExtensionElem> extensionElements) {
    Map<String, Value> bindings = new ConcurrentHashMap<>();
    Map<String, Value> values = new ConcurrentHashMap<>();
    Set<String> queryBnodes = new HashSet<>();
    Set<String> projectedBnodes = new HashSet<>();
    for (ExtensionElem ee : extensionElements) {
        if (ee.getExpr() instanceof ValueConstant) {
            bindings.put(ee.getName(), ((ValueConstant) ee.getExpr()).getValue());
        }
        else if (ee.getExpr() instanceof BNodeGenerator) {
            queryBnodes.add(ee.getName());
        }
    }
    for (ProjectionElem var : variables.getElements()) {
        String sourceName = var.getSourceName();
        String targetName = var.getTargetName();
        Value constValue = bindings.get(sourceName);
        if (constValue != null) {
            values.put(targetName, constValue);
        }
        else if (queryBnodes.contains(sourceName)) {
            projectedBnodes.add(targetName);
        }
    }
    Var subjVar = new Var(SUBJECT_VAR_NAME, values.get(SUBJECT_VAR_NAME));
    Var predVar = new Var(PREDICATE_VAR_NAME, values.get(PREDICATE_VAR_NAME));
    Var objVar = new Var(OBJECT_VAR_NAME, values.get(OBJECT_VAR_NAME));
    subjVar.setAnonymous(projectedBnodes.contains(SUBJECT_VAR_NAME));
    predVar.setAnonymous(projectedBnodes.contains(PREDICATE_VAR_NAME));
    objVar.setAnonymous(projectedBnodes.contains(OBJECT_VAR_NAME));
    StatementPattern sp = new StatementPattern(subjVar, predVar, objVar);
    consequentStatementPatterns.add(sp);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:34,代码来源:ConstructConsequentVisitor.java


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