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 open.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  /**
32   * Test method for OWL parsing
33   * 
34   * @author nathalie.steinmetz@deri.org
35   */
36  public class OWLParserTest extends Wsmo4jTestCase {
37  
38      protected Parser parser;
39      
40      protected Serializer serializer;
41      
42      protected void setUp() throws Exception {
43          super.setUp();
44          HashMap <String, Object> properties = new HashMap <String, Object> ();
45          properties.put(Factory.PROVIDER_CLASS, "com.ontotext.wsmo4j.parser.owl.OWLParser");
46          properties.put(Factory.WSMO_FACTORY, factory);
47          properties.put(Factory.LE_FACTORY, leFactory);
48          parser = Factory.createParser(properties);
49          
50          properties = new HashMap <String, Object> ();
51          properties.put(Factory.PROVIDER_CLASS,
52                  "com.ontotext.wsmo4j.serializer.wsml.WSMLSerializerImpl");
53          serializer = Factory.createSerializer(properties);
54      }
55  
56      protected void tearDown() throws Exception {
57          super.tearDown();
58          parser = null;
59          System.gc();
60      }
61      
62      public void testFileParsing() throws Exception {
63          InputStreamReader reader = new InputStreamReader(getStream("open/wsmo4j/parser/owl/PizzaExtract.owl"));
64  
65          try {
66              parser.parse(reader);
67              fail();
68          } catch (ParserException e) {
69              assertEquals("Nested http://www.w3.org/2002/07/owl#intersectionOf Not supported", e.getCause().getMessage()); 
70          }        
71      }
72      
73  }