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 10 Feb 2003
009: * Filename $RCSfile: OntResource.java,v $
010: * Revision $Revision: 1.42 $
011: * Release status $State: Exp $
012: *
013: * Last modified on $Date: 2008/01/23 12:47:17 $
014: * by $Author: ian_dickinson $
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;
019:
020: // Imports
021: ///////////////
022: import com.hp.hpl.jena.rdf.model.*;
023: import com.hp.hpl.jena.shared.JenaException;
024: import com.hp.hpl.jena.util.iterator.ExtendedIterator;
025:
026: /**
027: * <p>
028: * Provides a common super-type for all of the abstractions in this ontology
029: * representation package.
030: * </p>
031: *
032: * @author Ian Dickinson, HP Labs
033: * (<a href="mailto:Ian.Dickinson@hp.com" >email</a>)
034: * @version CVS $Id: OntResource.java,v 1.42 2008/01/23 12:47:17 ian_dickinson Exp $
035: */
036: public interface OntResource extends Resource {
037: // Constants
038: //////////////////////////////////
039:
040: // External signature methods
041: //////////////////////////////////
042:
043: /**
044: * <p>Answer the model that this resource is attached to, assuming that it
045: * is an {@link OntModel}. If this resource is not attached to any model,
046: * or is (unusually) attached to a model that is not an <code>OntModel</code>,
047: * answer null.</p>
048: * @return The ont model that this resource is attached to, or null.
049: */
050: public OntModel getOntModel();
051:
052: /**
053: * <p>
054: * Answer the ontology language profile that governs the ontology model to which
055: * this ontology resource is attached.
056: * </p>
057: *
058: * @return The language profile for this ontology resource
059: * @throws JenaException if the resource is not bound to an {@link OntModel}, since
060: * that's the only way to get the profile for the resource
061: */
062: public Profile getProfile();
063:
064: /**
065: * <p>Answer true if this resource is a symbol in one of the standard ontology
066: * languages supported by Jena: RDF, RDFS, OWL or DAML+OIL. Since these languages
067: * have restricted namespaces, this check is simply a convenient way of testing whether
068: * this resource is in one of those pre-declared namespaces.</p>
069: * @return True if this is a term in the language namespace for OWL, RDF, RDFS or DAML+OIL.
070: */
071: public boolean isOntLanguageTerm();
072:
073: // sameAs
074:
075: /**
076: * <p>Assert equivalence between the given resource and this resource. Any existing
077: * statements for <code>sameAs</code> will be removed.</p>
078: * @param res The resource that is declared to be the same as this resource
079: * @exception OntProfileException If the {@link Profile#SAME_AS()} property is not supported in the current language profile.
080: */
081: public void setSameAs(Resource res);
082:
083: /**
084: * <p>Add a resource that is declared to be equivalent to this resource.</p>
085: * @param res A resource that declared to be the same as this resource
086: * @exception OntProfileException If the {@link Profile#SAME_AS()} property is not supported in the current language profile.
087: */
088: public void addSameAs(Resource res);
089:
090: /**
091: * <p>Answer a resource that is declared to be the same as this resource. If there is
092: * more than one such resource, an arbitrary selection is made.</p>
093: * @return An ont resource that declared to be the same as this resource
094: * @exception OntProfileException If the {@link Profile#SAME_AS()} property is not supported in the current language profile.
095: */
096: public OntResource getSameAs();
097:
098: /**
099: * <p>Answer an iterator over all of the resources that are declared to be the same as
100: * this resource. Each element 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 element 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 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 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 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 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 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 label, String 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 label, String 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 retrieve 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 getLabel(String 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 restrict 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 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 label, String 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 label, String 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 comment, String 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 comment, String 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 retrieve 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 getComment(String 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 restrict 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 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 comment, String 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 comment, String 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: // rdf:type
462:
463: /**
464: * <p>Set the RDF type (i.e. the class) for this resource, replacing any
465: * existing <code>rdf:type</code> property. Any existing statements for the RDF type
466: * will first be removed.</p>
467: *
468: * @param cls The RDF resource denoting the new value for the <code>rdf:type</code> property,
469: * which will replace any existing type property.
470: * @see Individual#setOntClass(Resource)
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: * @see Individual#addOntClass(Resource)
479: */
480: public void addRDFType(Resource cls);
481:
482: /**
483: * <p>
484: * Answer the <code>rdf:type</code> (i.e. the class) of this resource. If there
485: * is more than one type for this resource, the return value will be one of
486: * the values, but it is not specified which one (nor that it will consistently
487: * be the same one each time). Equivalent to <code>getRDFType( false )</code>.
488: * </p>
489: *
490: * @return A resource that is the rdf:type for this resource, or one of them if
491: * more than one is defined.
492: * @see Individual#getOntClass()
493: */
494: public Resource getRDFType();
495:
496: /**
497: * <p>
498: * Answer the <code>rdf:type</code> (i.e. the class) of this resource. If there
499: * is more than one type for this resource, the return value will be one of
500: * the values, but it is not specified which one (nor that it will consistently
501: * be the same one each time).
502: * </p>
503: *
504: * @param direct If true, only consider the direct types of this resource, and not
505: * the super-classes of the type(s).
506: * @return A resource that is the rdf:type for this resource, or one of them if
507: * more than one is defined.
508: * @see Individual#getOntClass(boolean)
509: */
510: public Resource getRDFType(boolean direct);
511:
512: /**
513: * <p>
514: * Answer an iterator over the RDF classes to which this resource belongs.
515: * </p>
516: *
517: * @param direct If true, only answer those resources that are direct types
518: * of this resource, not the super-classes of the class etc.
519: * @return An iterator over the set of this resource's classes. Each member
520: * of the iteration will be an {@link Resource}. Use
521: * <code>.as( OntClass.class )</code> to map this resource to
522: * an OntClass.
523: * @see Individual#listOntClasses(boolean)
524: */
525: public ExtendedIterator listRDFTypes(boolean direct);
526:
527: /**
528: * <p>
529: * Answer true if this resource is a member of the class denoted by the
530: * given class resource.
531: * </p>
532: *
533: * @param ontClass Denotes a class to which this value may belong
534: * @param direct If true, only consider the direct types of this resource, ignoring
535: * the super-classes of the stated types.
536: * @return True if this resource has the given class as one of its <code>rdf:type</code>'s.
537: * @see Individual#hasOntClass(Resource, boolean)
538: */
539: public boolean hasRDFType(Resource ontClass, boolean direct);
540:
541: /**
542: * <p>
543: * Answer true if this resource is a member of the class denoted by the
544: * given class resource. Includes all available types, so is equivalent to
545: * <code><pre>
546: * hasRDF( ontClass, false );
547: * </pre></code>
548: * </p>
549: *
550: * @param ontClass Denotes a class to which this value may belong
551: * @return True if this resource has the given class as one of its <code>rdf:type</code>'s.
552: * @see Individual#hasOntClass(Resource)
553: */
554: public boolean hasRDFType(Resource ontClass);
555:
556: /**
557: * <p>Remove the statement that this resource is of the given RDF type. If this statement
558: * is not true of the current model, nothing happens.</p>
559: * @param cls A resource denoting a class that that is to be removed from the classes of this resource
560: * @see Individual#removeOntClass(Resource)
561: */
562: public void removeRDFType(Resource cls);
563:
564: /**
565: * <p>
566: * Answer true if this resource is a member of the class denoted by the
567: * given URI.</p>
568: *
569: * @param uri Denotes the URI of a class to which this value may belong
570: * @return True if this resource has the given class as one of its <code>rdf:type</code>'s.
571: * @see Individual#hasOntClass(String)
572: */
573: public boolean hasRDFType(String uri);
574:
575: // other utility methods
576:
577: /**
578: * <p>Answer the cardinality of the given property on this resource. The cardinality
579: * is the number of distinct values there are for the property.</p>
580: * @param p A property
581: * @return The cardinality for the property <code>p</code> on this resource, as an
582: * integer greater than or equal to zero.
583: */
584: public int getCardinality(Property p);
585:
586: /**
587: * <p>
588: * Set the value of the given property of this ontology resource to the given
589: * value, encoded as an RDFNode. Maintains the invariant that there is
590: * at most one value of the property for a given resource, so existing
591: * property values are first removed. To add multiple properties, use
592: * {@link #addProperty( Property, RDFNode ) addProperty}.
593: * </p>
594: *
595: * @param property The property to update
596: * @param value The new value of the property as an RDFNode, or null to
597: * effectively remove this property.
598: */
599: public void setPropertyValue(Property property, RDFNode value);
600:
601: /**
602: * <p>Answer the value of a given RDF property for this resource, or null
603: * if it doesn't have one. The value is returned as an RDFNode, from which
604: * the concrete data value can be extracted for literals. If the value is
605: * a resource, it will present the {@link OntResource} facet.
606: * If there is more than one RDF
607: * statement with the given property for the current value, it is not defined
608: * which of the values will be returned.</p>
609: *
610: * @param property An RDF property
611: * @return An RDFNode whose value is the value, or one of the values, of the
612: * given property. If the property is not defined the method returns null.
613: */
614: public RDFNode getPropertyValue(Property property);
615:
616: /**
617: * <p>Answer an iterator over the values for a given RDF property. Each
618: * value in the iterator will be an {@link RDFNode}.</p>
619: *
620: * @param property The property whose values are sought
621: * @return An Iterator over the values of the property
622: */
623: public NodeIterator listPropertyValues(Property property);
624:
625: /**
626: * <p>Remove the specific property-value pair from this resource.</p>
627: *
628: * @param property The property to be removed
629: * @param value The specific value of the property to be removed
630: */
631: public void removeProperty(Property property, RDFNode value);
632:
633: /**
634: * <p>Removes this resource from the ontology by deleting any statements that refer to it,
635: * as either statement-subject or statement-object.
636: * If this resource is a property, this method will <strong>not</strong> remove statements
637: * whose predicate is this property.</p>
638: * <p><strong>Caveat:</strong> Jena RDF models contain statements, not resources <em>per se</em>,
639: * so this method simulates removal of an object by removing all of the statements that have
640: * this resource as subject or object, with one exception. If the resource is referenced
641: * in an RDF List, i.e. as the object of an <code>rdf:first</code> statement in a list cell,
642: * this reference is <strong>not</strong> removed. Removing an arbitrary <code>rdf:first</code>
643: * statement from the midst of a list, without doing other work to repair the list, would
644: * leave an ill-formed list in the model. Therefore, if this resource is known to appear
645: * in a list somewhere in the model, it should be separately deleted from that list before
646: * calling this remove method.
647: * </p>
648: */
649: public void remove();
650:
651: // Conversion methods
652:
653: /**
654: * <p>Answer a view of this resource as a property</p>
655: * @return This resource, but viewed as an OntProperty
656: * @exception ConversionException if the resource cannot be converted to a property
657: */
658: public OntProperty asProperty();
659:
660: /**
661: * <p>Answer a view of this resource as an annotation property</p>
662: * @return This resource, but viewed as an AnnotationProperty
663: * @exception ConversionException if the resource cannot be converted to an annotation property
664: */
665: public AnnotationProperty asAnnotationProperty();
666:
667: /**
668: * <p>Answer a view of this resource as an object property</p>
669: * @return This resource, but viewed as an ObjectProperty
670: * @exception ConversionException if the resource cannot be converted to an object property
671: */
672: public ObjectProperty asObjectProperty();
673:
674: /**
675: * <p>Answer a view of this resource as a datatype property</p>
676: * @return This resource, but viewed as a DatatypeProperty
677: * @exception ConversionException if the resource cannot be converted to a datatype property
678: */
679: public DatatypeProperty asDatatypeProperty();
680:
681: /**
682: * <p>Answer a view of this resource as an individual</p>
683: * @return This resource, but viewed as an Individual
684: * @exception ConversionException if the resource cannot be converted to an individual
685: */
686: public Individual asIndividual();
687:
688: /**
689: * <p>Answer a view of this resource as a class</p>
690: * @return This resource, but viewed as an OntClass
691: * @exception ConversionException if the resource cannot be converted to a class
692: */
693: public OntClass asClass();
694:
695: /**
696: * <p>Answer a view of this resource as an ontology description node</p>
697: * @return This resource, but viewed as an Ontology
698: * @exception ConversionException if the resource cannot be converted to an ontology description node
699: */
700: public Ontology asOntology();
701:
702: /**
703: * <p>Answer a view of this resource as a data range</p>
704: * @return This resource, but viewed as a DataRange
705: * @exception ConversionException if the resource cannot be converted to a data range
706: */
707: public DataRange asDataRange();
708:
709: /**
710: * <p>Answer a view of this resource as an 'all different' declaration</p>
711: * @return This resource, but viewed as an AllDifferent node
712: * @exception ConversionException if the resource cannot be converted to an all different declaration
713: */
714: public AllDifferent asAllDifferent();
715:
716: // Conversion test methods
717:
718: /**
719: * <p>Answer true if this resource can be viewed as a property</p>
720: * @return True if this resource can be viewed as an OntProperty
721: */
722: public boolean isProperty();
723:
724: /**
725: * <p>Answer true if this resource can be viewed as an annotation property</p>
726: * @return True if this resource can be viewed as an AnnotationProperty
727: */
728: public boolean isAnnotationProperty();
729:
730: /**
731: * <p>Answer true if this resource can be viewed as an object property</p>
732: * @return True if this resource can be viewed as an ObjectProperty
733: */
734: public boolean isObjectProperty();
735:
736: /**
737: * <p>Answer true if this resource can be viewed as a datatype property</p>
738: * @return True if this resource can be viewed as a DatatypeProperty
739: */
740: public boolean isDatatypeProperty();
741:
742: /**
743: * <p>Answer true if this resource can be viewed as an individual</p>
744: * @return True if this resource can be viewed as an Individual
745: */
746: public boolean isIndividual();
747:
748: /**
749: * <p>Answer true if this resource can be viewed as a class</p>
750: * @return True if this resource can be viewed as an OntClass
751: */
752: public boolean isClass();
753:
754: /**
755: * <p>Answer true if this resource can be viewed as an ontology description node</p>
756: * @return True if this resource can be viewed as an Ontology
757: */
758: public boolean isOntology();
759:
760: /**
761: * <p>Answer true if this resource can be viewed as a data range</p>
762: * @return True if this resource can be viewed as a DataRange
763: */
764: public boolean isDataRange();
765:
766: /**
767: * <p>Answer true if this resource can be viewed as an 'all different' declaration</p>
768: * @return True if this resource can be viewed as an AllDifferent node
769: */
770: public boolean isAllDifferent();
771:
772: }
773:
774: /*
775: (c) Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
776: All rights reserved.
777:
778: Redistribution and use in source and binary forms, with or without
779: modification, are permitted provided that the following conditions
780: are met:
781:
782: 1. Redistributions of source code must retain the above copyright
783: notice, this list of conditions and the following disclaimer.
784:
785: 2. Redistributions in binary form must reproduce the above copyright
786: notice, this list of conditions and the following disclaimer in the
787: documentation and/or other materials provided with the distribution.
788:
789: 3. The name of the author may not be used to endorse or promote products
790: derived from this software without specific prior written permission.
791:
792: THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
793: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
794: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
795: IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
796: INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
797: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
798: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
799: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
800: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
801: THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
802: */
|