KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > ontology > impl > test > TestClassExpression


1 /*****************************************************************************
2  * Source code information
3  * -----------------------
4  * Original author Ian Dickinson, HP Labs Bristol
5  * Author email Ian.Dickinson@hp.com
6  * Package Jena 2
7  * Web http://sourceforge.net/projects/jena/
8  * Created 27-May-2003
9  * Filename $RCSfile: TestClassExpression.java,v $
10  * Revision $Revision: 1.31 $
11  * Release status $State: Exp $
12  *
13  * Last modified on $Date: 2005/04/08 17:38:50 $
14  * by $Author: ian_dickinson $
15  *
16  * (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
17  * (see footer for full conditions)
18  *****************************************************************************/

19
20 // Package
21
///////////////
22
package com.hp.hpl.jena.ontology.impl.test;
23
24
25
26 // Imports
27
///////////////
28
import com.hp.hpl.jena.ontology.*;
29 import com.hp.hpl.jena.rdf.model.*;
30 import com.hp.hpl.jena.util.iterator.ClosableIterator;
31 import com.hp.hpl.jena.util.iterator.NullIterator;
32 import com.hp.hpl.jena.vocabulary.*;
33 import com.hp.hpl.jena.vocabulary.XSD;
34
35 import junit.framework.*;
36
37
38 /**
39  * <p>
40  * Unit tests for OntClass and other class expressions.
41  * </p>
42  *
43  * @author Ian Dickinson, HP Labs
44  * (<a HREF="mailto:Ian.Dickinson@hp.com" >email</a>)
45  * @version CVS $Id: TestClassExpression.java,v 1.31 2005/04/08 17:38:50 ian_dickinson Exp $
46  */

47 public class TestClassExpression
48     extends OntTestBase
49 {
50     // Constants
51
//////////////////////////////////
52

53     // Static variables
54
//////////////////////////////////
55

56     // Instance variables
57
//////////////////////////////////
58

59     // Constructors
60
//////////////////////////////////
61

62     static public TestSuite suite() {
63         return new TestClassExpression( "TestClassExpression" );
64     }
65
66     public TestClassExpression( String JavaDoc name ) {
67         super( name );
68     }
69
70
71     // External signature methods
72
//////////////////////////////////
73

74     public OntTestCase[] getTests() {
75         return new OntTestCase[] {
76             new OntTestCase( "OntClass.super-class", true, true, true, true ) {
77                 public void ontTest( OntModel m ) throws Exception JavaDoc {
78                     Profile prof = m.getProfile();
79                     OntClass A = m.createClass( NS + "A" );
80                     OntClass B = m.createClass( NS + "B" );
81                     OntClass C = m.createClass( NS + "C" );
82
83                     A.addSuperClass( B );
84                     assertEquals( "Cardinality should be 1", 1, A.getCardinality( prof.SUB_CLASS_OF() ) );
85                     assertEquals( "A should have super-class B", B, A.getSuperClass() );
86
87                     A.addSuperClass( C );
88                     assertEquals( "Cardinality should be 2", 2, A.getCardinality( prof.SUB_CLASS_OF() ) );
89                     iteratorTest( A.listSuperClasses(), new Object JavaDoc[] {C, B} );
90
91                     A.setSuperClass( C );
92                     assertEquals( "Cardinality should be 1", 1, A.getCardinality( prof.SUB_CLASS_OF() ) );
93                     assertEquals( "A shuold have super-class C", C, A.getSuperClass() );
94                     assertTrue( "A shuold not have super-class B", !A.hasSuperClass( B, false ) );
95
96                     A.removeSuperClass( B );
97                     assertEquals( "Cardinality should be 1", 1, A.getCardinality( prof.SUB_CLASS_OF() ) );
98                     A.removeSuperClass( C );
99                     assertEquals( "Cardinality should be 0", 0, A.getCardinality( prof.SUB_CLASS_OF() ) );
100                 }
101             },
102             new OntTestCase( "OntClass.sub-class", true, true, true, true ) {
103                 public void ontTest( OntModel m ) throws Exception JavaDoc {
104                     Profile prof = m.getProfile();
105                     OntClass A = m.createClass( NS + "A" );
106                     OntClass B = m.createClass( NS + "B" );
107                     OntClass C = m.createClass( NS + "C" );
108
109                     A.addSubClass( B );
110                     assertEquals( "Cardinality should be 1", 1, B.getCardinality( prof.SUB_CLASS_OF() ) );
111                     assertEquals( "A should have sub-class B", B, A.getSubClass() );
112
113                     A.addSubClass( C );
114                     assertEquals( "Cardinality should be 2", 2, B.getCardinality( prof.SUB_CLASS_OF() ) + C.getCardinality( prof.SUB_CLASS_OF() ) );
115                     iteratorTest( A.listSubClasses(), new Object JavaDoc[] {C, B} );
116
117                     A.setSubClass( C );
118                     assertEquals( "Cardinality should be 1", 1, B.getCardinality( prof.SUB_CLASS_OF() ) + C.getCardinality( prof.SUB_CLASS_OF() ) );
119                     assertEquals( "A shuold have sub-class C", C, A.getSubClass() );
120                     assertTrue( "A shuold not have sub-class B", !A.hasSubClass( B, false ) );
121
122                     A.removeSubClass( B );
123                     assertTrue( "A should have sub-class C", A.hasSubClass( C, false ) );
124                     A.removeSubClass( C );
125                     assertTrue( "A should not have sub-class C", !A.hasSubClass( C, false ) );
126                 }
127             },
128             new OntTestCase( "OntClass.equivalentClass", true, true, true, false ) {
129                 public void ontTest( OntModel m ) throws Exception JavaDoc {
130                     Profile prof = m.getProfile();
131                     OntClass A = m.createClass( NS + "A" );
132                     OntClass B = m.createClass( NS + "B" );
133                     OntClass C = m.createClass( NS + "C" );
134
135                     A.addEquivalentClass( B );
136                     assertEquals( "Cardinality should be 1", 1, A.getCardinality( prof.EQUIVALENT_CLASS() ) );
137                     assertEquals( "A have equivalentClass B", B, A.getEquivalentClass() );
138
139                     A.addEquivalentClass( C );
140                     assertEquals( "Cardinality should be 2", 2, A.getCardinality( prof.EQUIVALENT_CLASS() ) );
141                     iteratorTest( A.listEquivalentClasses(), new Object JavaDoc[] {C, B} );
142
143                     A.setEquivalentClass( C );
144                     assertEquals( "Cardinality should be 1", 1, A.getCardinality( prof.EQUIVALENT_CLASS() ) );
145                     assertEquals( "A should have equivalentClass C", C, A.getEquivalentClass() );
146                     assertTrue( "A should not have equivalentClass B", !A.hasEquivalentClass( B ) );
147
148                     A.removeEquivalentClass( B );
149                     assertEquals( "Cardinality should be 1", 1, A.getCardinality( prof.EQUIVALENT_CLASS() ) );
150                     A.removeEquivalentClass( C );
151                     assertEquals( "Cardinality should be 0", 0, A.getCardinality( prof.EQUIVALENT_CLASS() ) );
152                 }
153             },
154             new OntTestCase( "OntClass.disjointWith", true, false, true, false ) {
155                 public void ontTest( OntModel m ) throws Exception JavaDoc {
156                     Profile prof = m.getProfile();
157                     OntClass A = m.createClass( NS + "A" );
158                     OntClass B = m.createClass( NS + "B" );
159                     OntClass C = m.createClass( NS + "C" );
160
161                     A.addDisjointWith( B );
162                     assertEquals( "Cardinality should be 1", 1, A.getCardinality( prof.DISJOINT_WITH() ) );
163                     assertEquals( "A have be disjoint with B", B, A.getDisjointWith() );
164
165                     A.addDisjointWith( C );
166                     assertEquals( "Cardinality should be 2", 2, A.getCardinality( prof.DISJOINT_WITH() ) );
167                     iteratorTest( A.listDisjointWith(), new Object JavaDoc[] {C,B} );
168
169                     A.setDisjointWith( C );
170                     assertEquals( "Cardinality should be 1", 1, A.getCardinality( prof.DISJOINT_WITH() ) );
171                     assertEquals( "A should be disjoint with C", C, A.getDisjointWith() );
172                     assertTrue( "A should not be disjoint with B", !A.isDisjointWith( B ) );
173
174                     A.removeDisjointWith( B );
175                     assertEquals( "Cardinality should be 1", 1, A.getCardinality( prof.DISJOINT_WITH() ) );
176                     A.removeDisjointWith( C );
177                     assertEquals( "Cardinality should be 0", 0, A.getCardinality( prof.DISJOINT_WITH() ) );
178                 }
179             },
180             new OntTestCase( "EnumeratedClass.oneOf", true, false, true, false ) {
181                 public void ontTest( OntModel m ) throws Exception JavaDoc {
182                     Profile prof = m.getProfile();
183                     EnumeratedClass A = m.createEnumeratedClass( NS + "A", null );
184                     OntResource a = (OntResource) m.getResource( NS + "a" ).as( OntResource.class );
185                     OntResource b = (OntResource) m.getResource( NS + "b" ).as( OntResource.class );
186
187                     A.addOneOf( a );
188                     assertEquals( "Cardinality should be 1", 1, A.getCardinality( prof.ONE_OF() ) );
189                     assertEquals( "Size should be 1", 1, A.getOneOf().size() );
190                     assertTrue( "A should have a as enumerated member", A.getOneOf().contains( a ) );
191
192                     A.addOneOf( b );
193                     assertEquals( "Cardinality should be 1", 1, A.getCardinality( prof.ONE_OF() ) );
194                     assertEquals( "Size should be 2", 2, A.getOneOf().size() );
195                     iteratorTest( A.listOneOf(), new Object JavaDoc[] {a,b} );
196
197                     A.setOneOf( m.createList( new RDFNode[] {b} ) );
198                     assertEquals( "Cardinality should be 1", 1, A.getCardinality( prof.ONE_OF() ) );
199                     assertEquals( "Size should be 1", 1, A.getOneOf().size() );
200                     assertTrue( "A should have b in the enum", A.hasOneOf( b ) );
201                     assertTrue( "A should not have a in the enum", !A.hasOneOf( a ) );
202
203                     A.removeOneOf( a );
204                     assertTrue( "Should have b as an enum value", A.hasOneOf( b ) );
205                     A.removeOneOf( b );
206                     assertTrue( "Should not have b as an enum value", !A.hasOneOf( b ) );
207                 }
208             },
209             new OntTestCase( "IntersectionClass.intersectionOf", true, true, true, false ) {
210                 public void ontTest( OntModel m ) throws Exception JavaDoc {
211                     Profile prof = m.getProfile();
212                     IntersectionClass A = m.createIntersectionClass( NS + "A", null );
213                     OntClass B = m.createClass( NS + "B" );
214                     OntClass C = m.createClass( NS + "C" );
215
216                     A.addOperand( B );
217                     assertEquals( "Cardinality should be 1", 1, A.getCardinality( prof.INTERSECTION_OF() ) );
218                     assertEquals( "Size should be 1", 1, A.getOperands().size() );
219                     assertTrue( "A should have a as intersection member", A.getOperands().contains( B ) );
220
221                     A.addOperand( C );
222                     assertEquals( "Cardinality should be 1", 1, A.getCardinality( prof.INTERSECTION_OF() ) );
223                     assertEquals( "Size should be 2", 2, A.getOperands().size() );
224                     iteratorTest( A.listOperands(), new Object JavaDoc[] {B,C} );
225
226                     ClosableIterator i = A.listOperands();
227                     assertTrue( "Argument should be an OntClass", i.next() instanceof OntClass );
228                     i.close();
229
230                     A.setOperands( m.createList( new RDFNode[] {C} ) );
231                     assertEquals( "Cardinality should be 1", 1, A.getCardinality( prof.INTERSECTION_OF() ) );
232                     assertEquals( "Size should be 1", 1, A.getOperands().size() );
233                     assertTrue( "A should have C in the intersection", A.hasOperand( C ) );
234                     assertTrue( "A should not have B in the intersection", !A.hasOperand( B ) );
235
236                     A.removeOperand( B );
237                     assertTrue( "Should have C as an operand", A.hasOperand( C ) );
238                     A.removeOperand( C );
239                     assertTrue( "Should not have C as an operand", !A.hasOperand( C ) );
240                 }
241             },
242             new OntTestCase( "UnionClass.unionOf", true, false, true, false ) {
243                 public void ontTest( OntModel m ) throws Exception JavaDoc {
244                     Profile prof = m.getProfile();
245                     UnionClass A = m.createUnionClass( NS + "A", null );
246                     OntClass B = m.createClass( NS + "B" );
247                     OntClass C = m.createClass( NS + "C" );
248
249                     A.addOperand( B );
250                     assertEquals( "Cardinality should be 1", 1, A.getCardinality( prof.UNION_OF() ) );
251                     assertEquals( "Size should be 1", 1, A.getOperands().size() );
252                     assertTrue( "A should have a as union member", A.getOperands().contains( B ) );
253
254                     A.addOperand( C );
255                     assertEquals( "Cardinality should be 1", 1, A.getCardinality( prof.UNION_OF() ) );
256                     assertEquals( "Size should be 2", 2, A.getOperands().size() );
257                     iteratorTest( A.listOperands(), new Object JavaDoc[] {B,C} );
258
259                     ClosableIterator i = A.listOperands();
260                     assertTrue( "Argument should be an OntClass", i.next() instanceof OntClass );
261                     i.close();
262
263                     A.setOperands( m.createList( new RDFNode[] {C} ) );
264                     assertEquals( "Cardinality should be 1", 1, A.getCardinality( prof.UNION_OF() ) );
265                     assertEquals( "Size should be 1", 1, A.getOperands().size() );
266                     assertTrue( "A should have C in the union", A.hasOperand( C ) );
267                     assertTrue( "A should not have B in the union", !A.hasOperand( B ) );
268
269                     A.removeOperand( B );
270                     assertTrue( "Should have C as an operand", A.hasOperand( C ) );
271                     A.removeOperand( C );
272                     assertTrue( "Should not have C as an operand", !A.hasOperand( C ) );
273                 }
274             },
275             new OntTestCase( "ComplementClass.complementOf", true, false, true, false ) {
276                 public void ontTest( OntModel m ) throws Exception JavaDoc {
277                     Profile prof = m.getProfile();
278                     ComplementClass A = m.createComplementClass( NS + "A", null );
279                     OntClass B = m.createClass( NS + "B" );
280                     OntClass C = m.createClass( NS + "C" );
281                     boolean ex = false;
282
283                     try { A.addOperand( B ); } catch (UnsupportedOperationException JavaDoc e) {ex = true;}
284                     assertTrue( "Should fail to add to a complement", ex );
285
286                     ex = false;
287                     try { A.addOperands( NullIterator.instance ); } catch (UnsupportedOperationException JavaDoc e) {ex = true;}
288                     assertTrue( "Should fail to add to a complement", ex );
289
290                     ex = false;
291                     try { A.setOperands( m.createList( new RDFNode[] {C} ) ); } catch (UnsupportedOperationException JavaDoc e) {ex = true;}
292                     assertTrue( "Should fail to set a list to a complement", ex );
293
294                     A.setOperand( B );
295                     assertEquals( "Cardinality should be 1", 1, A.getCardinality( prof.COMPLEMENT_OF() ) );
296                     assertEquals( "Complement should be B", B, A.getOperand() );
297                     iteratorTest( A.listOperands(), new Object JavaDoc[] {B} );
298
299                     A.setOperand( C );
300                     assertEquals( "Cardinality should be 1", 1, A.getCardinality( prof.COMPLEMENT_OF() ) );
301                     assertTrue( "A should have C in the complement", A.hasOperand( C ) );
302                     assertTrue( "A should not have B in the complement", !A.hasOperand( B ) );
303
304                     A.removeOperand( B );
305                     assertTrue( "Should have C as an operand", A.hasOperand( C ) );
306                     A.removeOperand( C );
307                     assertTrue( "Should not have C as an operand", !A.hasOperand( C ) );
308                 }
309             },
310             new OntTestCase( "Restriction.onProperty", true, true, true, false ) {
311                 public void ontTest( OntModel m ) throws Exception JavaDoc {
312                     Profile prof = m.getProfile();
313                     OntProperty p = m.createObjectProperty( NS + "p" );
314                     OntProperty q = m.createObjectProperty( NS + "q" );
315                     OntClass B = m.createClass( NS + "B" );
316
317                     Restriction A = m.createAllValuesFromRestriction( NS + "A", p, B );
318
319                     assertEquals( "Restriction should be on property p", p, A.getOnProperty() );
320                     assertTrue( "Restriction should be on property p", A.onProperty( p ) );
321                     assertTrue( "Restriction should not be on property q", !A.onProperty( q ) );
322                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.ON_PROPERTY() ));
323
324                     A.setOnProperty( q );
325
326                     assertEquals( "Restriction should be on property q", q, A.getOnProperty() );
327                     assertTrue( "Restriction should not be on property p", !A.onProperty( p ) );
328                     assertTrue( "Restriction should not on property q", A.onProperty( q ) );
329                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.ON_PROPERTY() ));
330
331                     A.removeOnProperty( p );
332                     assertTrue( "Should have q as on property", A.onProperty( q ) );
333                     A.removeOnProperty( q );
334                     assertTrue( "Should not have q as on property", !A.onProperty( q ) );
335                 }
336             },
337             new OntTestCase( "AllValuesFromRestriction.allValuesFrom", true, true, true, false ) {
338                 public void ontTest( OntModel m ) throws Exception JavaDoc {
339                     Profile prof = m.getProfile();
340                     OntProperty p = m.createObjectProperty( NS + "p" );
341                     OntClass B = m.createClass( NS + "B" );
342                     OntClass C = m.createClass( NS + "C" );
343
344                     AllValuesFromRestriction A = m.createAllValuesFromRestriction( NS + "A", p, B );
345
346                     assertEquals( "Restriction should be all values from B", B, A.getAllValuesFrom() );
347                     assertTrue( "Restriction should be all values from B", A.hasAllValuesFrom( B ) );
348                     assertTrue( "Restriction should not be all values from C", !A.hasAllValuesFrom( C ) );
349                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.ALL_VALUES_FROM() ));
350
351                     A.setAllValuesFrom( C );
352
353                     assertEquals( "Restriction should be all values from C", C, A.getAllValuesFrom() );
354                     assertTrue( "Restriction should not be all values from B", !A.hasAllValuesFrom( B ) );
355                     assertTrue( "Restriction should be all values from C", A.hasAllValuesFrom( C ) );
356                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.ALL_VALUES_FROM() ));
357
358                     A.removeAllValuesFrom( C );
359
360                     assertTrue( "Restriction should not be some values from C", !A.hasAllValuesFrom( C ) );
361                     assertEquals( "cardinality should be 0 ", 0, A.getCardinality( prof.ALL_VALUES_FROM() ));
362                 }
363             },
364             new OntTestCase( "AllValuesFromRestriction.allValuesFrom.datatype", true, true, true, false ) {
365                 public void ontTest( OntModel m ) throws Exception JavaDoc {
366                     Profile prof = m.getProfile();
367                     OntProperty p = m.createObjectProperty( NS + "p" );
368
369                     AllValuesFromRestriction A = m.createAllValuesFromRestriction( NS + "A", p, XSD.gDay );
370
371                     assertEquals( "Restriction should be all values from gDay", XSD.gDay, A.getAllValuesFrom() );
372                     assertTrue( "Restriction should be all values from gDay", A.hasAllValuesFrom( XSD.gDay ) );
373                     assertTrue( "Restriction should not be all values from decimal", !A.hasAllValuesFrom( XSD.decimal ) );
374                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.ALL_VALUES_FROM() ));
375
376                     A.setAllValuesFrom( XSD.gMonth );
377
378                     assertEquals( "Restriction should be all values from gMonth", XSD.gMonth, A.getAllValuesFrom() );
379                     assertTrue( "Restriction should not be all values from gDay", !A.hasAllValuesFrom( XSD.gDay ) );
380                     assertTrue( "Restriction should be all values from gMonth", A.hasAllValuesFrom( XSD.gMonth ) );
381                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.ALL_VALUES_FROM() ));
382
383                     A.removeAllValuesFrom( XSD.gMonth );
384
385                     assertTrue( "Restriction should not be some values from gMonth", !A.hasAllValuesFrom( XSD.gMonth ) );
386                     assertEquals( "cardinality should be 0 ", 0, A.getCardinality( prof.ALL_VALUES_FROM() ));
387                 }
388             },
389             new OntTestCase( "AllValuesFromRestriction.allValuesFrom.literal", true, true, true, false ) {
390                 public void ontTest( OntModel m ) throws Exception JavaDoc {
391                     Profile prof = m.getProfile();
392                     OntProperty p = m.createObjectProperty( NS + "p" );
393
394                     AllValuesFromRestriction A = m.createAllValuesFromRestriction( NS + "A", p, RDFS.Literal );
395
396                     assertEquals( "Restriction should be all values from literal", RDFS.Literal, A.getAllValuesFrom() );
397                     assertTrue( "Restriction should be all values from literal", A.hasAllValuesFrom( RDFS.Literal ) );
398                     assertTrue( "Restriction should not be all values from decimal", !A.hasAllValuesFrom( XSD.decimal ) );
399                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.ALL_VALUES_FROM() ));
400                 }
401             },
402             new OntTestCase( "AllValuesFromRestriction.allValuesFrom.datarange", true, false, false, false ) {
403                 public void ontTest( OntModel m ) throws Exception JavaDoc {
404                     Profile prof = m.getProfile();
405                     Literal x = m.createLiteral( 1 );
406                     Literal y = m.createLiteral( 2 );
407                     DataRange dr = m.createDataRange( m.createList( new RDFNode[] {x, y} ) );
408                     OntProperty p = m.createObjectProperty( NS + "p" );
409
410                     AllValuesFromRestriction A = m.createAllValuesFromRestriction( NS + "A", p, dr );
411
412                     assertEquals( "Restriction should be all values from dr", dr, A.getAllValuesFrom() );
413                     assertTrue( "value should be a datarange", A.getAllValuesFrom() instanceof DataRange );
414                     assertTrue( "Restriction should be all values from dr", A.hasAllValuesFrom( dr ) );
415                     assertTrue( "Restriction should not be all values from decimal", !A.hasAllValuesFrom( XSD.decimal ) );
416                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.ALL_VALUES_FROM() ));
417
418                     A.removeAllValuesFrom( dr );
419
420                     assertTrue( "Restriction should not be some values from gMonth", !A.hasAllValuesFrom( dr ) );
421                     assertEquals( "cardinality should be 0 ", 0, A.getCardinality( prof.ALL_VALUES_FROM() ));
422                 }
423             },
424             new OntTestCase( "HasValueRestriction.hasValue", true, false, true, false ) {
425                 public void ontTest( OntModel m ) throws Exception JavaDoc {
426                     Profile prof = m.getProfile();
427                     OntProperty p = m.createObjectProperty( NS + "p" );
428                     OntClass B = m.createClass( NS + "B" );
429                     Individual b = m.createIndividual( B );
430                     OntClass C = m.createClass( NS + "C" );
431                     Individual c = m.createIndividual( C );
432
433                     HasValueRestriction A = m.createHasValueRestriction( NS + "A", p, b );
434
435                     assertEquals( "Restriction should be has value b", b, A.getHasValue() );
436                     assertTrue( "Restriction should be to have value b", A.hasValue( b ) );
437                     assertTrue( "Restriction should not be have value c", !A.hasValue( c ) );
438                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.HAS_VALUE() ));
439
440                     A.setHasValue( c );
441
442                     assertEquals( "Restriction should be has value c", c, A.getHasValue() );
443                     assertTrue( "Restriction should not be to have value b", !A.hasValue( b ) );
444                     assertTrue( "Restriction should not be have value c", A.hasValue( c ) );
445                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.HAS_VALUE() ));
446
447                     A.removeHasValue( c );
448
449                     assertTrue( "Restriction should not be to have value b", !A.hasValue( b ) );
450                     assertTrue( "Restriction should not be have value c", !A.hasValue( c ) );
451                     assertEquals( "cardinality should be 0 ", 0, A.getCardinality( prof.HAS_VALUE() ));
452                 }
453             },
454             new OntTestCase( "SomeValuesFromRestriction.someValuesFrom", true, true, true, false ) {
455                 public void ontTest( OntModel m ) throws Exception JavaDoc {
456                     Profile prof = m.getProfile();
457                     OntProperty p = m.createObjectProperty( NS + "p" );
458                     OntClass B = m.createClass( NS + "B" );
459                     OntClass C = m.createClass( NS + "C" );
460
461                     SomeValuesFromRestriction A = m.createSomeValuesFromRestriction( NS + "A", p, B );
462
463                     assertEquals( "Restriction should be some values from B", B, A.getSomeValuesFrom() );
464                     assertTrue( "Restriction should be some values from B", A.hasSomeValuesFrom( B ) );
465                     assertTrue( "Restriction should not be some values from C", !A.hasSomeValuesFrom( C ) );
466                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.SOME_VALUES_FROM() ));
467
468                     A.setSomeValuesFrom( C );
469
470                     assertEquals( "Restriction should be some values from C", C, A.getSomeValuesFrom() );
471                     assertTrue( "Restriction should not be some values from B", !A.hasSomeValuesFrom( B ) );
472                     assertTrue( "Restriction should be some values from C", A.hasSomeValuesFrom( C ) );
473                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.SOME_VALUES_FROM() ));
474
475                     A.removeSomeValuesFrom( C );
476
477                     assertTrue( "Restriction should not be some values from C", !A.hasSomeValuesFrom( C ) );
478                     assertEquals( "cardinality should be 0 ", 0, A.getCardinality( prof.SOME_VALUES_FROM() ));
479                 }
480             },
481             new OntTestCase( "SomeValuesFromRestriction.SomeValuesFrom.datatype", true, true, true, false ) {
482                 public void ontTest( OntModel m ) throws Exception JavaDoc {
483                     Profile prof = m.getProfile();
484                     OntProperty p = m.createObjectProperty( NS + "p" );
485
486                     SomeValuesFromRestriction A = m.createSomeValuesFromRestriction( NS + "A", p, XSD.gDay );
487
488                     assertEquals( "Restriction should be some values from gDay", XSD.gDay, A.getSomeValuesFrom() );
489                     assertTrue( "Restriction should be some values from gDay", A.hasSomeValuesFrom( XSD.gDay ) );
490                     assertTrue( "Restriction should not be some values from decimal", !A.hasSomeValuesFrom( XSD.decimal ) );
491                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.SOME_VALUES_FROM() ));
492
493                     A.setSomeValuesFrom( XSD.gMonth );
494
495                     assertEquals( "Restriction should be some values from gMonth", XSD.gMonth, A.getSomeValuesFrom() );
496                     assertTrue( "Restriction should not be some values from gDay", !A.hasSomeValuesFrom( XSD.gDay ) );
497                     assertTrue( "Restriction should be some values from gMonth", A.hasSomeValuesFrom( XSD.gMonth ) );
498                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.SOME_VALUES_FROM() ));
499
500                     A.removeSomeValuesFrom( XSD.gMonth );
501
502                     assertTrue( "Restriction should not be some values from gMonth", !A.hasSomeValuesFrom( XSD.gMonth ) );
503                     assertEquals( "cardinality should be 0 ", 0, A.getCardinality( prof.SOME_VALUES_FROM() ));
504                 }
505             },
506             new OntTestCase( "SomeValuesFromRestriction.SomeValuesFrom.literal", true, true, true, false ) {
507                 public void ontTest( OntModel m ) throws Exception JavaDoc {
508                     Profile prof = m.getProfile();
509                     OntProperty p = m.createObjectProperty( NS + "p" );
510
511                     SomeValuesFromRestriction A = m.createSomeValuesFromRestriction( NS + "A", p, RDFS.Literal );
512
513                     assertEquals( "Restriction should be some values from literal", RDFS.Literal, A.getSomeValuesFrom() );
514                     assertTrue( "Restriction should be some values from literal", A.hasSomeValuesFrom( RDFS.Literal ) );
515                     assertTrue( "Restriction should not be some values from decimal", !A.hasSomeValuesFrom( XSD.decimal ) );
516                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.SOME_VALUES_FROM() ));
517                 }
518             },
519             new OntTestCase( "SomeValuesFromRestriction.SomeValuesFrom.datarange", true, false, false, false ) {
520                 public void ontTest( OntModel m ) throws Exception JavaDoc {
521                     Profile prof = m.getProfile();
522                     Literal x = m.createLiteral( 1 );
523                     Literal y = m.createLiteral( 2 );
524                     DataRange dr = m.createDataRange( m.createList( new RDFNode[] {x, y} ) );
525                     OntProperty p = m.createObjectProperty( NS + "p" );
526
527                     SomeValuesFromRestriction A = m.createSomeValuesFromRestriction( NS + "A", p, dr );
528
529                     assertEquals( "Restriction should be some values from dr", dr, A.getSomeValuesFrom() );
530                     assertTrue( "value should be a datarange", A.getSomeValuesFrom() instanceof DataRange );
531                     assertTrue( "Restriction should be some values from dr", A.hasSomeValuesFrom( dr ) );
532                     assertTrue( "Restriction should not be some values from decimal", !A.hasSomeValuesFrom( XSD.decimal ) );
533                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.SOME_VALUES_FROM() ));
534
535                     A.removeSomeValuesFrom( dr );
536
537                     assertTrue( "Restriction should not be some values from gMonth", !A.hasSomeValuesFrom( dr ) );
538                     assertEquals( "cardinality should be 0 ", 0, A.getCardinality( prof.SOME_VALUES_FROM() ));
539                 }
540             },
541             new OntTestCase( "CardinalityRestriction.cardinality", true, true, true, false ) {
542                 public void ontTest( OntModel m ) throws Exception JavaDoc {
543                     Profile prof = m.getProfile();
544                     OntProperty p = m.createObjectProperty( NS + "p" );
545
546                     CardinalityRestriction A = m.createCardinalityRestriction( NS + "A", p, 3 );
547
548                     assertEquals( "Restriction should be cardinality 3", 3, A.getCardinality() );
549                     assertTrue( "Restriction should be cardinality 3", A.hasCardinality( 3 ) );
550                     assertTrue( "Restriction should not be cardinality 2", !A.hasCardinality( 2 ) );
551                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.CARDINALITY() ));
552
553                     A.setCardinality( 2 );
554
555                     assertEquals( "Restriction should be cardinality 2", 2, A.getCardinality() );
556                     assertTrue( "Restriction should not be cardinality 3", !A.hasCardinality( 3 ) );
557                     assertTrue( "Restriction should be cardinality 2", A.hasCardinality( 2 ) );
558                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.CARDINALITY() ));
559
560                     A.removeCardinality( 2 );
561
562                     assertTrue( "Restriction should not be cardinality 3", !A.hasCardinality( 3 ) );
563                     assertTrue( "Restriction should not be cardinality 2", !A.hasCardinality( 2 ) );
564                     assertEquals( "cardinality should be 0 ", 0, A.getCardinality( prof.CARDINALITY() ));
565                 }
566             },
567             new OntTestCase( "MinCardinalityRestriction.minCardinality", true, true, true, false ) {
568                 public void ontTest( OntModel m ) throws Exception JavaDoc {
569                     Profile prof = m.getProfile();
570                     OntProperty p = m.createObjectProperty( NS + "p" );
571
572                     MinCardinalityRestriction A = m.createMinCardinalityRestriction( NS + "A", p, 3 );
573
574                     assertEquals( "Restriction should be min cardinality 3", 3, A.getMinCardinality() );
575                     assertTrue( "Restriction should be min cardinality 3", A.hasMinCardinality( 3 ) );
576                     assertTrue( "Restriction should not be min cardinality 2", !A.hasMinCardinality( 2 ) );
577                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.MIN_CARDINALITY() ));
578
579                     A.setMinCardinality( 2 );
580
581                     assertEquals( "Restriction should be min cardinality 2", 2, A.getMinCardinality() );
582                     assertTrue( "Restriction should not be min cardinality 3", !A.hasMinCardinality( 3 ) );
583                     assertTrue( "Restriction should be min cardinality 2", A.hasMinCardinality( 2 ) );
584                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.MIN_CARDINALITY() ));
585
586                     A.removeMinCardinality( 2 );
587
588                     assertTrue( "Restriction should not be cardinality 3", !A.hasMinCardinality( 3 ) );
589                     assertTrue( "Restriction should not be cardinality 2", !A.hasMinCardinality( 2 ) );
590                     assertEquals( "cardinality should be 0 ", 0, A.getCardinality( prof.MIN_CARDINALITY() ));
591                 }
592             },
593             new OntTestCase( "MaxCardinalityRestriction.maxCardinality", true, true, true, false ) {
594                 public void ontTest( OntModel m ) throws Exception JavaDoc {
595                     Profile prof = m.getProfile();
596                     OntProperty p = m.createObjectProperty( NS + "p" );
597
598                     MaxCardinalityRestriction A = m.createMaxCardinalityRestriction( NS + "A", p, 3 );
599
600                     assertEquals( "Restriction should be max cardinality 3", 3, A.getMaxCardinality() );
601                     assertTrue( "Restriction should be max cardinality 3", A.hasMaxCardinality( 3 ) );
602                     assertTrue( "Restriction should not be max cardinality 2", !A.hasMaxCardinality( 2 ) );
603                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.MAX_CARDINALITY() ));
604
605                     A.setMaxCardinality( 2 );
606
607                     assertEquals( "Restriction should be max cardinality 2", 2, A.getMaxCardinality() );
608                     assertTrue( "Restriction should not be max cardinality 3", !A.hasMaxCardinality( 3 ) );
609                     assertTrue( "Restriction should be max cardinality 2", A.hasMaxCardinality( 2 ) );
610                     assertEquals( "cardinality should be 1 ", 1, A.getCardinality( prof.MAX_CARDINALITY() ));
611
612                     A.removeMaxCardinality( 2 );
613
614                     assertTrue( "Restriction should not be cardinality 3", !A.hasMaxCardinality( 3 ) );
615                     assertTrue( "Restriction should not be cardinality 2", !A.hasMaxCardinality( 2 ) );
616                     assertEquals( "cardinality should be 0 ", 0, A.getCardinality( prof.MAX_CARDINALITY() ));
617                 }
618             },
619             new OntTestCase( "QualifiedRestriction.hasClassQ", false, false, true, false ) {
620                 public void ontTest( OntModel m ) throws Exception JavaDoc {
621                     OntProperty p = m.createObjectProperty( NS + "p" );
622                     OntClass c = m.createClass( NS + "C" );
623                     OntClass d = m.createClass( NS + "D" );
624
625                     QualifiedRestriction A = m.createMaxCardinalityQRestriction( NS + "A", p, 3, c );
626
627                     assertEquals( "Restriction should hasClassQ c", c, A.getHasClassQ() );
628                     assertTrue( "Restriction should be hasClassQ c", A.hasHasClassQ( c ) );
629                     assertFalse( "Restriction should not be hasClassQ d", A.hasHasClassQ( d ) );
630
631                     A.setHasClassQ( d );
632
633                     assertEquals( "Restriction should hasClassQ d", d, A.getHasClassQ() );
634                     assertTrue( "Restriction should be hasClassQ d", A.hasHasClassQ( d ) );
635                     assertFalse( "Restriction should not be hasClassQ c", A.hasHasClassQ( c ) );
636
637                     assertTrue( "Should be a qualified restriction", m.getResource( NS + "A" ).canAs( QualifiedRestriction.class ) );
638                     A.removeHasClassQ( d );
639                     assertFalse( "Should not be a qualified restriction", m.getResource( NS + "A" ).canAs( QualifiedRestriction.class ) );
640                 }
641             },
642             new OntTestCase( "CardinalityQRestriction.cardinality", false, false, true, false ) {
643                 public void ontTest( OntModel m ) throws Exception JavaDoc {
644                     OntProperty p = m.createObjectProperty( NS + "p" );
645                     OntClass c = m.createClass( NS + "C" );
646
647                     CardinalityQRestriction A = m.createCardinalityQRestriction( NS + "A", p, 3, c );
648
649                     assertEquals( "Restriction should cardinality 3", 3, A.getCardinalityQ() );
650                     assertTrue( "Restriction should be cardinality 3", A.hasCardinalityQ( 3 ) );
651                     assertFalse( "Restriction should not be cardinality 1", A.hasCardinalityQ( 1 ) );
652
653                     A.setCardinalityQ( 1 );
654
655                     assertEquals( "Restriction should cardinality 1", 1, A.getCardinalityQ() );
656                     assertFalse( "Restriction should not be cardinality 3", A.hasCardinalityQ( 3 ) );
657                     assertTrue( "Restriction should be cardinality 1", A.hasCardinalityQ( 1 ) );
658
659                     assertTrue( "Should be a qualified cardinality restriction", m.getResource( NS + "A" ).canAs( CardinalityQRestriction.class ) );
660                     A.removeCardinalityQ( 1 );
661                     assertFalse( "Should not be a qualified cardinality restriction", m.getResource( NS + "A" ).canAs( CardinalityQRestriction.class ) );
662                 }
663             },
664             new OntTestCase( "MinCardinalityQRestriction.minCardinality", false, false, true, false ) {
665                 public void ontTest( OntModel m ) throws Exception JavaDoc {
666                     OntProperty p = m.createObjectProperty( NS + "p" );
667                     OntClass c = m.createClass( NS + "C" );
668
669                     MinCardinalityQRestriction A = m.createMinCardinalityQRestriction( NS + "A", p, 3, c );
670
671                     assertEquals( "Restriction should min cardinality 3", 3, A.getMinCardinalityQ() );
672                     assertTrue( "Restriction should be min cardinality 3", A.hasMinCardinalityQ( 3 ) );
673                     assertFalse( "Restriction should not be min cardinality 1", A.hasMinCardinalityQ( 1 ) );
674
675                     A.setMinCardinalityQ( 1 );
676
677                     assertEquals( "Restriction should min cardinality 1", 1, A.getMinCardinalityQ() );
678                     assertFalse( "Restriction should not be min cardinality 3", A.hasMinCardinalityQ( 3 ) );
679                     assertTrue( "Restriction should be min cardinality 1", A.hasMinCardinalityQ( 1 ) );
680
681                     assertTrue( "Should be a qualified min cardinality restriction", m.getResource( NS + "A" ).canAs( MinCardinalityQRestriction.class ) );
682                     A.removeMinCardinalityQ( 1 );
683                     assertFalse( "Should not be a qualified min cardinality restriction", m.getResource( NS + "A" ).canAs( MinCardinalityQRestriction.class ) );
684                 }
685             },
686             new OntTestCase( "MaxCardinalityQRestriction.maxCardinality", false, false, true, false ) {
687                 public void ontTest( OntModel m ) throws Exception JavaDoc {
688                     OntProperty p = m.createObjectProperty( NS + "p" );
689                     OntClass c = m.createClass( NS + "C" );
690
691                     MaxCardinalityQRestriction A = m.createMaxCardinalityQRestriction( NS + "A", p, 3, c );
692
693                     assertEquals( "Restriction should max cardinality 3", 3, A.getMaxCardinalityQ() );
694                     assertTrue( "Restriction should be max cardinality 3", A.hasMaxCardinalityQ( 3 ) );
695                     assertFalse( "Restriction should not be max cardinality 1", A.hasMaxCardinalityQ( 1 ) );
696
697                     A.setMaxCardinalityQ( 1 );
698
699                     assertEquals( "Restriction should max cardinality 1", 1, A.getMaxCardinalityQ() );
700                     assertFalse( "Restriction should not be max cardinality 3", A.hasMaxCardinalityQ( 3 ) );
701                     assertTrue( "Restriction should be max cardinality 1", A.hasMaxCardinalityQ( 1 ) );
702
703                     assertTrue( "Should be a qualified max cardinality restriction", m.getResource( NS + "A" ).canAs( MaxCardinalityQRestriction.class ) );
704                     A.removeMaxCardinalityQ( 1 );
705                     assertFalse( "Should not be a qualified max cardinality restriction", m.getResource( NS + "A" ).canAs( MaxCardinalityQRestriction.class ) );
706                 }
707             },
708
709             // from file
710
new OntTestCase( "OntClass.subclass.fromFile", true, true, true, true ) {
711                 public void ontTest( OntModel m ) throws Exception JavaDoc {
712                     String JavaDoc lang = m_owlLang ? "owl" : (m_damlLang ? "daml" : "rdfs");
713                     String JavaDoc fileName = "file:testing/ontology/" + lang + "/ClassExpression/test.rdf";
714                     m.read( fileName );
715
716                     OntClass A = m.createClass( NS + "ClassA" );
717                     OntClass B = m.createClass( NS + "ClassB" );
718
719                     iteratorTest( A.listSuperClasses(), new Object JavaDoc[] {B} );
720                     iteratorTest( B.listSubClasses(), new Object JavaDoc[] {A} );
721                 }
722             },
723             new OntTestCase( "OntClass.equivalentClass.fromFile", true, true, true, false ) {
724                 public void ontTest( OntModel m ) throws Exception JavaDoc {
725                     String JavaDoc lang = m_owlLang ? "owl" : (m_damlLang ? "daml" : "rdfs");
726                     String JavaDoc fileName = "file:testing/ontology/" + lang + "/ClassExpression/test.rdf";
727                     m.read( fileName );
728
729                     OntClass A = m.createClass( NS + "ClassA" );
730                     OntClass C = m.createClass( NS + "ClassC" );
731
732                     assertTrue( "A should be equiv to C", A.hasEquivalentClass( C ) );
733                 }
734             },
735             new OntTestCase( "OntClass.disjoint.fromFile", true, false, true, false ) {
736                 public void ontTest( OntModel m ) throws Exception JavaDoc {
737                     String JavaDoc lang = m_owlLang ? "owl" : (m_damlLang ? "daml" : "rdfs");
738                     String JavaDoc fileName = "file:testing/ontology/" + lang + "/ClassExpression/test.rdf";
739                     m.read( fileName );
740
741                     OntClass A = m.createClass( NS + "ClassA" );
742                     OntClass D = m.createClass( NS + "ClassD" );
743
744                     assertTrue( "A should be disjoint with D", A.isDisjointWith( D ) );
745                 }
746             },
747
748             // type testing
749
new OntTestCase( "OntClass.isEnumeratedClass", true, false, true, false ) {
750                 public void ontTest( OntModel m ) throws Exception JavaDoc {
751                     OntClass b = m.createClass( NS + "B" );
752                     Individual x = m.createIndividual( NS + "x", b );
753                     Individual y = m.createIndividual( NS + "y", b );
754                     OntClass a = m.createEnumeratedClass( NS + "A", m.createList( new RDFNode[] {x, y} ) );
755
756                     assertTrue( "enumerated class test not correct", a.isEnumeratedClass() );
757                     assertTrue( "intersection class test not correct", !a.isIntersectionClass() );
758                     assertTrue( "union class test not correct", !a.isUnionClass() );
759                     assertTrue( "complement class test not correct", !a.isComplementClass() );
760                     assertTrue( "restriction test not correct", !a.isRestriction() );
761                 }
762             },
763             new OntTestCase( "OntClass.isIntersectionClass", true, true, true, false ) {
764                 public void ontTest( OntModel m ) throws Exception JavaDoc {
765                     OntClass b = m.createClass( NS + "B" );
766                     OntClass c = m.createClass( NS + "C" );
767                     OntClass a = m.createIntersectionClass( NS + "A", m.createList( new RDFNode[] {b,c} ) );
768
769                     assertTrue( "enumerated class test not correct", m_owlLiteLang || !a.isEnumeratedClass() );
770                     assertTrue( "intersection class test not correct", a.isIntersectionClass() );
771                     assertTrue( "union class test not correct", m_owlLiteLang || !a.isUnionClass() );
772                     assertTrue( "complement class test not correct", m_owlLiteLang || !a.isComplementClass() );
773                     assertTrue( "restriction test not correct", !a.isRestriction() );
774                 }
775             },
776             new OntTestCase( "OntClass.isUnionClass", true, false, true, false ) {
777                 public void ontTest( OntModel m ) throws Exception JavaDoc {
778                     OntClass b = m.createClass( NS + "B" );
779                     OntClass c = m.createClass( NS + "C" );
780                     OntClass a = m.createUnionClass( NS + "A", m.createList( new RDFNode[] {b,c} ) );
781
782                     assertTrue( "enumerated class test not correct", !a.isEnumeratedClass() );
783                     assertTrue( "intersection class test not correct", !a.isIntersectionClass() );
784                     assertTrue( "union class test not correct", a.isUnionClass() );
785                     assertTrue( "complement class test not correct", !a.isComplementClass() );
786                     assertTrue( "restriction test not correct", !a.isRestriction() );
787                 }
788             },
789             new OntTestCase( "OntClass.isComplementClass", true, false, true, false ) {
790                 public void ontTest( OntModel m ) throws Exception JavaDoc {
791                     OntClass b = m.createClass( NS + "B" );
792                     OntClass a = m.createComplementClass( NS + "A", b );
793
794                     assertTrue( "enumerated class test not correct", !a.isEnumeratedClass() );
795                     assertTrue( "intersection class test not correct", !a.isIntersectionClass() );
796                     assertTrue( "union class test not correct", !a.isUnionClass() );
797                     assertTrue( "complement class test not correct", a.isComplementClass() );
798                     assertTrue( "restriction test not correct", !a.isRestriction() );
799                 }
800             },
801             new OntTestCase( "OntClass.isRestriction", true, true, true, false ) {
802                 public void ontTest( OntModel m ) throws Exception JavaDoc {
803                     OntClass a = m.createRestriction( null );
804
805                     assertTrue( "enumerated class test not correct", m_owlLiteLang || !a.isEnumeratedClass() );
806                     assertTrue( "intersection class test not correct", !a.isIntersectionClass() );
807                     assertTrue( "union class test not correct", m_owlLiteLang || !a.isUnionClass() );
808                     assertTrue( "complement class test not correct", m_owlLiteLang || !a.isComplementClass() );
809                     assertTrue( "restriction test not correct", a.isRestriction() );
810                 }
811             },
812
813             // conversion
814
new OntTestCase( "OntClass.toEnumeratedClass", true, false, true, false ) {
815                 public void ontTest( OntModel m ) throws Exception JavaDoc {
816                     OntClass a = m.createClass( NS + "A" );
817
818                     assertTrue( "enumerated class test not correct", !a.isEnumeratedClass() );
819                     assertTrue( "intersection class test not correct", !a.isIntersectionClass() );
820                     assertTrue( "union class test not correct", !a.isUnionClass() );
821                     assertTrue( "complement class test not correct", !a.isComplementClass() );
822                     assertTrue( "restriction test not correct", !a.isRestriction() );
823
824                     OntClass b = m.createClass( NS + "B" );
825                     Individual x = m.createIndividual( NS + "x", b );
826                     Individual y = m.createIndividual( NS + "y", b );
827                     a = a.convertToEnumeratedClass( m.createList( new RDFNode[] {x, y} ) );
828
829                     assertTrue( "enumerated class test not correct", a.isEnumeratedClass() );
830                     assertTrue( "intersection class test not correct", !a.isIntersectionClass() );
831                     assertTrue( "union class test not correct", !a.isUnionClass() );
832                     assertTrue( "complement class test not correct", !a.isComplementClass() );
833                     assertTrue( "restriction test not correct", !a.isRestriction() );
834                 }
835             },
836             new OntTestCase( "OntClass.toIntersectionClass", true, true, true, false ) {
837                 public void ontTest( OntModel m ) throws Exception JavaDoc {
838                     OntClass a = m.createClass( NS + "A" );
839
840                     assertTrue( "enumerated class test not correct", m_owlLiteLang || !a.isEnumeratedClass() );
841                     assertTrue( "intersection class test not correct", !a.isIntersectionClass() );
842                     assertTrue( "union class test not correct", m_owlLiteLang || !a.isUnionClass() );
843                     assertTrue( "complement class test not correct", m_owlLiteLang || !a.isComplementClass() );
844                     assertTrue( "restriction test not correct", !a.isRestriction() );
845
846                     OntClass b = m.createClass( NS + "B" );
847                     OntClass c = m.createClass( NS + "C" );
848                     a = a.convertToIntersectionClass( m.createList( new RDFNode[] {b,c} ) );
849
850                     assertTrue( "enumerated class test not correct", m_owlLiteLang || !a.isEnumeratedClass() );
851                     assertTrue( "intersection class test not correct", a.isIntersectionClass() );
852                     assertTrue( "union class test not correct", m_owlLiteLang || !a.isUnionClass() );
853                     assertTrue( "complement class test not correct", m_owlLiteLang || !a.isComplementClass() );
854                     assertTrue( "restriction test not correct", !a.isRestriction() );
855                 }
856             },
857             new OntTestCase( "OntClass.toUnionClass", true, false, true, false ) {
858                 public void ontTest( OntModel m ) throws Exception JavaDoc {
859                     OntClass a = m.createClass( NS + "A" );
860
861                     assertTrue( "enumerated class test not correct", !a.isEnumeratedClass() );
862                     assertTrue( "intersection class test not correct", !a.isIntersectionClass() );
863                     assertTrue( "union class test not correct", !a.isUnionClass() );
864                     assertTrue( "complement class test not correct", !a.isComplementClass() );
865                     assertTrue( "restriction test not correct", !a.isRestriction() );
866
867                     OntClass b = m.createClass( NS + "B" );
868                     OntClass c = m.createClass( NS + "C" );
869                     a = a.convertToUnionClass( m.createList( new RDFNode[] {b,c} ) );
870
871                     assertTrue( "enumerated class test not correct", m_owlLiteLang || !a.isEnumeratedClass() );
872                     assertTrue( "intersection class test not correct", !a.isIntersectionClass() );
873                     assertTrue( "union class test not correct", m_owlLiteLang || a.isUnionClass() );
874                     assertTrue( "complement class test not correct", m_owlLiteLang || !a.isComplementClass() );
875                     assertTrue( "restriction test not correct", !a.isRestriction() );
876                 }
877             },
878             new OntTestCase( "OntClass.toComplementClass", true, false, true, false ) {
879                 public void ontTest( OntModel m ) throws Exception JavaDoc {
880                     OntClass a = m.createClass( NS + "A" );
881
882                     assertTrue( "enumerated class test not correct", !a.isEnumeratedClass() );
883                     assertTrue( "intersection class test not correct", !a.isIntersectionClass() );
884                     assertTrue( "union class test not correct", !a.isUnionClass() );
885                     assertTrue( "complement class test not correct", !a.isComplementClass() );
886                     assertTrue( "restriction test not correct", !a.isRestriction() );
887
888                     OntClass b = m.createClass( NS + "B" );
889                     a = a.convertToComplementClass( b );
890
891                     assertTrue( "enumerated class test not correct", m_owlLiteLang || !a.isEnumeratedClass() );
892                     assertTrue( "intersection class test not correct", !a.isIntersectionClass() );
893                     assertTrue( "union class test not correct", m_owlLiteLang || !a.isUnionClass() );
894                     assertTrue( "complement class test not correct", m_owlLiteLang || a.isComplementClass() );
895                     assertTrue( "restriction test not correct", !a.isRestriction() );
896                 }
897             },
898             new OntTestCase( "OntClass.toRestriction", true, true, true, false ) {
899                 public void ontTest( OntModel m ) throws Exception JavaDoc {
900                     OntClass a = m.createClass( NS + "A" );
901
902                     assertTrue( "enumerated class test not correct", m_owlLiteLang || !a.isEnumeratedClass() );
903                     assertTrue( "intersection class test not correct", !a.isIntersectionClass() );
904                     assertTrue( "union class test not correct", m_owlLiteLang || !a.isUnionClass() );
905                     assertTrue( "complement class test not correct", m_owlLiteLang || !a.isComplementClass() );
906                     assertTrue( "restriction test not correct", !a.isRestriction() );
907
908                     ObjectProperty p = m.createObjectProperty( NS + "p" );
909                     a = a.convertToRestriction( p );
910
911                     assertTrue( "enumerated class test not correct", m_owlLiteLang || !a.isEnumeratedClass() );
912                     assertTrue( "intersection class test not correct", !a.isIntersectionClass() );
913                     assertTrue( "union class test not correct", m_owlLiteLang || !a.isUnionClass() );
914                     assertTrue( "complement class test not correct", m_owlLiteLang || !a.isComplementClass() );
915                     assertTrue( "restriction test not correct", a.isRestriction() );
916                 }
917             },
918
919
920             // restriction type testing
921
new OntTestCase( "Restriction.isAllValuesFrom", true, true, true, false ) {
922                 public void ontTest( OntModel m ) throws Exception JavaDoc {
923                     OntClass b = m.createClass( NS + "B" );
924                     ObjectProperty p = m.createObjectProperty( NS + "p" );
925                     Restriction a = m.createAllValuesFromRestriction( null, p, b );
926
927                     assertTrue( "all values from test not correct", a.isAllValuesFromRestriction() );
928                     assertTrue( "some values from test not correct", !a.isSomeValuesFromRestriction() );
929                     assertTrue( "has value test not correct", m_owlLiteLang || !a.isHasValueRestriction() );
930                     assertTrue( "cardinality test not correct", !a.isCardinalityRestriction() );
931                     assertTrue( "min cardinality test not correct", !a.isMinCardinalityRestriction() );
932                     assertTrue( "max cardinality test not correct", !a.isMaxCardinalityRestriction() );
933                 }
934             },
935             new OntTestCase( "Restriction.isSomeValuesFrom", true, true, true, false ) {
936                 public void ontTest( OntModel m ) throws Exception JavaDoc {
937                     OntClass b = m.createClass( NS + "B" );
938                     ObjectProperty p = m.createObjectProperty( NS + "p" );
939                     Restriction a = m.createSomeValuesFromRestriction( null, p, b );
940
941                     assertTrue( "all values from test not correct", !a.isAllValuesFromRestriction() );
942                     assertTrue( "some values from test not correct", a.isSomeValuesFromRestriction() );
943                     assertTrue( "has value test not correct", m_owlLiteLang || !a.isHasValueRestriction() );
944                     assertTrue( "cardinality test not correct", !a.isCardinalityRestriction() );
945                     assertTrue( "min cardinality test not correct", !a.isMinCardinalityRestriction() );
946                     assertTrue( "max cardinality test not correct", !a.isMaxCardinalityRestriction() );
947                 }
948             },
949             new OntTestCase( "Restriction.isHasValue", true, false, true, false ) {
950                 public void ontTest( OntModel m ) throws Exception JavaDoc {
951                     OntClass b = m.createClass( NS + "B" );
952                     Individual x = m.createIndividual( b );
953                     ObjectProperty p = m.createObjectProperty( NS + "p" );
954                     Restriction a = m.createHasValueRestriction( null, p, x );
955
956                     assertTrue( "all values from test not correct", !a.isAllValuesFromRestriction() );
957                     assertTrue( "some values from test not correct", !a.isSomeValuesFromRestriction() );
958                     assertTrue( "has value test not correct", m_owlLiteLang || a.isHasValueRestriction() );
959                     assertTrue( "cardinality test not correct", !a.isCardinalityRestriction() );
960                     assertTrue( "min cardinality test not correct", !a.isMinCardinalityRestriction() );
961                     assertTrue( "max cardinality test not correct", !a.isMaxCardinalityRestriction() );
962                 }
963             },
964             new OntTestCase( "Restriction.isCardinality", true, true, true, false ) {
965                 public void ontTest( OntModel m ) throws Exception JavaDoc {
966                     ObjectProperty p = m.createObjectProperty( NS + "p" );
967                     Restriction a = m.createCardinalityRestriction( null, p, 3 );
968
969                     assertTrue( "all values from test not correct", !a.isAllValuesFromRestriction() );
970                     assertTrue( "some values from test not correct", !a.isSomeValuesFromRestriction() );
971                     assertTrue( "has value test not correct", m_owlLiteLang || !a.isHasValueRestriction() );
972                     assertTrue( "cardinality test not correct", a.isCardinalityRestriction() );
973                     assertTrue( "min cardinality test not correct", !a.isMinCardinalityRestriction() );
974                     assertTrue( "max cardinality test not correct", !a.isMaxCardinalityRestriction() );
975                 }
976             },
977             new OntTestCase( "Restriction.isMinCardinality", true, true, true, false ) {
978                 public void ontTest( OntModel m ) throws Exception JavaDoc {
979                     ObjectProperty p = m.createObjectProperty( NS + "p" );
980                     Restriction a = m.createMinCardinalityRestriction( null, p, 1 );
981
982                     assertTrue( "all values from test not correct", !a.isAllValuesFromRestriction() );
983                     assertTrue( "some values from test not correct", !a.isSomeValuesFromRestriction() );
984                     assertTrue( "has value test not correct", m_owlLiteLang || !a.isHasValueRestriction() );
985                     assertTrue( "cardinality test not correct", !a.isCardinalityRestriction() );
986                     assertTrue( "min cardinality test not correct", a.isMinCardinalityRestriction() );
987                     assertTrue( "max cardinality test not correct", !a.isMaxCardinalityRestriction() );
988                 }
989             },
990             new OntTestCase( "Restriction.isMaxCardinality", true, true, true, false ) {
991                 public void ontTest( OntModel m ) throws Exception JavaDoc {
992                     ObjectProperty p = m.createObjectProperty( NS + "p" );
993                     Restriction a = m.createMaxCardinalityRestriction( null, p, 5 );
994
995                     assertTrue( "all values from test not correct", !a.isAllValuesFromRestriction() );
996                     assertTrue( "some values from test not correct", !a.isSomeValuesFromRestriction() );
997                     assertTrue( "has value test not correct", m_owlLiteLang || !a.isHasValueRestriction() );
998                     assertTrue( "cardinality test not correct", !a.isCardinalityRestriction() );
999                     assertTrue( "min cardinality test not correct", !a.isMinCardinalityRestriction() );
1000                    assertTrue( "max cardinality test not correct", a.isMaxCardinalityRestriction() );
1001                }
1002            },
1003
1004            // restriction conversions
1005
new OntTestCase( "Restriction.convertToAllValuesFrom", true, true, true, false ) {
1006                public void ontTest( OntModel m ) throws Exception JavaDoc {
1007                    ObjectProperty p = m.createObjectProperty( NS + "p" );
1008                    Restriction a = m.createRestriction( p );
1009
1010                    assertTrue( "all values from test not correct", !a.isAllValuesFromRestriction() );
1011                    assertTrue( "some values from test not correct", !a.isSomeValuesFromRestriction() );
1012                    assertTrue( "has value test not correct", m_owlLiteLang || !a.isHasValueRestriction() );
1013                    assertTrue( "cardinality test not correct", !a.isCardinalityRestriction() );
1014                    assertTrue( "min cardinality test not correct", !a.isMinCardinalityRestriction() );
1015                    assertTrue( "max cardinality test not correct", !a.isMaxCardinalityRestriction() );
1016
1017                    OntClass b = m.createClass( NS + "B" );
1018                    a = a.convertToAllValuesFromRestriction( b );
1019
1020                    assertTrue( "all values from test not correct", a.isAllValuesFromRestriction() );
1021                    assertTrue( "some values from test not correct", !a.isSomeValuesFromRestriction() );
1022                    assertTrue( "has value test not correct", m_owlLiteLang || !a.isHasValueRestriction() );
1023                    assertTrue( "cardinality test not correct", !a.isCardinalityRestriction() );
1024                    assertTrue( "min cardinality test not correct", !a.isMinCardinalityRestriction() );
1025                    assertTrue( "max cardinality test not correct", !a.isMaxCardinalityRestriction() );
1026                }
1027            },
1028            new OntTestCase( "Restriction.convertToSomeValuesFrom", true, true, true, false ) {
1029                public void ontTest( OntModel m ) throws Exception JavaDoc {
1030                    ObjectProperty p = m.createObjectProperty( NS + "p" );
1031                    Restriction a = m.createRestriction( p );
1032
1033                    assertTrue( "all values from test not correct", !a.isAllValuesFromRestriction() );
1034                    assertTrue( "some values from test not correct", !a.isSomeValuesFromRestriction() );
1035                    assertTrue( "has value test not correct", m_owlLiteLang || !a.isHasValueRestriction() );
1036                    assertTrue( "cardinality test not correct", !a.isCardinalityRestriction() );
1037                    assertTrue( "min cardinality test not correct", !a.isMinCardinalityRestriction() );
1038                    assertTrue( "max cardinality test not correct", !a.isMaxCardinalityRestriction() );
1039
1040                    OntClass b = m.createClass( NS + "B" );
1041                    a = a.convertToSomeValuesFromRestriction( b );
1042
1043                    assertTrue( "all values from test not correct", !a.isAllValuesFromRestriction() );
1044                    assertTrue( "some values from test not correct", a.isSomeValuesFromRestriction() );
1045                    assertTrue( "has value test not correct", m_owlLiteLang || !a.isHasValueRestriction() );
1046                    assertTrue( "cardinality test not correct", !a.isCardinalityRestriction() );
1047                    assertTrue( "min cardinality test not correct", !a.isMinCardinalityRestriction() );
1048                    assertTrue( "max cardinality test not correct", !a.isMaxCardinalityRestriction() );
1049                }
1050            },
1051            new OntTestCase( "Restriction.convertToHasValue", true, false, true, false ) {
1052                public void ontTest( OntModel m ) throws Exception JavaDoc {
1053                    ObjectProperty p = m.createObjectProperty( NS + "p" );
1054                    Restriction a = m.createRestriction( p );
1055
1056                    assertTrue( "all values from test not correct", !a.isAllValuesFromRestriction() );
1057                    assertTrue( "some values from test not correct", !a.isSomeValuesFromRestriction() );
1058                    assertTrue( "has value test not correct", m_owlLiteLang || !a.isHasValueRestriction() );
1059                    assertTrue( "cardinality test not correct", !a.isCardinalityRestriction() );
1060                    assertTrue( "min cardinality test not correct", !a.isMinCardinalityRestriction() );
1061                    assertTrue( "max cardinality test not correct", !a.isMaxCardinalityRestriction() );
1062
1063                    OntClass b = m.createClass( NS + "B" );
1064                    Individual x = m.createIndividual( b );
1065                    a = a.convertToHasValueRestriction( x );
1066
1067                    assertTrue( "all values from test not correct", !a.isAllValuesFromRestriction() );
1068                    assertTrue( "some values from test not correct", !a.isSomeValuesFromRestriction() );
1069                    assertTrue( "has value test not correct", m_owlLiteLang || a.isHasValueRestriction() );
1070                    assertTrue( "cardinality test not correct", !a.isCardinalityRestriction() );
1071                    assertTrue( "min cardinality test not correct", !a.isMinCardinalityRestriction() );
1072                    assertTrue( "max cardinality test not correct", !a.isMaxCardinalityRestriction() );
1073                }
1074            },
1075            new OntTestCase( "Restriction.convertCardinality", true, true, true, false ) {
1076                public void ontTest( OntModel m ) throws Exception JavaDoc {
1077                    ObjectProperty p = m.createObjectProperty( NS + "p" );
1078                    Restriction a = m.createRestriction( p );
1079
1080                    assertTrue( "all values from test not correct", !a.isAllValuesFromRestriction() );
1081                    assertTrue( "some values from test not correct", !a.isSomeValuesFromRestriction() );
1082                    assertTrue( "has value test not correct", m_owlLiteLang || !a.isHasValueRestriction() );
1083                    assertTrue( "cardinality test not correct", !a.isCardinalityRestriction() );
1084                    assertTrue( "min cardinality test not correct", !a.isMinCardinalityRestriction() );
1085                    assertTrue( "max cardinality test not correct", !a.isMaxCardinalityRestriction() );
1086
1087                    a = a.convertToCardinalityRestriction( 3 );
1088
1089                    assertTrue( "all values from test not correct", !a.isAllValuesFromRestriction() );
1090                    assertTrue( "some values from test not correct", !a.isSomeValuesFromRestriction() );
1091                    assertTrue( "has value test not correct", m_owlLiteLang || !a.isHasValueRestriction() );
1092                    assertTrue( "cardinality test not correct", a.isCardinalityRestriction() );
1093                    assertTrue( "min cardinality test not correct", !a.isMinCardinalityRestriction() );
1094                    assertTrue( "max cardinality test not correct", !a.isMaxCardinalityRestriction() );
1095                }
1096            },
1097            new OntTestCase( "Restriction.convertMinCardinality", true, true, true, false ) {
1098                public void ontTest( OntModel m ) throws Exception JavaDoc {
1099                    ObjectProperty p = m.createObjectProperty( NS + "p" );
1100                    Restriction a = m.createRestriction( p );
1101
1102                    assertTrue( "all values from test not correct", !a.isAllValuesFromRestriction() );
1103                    assertTrue( "some values from test not correct", !a.isSomeValuesFromRestriction() );
1104                    assertTrue( "has value test not correct", m_owlLiteLang || !a.isHasValueRestriction() );
1105                    assertTrue( "cardinality test not correct", !a.isCardinalityRestriction() );
1106                    assertTrue( "min cardinality test not correct", !a.isMinCardinalityRestriction() );
1107                    assertTrue( "max cardinality test not correct", !a.isMaxCardinalityRestriction() );
1108
1109                    a = a.convertToMinCardinalityRestriction( 3 );
1110
1111                    assertTrue( "all values from test not correct", !a.isAllValuesFromRestriction() );
1112                    assertTrue( "some values from test not correct", !a.isSomeValuesFromRestriction() );
1113                    assertTrue( "has value test not correct", m_owlLiteLang || !a.isHasValueRestriction() );
1114                    assertTrue( "cardinality test not correct", !a.isCardinalityRestriction() );
1115                    assertTrue( "min cardinality test not correct", a.isMinCardinalityRestriction() );
1116                    assertTrue( "max cardinality test not correct", !a.isMaxCardinalityRestriction() );
1117                }
1118            },
1119            new OntTestCase( "Restriction.convertMaxCardinality", true, true, true, false ) {
1120                public void ontTest( OntModel m ) throws Exception JavaDoc {
1121                    ObjectProperty p = m.createObjectProperty( NS + "p" );
1122                    Restriction a = m.createRestriction( p );
1123
1124                    assertTrue( "all values from test not correct", !a.isAllValuesFromRestriction() );
1125                    assertTrue( "some values from test not correct", !a.isSomeValuesFromRestriction() );
1126                    assertTrue( "has value test not correct", m_owlLiteLang || !a.isHasValueRestriction() );
1127                    assertTrue( "cardinality test not correct", !a.isCardinalityRestriction() );
1128                    assertTrue( "min cardinality test not correct", !a.isMinCardinalityRestriction() );
1129                    assertTrue( "max cardinality test not correct", !a.isMaxCardinalityRestriction() );
1130
1131                    a = a.convertToMaxCardinalityRestriction( 3 );
1132
1133                    assertTrue( "all values from test not correct", !a.isAllValuesFromRestriction() );
1134                    assertTrue( "some values from test not correct", !a.isSomeValuesFromRestriction() );
1135                    assertTrue( "has value test not correct", m_owlLiteLang || !a.isHasValueRestriction() );
1136                    assertTrue( "cardinality test not correct", !a.isCardinalityRestriction() );
1137                    assertTrue( "min cardinality test not correct", !a.isMinCardinalityRestriction() );
1138                    assertTrue( "max cardinality test not correct", a.isMaxCardinalityRestriction() );
1139                }
1140            },
1141            new OntTestCase( "OntClass.listInstances", true, true, true, true ) {
1142                public void ontTest( OntModel m ) throws Exception JavaDoc {
1143                    OntClass A = m.createClass( NS + "A" );
1144                    OntClass B = m.createClass( NS + "B" );
1145
1146                    Individual a0 = m.createIndividual( A );
1147                    Individual a1 = m.createIndividual( NS + "a1", A );
1148                    Individual b0 = m.createIndividual( B );
1149                    /*Individual b1 =*/ m.createIndividual( NS + "b1", B );
1150                    b0.addRDFType( A );
1151
1152                    iteratorTest( A.listInstances(), new Object JavaDoc[] {a0, a1, b0} );
1153                }
1154            },
1155            new OntTestCase( "OntClass.listDefinedProperties", true, true, true, true ) {
1156                public void ontTest( OntModel m ) throws Exception JavaDoc {
1157                    OntClass A = m.createClass( NS + "A" );
1158                    //OntClass B = m.createClass( NS + "B" );
1159
OntClass C = m.createClass( NS + "C" );
1160
1161                    OntProperty p = m.createOntProperty( NS + "p" );
1162                    OntProperty q = m.createOntProperty( NS + "q" );
1163                    OntProperty r = m.createOntProperty( NS + "r" );
1164                    OntProperty s = m.createOntProperty( NS + "s" );
1165
1166                    p.setDomain( A );
1167                    q.setDomain( A );
1168                    s.setDomain( C );
1169
1170                    if (m_rdfsLang) {
1171                        iteratorTest( A.listDeclaredProperties(), new Object JavaDoc[] {p, q, r} );
1172                    }
1173                    else {
1174                        Restriction r0 = m.createRestriction( r );
1175                        C.addSuperClass( r0 );
1176
1177                        iteratorTest( A.listDeclaredProperties(), new Object JavaDoc[] {p, q, r} );
1178
1179                        iteratorTest( C.listDeclaredProperties(), new Object JavaDoc[] {s, r} );
1180
1181                        iteratorTest( r0.listDeclaredProperties(), new Object JavaDoc[] {r} );
1182                    }
1183                }
1184            },
1185            new OntTestCase( "OntClass.listDefinedProperties.notAll", true, true, true, true ) {
1186                public void ontTest( OntModel m ) throws Exception JavaDoc {
1187                    OntClass A = m.createClass( NS + "A" );
1188                    OntClass C = m.createClass( NS + "C" );
1189                    C.addSuperClass(A);
1190
1191                    OntProperty p = m.createOntProperty( NS + "p" );
1192                    OntProperty q = m.createOntProperty( NS + "q" );
1193                    OntProperty s = m.createOntProperty( NS + "s" );
1194
1195                    p.setDomain( A );
1196                    q.setDomain( A );
1197                    s.setDomain( C );
1198
1199                    iteratorTest( C.listDeclaredProperties( false ), new Object JavaDoc[] { p, q, s} );
1200                    iteratorTest( C.listDeclaredProperties( true ), new Object JavaDoc[] {s} );
1201
1202                    assertTrue( "declared property should be an ont prop", C.listDeclaredProperties( true ).next() instanceof OntProperty );
1203                    assertTrue( "declared property should be an ont prop", C.listDeclaredProperties( false ).next() instanceof OntProperty );
1204                }
1205            },
1206            new OntTestCase( "DataRange.oneOf", true, false, false, false ) {
1207                public void ontTest( OntModel m ) throws Exception JavaDoc {
1208                    Literal x = m.createTypedLiteral( 42 );
1209                    Literal y = m.createTypedLiteral( true );
1210                    Literal z = m.createTypedLiteral( "life" );
1211                    RDFList lits = m.createList( new RDFNode[] {x,y} );
1212
1213                    DataRange d0 = m.createDataRange( lits );
1214
1215                    assertTrue( "datarange should contain x", d0.hasOneOf( x ) );
1216                    assertTrue( "datarange should contain y", d0.hasOneOf( y ) );
1217                    assertFalse( "datarange should not contain z", d0.hasOneOf( z ) );
1218
1219                    d0.removeOneOf( z );
1220                    assertTrue( "datarange should contain x", d0.hasOneOf( x ) );
1221                    assertTrue( "datarange should contain y", d0.hasOneOf( y ) );
1222                    assertFalse( "datarange should not contain z", d0.hasOneOf( z ) );
1223
1224                    d0.removeOneOf( x );
1225                    assertFalse( "datarange should not contain x", d0.hasOneOf( x ) );
1226                    assertTrue( "datarange should contain y", d0.hasOneOf( y ) );
1227                    assertFalse( "datarange should not contain z", d0.hasOneOf( z ) );
1228
1229                    d0.addOneOf( z );
1230                    assertEquals( "datarange should be size 2", 2, d0.getOneOf().size() );
1231                    iteratorTest( d0.listOneOf(), new Object JavaDoc[] {y,z} );
1232
1233                    d0.setOneOf( m.createList( new RDFNode[] {x} ) );
1234                    iteratorTest( d0.listOneOf(), new Object JavaDoc[] {x} );
1235                }
1236            },
1237
1238        };
1239    }
1240
1241    // Internal implementation methods
1242
//////////////////////////////////
1243

1244    //==============================================================================
1245
// Inner class definitions
1246
//==============================================================================
1247

1248}
1249
1250
1251/*
1252    (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
1253    All rights reserved.
1254
1255    Redistribution and use in source and binary forms, with or without
1256    modification, are permitted provided that the following conditions
1257    are met:
1258
1259    1. Redistributions of source code must retain the above copyright
1260       notice, this list of conditions and the following disclaimer.
1261
1262    2. Redistributions in binary form must reproduce the above copyright
1263       notice, this list of conditions and the following disclaimer in the
1264       documentation and/or other materials provided with the distribution.
1265
1266    3. The name of the author may not be used to endorse or promote products
1267       derived from this software without specific prior written permission.
1268
1269    THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1270    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1271    OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1272    IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1273    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1274    NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1275    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1276    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1277    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1278    THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1279*/

1280
1281
Popular Tags