コード例 #1
0
  //    @SuppressWarnings("null")
  //    @Override
  @Override
  protected ExtendedIterator<Triple> graphBaseFind(TripleMatch m) {
    Node s = m.getMatchSubject();
    Var sVar = null;
    if (s == null) {
      sVar = Var.alloc("s");
      s = sVar;
    }

    Node p = m.getMatchPredicate();
    Var pVar = null;
    if (p == null) {
      pVar = Var.alloc("p");
      p = pVar;
    }

    Node o = m.getMatchObject();
    Var oVar = null;
    if (o == null) {
      oVar = Var.alloc("o");
      o = oVar;
    }

    Triple triple = new Triple(s, p, o);

    // Evaluate as an algebra expression
    BasicPattern pattern = new BasicPattern();
    pattern.add(triple);
    Op op = new OpBGP(pattern);

    //        // Make remote execution object.
    //        System.err.println("GraphSPARQLService.graphBaseFind: Unimplemented : remote service
    // execution") ;
    //        //Plan plan = factory.create(op, getDataset(), BindingRoot.create(), null) ;
    //
    //        QueryIterator qIter = plan.iterator() ;
    //        List<Triple> triples = new ArrayList<Triple>() ;
    //
    //
    //        for (; qIter.hasNext() ; )
    //        {
    //            Binding b = qIter.nextBinding() ;
    //            Node sResult = s ;
    //            Node pResult = p ;
    //            Node oResult = o ;
    //            if ( sVar != null )
    //                sResult = b.get(sVar) ;
    //            if ( pVar != null )
    //                pResult = b.get(pVar) ;
    //            if ( oVar != null )
    //                oResult = b.get(oVar) ;
    //            Triple resultTriple = new Triple(sResult, pResult, oResult) ;
    //            if ( log.isDebugEnabled() )
    //                log.debug("  "+resultTriple) ;
    //            triples.add(resultTriple) ;
    //        }
    //        qIter.close() ;
    //        return WrappedIterator.createNoRemove(triples.iterator()) ;
    return null;
  }
コード例 #2
0
  @Override
  protected ExtendedIterator<Triple> graphBaseFind(TripleMatch m) {
    Node s = m.getMatchSubject();
    Node p = m.getMatchPredicate();
    Node o = m.getMatchObject();

    Resource subj = (s == null ? null : Convert.nodeToValueResource(valueFactory, s));
    URI pred = (p == null ? null : Convert.nodeURIToValue(valueFactory, p));
    Value obj = (o == null ? null : Convert.nodeToValue(valueFactory, o));

    try {
      RepositoryResult<Statement> iter1 = connection.getStatements(subj, pred, obj, true, contexts);
      return new RepositoryResultIterator(iter1);
    } catch (RepositoryException ex) {
      LOG.error("Repository exception in graphBaseFind", ex);
      throw new JenaException(ex);
    }
  }