Search in sources :

Example 1 with AssignmentNode

use of com.bigdata.rdf.sparql.ast.AssignmentNode in project wikidata-query-rdf by wikimedia.

the class EmptyLabelServiceOptimizer method addResolutions.

/**
 * Infer that the user wanted to resolve some variables using the label
 * service.
 */
private void addResolutions(AST2BOpContext ctx, JoinGroupNode g, ProjectionNode p) {
    if (p == null) {
        return;
    }
    for (AssignmentNode a : p) {
        IVariable<IV> v = a.getVar();
        if (a.getValueExpression() != v) {
            continue;
        }
        /*
             * Try and match a variable name we can resolve via labels. Note
             * that we should match AltLabel before Label because Label is a
             * suffix of it....
             */
        boolean replaced = addResolutionIfSuffix(ctx, g, "AltLabel", SKOS.ALT_LABEL, v) || addResolutionIfSuffix(ctx, g, "Label", RDFS.LABEL, v) || addResolutionIfSuffix(ctx, g, "Description", DESCRIPTION, v);
        if (replaced && log.isDebugEnabled()) {
            log.debug("Resolving {} using a label lookup.", v);
        }
    }
}
Also used : AssignmentNode(com.bigdata.rdf.sparql.ast.AssignmentNode) IV(com.bigdata.rdf.internal.IV)

Aggregations

IV (com.bigdata.rdf.internal.IV)1 AssignmentNode (com.bigdata.rdf.sparql.ast.AssignmentNode)1