01: /*
02: * (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: * All rights reserved.
04: * [See end of file]
05: */
06:
07: package com.hp.hpl.jena.n3.turtle.test;
08:
09: import junit.framework.TestCase;
10:
11: import com.hp.hpl.jena.n3.turtle.TurtleParseException;
12: import com.hp.hpl.jena.n3.turtle.TurtleReader;
13: import com.hp.hpl.jena.rdf.model.Model;
14: import com.hp.hpl.jena.rdf.model.ModelFactory;
15: import com.hp.hpl.jena.rdf.model.RDFReader;
16: import com.hp.hpl.jena.util.FileManager;
17: import com.hp.hpl.jena.util.FileUtils;
18:
19: public class TestTurtle extends TestCase {
20: String input;
21: String output;
22: String baseIRI;
23:
24: public TestTurtle(String name, String input, String output,
25: String baseIRI) {
26: super (name);
27: this .input = input;
28: this .output = output;
29: this .baseIRI = baseIRI;
30: }
31:
32: public void runTest() {
33: Model model = ModelFactory.createDefaultModel();
34: RDFReader t = new TurtleReader();
35: try {
36: if (baseIRI != null)
37: t.read(model, FileManager.get().open(input), baseIRI);
38: else
39: t.read(model, input);
40: // "http://www.w3.org/2001/sw/DataAccess/df1/tests/rdfq-results.ttl"
41:
42: String syntax = FileUtils.guessLang(output,
43: FileUtils.langNTriple);
44:
45: Model results = FileManager.get().loadModel(output, syntax);
46: boolean b = model.isIsomorphicWith(results);
47: if (!b)
48: assertTrue("Models not isomorphic", b);
49: } catch (TurtleParseException ex) {
50: throw ex;
51: }
52: }
53: }
54:
55: /*
56: * (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
57: * All rights reserved.
58: *
59: * Redistribution and use in source and binary forms, with or without
60: * modification, are permitted provided that the following conditions
61: * are met:
62: * 1. Redistributions of source code must retain the above copyright
63: * notice, this list of conditions and the following disclaimer.
64: * 2. Redistributions in binary form must reproduce the above copyright
65: * notice, this list of conditions and the following disclaimer in the
66: * documentation and/or other materials provided with the distribution.
67: * 3. The name of the author may not be used to endorse or promote products
68: * derived from this software without specific prior written permission.
69: *
70: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
71: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
72: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
73: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
74: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
75: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
76: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
77: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
78: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
79: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
80: */
|