//    @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;
  }
  @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);
    }
  }
Exemple #3
0
 @Override
 public ExtendedIterator<Triple> graphBaseFind(TripleMatch m) {
   checkOpen();
   Triple t = m.asTriple();
   if (log.isDebugEnabled()) {
     log.debug("Find: " + PrettyPrinter.toString(t, getPrefixMapping()));
   }
   FindQuery query = new FindQuery(t, mapping.compiledPropertyBridges());
   ExtendedIterator<Triple> result = query.iterator();
   if (mapping.configuration().getServeVocabulary()) {
     result = result.andThen(mapping.getVocabularyModel().getGraph().find(t));
   }
   return result;
 }