KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > ontology > OntResource


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 10 Feb 2003
9  * Filename $RCSfile: OntResource.java,v $
10  * Revision $Revision: 1.33 $
11  * Release status $State: Exp $
12  *
13  * Last modified on $Date: 2005/04/11 16:39:55 $
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;
23
24
25 // Imports
26
///////////////
27
import com.hp.hpl.jena.rdf.model.*;
28 import com.hp.hpl.jena.util.iterator.ExtendedIterator;
29
30
31
32 /**
33  * <p>
34  * Provides a common super-type for all of the abstractions in this ontology
35  * representation package.
36  * </p>
37  *
38  * @author Ian Dickinson, HP Labs
39  * (<a HREF="mailto:Ian.Dickinson@hp.com" >email</a>)
40  * @version CVS $Id: OntResource.java,v 1.33 2005/04/11 16:39:55 ian_dickinson Exp $
41  */

42 public interface OntResource
43     extends Resource
44 {
45     // Constants
46
//////////////////////////////////
47

48
49
50     // External signature methods
51
//////////////////////////////////
52

53     /**
54      * <p>
55      * Answer the ontology language profile that governs the ontology model to which
56      * this ontology resource is attached.
57      * </p>
58      *
59      * @return The language profile for this ontology resource
60      */

61     public Profile getProfile();
62
63     /**
64      * <p>Answer true if this resource is a symbol in one of the standard ontology
65      * languages supported by Jena: RDF, RDFS, OWL or DAML+OIL. Since these languages
66      * have restricted namespaces, this check is simply a convenient way of testing whether
67      * this resource is in one of those pre-declared namespaces.</p>
68      * @return True if this is a term in the language namespace for OWL, RDF, RDFS or DAML+OIL.
69      */

70     public boolean isOntLanguageTerm();
71
72
73     // sameAs
74

75     /**
76      * <p>Assert equivalence between the given resource and this resource. Any existing
77      * statements for <code>sameAs</code> will be removed.</p>
78      * @param res The resource that is declared to be the same as this resource
79      * @exception OntProfileException If the {@link Profile#SAME_AS()} property is not supported in the current language profile.
80      */

81     public void setSameAs( Resource res );
82
83     /**
84      * <p>Add a resource that is declared to be equivalent to this resource.</p>
85      * @param res A resource that declared to be the same as this resource
86      * @exception OntProfileException If the {@link Profile#SAME_AS()} property is not supported in the current language profile.
87      */

88     public void addSameAs( Resource res );
89
90     /**
91      * <p>Answer a resource that is declared to be the same as this resource. If there is
92      * more than one such resource, an arbitrary selection is made.</p>
93      * @return An ont resource that declared to be the same as this resource
94      * @exception OntProfileException If the {@link Profile#SAME_AS()} property is not supported in the current language profile.
95      */

96     public OntResource getSameAs();
97
98     /**
99      * <p>Answer an iterator over all of the resources that are declared to be the same as
100      * this resource. Each elemeent of the iterator will be an {@link OntResource}.</p>
101      * @return An iterator over the resources equivalent to this resource.
102      * @exception OntProfileException If the {@link Profile#SAME_AS()} property is not supported in the current language profile.
103      */

104     public ExtendedIterator listSameAs();
105
106     /**
107      * <p>Answer true if this resource is the same as the given resource.</p>
108      * @param res A resource to test against
109      * @return True if the resources are declared the same via a <code>sameAs</code> statement.
110      * @exception OntProfileException If the {@link Profile#SAME_AS()} property is not supported in the current language profile.
111      */

112     public boolean isSameAs( Resource res );
113
114     /**
115      * <p>Remove the statement that this resource is the same as the given resource. If this statement
116      * is not true of the current model, nothing happens.</p>
117      * @param res A resource that may be declared to be the sameAs this resource
118      */

119     public void removeSameAs( Resource res );
120
121     // differentFrom
122

123     /**
124      * <p>Assert that the given resource and this resource are distinct. Any existing
125      * statements for <code>differentFrom</code> will be removed.</p>
126      * @param res The resource that is declared to be distinct from this resource
127      * @exception OntProfileException If the {@link Profile#DIFFERENT_FROM()} property is not supported in the current language profile.
128      */

129     public void setDifferentFrom( Resource res );
130
131     /**
132      * <p>Add a resource that is declared to be equivalent to this resource.</p>
133      * @param res A resource that declared to be the same as this resource
134      * @exception OntProfileException If the {@link Profile#DIFFERENT_FROM()} property is not supported in the current language profile.
135      */

136     public void addDifferentFrom( Resource res );
137
138     /**
139      * <p>Answer a resource that is declared to be distinct from this resource. If there is
140      * more than one such resource, an arbitrary selection is made.</p>
141      * @return res An ont resource that declared to be different from this resource
142      * @exception OntProfileException If the {@link Profile#DIFFERENT_FROM()} property is not supported in the current language profile.
143      */

144     public OntResource getDifferentFrom();
145
146     /**
147      * <p>Answer an iterator over all of the resources that are declared to be different from
148      * this resource. Each elemeent of the iterator will be an {@link OntResource}.</p>
149      * @return An iterator over the resources different from this resource.
150      * @exception OntProfileException If the {@link Profile#DIFFERENT_FROM()} property is not supported in the current language profile.
151      */

152     public ExtendedIterator listDifferentFrom();
153
154     /**
155      * <p>Answer true if this resource is different from the given resource.</p>
156      * @param res A resource to test against
157      * @return True if the resources are declared to be distinct via a <code>differentFrom</code> statement.
158      */

159     public boolean isDifferentFrom( Resource res );
160
161     /**
162      * <p>Remove the statement that this resource is different the given resource. If this statement
163      * is not true of the current model, nothing happens.</p>
164      * @param res A resource that may be declared to be differentFrom this resource
165      */

166     public void removeDifferentFrom( Resource res );
167
168     // seeAlso
169

170     /**
171      * <p>Assert that the given resource provides additional information about the definition of this resource</p>
172      * @param res A resource that can provide additional information about this resource
173      * @exception OntProfileException If the {@link Profile#SEE_ALSO()} property is not supported in the current language profile.
174      */

175     public void setSeeAlso( Resource res );
176
177     /**
178      * <p>Add a resource that is declared to provided additional information about the definition of this resource</p>
179      * @param res A resource that provides extra information on this resource
180      * @exception OntProfileException If the {@link Profile#SEE_ALSO()} property is not supported in the current language profile.
181      */

182     public void addSeeAlso( Resource res );
183
184     /**
185      * <p>Answer a resource that provides additional information about this resource. If more than one such resource
186      * is defined, make an arbitrary choice.</p>
187      * @return res A resource that provides additional information about this resource
188      * @exception OntProfileException If the {@link Profile#SEE_ALSO()} property is not supported in the current language profile.
189      */

190     public Resource getSeeAlso();
191
192     /**
193      * <p>Answer an iterator over all of the resources that are declared to provide addition
194      * information about this resource.</p>
195      * @return An iterator over the resources providing additional definition on this resource.
196      * @exception OntProfileException If the {@link Profile#SEE_ALSO()} property is not supported in the current language profile.
197      */

198     public ExtendedIterator listSeeAlso();
199
200     /**
201      * <p>Answer true if this resource has the given resource as a source of additional information.</p>
202      * @param res A resource to test against
203      * @return True if the <code>res</code> provides more information on this resource.
204      */

205     public boolean hasSeeAlso( Resource res );
206
207     /**
208      * <p>Remove the statement indicating the given resource as a source of additional information
209      * about this resource. If this statement
210      * is not true of the current model, nothing happens.</p>
211      * @param res A resource that may be declared to provide additional information about this resource
212      */

213     public void removeSeeAlso( Resource res );
214
215     // is defined by
216

217     /**
218      * <p>Assert that the given resource provides a source of definitions about this resource. Any existing
219      * statements for <code>isDefinedBy</code> will be removed.</p>
220      * @param res The resource that is declared to be a definition of this resource.
221      * @exception OntProfileException If the {@link Profile#IS_DEFINED_BY()} property is not supported in the current language profile.
222      */

223     public void setIsDefinedBy( Resource res );
224
225     /**
226      * <p>Add a resource that is declared to provide a definition of this resource.</p>
227      * @param res A defining resource
228      * @exception OntProfileException If the {@link Profile#IS_DEFINED_BY()} property is not supported in the current language profile.
229      */

230     public void addIsDefinedBy( Resource res );
231
232     /**
233      * <p>Answer a resource that is declared to provide a definition of this resource. If there is
234      * more than one such resource, an arbitrary selection is made.</p>
235      * @return res An ont resource that is declared to provide a definition of this resource
236      * @exception OntProfileException If the {@link Profile#IS_DEFINED_BY()} property is not supported in the current language profile.
237      */

238     public Resource getIsDefinedBy();
239
240     /**
241      * <p>Answer an iterator over all of the resources that are declared to define
242      * this resource. </p>
243      * @return An iterator over the resources defining this resource.
244      * @exception OntProfileException If the {@link Profile#IS_DEFINED_BY()} property is not supported in the current language profile.
245      */

246     public ExtendedIterator listIsDefinedBy();
247
248     /**
249      * <p>Answer true if this resource is defined by the given resource.</p>
250      * @param res A resource to test against
251      * @return True if <code>res</code> defines this resource.
252      */

253     public boolean isDefinedBy( Resource res );
254
255     /**
256      * <p>Remove the statement that this resource is defined by the given resource. If this statement
257      * is not true of the current model, nothing happens.</p>
258      * @param res A resource that may be declared to define this resource
259      */

260     public void removeDefinedBy( Resource res );
261
262     // version info
263

264     /**
265      * <p>Assert that the given string is the value of the version info for this resource. Any existing
266      * statements for <code>versionInfo</code> will be removed.</p>
267      * @param info The version information for this resource
268      * @exception OntProfileException If the {@link Profile#VERSION_INFO()} property is not supported in the current language profile.
269      */

270     public void setVersionInfo( String JavaDoc info );
271
272     /**
273      * <p>Add the given version information to this resource.</p>
274      * @param info A version information string for this resource
275      * @exception OntProfileException If the {@link Profile#VERSION_INFO()} property is not supported in the current language profile.
276      */

277     public void addVersionInfo( String JavaDoc info );
278
279     /**
280      * <p>Answer the version information string for this object. If there is
281      * more than one such resource, an arbitrary selection is made.</p>
282      * @return A version info string
283      * @exception OntProfileException If the {@link Profile#VERSION_INFO()} property is not supported in the current language profile.
284      */

285     public String JavaDoc getVersionInfo();
286
287     /**
288      * <p>Answer an iterator over all of the version info strings for this resource.</p>
289      * @return An iterator over the version info strings for this resource.
290      * @exception OntProfileException If the {@link Profile#VERSION_INFO()} property is not supported in the current language profile.
291      */

292     public ExtendedIterator listVersionInfo();
293
294     /**
295      * <p>Answer true if this resource has the given version information</p>
296      * @param info Version information to test for
297      * @return True if this resource has <code>info</code> as version information.
298      */

299     public boolean hasVersionInfo( String JavaDoc info );
300
301     /**
302      * <p>Remove the statement that the given string provides version information about
303      * this resource. If this statement
304      * is not true of the current model, nothing happens.</p>
305      * @param info A version information string to be removed
306      */

307     public void removeVersionInfo( String JavaDoc info );
308
309     // label
310

311     /**
312      * <p>Assert that the given string is the value of the label for this resource. Any existing
313      * statements for <code>label</code> will be removed.</p>
314      * @param label The label for this resource
315      * @param lang The language attribute for this label (EN, FR, etc) or null if not specified.
316      * @exception OntProfileException If the {@link Profile#LABEL()} property is not supported in the current language profile.
317      */

318     public void setLabel( String JavaDoc label, String JavaDoc lang );
319
320     /**
321      * <p>Add the given label to this resource.</p>
322      * @param label A label string for this resource
323      * @param lang The language attribute for this label (EN, FR, etc) or null if not specified.
324      * @exception OntProfileException If the {@link Profile#LABEL()} property is not supported in the current language profile.
325      */

326     public void addLabel( String JavaDoc label, String JavaDoc lang );
327
328     /**
329      * <p>Add the given label to this resource.</p>
330      * @param label The literal label
331      * @exception OntProfileException If the {@link Profile#LABEL()} property is not supported in the current language profile.
332      */

333     public void addLabel( Literal label );
334
335     /**
336      * <p>Answer the label string for this object. If there is
337      * more than one such resource, an arbitrary selection is made.</p>
338      * @param lang The language attribute for the desired label (EN, FR, etc) or null for don't care. Will
339      * attempt to retreive the most specific label matching the given language</p>
340      * @return A label string matching the given language, or null if there is no matching label.
341      * @exception OntProfileException If the {@link Profile#LABEL()} property is not supported in the current language profile.
342      */

343     public String JavaDoc getLabel( String JavaDoc lang );
344
345     /**
346      * <p>Answer an iterator over all of the label literals for this resource.</p>
347      * @param lang The language tag to restric the listed comments to, or null to select all comments
348      * @return An iterator over RDF {@link Literal}'s.
349      * @exception OntProfileException If the {@link Profile#LABEL()} property is not supported in the current language profile.
350      */

351     public ExtendedIterator listLabels( String JavaDoc lang );
352
353     /**
354      * <p>Answer true if this resource has the given label</p>
355      * @param label The label to test for
356      * @param lang The optional language tag, or null for don't care.
357      * @return True if this resource has <code>label</code> as a label.
358      */

359     public boolean hasLabel( String JavaDoc label, String JavaDoc lang );
360
361     /**
362      * <p>Answer true if this resource has the given label</p>
363      * @param label The label to test for
364      * @return True if this resource has <code>label</code> as a label.
365      */

366     public boolean hasLabel( Literal label );
367
368     /**
369      * <p>Remove the statement that the given string is a label for
370      * this resource. If this statement
371      * is not true of the current model, nothing happens.</p>
372      * @param label A label string to be removed
373      * @param lang A lang tag, or null if not specified
374      */

375     public void removeLabel( String JavaDoc label, String JavaDoc lang );
376
377     /**
378      * <p>Remove the statement that the given string is a label for
379      * this resource. If this statement
380      * is not true of the current model, nothing happens.</p>
381      * @param label A label literal to be removed
382      */

383     public void removeLabel( Literal label );
384
385     // comment
386

387     /**
388      * <p>Assert that the given string is the comment on this resource. Any existing
389      * statements for <code>comment</code> will be removed.</p>
390      * @param comment The comment for this resource
391      * @param lang The language attribute for this comment (EN, FR, etc) or null if not specified.
392      * @exception OntProfileException If the {@link Profile#COMMENT()} property is not supported in the current language profile.
393      */

394     public void setComment( String JavaDoc comment, String JavaDoc lang );
395
396     /**
397      * <p>Add the given comment to this resource.</p>
398      * @param comment A comment string for this resource
399      * @param lang The language attribute for this comment (EN, FR, etc) or null if not specified.
400      * @exception OntProfileException If the {@link Profile#COMMENT()} property is not supported in the current language profile.
401      */

402     public void addComment( String JavaDoc comment, String JavaDoc lang );
403
404     /**
405      * <p>Add the given comment to this resource.</p>
406      * @param comment The literal comment
407      * @exception OntProfileException If the {@link Profile#COMMENT()} property is not supported in the current language profile.
408      */

409     public void addComment( Literal comment );
410
411     /**
412      * <p>Answer the comment string for this object. If there is
413      * more than one such resource, an arbitrary selection is made.</p>
414      * @param lang The language attribute for the desired comment (EN, FR, etc) or null for don't care. Will
415      * attempt to retreive the most specific comment matching the given language</p>
416      * @return A comment string matching the given language, or null if there is no matching comment.
417      * @exception OntProfileException If the {@link Profile#COMMENT()} property is not supported in the current language profile.
418      */

419     public String JavaDoc getComment( String JavaDoc lang );
420
421     /**
422      * <p>Answer an iterator over all of the comment literals for this resource.</p>
423      * @param lang The language tag to restric the listed comments to, or null to select all comments
424      * @return An iterator over RDF {@link Literal}'s.
425      * @exception OntProfileException If the {@link Profile#COMMENT()} property is not supported in the current language profile.
426      */

427     public ExtendedIterator listComments( String JavaDoc lang );
428
429     /**
430      * <p>Answer true if this resource has the given comment.</p>
431      * @param comment The comment to test for
432      * @param lang The optional language tag, or null for don't care.
433      * @return True if this resource has <code>comment</code> as a comment.
434      */

435     public boolean hasComment( String JavaDoc comment, String JavaDoc lang );
436
437     /**
438      * <p>Answer true if this resource has the given comment.</p>
439      * @param comment The comment to test for
440      * @return True if this resource has <code>comment</code> as a comment.
441      */

442     public boolean hasComment( Literal comment );
443
444     /**
445      * <p>Remove the statement that the given string is a comment on
446      * this resource. If this statement
447      * is not true of the current model, nothing happens.</p>
448      * @param comment A comment string to be removed
449      * @param lang A lang tag, or null if not specified
450      */

451     public void removeComment( String JavaDoc comment, String JavaDoc lang );
452
453     /**
454      * <p>Remove the statement that the given string is a comment on
455      * this resource. If this statement
456      * is not true of the current model, nothing happens.</p>
457      * @param comment A comment literal to be removed
458      */

459     public void removeComment( Literal comment );
460
461
462     // rdf:type
463

464     /**
465      * <p>Set the RDF type (ie the class) for this resource, replacing any
466      * existing <code>rdf:type</code> property. Any existing statements for the RDF type
467      * will first be removed.</p>
468      *
469      * @param cls The RDF resource denoting the new value for the <code>rdf:type</code> property,
470      * which will replace any existing type property.
471      */

472     public void setRDFType( Resource cls );
473
474     /**
475      * <p>Add the given class as one of the <code>rdf:type</code>'s for this resource.</p>
476      *
477      * @param cls An RDF resource denoting a new value for the <code>rdf:type</code> property.
478      */

479     public void addRDFType( Resource cls );
480
481     /**
482      * <p>
483      * Answer the <code>rdf:type</code> (ie the class) of this resource. If there
484      * is more than one type for this resource, the return value will be one of
485      * the values, but it is not specified which one (nor that it will consistently
486      * be the same one each time). Equivalent to <code>getRDFType( false )</code>.
487      * </p>
488      *
489      * @return A resource that is the rdf:type for this resource, or one of them if
490      * more than one is defined.
491      */

492     public Resource getRDFType();
493
494     /**
495      * <p>
496      * Answer the <code>rdf:type</code> (ie the class) of this resource. If there
497      * is more than one type for this resource, the return value will be one of
498      * the values, but it is not specified which one (nor that it will consistently
499      * be the same one each time).
500      * </p>
501      *
502      * @param direct If true, only consider the direct types of this resource, and not
503      * the super-classes of the type(s).
504      * @return A resource that is the rdf:type for this resource, or one of them if
505      * more than one is defined.
506      */

507     public Resource getRDFType( boolean direct );
508
509     /**
510      * <p>
511      * Answer an iterator over the RDF classes to which this resource belongs.
512      * </p>
513      *
514      * @param direct If true, only answer those resources that are direct types
515      * of this resource, not the super-classes of the class etc.
516      * @return An iterator over the set of this resource's classes. Each member
517      * of the iteration will be an {@link Resource}. Use
518      * <code>.as(&nbsp;OntClass.class&nbsp;)</code> to map this resource to
519      * an OntClass.
520      */

521     public ExtendedIterator listRDFTypes( boolean direct );
522
523     /**
524      * <p>
525      * Answer true if this resource is a member of the class denoted by the
526      * given class resource.
527      * </p>
528      *
529      * @param ontClass Denotes a class to which this value may belong
530      * @param direct If true, only consider the direct types of this resource, ignoring
531      * the super-classes of the stated types.
532      * @return True if this resource has the given class as one of its <code>rdf:type</code>'s.
533      */

534     public boolean hasRDFType( Resource ontClass, boolean direct );
535
536     /**
537      * <p>
538      * Answer true if this resource is a member of the class denoted by the
539      * given class resource. Includes all available types, so is equivalent to
540      * <code><pre>
541      * hasRDF( ontClass, false );
542      * </pre></code>
543      * </p>
544      *
545      * @param ontClass Denotes a class to which this value may belong
546      * @return True if this resource has the given class as one of its <code>rdf:type</code>'s.
547      */

548     public boolean hasRDFType( Resource ontClass );
549
550     /**
551      * <p>Remove the statement that this resource is of the given RDF type. If this statement
552      * is not true of the current model, nothing happens.</p>
553      * @param cls A resource denoting a class that that is to be removed from the classes of this resource
554      */

555     public void removeRDFType( Resource cls );
556
557     /**
558      * <p>
559      * Answer true if this resource is a member of the class denoted by the
560      * given URI.</p>
561      *
562      * @param uri Denotes the URI of a class to which this value may belong
563      * @return True if this resource has the given class as one of its <code>rdf:type</code>'s.
564      */

565     public boolean hasRDFType( String JavaDoc uri );
566
567
568
569     // other utility methods
570

571     /**
572      * <p>Answer the cardinality of the given property on this resource. The cardinality
573      * is the number of distinct values there are for the property.</p>
574      * @param p A property
575      * @return The cardinality for the property <code>p</code> on this resource, as an
576      * integer greater than or equal to zero.
577      */

578     public int getCardinality( Property p );
579
580     /**
581      * <p>
582      * Set the value of the given property of this ontology resource to the given
583      * value, encoded as an RDFNode. Maintains the invariant that there is
584      * at most one value of the property for a given resource, so existing
585      * property values are first removed. To add multiple properties, use
586      * {@link #addProperty( Property, RDFNode ) addProperty}.
587      * </p>
588      *
589      * @param property The property to update
590      * @param value The new value of the property as an RDFNode, or null to
591      * effectively remove this property.
592      */

593     public void setPropertyValue( Property property, RDFNode value );
594
595
596     /**
597      * <p>Answer the value of a given RDF property for this resource, or null
598      * if it doesn't have one. If there is more than one RDF
599      * statement with the given property for the current value, it is not defined
600      * which of the values will be returned.</p>
601      *
602      * @param property An RDF property
603      * @return An RDFNode or null.
604      */

605     public RDFNode getPropertyValue( Property property );
606
607
608     /**
609      * <p>Answer an iterator over the values for a given RDF property. Each
610      * value in the iterator will be an {@link RDFNode}.</p>
611      *
612      * @param property The property whose values are sought
613      * @return An Iterator over the values of the property
614      */

615     public NodeIterator listPropertyValues( Property property );
616
617     /**
618      * <p>Removes this resource from the ontology by deleting any statements that refer to it,
619      * as either statement-subject or statement-object.
620      * If this resource is a property, this method will <strong>not</strong> remove statements
621      * whose predicate is this property.</p>
622      * <p><strong>Caveat:</strong> Jena RDF models contain statements, not resources <em>per se</em>,
623      * so this method simulates removal of an object by removing all of the statements that have
624      * this resource as subject or object, with one exception. If the resource is referenced
625      * in an RDF List, i.e. as the object of an <code>rdf:first</code> statement in a list cell,
626      * this reference is <strong>not</strong> removed. Removing an arbitrary <code>rdf:first</code>
627      * statement from the midst of a list, without doing other work to repair the list, would
628      * leave an ill-formed list in the model. Therefore, if this resource is known to appear
629      * in a list somewhere in the model, it should be separately deleted from that list before
630      * calling this remove method.
631      * </p>
632      */

633     public void remove();
634
635
636     /**
637      * <p>Remove the specific property-value pair from this resource.</p>
638      *
639      * @param property The property to be removed
640      * @param value The specific value of the property to be removed
641      */

642     public void removeProperty( Property property, RDFNode value );
643
644
645     // Conversion methods
646

647     /**
648      * <p>Answer a view of this resource as a property</p>
649      * @return This resource, but viewed as an OntProperty
650      * @exception ConversionException if the resource cannot be converted to a property
651      */

652     public OntProperty asProperty();
653
654     /**
655      * <p>Answer a view of this resource as an annotation property</p>
656      * @return This resource, but viewed as an AnnotationProperty
657      * @exception ConversionException if the resource cannot be converted to an annotation property
658      */

659     public AnnotationProperty asAnnotationProperty();
660
661     /**
662      * <p>Answer a view of this resource as an object property</p>
663      * @return This resource, but viewed as an ObjectProperty
664      * @exception ConversionException if the resource cannot be converted to an object property
665      */

666     public ObjectProperty asObjectProperty();
667
668     /**
669      * <p>Answer a view of this resource as a datatype property</p>
670      * @return This resource, but viewed as a DatatypeProperty
671      * @exception ConversionException if the resource cannot be converted to a datatype property
672      */

673     public DatatypeProperty asDatatypeProperty();
674
675     /**
676      * <p>Answer a view of this resource as an individual</p>
677      * @return This resource, but viewed as an Individual
678      * @exception ConversionException if the resource cannot be converted to an individual
679      */

680     public Individual asIndividual();
681
682     /**
683      * <p>Answer a view of this resource as a class</p>
684      * @return This resource, but viewed as an OntClass
685      * @exception ConversionException if the resource cannot be converted to a class
686      */

687     public OntClass asClass();
688
689     /**
690      * <p>Answer a view of this resource as an ontology description node</p>
691      * @return This resource, but viewed as an Ontology
692      * @exception ConversionException if the resource cannot be converted to an ontology description node
693      */

694     public Ontology asOntology();
695
696     /**
697      * <p>Answer a view of this resource as a data range</p>
698      * @return This resource, but viewed as a DataRange
699      * @exception ConversionException if the resource cannot be converted to a data range
700      */

701     public DataRange asDataRange();
702
703     /**
704      * <p>Answer a view of this resource as an 'all different' declaration</p>
705      * @return This resource, but viewed as an AllDifferent node
706      * @exception ConversionException if the resource cannot be converted to an all different declaration
707      */

708     public AllDifferent asAllDifferent();
709
710
711     // Conversion test methods
712

713     /**
714      * <p>Answer true if this resource can be viewed as a property</p>
715      * @return True if this resource can be viewed as an OntProperty
716      */

717     public boolean isProperty();
718
719     /**
720      * <p>Answer true if this resource can be viewed as an annotation property</p>
721      * @return True if this resource can be viewed as an AnnotationProperty
722      */

723     public boolean isAnnotationProperty();
724
725     /**
726      * <p>Answer true if this resource can be viewed as an object property</p>
727      * @return True if this resource can be viewed as an ObjectProperty
728      */

729     public boolean isObjectProperty();
730
731     /**
732      * <p>Answer true if this resource can be viewed as a datatype property</p>
733      * @return True if this resource can be viewed as a DatatypeProperty
734      */

735     public boolean isDatatypeProperty();
736
737     /**
738      * <p>Answer true if this resource can be viewed as an individual</p>
739      * @return True if this resource can be viewed as an Individual
740      */

741     public boolean isIndividual();
742
743     /**
744      * <p>Answer true if this resource can be viewed as a class</p>
745      * @return True if this resource can be viewed as an OntClass
746      */

747     public boolean isClass();
748
749     /**
750      * <p>Answer true if this resource can be viewed as an ontology description node</p>
751      * @return True if this resource can be viewed as an Ontology
752      */

753     public boolean isOntology();
754
755     /**
756      * <p>Answer true if this resource can be viewed as a data range</p>
757      * @return True if this resource can be viewed as a DataRange
758      */

759     public boolean isDataRange();
760
761     /**
762      * <p>Answer true if this resource can be viewed as an 'all different' declaration</p>
763      * @return True if this resource can be viewed as an AllDifferent node
764      */

765     public boolean isAllDifferent();
766
767
768 }
769
770
771 /*
772     (c) Copyright 2001, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
773     All rights reserved.
774
775     Redistribution and use in source and binary forms, with or without
776     modification, are permitted provided that the following conditions
777     are met:
778
779     1. Redistributions of source code must retain the above copyright
780        notice, this list of conditions and the following disclaimer.
781
782     2. Redistributions in binary form must reproduce the above copyright
783        notice, this list of conditions and the following disclaimer in the
784        documentation and/or other materials provided with the distribution.
785
786     3. The name of the author may not be used to endorse or promote products
787        derived from this software without specific prior written permission.
788
789     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
790     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
791     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
792     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
793     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
794     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
795     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
796     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
797     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
798     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
799 */

800
Popular Tags