Source Code Cross Referenced for TestFrameView.java in  » RSS-RDF » Jena-2.5.5 » com » hp » hpl » jena » ontology » impl » test » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » RSS RDF » Jena 2.5.5 » com.hp.hpl.jena.ontology.impl.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*****************************************************************************
002:         * Source code information
003:         * -----------------------
004:         * Original author    Ian Dickinson, HP Labs Bristol
005:         * Author email       Ian.Dickinson@hp.com
006:         * Package            Jena 2
007:         * Web                http://sourceforge.net/projects/jena/
008:         * Created            04-Apr-2005
009:         * Filename           $RCSfile: TestFrameView.java,v $
010:         * Revision           $Revision: 1.9 $
011:         * Release status     $State: Exp $
012:         *
013:         * Last modified on   $Date: 2008/01/02 12:08:41 $
014:         *               by   $Author: andy_seaborne $
015:         *
016:         * (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
017:         * (see footer for full conditions)
018:         *****************************************************************************/package com.hp.hpl.jena.ontology.impl.test;
019:
020:        // Imports
021:        ///////////////
022:        import junit.framework.TestCase;
023:
024:        import com.hp.hpl.jena.ontology.*;
025:        import com.hp.hpl.jena.rdf.model.*;
026:        import com.hp.hpl.jena.reasoner.test.TestUtil;
027:
028:        /**
029:         * <p>
030:         * Unit-tests for frame-like views of OWL and RDFS-classes, especially listDeclaredProperties
031:         * </p>
032:         *
033:         * @author Ian Dickinson, HP Labs (<a href="mailto:Ian.Dickinson@hp.com">email</a>)
034:         * @version Release @release@ ($Id: TestFrameView.java,v 1.9 2008/01/02 12:08:41 andy_seaborne Exp $)
035:         */
036:        public class TestFrameView extends TestCase {
037:            // Constants
038:            //////////////////////////////////
039:
040:            public static final String BASE = "http://jena.hpl.hp.com/testing/ontology";
041:            public static final String NS = BASE + "#";
042:
043:            // Static variables
044:            //////////////////////////////////
045:
046:            // Instance variables
047:            //////////////////////////////////
048:
049:            OntModel mInf;
050:            OntModel mNoInf;
051:
052:            OntClass infA;
053:            OntClass infB;
054:            OntClass infC;
055:
056:            OntClass noinfA;
057:            OntClass noinfB;
058:            OntClass noinfC;
059:
060:            ObjectProperty noinfG;
061:            ObjectProperty infG;
062:
063:            ObjectProperty noinfPa;
064:            ObjectProperty noinfPb;
065:            ObjectProperty noinfPc;
066:
067:            ObjectProperty infPa;
068:            ObjectProperty infPb;
069:            ObjectProperty infPc;
070:
071:            ObjectProperty noinfQa;
072:            ObjectProperty noinfQb;
073:
074:            ObjectProperty infQa;
075:            ObjectProperty infQb;
076:
077:            OntClass infAnn;
078:            OntClass noinfAnn;
079:            AnnotationProperty infPann;
080:            AnnotationProperty noinfPann;
081:
082:            OntClass infUnion1;
083:            OntClass infUnion2;
084:            OntClass noinfUnion1;
085:            OntClass noinfUnion2;
086:            ObjectProperty infPunion;
087:            ObjectProperty noinfPunion;
088:
089:            OntClass infIntersect1;
090:            OntClass infIntersect2;
091:            OntClass noinfIntersect1;
092:            OntClass noinfIntersect2;
093:            ObjectProperty infPintersect;
094:            ObjectProperty noinfPintersect;
095:
096:            // Constructors
097:            //////////////////////////////////
098:
099:            // External signature methods
100:            //////////////////////////////////
101:
102:            public void setUp() {
103:                OntDocumentManager.getInstance().reset();
104:                OntDocumentManager.getInstance().clearCache();
105:                mNoInf = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
106:                mNoInf
107:                        .read("file:testing/ontology/owl/list-syntax/test-ldp.rdf");
108:                //mInf = ModelFactory.createOntologyModel( OntModelSpec.OWL_MEM_RULE_INF );
109:                mInf = ModelFactory
110:                        .createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF);
111:                mInf.read("file:testing/ontology/owl/list-syntax/test-ldp.rdf");
112:
113:                infA = mInf.getOntClass(NS + "A");
114:                infB = mInf.getOntClass(NS + "B");
115:                infC = mInf.getOntClass(NS + "C");
116:
117:                noinfA = mNoInf.getOntClass(NS + "A");
118:                noinfB = mNoInf.getOntClass(NS + "B");
119:                noinfC = mNoInf.getOntClass(NS + "C");
120:
121:                noinfG = mNoInf.getObjectProperty(NS + "global");
122:                infG = mInf.getObjectProperty(NS + "global");
123:
124:                noinfPa = mNoInf.getObjectProperty(NS + "pA");
125:                noinfPb = mNoInf.getObjectProperty(NS + "pB");
126:                noinfPc = mNoInf.getObjectProperty(NS + "pC");
127:
128:                infPa = mInf.getObjectProperty(NS + "pA");
129:                infPb = mInf.getObjectProperty(NS + "pB");
130:                infPc = mInf.getObjectProperty(NS + "pC");
131:
132:                noinfQa = mNoInf.getObjectProperty(NS + "qA");
133:                noinfQb = mNoInf.getObjectProperty(NS + "qB");
134:
135:                infQa = mInf.getObjectProperty(NS + "qA");
136:                infQb = mInf.getObjectProperty(NS + "qB");
137:
138:                infAnn = mInf.getOntClass(NS + "HasAnn");
139:                noinfAnn = mNoInf.getOntClass(NS + "HasAnn");
140:                infPann = mInf.getAnnotationProperty(NS + "ann");
141:                noinfPann = mNoInf.getAnnotationProperty(NS + "ann");
142:
143:                infUnion1 = mInf.getOntClass(NS + "Union1");
144:                infUnion2 = mInf.getOntClass(NS + "Union2");
145:                noinfUnion1 = mNoInf.getOntClass(NS + "Union1");
146:                noinfUnion2 = mNoInf.getOntClass(NS + "Union2");
147:                infPunion = mInf.getObjectProperty(NS + "unionP");
148:                noinfPunion = mNoInf.getObjectProperty(NS + "unionP");
149:
150:                infIntersect1 = mInf.getOntClass(NS + "Intersect1");
151:                infIntersect2 = mInf.getOntClass(NS + "Intersect2");
152:                noinfIntersect1 = mNoInf.getOntClass(NS + "Intersect1");
153:                noinfIntersect2 = mNoInf.getOntClass(NS + "Intersect2");
154:                infPintersect = mInf.getObjectProperty(NS + "intersectP");
155:                noinfPintersect = mNoInf.getObjectProperty(NS + "intersectP");
156:            }
157:
158:            public void tearDown() {
159:                /* assistance with monitoring space leak
160:                System.gc();
161:                System.gc();
162:                Runtime r = Runtime.getRuntime();
163:                System.out.println( getName() + 
164:                                    " memory = " + r.freeMemory() + 
165:                                    ", alloc = " + r.totalMemory() + 
166:                                    ", % = " + Math.round( 100.0 * (double) r.freeMemory() / (double) r.totalMemory() ));
167:                 */
168:                mInf.close();
169:                mInf = null;
170:                mNoInf.close();
171:                mNoInf = null;
172:            }
173:
174:            // OntClass.listDeclaredProperties() tests ...
175:
176:            public void testLDP_noinfA_nodirect() {
177:                TestUtil.assertIteratorValues(this , noinfA
178:                        .listDeclaredProperties(false), new Object[] { noinfPa,
179:                        noinfQa, noinfG, noinfQb });
180:            }
181:
182:            public void testHasDP_noinfA_nodirect() {
183:                // we only need a small number of tests on hasDP because it's the
184:                // main componenet of listDP
185:                assertTrue(noinfA.hasDeclaredProperty(noinfPa, false));
186:                assertFalse(noinfA.hasDeclaredProperty(noinfPb, false));
187:            }
188:
189:            public void testLDP_noinfA_direct() {
190:                TestUtil.assertIteratorValues(this , noinfA
191:                        .listDeclaredProperties(true), new Object[] { noinfPa,
192:                        noinfQa, noinfG, noinfQb });
193:            }
194:
195:            public void testLDP_infA_nodirect() {
196:                TestUtil.assertIteratorValues(this , infA
197:                        .listDeclaredProperties(false), new Object[] { infPa,
198:                        infQa, infQb, noinfG });
199:            }
200:
201:            public void testLDP_infA_direct() {
202:                TestUtil.assertIteratorValues(this , infA
203:                        .listDeclaredProperties(true), new Object[] { infPa,
204:                        infQa, infQb, noinfG });
205:            }
206:
207:            public void testLDP_noinfB_nodirect() {
208:                TestUtil.assertIteratorValues(this , noinfB
209:                        .listDeclaredProperties(false), new Object[] { noinfPa,
210:                        noinfPb, noinfQa, noinfG, noinfQb });
211:            }
212:
213:            public void testLDP_noinfB_direct() {
214:                TestUtil
215:                        .assertIteratorValues(this , noinfB
216:                                .listDeclaredProperties(true),
217:                                new Object[] { noinfPb });
218:            }
219:
220:            public void testLDP_infB_nodirect() {
221:                TestUtil.assertIteratorValues(this , infB
222:                        .listDeclaredProperties(false), new Object[] { infPa,
223:                        infPb, infQa, infQb, infG });
224:            }
225:
226:            public void testLDP_infB_direct() {
227:                TestUtil.assertIteratorValues(this , infB
228:                        .listDeclaredProperties(true), new Object[] { infPb });
229:            }
230:
231:            public void testLDP_noinfC_nodirect() {
232:                // note that qB appears in the results because without inference it looks like a global
233:                TestUtil.assertIteratorValues(this , noinfC
234:                        .listDeclaredProperties(false), new Object[] { noinfPa,
235:                        noinfPb, noinfPc, noinfQa, noinfG, noinfQb });
236:            }
237:
238:            public void testLDP_noinfC_direct() {
239:                TestUtil
240:                        .assertIteratorValues(this , noinfC
241:                                .listDeclaredProperties(true),
242:                                new Object[] { noinfPc });
243:            }
244:
245:            public void testLDP_infC_nodirect() {
246:                TestUtil.assertIteratorValues(this , infC
247:                        .listDeclaredProperties(false), new Object[] { infPa,
248:                        infPb, infPc, infQa, infQb, infG });
249:            }
250:
251:            public void testLDP_infC_direct() {
252:                TestUtil.assertIteratorValues(this , infC
253:                        .listDeclaredProperties(true), new Object[] { infPc });
254:            }
255:
256:            public void testLDP_noinfAnn_nodirect() {
257:                // note that qB appears in the results because without inference it looks like a global
258:                TestUtil.assertIteratorValues(this , noinfAnn
259:                        .listDeclaredProperties(false), new Object[] {
260:                        noinfPann, noinfG, noinfQb });
261:            }
262:
263:            public void testLDP_noinfAnn_direct() {
264:                TestUtil.assertIteratorValues(this , noinfAnn
265:                        .listDeclaredProperties(true), new Object[] {
266:                        noinfPann, noinfG, noinfQb });
267:            }
268:
269:            public void testLDP_infAnn_nodirect() {
270:                TestUtil.assertIteratorValues(this , infAnn
271:                        .listDeclaredProperties(false), new Object[] {
272:                        noinfPann, noinfG });
273:            }
274:
275:            public void testLDP_infAnn_direct() {
276:                TestUtil.assertIteratorValues(this , infAnn
277:                        .listDeclaredProperties(true), new Object[] {
278:                        noinfPann, noinfG });
279:            }
280:
281:            public void testLDP_noinfUnion_nodirect() {
282:                TestUtil.assertIteratorValues(this , noinfUnion1
283:                        .listDeclaredProperties(false), new Object[] { noinfG,
284:                        noinfQb });
285:                TestUtil.assertIteratorValues(this , noinfUnion2
286:                        .listDeclaredProperties(false), new Object[] { noinfG,
287:                        noinfQb });
288:            }
289:
290:            public void testLDP_infUnion_nodirect() {
291:                TestUtil.assertIteratorValues(this , infUnion1
292:                        .listDeclaredProperties(false), new Object[] {
293:                        infPunion, infG });
294:                TestUtil.assertIteratorValues(this , infUnion2
295:                        .listDeclaredProperties(false), new Object[] {
296:                        infPunion, infG });
297:            }
298:
299:            public void testLDP_noinfIntersect_nodirect() {
300:                TestUtil.assertIteratorValues(this , noinfIntersect1
301:                        .listDeclaredProperties(false), new Object[] { noinfG,
302:                        noinfQb });
303:                TestUtil.assertIteratorValues(this , noinfIntersect2
304:                        .listDeclaredProperties(false), new Object[] { noinfG,
305:                        noinfQb });
306:            }
307:
308:            public void testLDP_infIntersect_nodirect() {
309:                TestUtil.assertIteratorValues(this , infIntersect1
310:                        .listDeclaredProperties(false), new Object[] { infG });
311:                TestUtil.assertIteratorValues(this , infIntersect2
312:                        .listDeclaredProperties(false), new Object[] { infG });
313:            }
314:
315:            // OntProperty.listDeclaringProperties() tests ...
316:
317:            public void testLDC_noinfPa_nodirect() {
318:                TestUtil.assertIteratorValues(this , noinfPa
319:                        .listDeclaringClasses(false), new Object[] { noinfA,
320:                        noinfB, noinfC });
321:            }
322:
323:            public void testLDC_infPa_nodirect() {
324:                TestUtil.assertIteratorValues(this , infPa
325:                        .listDeclaringClasses(false), new Object[] { infA,
326:                        infB, infC });
327:            }
328:
329:            public void testLDC_noinfPb_nodirect() {
330:                TestUtil.assertIteratorValues(this , noinfPb
331:                        .listDeclaringClasses(false), new Object[] { noinfB,
332:                        noinfC });
333:            }
334:
335:            public void testLDC_infPb_nodirect() {
336:                TestUtil.assertIteratorValues(this , infPb
337:                        .listDeclaringClasses(false),
338:                        new Object[] { infC, infB });
339:            }
340:
341:            public void testLDC_noinfPc_nodirect() {
342:                TestUtil.assertIteratorValues(this , noinfPc
343:                        .listDeclaringClasses(false), new Object[] { noinfC });
344:            }
345:
346:            public void testLDC_infPc_nodirect() {
347:                TestUtil.assertIteratorValues(this , infPc
348:                        .listDeclaringClasses(false), new Object[] { infC });
349:            }
350:
351:            public void testLDC_noinfPa_direct() {
352:                TestUtil.assertIteratorValues(this , noinfPa
353:                        .listDeclaringClasses(true), new Object[] { noinfA });
354:            }
355:
356:            public void testLDC_infPa_direct() {
357:                TestUtil.assertIteratorValues(this , infPa
358:                        .listDeclaringClasses(true), new Object[] { infA });
359:            }
360:
361:            public void testLDC_noinfPb_direct() {
362:                TestUtil.assertIteratorValues(this , noinfPb
363:                        .listDeclaringClasses(true), new Object[] { noinfB });
364:            }
365:
366:            public void testLDC_infPb_direct() {
367:                TestUtil.assertIteratorValues(this , infPb
368:                        .listDeclaringClasses(true), new Object[] { infB });
369:            }
370:
371:            public void testLDC_noinfPc_direct() {
372:                TestUtil.assertIteratorValues(this , noinfPc
373:                        .listDeclaringClasses(true), new Object[] { noinfC });
374:            }
375:
376:            public void testLDC_infPc_direct() {
377:                TestUtil.assertIteratorValues(this , infPc
378:                        .listDeclaringClasses(true), new Object[] { infC });
379:            }
380:
381:            public void testLDC_noinfG_direct() {
382:                TestUtil.assertIteratorValues(this , noinfG
383:                        .listDeclaringClasses(true), new Object[] { noinfA,
384:                        noinfAnn, noinfUnion1, noinfUnion2,
385:                        mNoInf.getOntClass(NS + "Joint"), noinfIntersect1,
386:                        noinfIntersect2 }, 2);
387:            }
388:
389:            public void testLDC_infG_direct() {
390:                TestUtil.assertIteratorValues(this , infG
391:                        .listDeclaringClasses(true), new Object[] { infA,
392:                        infAnn, mNoInf.getOntClass(NS + "Joint"),
393:                        noinfIntersect1, noinfIntersect2 }, 1);
394:            }
395:
396:            public void testLDC_noinfG_nodirect() {
397:                TestUtil.assertIteratorValues(this , noinfG
398:                        .listDeclaringClasses(false), new Object[] { noinfA,
399:                        noinfB, noinfC, noinfUnion1, noinfUnion2, noinfAnn,
400:                        mNoInf.getOntClass(NS + "Joint"), noinfIntersect1,
401:                        noinfIntersect2 }, 2);
402:            }
403:
404:            public void testLDC_infG_nodirect() {
405:                TestUtil.assertIteratorValues(this , infG
406:                        .listDeclaringClasses(false), new Object[] { infA,
407:                        infB, infC, infAnn, noinfUnion1, noinfUnion2,
408:                        mNoInf.getOntClass(NS + "Joint"), noinfIntersect1,
409:                        noinfIntersect2 }, 2);
410:            }
411:
412:            // Internal implementation methods
413:            //////////////////////////////////
414:
415:            //==============================================================================
416:            // Inner class definitions
417:            //==============================================================================
418:
419:        }
420:
421:        /*
422:         (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
423:         All rights reserved.
424:
425:         Redistribution and use in source and binary forms, with or without
426:         modification, are permitted provided that the following conditions
427:         are met:
428:
429:         1. Redistributions of source code must retain the above copyright
430:         notice, this list of conditions and the following disclaimer.
431:
432:         2. Redistributions in binary form must reproduce the above copyright
433:         notice, this list of conditions and the following disclaimer in the
434:         documentation and/or other materials provided with the distribution.
435:
436:         3. The name of the author may not be used to endorse or promote products
437:         derived from this software without specific prior written permission.
438:
439:         THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
440:         IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
441:         OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
442:         IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
443:         INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
444:         NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
445:         DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
446:         THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
447:         (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
448:         THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
449:         */
w__ww___.j__a___va_2s___._c___o_m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.