Package com.hp.hpl.jena.sparql.engine.iterator

Examples of com.hp.hpl.jena.sparql.engine.iterator.QueryIterConcat


 
  public Graph description() {
    if (executed) return result;
    executed = true;

    final QueryIterConcat qIter = new QueryIterConcat(context);
    Pingback<?> pingback = null;
    if (timeout > 0) {
      pingback = AlarmClock.get().add(new Callback<Object>() {
        public void proc(Object ignore) {
          qIter.cancel();
        }
      }, timeout);
    }
   
    FindQuery outgoing = new FindQuery(
        Triple.create(node, Node.ANY, Node.ANY),
        mapping.compiledPropertyBridges(), limit, context);
    qIter.add(outgoing.iterator());
   
    if (!onlyOutgoing) {
      FindQuery incoming = new FindQuery(
          Triple.create(Node.ANY, Node.ANY, node),
          mapping.compiledPropertyBridges(), limit, context);
      qIter.add(incoming.iterator());
 
      FindQuery triples = new FindQuery(
          Triple.create(Node.ANY, node, Node.ANY),
          mapping.compiledPropertyBridges(), limit, context);
      qIter.add(triples.iterator());
    }
    result.getBulkUpdateHandler().add(TripleQueryIter.create(qIter));
   
    if (pingback != null) {
      AlarmClock.get().cancel(pingback);
View Full Code Here


    }
    return result;
  }
 
  public QueryIter iterator() {
    QueryIterConcat qIter = new QueryIterConcat(context);
    for (CompatibleRelationGroup group:
        CompatibleRelationGroup.groupNodeRelations(selectedTripleRelations())) {
      if (!group.baseRelation().equals(Relation.EMPTY) && group.baseRelation().limit()!=0) {
        qIter.add(QueryIterTableSQL.create(
            group.baseRelation(), group.bindingMakers(), context));
      }
    }
    return qIter;
  }
View Full Code Here

  @Override
  public QueryIterator eval(QueryIterator input, final ExecutionContext execCxt) {
    return new QueryIterRepeatApply(input, execCxt) {
      @Override
      protected QueryIterator nextStage(Binding binding) {
        QueryIterConcat resultIt = new QueryIterConcat(execCxt);
        Collection<NodeRelation> tables = new ArrayList<NodeRelation>();
        for (OpTableSQL tableOp: tableOps) {
          tables.add(tableOp.table().extendWith(binding));
        }
        for (CompatibleRelationGroup group: CompatibleRelationGroup.groupNodeRelations(tables)) {
          resultIt.add(QueryIterTableSQL.create(group.baseRelation(), group.bindingMakers(), execCxt));
        }
        return resultIt;
      }
    };
  }
View Full Code Here

    // Brute force evaluation of a TriplePath where neither subject nor object are bound
    private static QueryIterator ungroundedPath(Binding binding, Graph graph, Var sVar, Path path, Var oVar,
                                                ExecutionContext execCxt)
    {
        Iterator<Node> iter = GraphUtils.allNodes(graph) ;
        QueryIterConcat qIterCat = new QueryIterConcat(execCxt) ;
       
        for ( ; iter.hasNext() ; )
        {
            Node n = iter.next() ;
            Binding b2 = BindingFactory.binding(binding, sVar, n) ;
            Iterator<Node> pathIter = PathEval.eval(graph, n, path) ;
            QueryIterator qIter = _execTriplePath(b2, pathIter, oVar, execCxt) ;
            qIterCat.add(qIter) ;
        }
        return qIterCat ;
    }
View Full Code Here

    @Override
    public QueryIterator execEvaluated(Binding binding, Node containerNode, Node predicate, Node member, ExecutionContext execCxt)
    {
        QueryIterator qIter1 = execEvaluatedConcrete(binding, containerNode, predicate, member, execCxt) ;
        QueryIterator qIter2 = execEvaluatedCalc(binding, containerNode, predicate, member, execCxt) ;
        QueryIterConcat concat = new QueryIterConcat(execCxt) ;
        concat.add(qIter1) ;
        concat.add(qIter2) ;
        return concat ;
    }
View Full Code Here

        if ( member.isVariable() )
            c = findContainers(graph, typeNode) ;
        else
            c = findContainingContainers(graph, typeNode, member) ;
       
        QueryIterConcat cIter = new QueryIterConcat(execCxt) ;
        Var cVar = Var.alloc(containerNode) ;
        for ( Iterator<Node> iter = c.iterator() ; iter.hasNext() ; )
        {
            Node cn = iter.next() ;
            //Binding the container node.
            Binding b = BindingFactory.binding(binding, cVar, cn) ;
            Node m = member ;
            // Special case of ?x rdfs:member ?x
            if ( Var.isVar(member) && member.equals(cVar) )
                m = cn ;
           
            cIter.add(oneContainer(b, cn, m, execCxt)) ;
        }
        return cIter ;
        //throw new QueryFatalException(Utils.className(this)+": Arg 1 is too hard : "+containerNode) ;
    }
View Full Code Here

        else
        {
            // Variable.
            Var gVar = Var.alloc(opQuad.getGraphNode()) ;
            // Or just just devolve to OpGraph and get OpUnion chain of OpJoin
            QueryIterConcat concat = new QueryIterConcat(cxt) ;
            for ( Iterator<Node> graphNodes = cxt.getDataset().listGraphNodes() ; graphNodes.hasNext(); )
            {
                Node gn = graphNodes.next() ;
                //Op tableVarURI = TableFactory.create(gn.getName(), Node.createURI(uri)) ;
               
                Graph g = cxt.getDataset().getGraph(gn) ;
                Binding b = BindingFactory.binding(BindingRoot.create(), gVar, gn) ;
                ExecutionContext cxt2 = new ExecutionContext(cxt, g) ;

                // Eval the pattern, eval the variable, join.
                // Pattern may be non-linear in the variable - do a pure execution. 
                Table t1 = TableFactory.create(gVar, gn) ;
                QueryIterator qIter = StageBuilder.execute(pattern, QueryIterRoot.create(cxt2), cxt2) ;
                Table t2 = TableFactory.create(qIter) ;
                Table t3 = evaluator.join(t1, t2) ;
                concat.add(t3.iterator(cxt2)) ;
            }
            return TableFactory.create(concat) ;
        }
    }
View Full Code Here

    }

    @Override
    protected QueryIterator nextStage(Binding binding)
    {
        QueryIterConcat unionQIter = new QueryIterConcat(getExecContext()) ;
        for (Op subOp : subOps)
        {
            subOp = QC.substitute(subOp, binding) ;
            QueryIterator parent = QueryIterSingleton.create(binding, getExecContext()) ;
            QueryIterator qIter = QC.execute(subOp, parent, getExecContext()) ;
            unionQIter.add(qIter) ;
        }
       
        return unionQIter ;
    }
View Full Code Here

    }

    protected QueryIterator allLists(Binding binding, Collection<Node> x, Var listVar, Node predicate, PropFuncArg argObject, ExecutionContext execCxt)
    {
        // BFI: Find all lists; work hard.
        QueryIterConcat qIter = new QueryIterConcat(execCxt) ;
        for ( Node n : x )
        {
            Binding b = BindingFactory.binding(binding, listVar, n) ;
            QueryIterator q = execOneList(b, n, predicate, argObject, execCxt) ;
            qIter.add(q) ;
        }
        return qIter ;
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.engine.iterator.QueryIterConcat

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.