Package com.hp.hpl.jena.sparql.core

Examples of com.hp.hpl.jena.sparql.core.Var


       
        // See also ExProg1
       
        ElementGroup elg = new ElementGroup() ;
       
        Var varTitle = Var.alloc("title") ;
        Var varX = Var.alloc("x") ;
       
        Triple t1 = new Triple(varX, DC.title.asNode(),  varTitle) ;
        elg.addTriplePattern(t1) ;
       
        // Adds a filter.  Need to wrap variable in a NodeVar.
View Full Code Here


    {
        Iterator<Var> vIter = b.vars() ;
        BindingMap b2 = create() ;
        while( vIter.hasNext() )
        {
            Var v = vIter.next();
            b2.add(v, b.get(v)) ;
        }
        return b2 ;
    }
View Full Code Here

            BindingMap b2 = BindingFactory.create(parentBinding) ;

            // Copy the resultSet bindings to the combined result binding with checking.
            for ( Iterator<Var> iter = b.vars() ; iter.hasNext(); )
            {
                Var v = iter.next();
                Node n = b.get(v) ;
                if ( b2.contains(v) )
                {
                    Node n2 = b2.get(v) ;
                    if ( n2.equals(n) )
View Full Code Here

            if ( Var.isVar(opGraph.getNode()) )
            {
                // This is the join of the graph node variable to the sub-pattern solution.
                // Do after the subpattern so that the variable is not visible to the
                // subpattern.
                Var v = Var.alloc(opGraph.getNode()) ;
                qIter = new QueryIterAssignVarValue(qIter, v, gn, getExecContext()) ;
            }
           
            return qIter ;
        }
View Full Code Here

                    if ( accs == null )
                    {
                        for ( ExprAggregator agg : aggregators )
                        {
                            Accumulator x = agg.getAggregator().createAccumulator() ;
                            Var v = agg.getVar() ;
                            accumulators.put(key, Pair.create(v, x)) ;
                        }
                        accs = accumulators.get(key) ;
                    }

                    // Do the per-accumulator calculation.
                    for ( Pair<Var, Accumulator> pair : accs )
                        pair.getRight().accumulate(b, execCxt) ;
                }

                // Phase 2 : Empty input
                // has as iter.hasNext false at start.

                // If there are no binding from the input stage, two things can happen.
                //   If there are no aggregators, there are no groups.
                //   If there are aggregators, then they may have a default value.

                if ( accumulators.isEmpty() )
                {
                    if ( noAggregators )
                    {
                        // No rows to group, no aggregators.
                        // ==> No result rows.
                        return Iter.nullIterator() ;
                    }
                   
                    BindingMap binding = BindingFactory.create() ;

                    for ( Iterator<ExprAggregator> aggIter = aggregators.iterator() ; aggIter.hasNext() ; )
                    {
                        ExprAggregator agg = aggIter.next();
                        Var v = agg.getVar() ;
                        Node value = agg.getAggregator().getValueEmpty() ;
                        if ( value != null )
                            binding.add(v, value) ;
                    }
                       
                    if ( binding == null )
                        // This does not happen if there are any aggregators.
                        return Iter.nullIterator() ;
                    // cast to get the static type inference to work.
                    return Iter.singletonIter((Binding)binding) ;
                }

                // Phase 2 : There was input and so there are some groups.
                // For each bucket, get binding, add aggregator values to the binding.
                // We used AccNull so there are always accumulators.
               
                if ( noAggregators )
                    // We used placeholder so there are always the key.
                    return accumulators.keys().iterator() ;
               
                List<Binding> results = new ArrayList<Binding>() ;

                for ( Binding k : accumulators.keys() )
                {
                    Collection<Pair<Var, Accumulator>> accs = accumulators.get(k) ;
                    BindingMap b = BindingFactory.create(k) ;
                   
                    for ( Pair<Var, Accumulator> pair : accs )
                    {
                        Var v = pair.getLeft() ;
                        NodeValue value = pair.getRight().getValue() ;
                        Node n = (value==null) ? null : value.asNode() ;
                        if ( v == null || n == null )
                        {}
                        else
View Full Code Here

        // No group vars (implicit or explicit) => working on whole result set.
        // Still need a BindingMap to assign to later.
        BindingMap x = BindingFactory.create() ;
        for ( Iterator<Var> iter = vars.getVars().iterator() ; iter.hasNext() ; )
        {
            Var var = iter.next() ;
            Node node = vars.get(var, binding, execCxt) ;
            // Null returned for unbound and error.
            if ( node != null )
                x.add(var, node) ;
        }
View Full Code Here

    SolutionModifier();
    ValuesClause();
  }

  final public void SelectClause() throws ParseException {
                        Var v ; Expr expr ; Node n ;
    jj_consume_token(SELECT);
      getQuery().setQuerySelectType() ;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case DISTINCT:
    case REDUCED:
View Full Code Here

      }
    }
  }

  final public void GroupCondition() throws ParseException {
                          Var v = null ; Expr expr = null ;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case EXISTS:
    case NOT:
    case COUNT:
    case MIN:
View Full Code Here

      {if (true) return new ElementService(n, el, silent) ;}
    throw new Error("Missing return statement in function");
  }

  final public Element Bind() throws ParseException {
                   Var v ; Expr expr ;
    jj_consume_token(BIND);
    jj_consume_token(LPAREN);
    expr = Expression();
    jj_consume_token(AS);
    v = Var();
View Full Code Here

      throw new ParseException();
    }
  }

  final public void InlineDataOneVar() throws ParseException {
                            Var v ; Node n ; Token t ;
    v = Var();
    emitDataBlockVariable(v) ;
    t = jj_consume_token(LBRACE);
    label_17:
    while (true) {
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.core.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.