KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > reasoner > ValidityReport


1 /******************************************************************
2  * File: ValidityReport.java
3  * Created by: Dave Reynolds
4  * Created on: 09-Feb-03
5  *
6  * (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
7  * [See end of file]
8  * $Id: ValidityReport.java,v 1.11 2005/02/23 11:40:44 der Exp $
9  *****************************************************************/

10 package com.hp.hpl.jena.reasoner;
11
12 import java.util.Iterator JavaDoc;
13
14 /**
15  * Data structure used to report the results of validation
16  * or consistency checking operations. It is an array of reports,
17  * each of which has a severity, a type (string) and a description (string).
18  *
19  * @author <a HREF="mailto:der@hplb.hpl.hp.com">Dave Reynolds</a>
20  * @version $Revision: 1.11 $ on $Date: 2005/02/23 11:40:44 $
21  */

22 public interface ValidityReport {
23     
24     /**
25      * Returns true if no logical inconsistencies were detected. If it is false
26      * then ether will be at least one error Report included. If it is true
27      * then warnings may still
28      * be present. As of Jena 2.2 we regard classes which can't be instantiated
29      * as warnings (of type 'Inconsistent class') rather than errors.
30      */

31     public boolean isValid();
32     
33     /**
34      * Returns true if the model is both valid (logically consistent) and no
35      * warnings were generated.
36      */

37     public boolean isClean();
38     
39     /**
40      * Return an iterator over the separate ValidityReport.Report records.
41      */

42     public Iterator JavaDoc getReports();
43     
44     // Inner class defining the datastructure of a single error report
45
static class Report {
46         /**
47          * The type of the error discovered, the range of
48          * errors types is reasoner-dependent.
49          */

50         public String JavaDoc type;
51         
52         /**
53          * True if the report is a error, false if it is just a warning.
54          */

55         public boolean isError;
56         
57         /**
58          * A textual description of the error or warning.
59          */

60         public String JavaDoc description;
61         
62         /**
63          * Some reasoner dependent data structure giving more information
64          * on the problem.
65          */

66         public Object JavaDoc extension;
67         
68         /**
69          * Constructor.
70          * @param error true if the report is an error, false if it is just a warning
71          * @param type a string giving a reasoner-dependent classification for the report
72          * @param description a textual description of the problem
73          */

74         public Report(boolean error, String JavaDoc type, String JavaDoc description) {
75             this( error, type, description, null );
76         }
77         
78         /**
79          * Constructor
80          * @param error true if the report is an error, false if it is just a warning
81          * @param type a string giving a reasoner-dependent classification for the report
82          * @param description a textual description of the problem
83          * @param extension a reasoner dependent data structure giving more information
84          * on the problem.
85          */

86         public Report(boolean error, String JavaDoc type, String JavaDoc description, Object JavaDoc extension) {
87             this.isError = error;
88             this.type = type;
89             this.description = description;
90             this.extension = extension;
91         }
92         
93         /**
94          * @return a textual description of the problem
95          */

96         public String JavaDoc getDescription() {
97             return description;
98         }
99         /**
100          * @return a reasoner dependent data structure giving more information
101          * on the problem.
102          */

103         public Object JavaDoc getExtension() {
104             return extension;
105         }
106         /**
107          * @return True if the report is a error, false if it is just a warning.
108          */

109         public boolean isError() {
110             return isError;
111         }
112         /**
113          * @return a string giving a reasoner-dependent classification for the report
114          */

115         public String JavaDoc getType() {
116             return type;
117         }
118          /**
119          * Printable form of the report
120          */

121         public String JavaDoc toString() {
122             return (isError ? "Error (" : "Warning (") + type + "): " + description;
123         }
124     }
125 }
126
127 /*
128     (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
129     All rights reserved.
130
131     Redistribution and use in source and binary forms, with or without
132     modification, are permitted provided that the following conditions
133     are met:
134
135     1. Redistributions of source code must retain the above copyright
136        notice, this list of conditions and the following disclaimer.
137
138     2. Redistributions in binary form must reproduce the above copyright
139        notice, this list of conditions and the following disclaimer in the
140        documentation and/or other materials provided with the distribution.
141
142     3. The name of the author may not be used to endorse or promote products
143        derived from this software without specific prior written permission.
144
145     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
146     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
147     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
148     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
149     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
150     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
151     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
152     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
153     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
154     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
155 */
Popular Tags