1   /*
2    wsmo4j - a WSMO API and Reference Implementation
3    Copyright (c) 2005, University of Innsbruck, Austria
4    This library is free software; you can redistribute it and/or modify it under
5    the terms of the GNU Lesser General Public License as published by the Free
6    Software Foundation; either version 2.1 of the License, or (at your option)
7    any later version.
8    This library is distributed in the hope that it will be useful, but WITHOUT
9    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10   FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11   details.
12   You should have received a copy of the GNU Lesser General Public License along
13   with this library; if not, write to the Free Software Foundation, Inc.,
14   59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15   */
16  package test.wsmo4j.parser.owl;
17  
18  import java.io.InputStreamReader;
19  import java.util.HashMap;
20  
21  import org.wsmo.common.TopEntity;
22  import org.wsmo.factory.Factory;
23  import org.wsmo.wsml.Parser;
24  import org.wsmo.wsml.ParserException;
25  import org.wsmo.wsml.Serializer;
26  
27  import test.wsmo4j.Wsmo4jTestCase;
28  
29  import static test.wsmo4j.Utils.*;
30  /**
31   * Test method for OWL parsing
32   * 
33   * @author nathalie.steinmetz@deri.org
34   */
35  public class OWLParserTest extends Wsmo4jTestCase {
36  
37      protected Parser parser;
38      
39      protected Serializer serializer;
40      
41      protected void setUp() throws Exception {
42          super.setUp();
43          HashMap <String, Object> properties = new HashMap <String, Object> ();
44          properties.put(Factory.PROVIDER_CLASS, "com.ontotext.wsmo4j.parser.owl.OWLParser");
45          properties.put(Factory.WSMO_FACTORY, factory);
46          properties.put(Factory.LE_FACTORY, leFactory);
47          parser = Factory.createParser(properties);
48          
49          properties = new HashMap <String, Object> ();
50          properties.put(Factory.PROVIDER_CLASS,
51                  "com.ontotext.wsmo4j.serializer.wsml.WSMLSerializerImpl");
52          serializer = Factory.createSerializer(properties);
53      }
54  
55      protected void tearDown() throws Exception {
56          super.tearDown();
57          parser = null;
58          System.gc();
59      }
60      
61      public void testFileParsing() throws Exception {
62          InputStreamReader reader = new InputStreamReader(getStream("test/wsmo4j/parser/owl/Pizza.owl"));
63          
64          try {
65              parser.parse(reader);
66              fail();
67          } catch (ParserException e) {
68              assertEquals("Nested http://www.w3.org/2002/07/owl#intersectionOf Not supported", e.getCause().getMessage()); 
69          }        
70      }
71      
72  }