Package com.hp.hpl.jena.query

Examples of com.hp.hpl.jena.query.ResultSetRewindable


   
    private ResultSetRewindable makeRewindable(String var, Node val)
    {
        ResultSet rs = make(var, val) ;
        ResultSetRewindable rsw = ResultSetFactory.makeRewindable(rs) ;
        return rsw ;
    }
View Full Code Here


    }
   
    private ResultSetRewindable make2Rewindable(String var, Node val)
    {
        ResultSet rs = make2(var, val) ;
        ResultSetRewindable rsw = ResultSetFactory.makeRewindable(rs) ;
        return rsw ;
    }
View Full Code Here

    }

    private ResultSetRewindable makeRewindable(String var1, Node val1, String var2, Node val2 )
    {
        ResultSet rs = make(var1, val1, var2, val2) ;
        ResultSetRewindable rsw = ResultSetFactory.makeRewindable(rs) ;
        return rsw ;
    }
View Full Code Here

        ResultSetFormatter.outputAsCSV(out, rs) ;
    }
   
    private static void areIsomorphic(ResultSet x, ResultSet y)
    {
        ResultSetRewindable rs1 = ResultSetFactory.makeRewindable(x) ;
        ResultSetRewindable rs2 = ResultSetFactory.makeRewindable(y) ;
//        System.out.println(ResultSetFormatter.asText(rs1));
//        System.out.println();
//        System.out.println(ResultSetFormatter.asText(rs2));
//        rs1.reset();
//        rs2.reset();
View Full Code Here

        }

        return ok;
      }
      else {
        ResultSetRewindable expected = null;
        if( !noCheck ) {
          expected = ResultSetFactory.makeRewindable( JenaIOUtils
              .parseResultSet( resultURI ) );

          final List<?> expectedList = ResultSetFormatter.toList( expected );
          if( expected.size() > 10 ) {
            if( log.isLoggable( Level.INFO ) ) {
              log.log( Level.INFO, "Expected=" + expectedList.subList( 0, 9 )
                  + " ... " + expectedList.size() );
            }
          }
View Full Code Here

    final QueryResult bindings = runSingleTest( query );

    boolean ok = true;

    if( !noCheck ) {
      final ResultSetRewindable real = realResultsHandler( bindings );

      real.reset();
      expected.reset();
      ok &= ResultSetUtils.assertEquals( real, expected );

      if( writeResults ) {
        real.reset();
        expected.reset();
        // final ResultSetRewindable rMinusE = ResultSetFactory
        // .makeRewindable(ResultSetFactory.copyResults(real));
        // final ResultSetRewindable eMinusR = ResultSetFactory
        // .makeRewindable(ResultSetFactory.copyResults(expected));

        // real.reset();
        // final Model realModel = ResultSetFormatter.toModel(real);
        // expected.reset();
        // final Model expectedModel = ResultSetFormatter
        // .toModel(expected);

        try {
          real.reset();
          ResultSetFormatter.out( new FileOutputStream( "real" ), real );

          ResultSetFormatter.out( new FileOutputStream( "real-expected" ),
              new DifferenceResultSet( real, expected ) );
          ResultSetFormatter.out( new FileOutputStream( "expected-real" ),
View Full Code Here

      fwre.write( "\n" );
    }
  }

  private final ResultSetRewindable realResultsHandler(QueryResult bindings) {
    final ResultSetRewindable real = ResultSetFactory.makeRewindable( new SparqlDLResultSet(
        bindings, model.getRawModel() ) );

    final List<?> realList = ResultSetFormatter.toList( real );
    if( realList.size() > 10 ) {
      if( log.isLoggable( Level.INFO ) ) {
        log
            .log( Level.INFO, "Real=" + realList.subList( 0, 9 ) + " ... "
                + realList.size() );
      }
    }
    else {
      if( log.isLoggable( Level.INFO ) ) {
        log.info( "Real=" + realList );
      }
    }
    real.reset();

    return real;
  }
View Full Code Here

    public DifferenceResultSet(final ResultSet rs1, final ResultSet rs2) {
      vars = rs1.getResultVars();

      index = 0;

      final ResultSetRewindable real = ResultSetFactory.makeRewindable( rs1 );
      final ResultSetRewindable expected = ResultSetFactory.makeRewindable( rs2 );

      real.reset();
      while( real.hasNext() ) {
        final Binding b1 = real.nextBinding();
        expected.reset();
        boolean toAdd = true;
        while( expected.hasNext() ) {
          final Binding b2 = expected.nextBinding();
          if( BindingBase.equals( b1, b2 ) ) {
            toAdd = false;
            break;
          }
        }
View Full Code Here

            "No result set associated with this test, assumuing success!" );
        return true;
      }

      if( query.isSelectType() ) {
        final ResultSetRewindable real = ResultSetFactory
            .makeRewindable( exec.execSelect() );
        final ResultSetRewindable expected = ResultSetFactory.makeRewindable( JenaIOUtils
            .parseResultSet( resultURI ) );

        boolean correct = ResultSetUtils.assertEquals( real, expected );

        if( !correct ) {
View Full Code Here

  private static final Logger log = Logger.getLogger(ResultSetUtils.class.getName());
 
  private static final RDFNode DUMMY_FOR_BNODE = ResourceFactory.createPlainLiteral("dummy node for bnode");

  public static boolean assertEquals(ResultSet expectedResults, ResultSet computedResults) {
    ResultSetRewindable expected = ResultSetFactory.makeRewindable( expectedResults );
    ResultSetRewindable computed = ResultSetFactory.makeRewindable( computedResults );
                                                     
    System.out.println( "Computed: " + computed.size() + " Expected: " + expected.size() );
    if( expected.size() != computed.size() ) {
      logResults( "Expected", expected );
      logResults( "Real", computed );     
      Assert.fail( "Expected " + expected.size() + " but got " + computed.size() );
    }
 
    List<String> vars = expected.getResultVars();
    Collection<Map<String, RDFNode>> results = results( computed );
    for( expected.reset(); expected.hasNext(); ) {
      QuerySolution qs = expected.nextSolution();
      Map<String, RDFNode> map = solutionMap(qs, vars);
     
      if( !results.contains( map ) ) {
        logResults( "Expected", expected );
        logResults( "Real", computed );
        Assert.fail( "Solution not found: " + map );       
 
        Assert.fail( "Expected " + expected.size() + " but got " + computed.size() );       
      }
    }
 
    return true;
  }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.query.ResultSetRewindable

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.