Package org.openrdf.query.algebra

Examples of org.openrdf.query.algebra.Var


       
        _typeURI = _exhibit.getDatabase().getTypeURI(itemTypes);
    }

    public Var getAllItems(TupleQueryBuilder builder, Var defaultVar) {
        Var var = defaultVar != null ? defaultVar : builder.makeVar("item");
       
        builder.addTupleExpr(
            new StatementPattern(
                var,
                builder.makeVar("p", RDF.TYPE),
View Full Code Here


        super.configure(config, backChannel);
        // nothing to do
    }
   
    public Var getAllItems(TupleQueryBuilder builder, Var defaultVar) {
        Var var = defaultVar != null ? defaultVar : builder.makeVar("item");
       
        builder.addTupleExpr(
            new StatementPattern(
                var,
                builder.makeVar("p", RDF.TYPE),
View Full Code Here

        String      rootName = _rootVariable != null ? _rootVariable : "value";
        ValueExpr   valueExpr = variableValues.get(rootName);
        String      valueType = variableTypes.get(rootName);
        for (PathSegment segment : _segments) {
            if (valueExpr instanceof Var) {
                Var input = (Var) valueExpr;
               
                PropertyRecord record = database.getPropertyRecord(segment.propertyID);
                if (record == null) {
                  throw new ExpressionException("No property can be aliased to '" + segment.propertyID + "'");
                }
               
                Var output = builder.makeVar("seg");
                Var propertyVar = builder.makeVar("seg", record.uri);
                if (segment.forward) {
                    builder.addTupleExpr(new StatementPattern(input, propertyVar, output));
                    valueType = record.valueType;
                } else {
                    builder.addTupleExpr(new StatementPattern(output, propertyVar, input));
View Full Code Here

    public Var getAllItems(TupleQueryBuilder builder, Var defaultVar) {
        throw new NotImplementedException();
    }
   
    public Var getRestrictedItems(TupleQueryBuilder builder, Var defaultVar) {
        Var itemVar = getAllItems(builder, defaultVar);
       
        computeRestrictedItems(builder, itemVar, null);
       
        return itemVar;
    }
View Full Code Here

        fireOnItemsChanged(backChannel);
    }
   
    protected void updateOneFacet(Facet facet, BackChannel backChannel) {
        TupleQueryBuilder builder = new TupleQueryBuilder();
        Var itemVar = getAllItems(builder, null);
       
        computeRestrictedItems(builder, itemVar, facet);
       
        try {
            facet.update(builder, itemVar, backChannel);
View Full Code Here

  /*---------*
   * Methods *
   *---------*/

  private Var createConstantVar(Value value) {
    Var var = new Var("-const-" + constantVarID++);
    var.setAnonymous(true);
    var.setValue(value);
    return var;
  }
View Full Code Here

        extension.addElement(new ExtensionElem(valueExpr, alias));
        projElemList.addElement(new ProjectionElem(alias));
      }
      else if (valueExpr instanceof Var) {
        // unaliased variable
        Var projVar = (Var)valueExpr;
        projElemList.addElement(new ProjectionElem(projVar.getName()));
      }
      else {
        throw new IllegalStateException("required alias for non-Var projection elements not found");
      }
    }
View Full Code Here

  @Override
  public Object visit(ASTFrom node, Object data)
    throws VisitorException
  {
    StatementPattern.Scope scope = StatementPattern.Scope.DEFAULT_CONTEXTS;
    Var contextVar = null;

    if (node.hasContextID()) {
      scope = StatementPattern.Scope.NAMED_CONTEXTS;
      ValueExpr contextID = (ValueExpr)node.getContextID().jjtAccept(this, null);
View Full Code Here

  @Override
  public Object visit(ASTBasicPathExprTail tailNode, Object data)
    throws VisitorException
  {
    List<Var> subjVars = (List<Var>)data;
    Var predVar = (Var)tailNode.getEdge().jjtAccept(this, null);
    List<Var> objVars = (List<Var>)tailNode.getNode().jjtAccept(this, null);

    Var contextVar = graphPattern.getContextVar();
    StatementPattern.Scope spScope = graphPattern.getStatementPatternScope();

    for (Var subjVar : subjVars) {
      for (Var objVar : objVars) {
        StatementPattern sp = new StatementPattern(spScope, subjVar, predVar, objVar, contextVar);
View Full Code Here

    throws VisitorException
  {
    List<Var> nodeVars = new ArrayList<Var>();

    for (ASTNodeElem nodeElem : node.getNodeElemList()) {
      Var nodeVar = (Var)nodeElem.jjtAccept(this, null);
      nodeVars.add(nodeVar);
    }

    // Create any implicit unequalities
    for (int i = 0; i < nodeVars.size() - 1; i++) {
      Var var1 = nodeVars.get(i);

      for (int j = i + 1; j < nodeVars.size(); j++) {
        Var var2 = nodeVars.get(j);

        // At least one of the variables should be non-constant
        // for the unequality to make any sense:
        if (!var1.hasValue() || !var2.hasValue()) {
          graphPattern.addConstraint(new Not(new SameTerm(var1, var2)));
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.openrdf.query.algebra.Var

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.