Ignore:
Timestamp:
Jul 18, 2011, 1:15:46 AM (14 years ago)
Author:
cla
Message:

rdfint

  • reworked handling of RDF testcase results, results are now also ordered before comparing
File:
1 edited

Legend:

Unmodified
Added
Removed
  • php/trunk/unittest/rdftestcases/unittest.php

    r57 r58  
    4242  // --------------------------------------------------------
    4343
    44   private function _reIdentifyBlankNode( $data) {
    45     return preg_replace( '/_:[^ ]*/', '_:a', $data);
     44  private function _refineResult( $data) {
     45    // replace all blank nodes by one ID
     46    // NOTE: thi sis not accurate, but not much better
     47    // possible without access to the triple data
     48    $data = preg_replace( '/_:[^ ]*/', '_:a', $data);
     49
     50    // sort the data
     51    $adata = explode( "\n", $data);
     52    sort( &$adata);
     53    $data = implode( "\n", $adata);
     54
     55    return $data;
    4656  }
    4757
     
    93103    $this->assertEquals( ($result !== false), true);
    94104
    95     // rework blank node identifiers for coparison
    96     $source = $this->_reIdentifyBlankNode( $source);
    97     $result = $this->_reIdentifyBlankNode( $result);
    98 
     105    // resolve problems with blnak node identifiers
     106    // and different sorting of triples
     107    $source = $this->_refineResult( $source);
     108    $result = $this->_refineResult( $result);
    99109
    100110    // check if results are equal
Note: See TracChangeset for help on using the changeset viewer.