1 6 package com.hp.hpl.jena.regression; 7 8 import com.hp.hpl.jena.rdf.model.*; 9 10 import org.apache.commons.logging.Log; 11 import org.apache.commons.logging.LogFactory; 12 16 public class testModelEquals extends Object { 17 18 19 protected static Log logger = LogFactory.getLog( testModelEquals.class ); 20 21 void test(GetModel gm) { 22 Model m1, m2; 23 String test = "testModelEquals"; 24 String filebase = "modules/rdf/regression/" + test + "/"; 25 boolean results[] = { 26 false, true, true, true, true, false, false, true, false }; 27 int n = 0; 28 try { 29 for (n=1; n<7; n++) { 30 m1 = gm.get(); 31 m2= gm.get(); 32 m1.read( 33 ResourceReader.getInputStream(filebase + Integer.toString(n) + "-1.rdf"), 34 "http://www.example.org/"); 35 m2.read( 36 ResourceReader.getInputStream(filebase + Integer.toString(n) + "-2.rdf"), 37 "http://www.example.org/"); 38 if (! (m1.isIsomorphicWith(m2) == results[n])) { 39 error(test, n); 40 System.out.println("m1:"); 41 m1.write(System.out, "N-TRIPLE"); 42 System.out.println("m2:"); 43 m2.write(System.out, "N-TRIPLE"); 44 } 45 } 46 for (n=7; n<9; n++) { 47 m1 = gm.get(); 48 m2= gm.get(); 49 m1.read( 50 ResourceReader.getInputStream(filebase + Integer.toString(n) + "-1.nt"), 51 "", "N-TRIPLE"); 52 m2.read( 53 ResourceReader.getInputStream(filebase + Integer.toString(n) + "-2.nt"), 54 "", "N-TRIPLE"); 55 if (! (m1.isIsomorphicWith(m2) == results[n])) { 56 error(test, n); 57 System.out.println("m1:"); 58 m1.write(System.out, "N-TRIPLE"); 59 System.out.println("m2:"); 60 m2.write(System.out, "N-TRIPLE"); 61 } 62 } 63 } catch (Exception e) { 64 inError = true; 65 logger.error( " test " + test + "[" + n + "]", e); 66 } 67 } 68 69 private boolean inError = false; 70 71 protected void error(String test, int n) { 72 System.out.println(test + ": failed test " + Integer.toString(n)); 73 inError = true; 74 } 75 76 public boolean getErrors() { 77 return inError; 78 } 79 } 80 81 108 | Popular Tags |