KickJava   Java API By Example, From Geeks To Geeks.

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


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: OntModel.java,v $
10  * Revision $Revision: 1.48 $
11  * Release status $State: Exp $
12  *
13  * Last modified on $Date: 2005/04/13 09:45:32 $
14  * by $Author: jeremy_carroll $
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.graph.query.BindingQueryPlan;
28 import com.hp.hpl.jena.ontology.event.OntEventManager;
29 import com.hp.hpl.jena.rdf.model.*;
30 import com.hp.hpl.jena.util.iterator.ExtendedIterator;
31
32 import java.io.*;
33 import java.util.*;
34
35
36
37 /**
38  * <p>
39  * An enhanced view of a Jena model that is known to contain ontology
40  * data, under a given ontology {@link Profile vocabulary} (such as OWL).
41  * This class does not by itself compute the deductive extension of the graph
42  * under the semantic rules of the language. Instead, we wrap an underlying
43  * model with this ontology interface, that presents a convenience syntax for accessing
44  * the language elements. Depending on the inference capability of the underlying model,
45  * the OntModel will appear to contain more or less triples. For example, if
46  * this class is used to wrap a plain memory or database model, only the
47  * relationships asserted by the document will be reported through this
48  * convenience API. Alternatively, if the OntModel wraps an OWL inferencing model,
49  * the inferred triples from the extension will be reported as well. For
50  * example, assume the following ontology fragment:
51  * <code><pre>
52  * :A rdf:type owl:Class .
53  * :B rdf:type owl:Class ; rdfs:subClassOf :A .
54  * :widget rdf:type :B .
55  * </pre></code>
56  * In a non-inferencing model, the <code>rdf:type</code> of the widget will be
57  * reported as class <code>:B</code> only. In a model that can process the OWL
58  * semantics, the widget's types will include <code>:B</code>, <code>:A</code>,
59  * and <code>owl:Thing</code>.
60  * </p>
61  * <p>
62  * <strong>Note:</strong> that <code>OntModel</code> is an extension to the
63  * {@link InfModel} interface. This is to support the case where an ontology model
64  * wraps an inference graph, and we want to make the special capabilities of the
65  * <code>InfModel</code>, for example global consistency checking, accessible to
66  * client programs. Since not all ont models use a reasoner, using these methods
67  * may result in a runtime exception, though the typical behaviour is that such
68  * calls will be silently ignored.
69  * </p>
70  *
71  * @author Ian Dickinson, HP Labs
72  * (<a HREF="mailto:Ian.Dickinson@hp.com" >email</a>)
73  * @version CVS $Id: OntModel.java,v 1.48 2005/04/13 09:45:32 jeremy_carroll Exp $
74  */

75 public interface OntModel
76     extends InfModel
77 {
78     // Constants
79
//////////////////////////////////
80

81
82     // External signature methods
83
//////////////////////////////////
84

85     /**
86      * <p>
87      * Answer an iterator that ranges over the ontology resources in this model, i&#046;e&#046;
88      * the resources with <code>rdf:type Ontology</code> or equivalent. These resources
89      * typically contain metadata about the ontology document that contains them.
90      * </p>
91      * <p>
92      * Specifically, the resources in this iterator will those whose type corresponds
93      * to the value given in the ontology vocabulary associated with this model, see
94      * {@link Profile#ONTOLOGY}.
95      * </p>
96      *
97      * @return An iterator over ontology resources.
98      */

99     public ExtendedIterator listOntologies();
100
101
102     /**
103      * <p>
104      * Answer an iterator that ranges over the property resources in this model, i&#046;e&#046;
105      * the resources with <code>rdf:type Property</code> or equivalent. An <code>OntProperty</code>
106      * is equivalent to an <code>rdfs:Property</code> in a normal RDF graph; this type is
107      * provided as a common super-type for the more specific {@link ObjectProperty} and
108      * {@link DatatypeProperty} property types.
109      * </p>
110      * <p>
111      * Specifically, the resources in this iterator will those whose type corresponds
112      * to the value given in the ontology vocabulary associated with this model.
113      * </p>
114      *
115      * @return An iterator over property resources.
116      */

117     public ExtendedIterator listOntProperties();
118
119
120     /**
121      * <p>
122      * Answer an iterator that ranges over the object property resources in this model, i&#046;e&#046;
123      * the resources with <code>rdf:type ObjectProperty</code> or equivalent. An object
124      * property is a property that is defined in the ontology language semantics as a
125      * one whose range comprises individuals (rather than datatyped literals).
126      * </p>
127      * <p>
128      * Specifically, the resources in this iterator will those whose type corresponds
129      * to the value given in the ontology vocabulary associated with this model: see
130      * {@link Profile#OBJECT_PROPERTY}.
131      * </p>
132      *
133      * @return An iterator over object property resources.
134      */

135     public ExtendedIterator listObjectProperties();
136
137
138     /**
139      * <p>
140      * Answer an iterator that ranges over the datatype property resources in this model, i&#046;e&#046;
141      * the resources with <code>rdf:type DatatypeProperty</code> or equivalent. An datatype
142      * property is a property that is defined in the ontology language semantics as a
143      * one whose range comprises datatyped literals (rather than individuals).
144      * </p>
145      * <p>
146      * Specifically, the resources in this iterator will those whose type corresponds
147      * to the value given in the ontology vocabulary associated with this model: see
148      * {@link Profile#DATATYPE_PROPERTY}.
149      * </p>
150      *
151      * @return An iterator over datatype property resources.
152      */

153     public ExtendedIterator listDatatypeProperties();
154
155
156     /**
157      * <p>
158      * Answer an iterator that ranges over the functional property resources in this model, i&#046;e&#046;
159      * the resources with <code>rdf:type FunctionalProperty</code> or equivalent. A functional
160      * property is a property that is defined in the ontology language semantics as having
161      * a unique domain element for each instance of the relationship.
162      * </p>
163      * <p>
164      * Specifically, the resources in this iterator will those whose type corresponds
165      * to the value given in the ontology vocabulary associated with this model: see
166      * {@link Profile#FUNCTIONAL_PROPERTY}.
167      * </p>
168      *
169      * @return An iterator over functional property resources.
170      */

171     public ExtendedIterator listFunctionalProperties();
172
173
174     /**
175      * <p>
176      * Answer an iterator that ranges over the transitive property resources in this model, i&#046;e&#046;
177      * the resources with <code>rdf:type TransitiveProperty</code> or equivalent.
178      * </p>
179      * <p>
180      * Specifically, the resources in this iterator will those whose type corresponds
181      * to the value given in the ontology vocabulary associated with this model: see
182      * {@link Profile#TRANSITIVE_PROPERTY}.
183      * </p>
184      *
185      * @return An iterator over transitive property resources.
186      */

187     public ExtendedIterator listTransitiveProperties();
188
189
190     /**
191      * <p>
192      * Answer an iterator that ranges over the symmetric property resources in this model, i&#046;e&#046;
193      * the resources with <code>rdf:type SymmetricProperty</code> or equivalent.
194      * </p>
195      * <p>
196      * Specifically, the resources in this iterator will those whose type corresponds
197      * to the value given in the ontology vocabulary associated with this model: see
198      * {@link Profile#SYMMETRIC_PROPERTY}.
199      * </p>
200      *
201      * @return An iterator over symmetric property resources.
202      */

203     public ExtendedIterator listSymmetricProperties();
204
205
206     /**
207      * <p>
208      * Answer an iterator that ranges over the inverse functional property resources in this model, i&#046;e&#046;
209      * the resources with <code>rdf:type InverseFunctionalProperty</code> or equivalent.
210      * </p>
211      * <p>
212      * Specifically, the resources in this iterator will those whose type corresponds
213      * to the value given in the ontology vocabulary associated with this model: see
214      * {@link Profile#INVERSE_FUNCTIONAL_PROPERTY}.
215      * </p>
216      *
217      * @return An iterator over inverse functional property resources.
218      */

219     public ExtendedIterator listInverseFunctionalProperties();
220
221
222     /**
223      * <p>
224      * Answer an iterator that ranges over the individual resources in this model, i&#046;e&#046;
225      * the resources with <code>rdf:type</code> corresponding to a class defined
226      * in the ontology.
227      * </p>
228      *
229      * @return An iterator over individual resources.
230      */

231     public ExtendedIterator listIndividuals();
232
233
234     /**
235      * <p>
236      * Answer an iterator that ranges over all of the various forms of class description resource
237      * in this model. Class descriptions include {@linkplain #listEnumeratedClasses enumerated}
238      * classes, {@linkplain #listUnionClasses union} classes, {@linkplain #listComplementClasses complement}
239      * classes, {@linkplain #listIntersectionClasses intersection} classes, {@linkplain #listClasses named}
240      * classes and {@linkplain #listRestrictions property restrictions}.
241      * </p>
242      * @return An iterator over class description resources.
243      */

244     public ExtendedIterator listClasses();
245
246
247     /**
248      * <p>Answer an iterator over the classes in this ontology model that represent
249      * the uppermost nodes of the class hierarchy. Depending on the underlying
250      * reasoner configuration, if any, these will be calculated as the classes
251      * that have Top (i.e. <code>owl:Thing</code> or <code>daml:Thing</code>)
252      * as a direct super-class, or the classes which have no declared super-class.</p>
253      * @return An iterator of the root classes in the local class hierarchy
254      */

255     public ExtendedIterator listHierarchyRootClasses();
256
257
258     /**
259      * <p>
260      * Answer an iterator that ranges over the enumerated class class-descriptions
261      * in this model, i&#046;e&#046; the class resources specified to have a property
262      * <code>oneOf</code> (or equivalent) and a list of values.
263      * </p>
264      *
265      * @return An iterator over enumerated class resources.
266      * @see Profile#ONE_OF
267      */

268     public ExtendedIterator listEnumeratedClasses();
269
270
271     /**
272      * <p>
273      * Answer an iterator that ranges over the union class-descriptions
274      * in this model, i&#046;e&#046; the class resources specified to have a property
275      * <code>unionOf</code> (or equivalent) and a list of values.
276      * </p>
277      *
278      * @return An iterator over union class resources.
279      * @see Profile#UNION_OF
280      */

281     public ExtendedIterator listUnionClasses();
282
283
284     /**
285      * <p>
286      * Answer an iterator that ranges over the complement class-descriptions
287      * in this model, i&#046;e&#046; the class resources specified to have a property
288      * <code>complementOf</code> (or equivalent) and a list of values.
289      * </p>
290      *
291      * @return An iterator over complement class resources.
292      * @see Profile#COMPLEMENT_OF
293      */

294     public ExtendedIterator listComplementClasses();
295
296
297     /**
298      * <p>
299      * Answer an iterator that ranges over the intersection class-descriptions
300      * in this model, i&#046;e&#046; the class resources specified to have a property
301      * <code>intersectionOf</code> (or equivalent) and a list of values.
302      * </p>
303      *
304      * @return An iterator over complement class resources.
305      * @see Profile#INTERSECTION_OF
306      */

307     public ExtendedIterator listIntersectionClasses();
308
309
310     /**
311      * <p>
312      * Answer an iterator that ranges over the named class-descriptions
313      * in this model, i&#046;e&#046; resources with <code>rdf:type
314      * Class</code> (or equivalent) and a node URI.
315      * </p>
316      *
317      * @return An iterator over named class resources.
318      */

319     public ExtendedIterator listNamedClasses();
320
321
322     /**
323      * <p>
324      * Answer an iterator that ranges over the property restriction class-descriptions
325      * in this model, i&#046;e&#046; resources with <code>rdf:type
326      * Restriction</code> (or equivalent).
327      * </p>
328      *
329      * @return An iterator over restriction class resources.
330      * @see Profile#RESTRICTION
331      */

332     public ExtendedIterator listRestrictions();
333
334
335     /**
336      * <p>
337      * Answer an iterator that ranges over the properties in this model that are declared
338      * to be annotation properties. Not all supported languages define annotation properties
339      * (the category of annotation properties is chiefly an OWL innovation).
340      * </p>
341      *
342      * @return An iterator over annotation properties.
343      * @see Profile#getAnnotationProperties()
344      */

345     public ExtendedIterator listAnnotationProperties();
346
347
348     /**
349      * <p>
350      * Answer an iterator that ranges over the nodes that denote pair-wise disjointness between
351      * sets of classes.
352      * </p>
353      *
354      * @return An iterator over AllDifferent nodes.
355      */

356     public ExtendedIterator listAllDifferent();
357
358
359     /**
360      * <p>Answer an iterator over the DataRange objects in this ontology, if there
361      * are any.</p>
362      * @return An iterator, whose values are {@link DataRange} objects.
363      */

364     public ExtendedIterator listDataRanges();
365
366
367     /**
368      * <p>
369      * Answer a resource that represents an ontology description node in this model. If a resource
370      * with the given uri exists in the model, and can be viewed as an Ontology, return the
371      * Ontology facet, otherwise return null.
372      * </p>
373      *
374      * @param uri The uri for the ontology node. Conventionally, this corresponds to the base URI
375      * of the document itself.
376      * @return An Ontology resource or null.
377      */

378     public Ontology getOntology( String JavaDoc uri );
379
380
381     /**
382      * <p>
383      * Answer a resource that represents an Individual node in this model. If a resource
384      * with the given uri exists in the model, and can be viewed as an Individual, return the
385      * Individual facet, otherwise return null.
386      * </p>
387      *
388      * @param uri The URI for the requried individual
389      * @return An Individual resource or null.
390      */

391     public Individual getIndividual( String JavaDoc uri );
392
393
394     /**
395      * <p>
396      * Answer a resource representing an generic property in this model. If a property
397      * with the given uri exists in the model, return the
398      * OntProperty facet, otherwise return null.
399      * </p>
400      *
401      * @param uri The uri for the property.
402      * @return An OntProperty resource or null.
403      */

404     public OntProperty getOntProperty( String JavaDoc uri );
405
406
407     /**
408      * <p>
409      * Answer a resource representing an object property in this model. If a resource
410      * with the given uri exists in the model, and can be viewed as an ObjectProperty, return the
411      * ObjectProperty facet, otherwise return null.
412      * </p>
413      *
414      * @param uri The uri for the object property. May not be null.
415      * @return An ObjectProperty resource or null.
416      */

417     public ObjectProperty getObjectProperty( String JavaDoc uri );
418
419
420     /**
421      * <p>Answer a resource representing a transitive property. If a resource
422      * with the given uri exists in the model, and can be viewed as a TransitiveProperty, return the
423      * TransitiveProperty facet, otherwise return null. </p>
424      * @param uri The uri for the property. May not be null.
425      * @return A TransitiveProperty resource or null
426      */

427     public TransitiveProperty getTransitiveProperty( String JavaDoc uri );
428
429
430     /**
431      * <p>Answer a resource representing a symmetric property. If a resource
432      * with the given uri exists in the model, and can be viewed as a SymmetricProperty, return the
433      * SymmetricProperty facet, otherwise return null. </p>
434      * @param uri The uri for the property. May not be null.
435      * @return A SymmetricProperty resource or null
436      */

437     public SymmetricProperty getSymmetricProperty( String JavaDoc uri );
438
439
440     /**
441      * <p>Answer a resource representing an inverse functional property. If a resource
442      * with the given uri exists in the model, and can be viewed as a InverseFunctionalProperty, return the
443      * InverseFunctionalProperty facet, otherwise return null. </p>
444      * @param uri The uri for the property. May not be null.
445      * @return An InverseFunctionalProperty resource or null
446      */

447     public InverseFunctionalProperty getInverseFunctionalProperty( String JavaDoc uri );
448
449
450     /**
451      * <p>
452      * Answer a resource that represents datatype property in this model. . If a resource
453      * with the given uri exists in the model, and can be viewed as a DatatypeProperty, return the
454      * DatatypeProperty facet, otherwise return null.
455      * </p>
456      *
457      * @param uri The uri for the datatype property. May not be null.
458      * @return A DatatypeProperty resource or null
459      */

460     public DatatypeProperty getDatatypeProperty( String JavaDoc uri );
461
462
463     /**
464      * <p>
465      * Answer a resource that represents an annotation property in this model. If a resource
466      * with the given uri exists in the model, and can be viewed as an AnnotationProperty, return the
467      * AnnotationProperty facet, otherwise return null.
468      * </p>
469      *
470      * @param uri The uri for the annotation property. May not be null.
471      * @return An AnnotationProperty resource or null
472      */

473     public AnnotationProperty getAnnotationProperty( String JavaDoc uri );
474
475     /**
476      * <p>Answer a resource presenting the {@link OntResource} facet, which has the given
477      * URI. If no such resource is currently present in the model, return null.</p>
478      * @param uri The URI of a resource
479      * @return An OntResource with the given URI, or null
480      */

481     public OntResource getOntResource( String JavaDoc uri );
482
483     /**
484      * <p>Answer a resource presenting the {@link OntResource} facet, which
485      * corresponds to the given resource but attached to this model.</p>
486      * @param res An existing resource
487      * @return An OntResource attached to this model that has the same URI
488      * or anonID as the given resource
489      */

490     public OntResource getOntResource( Resource res );
491
492     /**
493      * <p>
494      * Answer a resource that represents a class description node in this model. If a resource
495      * with the given uri exists in the model, and can be viewed as an OntClass, return the
496      * OntClass facet, otherwise return null.
497      * </p>
498      *
499      * @param uri The uri for the class node, or null for an anonymous class.
500      * @return An OntClass resource or null.
501      */

502     public OntClass getOntClass( String JavaDoc uri );
503
504
505     /**
506      * <p>Answer a resource representing the class that is the complement of another class. If a resource
507      * with the given uri exists in the model, and can be viewed as a ComplementClass, return the
508      * ComplementClass facet, otherwise return null. </p>
509      * @param uri The URI of the new complement class.
510      * @return A complement class or null
511      */

512     public ComplementClass getComplementClass( String JavaDoc uri );
513
514
515     /**
516      * <p>Answer a resource representing the class that is the enumeration of a list of individuals. If a resource
517      * with the given uri exists in the model, and can be viewed as an EnumeratedClass, return the
518      * EnumeratedClass facet, otherwise return null. </p>
519      * @param uri The URI of the new enumeration class.
520      * @return An enumeration class or null
521      */

522     public EnumeratedClass getEnumeratedClass( String JavaDoc uri );
523
524
525     /**
526      * <p>Answer a resource representing the class that is the union of a list of class desctiptions. If a resource
527      * with the given uri exists in the model, and can be viewed as a UnionClass, return the
528      * UnionClass facet, otherwise return null. </p>
529      * @param uri The URI of the new union class.
530      * @return A union class description or null
531      */

532     public UnionClass getUnionClass( String JavaDoc uri );
533
534
535     /**
536      * <p>Answer a resource representing the class that is the intersection of a list of class descriptions. If a resource
537      * with the given uri exists in the model, and can be viewed as a IntersectionClass, return the
538      * IntersectionClass facet, otherwise return null. </p>
539      * @param uri The URI of the new intersection class.
540      * @return An intersection class description or null
541      */

542     public IntersectionClass getIntersectionClass( String JavaDoc uri );
543
544
545     /**
546      * <p>
547      * Answer a resource that represents a property restriction in this model. If a resource
548      * with the given uri exists in the model, and can be viewed as a Restriction, return the
549      * Restriction facet, otherwise return null.
550      * </p>
551      *
552      * @param uri The uri for the restriction node.
553      * @return A Restriction resource or null
554      */

555     public Restriction getRestriction( String JavaDoc uri );
556
557
558     /**
559      * <p>Answer a class description defined as the class of those individuals that have the given
560      * resource as the value of the given property. If a resource
561      * with the given uri exists in the model, and can be viewed as a HasValueRestriction, return the
562      * HasValueRestriction facet, otherwise return null. </p>
563      *
564      * @param uri The URI for the restriction
565      * @return A resource representing a has-value restriction or null
566      */

567     public HasValueRestriction getHasValueRestriction( String JavaDoc uri );
568
569
570     /**
571      * <p>Answer a class description defined as the class of those individuals that have at least
572      * one property with a value belonging to the given class. If a resource
573      * with the given uri exists in the model, and can be viewed as a SomeValuesFromRestriction, return the
574      * SomeValuesFromRestriction facet, otherwise return null. </p>
575      *
576      * @param uri The URI for the restriction
577      * @return A resource representing a some-values-from restriction, or null
578      */

579     public SomeValuesFromRestriction getSomeValuesFromRestriction( String JavaDoc uri );
580
581
582     /**
583      * <p>Answer a class description defined as the class of those individuals for which all values
584      * of the given property belong to the given class. If a resource
585      * with the given uri exists in the model, and can be viewed as an AllValuesFromResriction, return the
586      * AllValuesFromRestriction facet, otherwise return null. </p>
587      *
588      * @param uri The URI for the restriction
589      * @return A resource representing an all-values-from restriction or null
590      */

591     public AllValuesFromRestriction getAllValuesFromRestriction( String JavaDoc uri );
592
593
594     /**
595      * <p>Answer a class description defined as the class of those individuals that have exactly
596      * the given number of values for the given property. If a resource
597      * with the given uri exists in the model, and can be viewed as a CardinalityRestriction, return the
598      * CardinalityRestriction facet, otherwise return null. </p>
599      *
600      * @param uri The URI for the restriction
601      * @return A resource representing a has-value restriction, or null
602      */

603     public CardinalityRestriction getCardinalityRestriction( String JavaDoc uri );
604
605
606     /**
607      * <p>Answer a class description defined as the class of those individuals that have at least
608      * the given number of values for the given property. If a resource
609      * with the given uri exists in the model, and can be viewed as a MinCardinalityRestriction, return the
610      * MinCardinalityRestriction facet, otherwise return null. </p>
611      *
612      * @param uri The URI for the restriction
613      * @return A resource representing a min-cardinality restriction, or null
614      */

615     public MinCardinalityRestriction getMinCardinalityRestriction( String JavaDoc uri );
616
617
618     /**
619      * <p>Answer a class description defined as the class of those individuals that have at most
620      * the given number of values for the given property. If a resource
621      * with the given uri exists in the model, and can be viewed as a MaxCardinalityRestriction, return the
622      * MaxCardinalityRestriction facet, otherwise return null.</p>
623      *
624      * @param uri The URI for the restriction
625      * @return A resource representing a max-cardinality restriction, or null
626      */

627     public MaxCardinalityRestriction getMaxCardinalityRestriction( String JavaDoc uri );
628
629
630     /**
631      * <p>Answer a class description defined as the class of those individuals that have a property
632      * p, all values of which are members of a given class. Typically used with a cardinality constraint.
633      * If a resource
634      * with the given uri exists in the model, and can be viewed as a QualifiedRestriction, return the
635      * QualifiedRestriction facet, otherwise return null.</p>
636      *
637      * @param uri The URI for the restriction
638      * @return A resource representing a qualified restriction, or null
639      */

640     public QualifiedRestriction getQualifiedRestriction( String JavaDoc uri );
641
642
643     /**
644      * <p>Answer a class description defined as the class of those individuals that have a property
645      * p, with cardinality N, all values of which are members of a given class.
646      * If a resource
647      * with the given uri exists in the model, and can be viewed as a CardinalityQRestriction, return the
648      * CardinalityQRestriction facet, otherwise return null.</p>
649      *
650      * @param uri The URI for the restriction
651      * @return A resource representing a qualified cardinality restriction, or null
652      */

653     public CardinalityQRestriction getCardinalityQRestriction( String JavaDoc uri );
654
655
656     /**
657      * <p>Answer a class description defined as the class of those individuals that have a property
658      * p, with min cardinality N, all values of which are members of a given class.
659      * If a resource
660      * with the given uri exists in the model, and can be viewed as a MinCardinalityQRestriction, return the
661      * MinCardinalityQRestriction facet, otherwise return null.</p>
662      *
663      * @param uri The URI for the restriction
664      * @return A resource representing a qualified min cardinality restriction, or null
665      */

666     public MinCardinalityQRestriction getMinCardinalityQRestriction( String JavaDoc uri );
667
668
669     /**
670      * <p>Answer a class description defined as the class of those individuals that have a property
671      * p, with max cardinality N, all values of which are members of a given class.
672      * If a resource
673      * with the given uri exists in the model, and can be viewed as a MaxCardinalityQRestriction, return the
674      * MaxCardinalityQRestriction facet, otherwise return null.</p>
675      *
676      * @param uri The URI for the restriction
677      * @return A resource representing a qualified max cardinality restriction, or null
678      */

679     public MaxCardinalityQRestriction getMaxCardinalityQRestriction( String JavaDoc uri );
680
681
682     /**
683      * <p>
684      * Answer a resource that represents an ontology description node in this model. If a resource
685      * with the given uri exists in the model, it will be re-used. If not, a new one is created in
686      * the updateable sub-model of the ontology model.
687      * </p>
688      *
689      * @param uri The uri for the ontology node. Conventionally, this corresponds to the base URI
690      * of the document itself.
691      * @return An Ontology resource.
692      */

693     public Ontology createOntology( String JavaDoc uri );
694
695
696     /**
697      * <p>
698      * Answer a resource that represents an Indvidual node in this model. A new anonymous resource
699      * will be created in the updateable sub-model of the ontology model.
700      * </p>
701      *
702      * @param cls Resource representing the ontology class to which the individual belongs
703      * @return A new anoymous Individual of the given class.
704      */

705     public Individual createIndividual( Resource cls );
706
707
708     /**
709      * <p>
710      * Answer a resource that represents an Individual node in this model. If a resource
711      * with the given uri exists in the model, it will be re-used. If not, a new one is created in
712      * the updateable sub-model of the ontology model.
713      * </p>
714      *
715      * @param cls Resource representing the ontology class to which the individual belongs
716      * @param uri The uri for the individual, or null for an anonymous individual.
717      * @return An Individual resource.
718      */

719     public Individual createIndividual( String JavaDoc uri, Resource cls );
720
721
722     /**
723      * <p>
724      * Answer a resource representing an generic property in this model. Effectively
725      * this method is an alias for {@link #createProperty( String )}, except that
726      * the return type is {@link OntProperty}, which allow more convenient access to
727      * a property's position in the property hierarchy, domain, range, etc.
728      * </p>
729      *
730      * @param uri The uri for the property. May not be null.
731      * @return An OntProperty resource.
732      */

733     public OntProperty createOntProperty( String JavaDoc uri );
734
735
736     /**
737      * <p>
738      * Answer a resource representing an object property in this model,
739      * and that is not a functional property.
740      * </p>
741      *
742      * @param uri The uri for the object property. May not be null.
743      * @return An ObjectProperty resource.
744      * @see #createObjectProperty( String, boolean )
745      */

746     public ObjectProperty createObjectProperty( String JavaDoc uri );
747
748
749     /**
750      * <p>
751      * Answer a resource that represents an object property in this model. An object property
752      * is defined to have a range of individuals, rather than datatypes.
753      * If a resource
754      * with the given uri exists in the model, it will be re-used. If not, a new one is created in
755      * the updateable sub-model of the ontology model.
756      * </p>
757      *
758      * @param uri The uri for the object property. May not be null.
759      * @param functional If true, the resource will also be typed as a {@link FunctionalProperty},
760      * that is, a property that has a unique range value for any given domain value.
761      * @return An ObjectProperty resource, optionally also functional.
762      */

763     public ObjectProperty createObjectProperty( String JavaDoc uri, boolean functional );
764
765
766     /**
767      * <p>Answer a resource representing a transitive property</p>
768      * @param uri The uri for the property. May not be null.
769      * @return An TransitiveProperty resource
770      * @see #createTransitiveProperty( String, boolean )
771      */

772     public TransitiveProperty createTransitiveProperty( String JavaDoc uri );
773
774
775     /**
776      * <p>Answer a resource representing a transitive property, which is optionally
777      * also functional. <strong>Note:</strong> although it is permitted in OWL full
778      * to have functional transitive properties, it makes the language undecideable.
779      * Functional transitive properties are not permitted in OWL Lite or OWL DL.</p>
780      * @param uri The uri for the property. May not be null.
781      * @param functional If true, the property is also functional
782      * @return An TransitiveProperty resource, optionally also functional.
783      */

784     public TransitiveProperty createTransitiveProperty( String JavaDoc uri, boolean functional );
785
786
787     /**
788      * <p>Answer a resource representing a symmetric property</p>
789      * @param uri The uri for the property. May not be null.
790      * @return An SymmetricProperty resource
791      * @see #createSymmetricProperty( String, boolean )
792      */

793     public SymmetricProperty createSymmetricProperty( String JavaDoc uri );
794
795
796     /**
797      * <p>Answer a resource representing a symmetric property, which is optionally
798      * also functional.</p>
799      * @param uri The uri for the property. May not be null.
800      * @param functional If true, the property is also functional
801      * @return An SymmetricProperty resource, optionally also functional.
802      */

803     public SymmetricProperty createSymmetricProperty( String JavaDoc uri, boolean functional );
804
805
806     /**
807      * <p>Answer a resource representing an inverse functional property</p>
808      * @param uri The uri for the property. May not be null.
809      * @return An InverseFunctionalProperty resource
810      * @see #createInverseFunctionalProperty( String, boolean )
811      */

812     public InverseFunctionalProperty createInverseFunctionalProperty( String JavaDoc uri );
813
814
815     /**
816      * <p>Answer a resource representing an inverse functional property, which is optionally
817      * also functional.</p>
818      * @param uri The uri for the property. May not be null.
819      * @param functional If true, the property is also functional
820      * @return An InverseFunctionalProperty resource, optionally also functional.
821      */

822     public InverseFunctionalProperty createInverseFunctionalProperty( String JavaDoc uri, boolean functional );
823
824     /**
825      * <p>
826      * Answer a resource that represents datatype property in this model, and that is
827      * not a functional property.
828      * </p>
829      *
830      * @param uri The uri for the datatype property. May not be null.
831      * @return A DatatypeProperty resource.
832      * @see #createDatatypeProperty( String, boolean )
833      */

834     public DatatypeProperty createDatatypeProperty( String JavaDoc uri );
835
836
837     /**
838      * <p>
839      * Answer a resource that represents datatype property in this model. A datatype property
840      * is defined to have a range that is a concrete datatype, rather than an individual.
841      * If a resource
842      * with the given uri exists in the model, it will be re-used. If not, a new one is created in
843      * the updateable sub-model of the ontology model.
844      * </p>
845      *
846      * @param uri The uri for the datatype property. May not be null.
847      * @param functional If true, the resource will also be typed as a {@link FunctionalProperty},
848      * that is, a property that has a unique range value for any given domain value.
849      * @return A DatatypeProperty resource.
850      */

851     public DatatypeProperty createDatatypeProperty( String JavaDoc uri, boolean functional );
852
853
854     /**
855      * <p>
856      * Answer a resource that represents an annotation property in this model. If a resource
857      * with the given uri exists in the model, it will be re-used. If not, a new one is created in
858      * the updateable sub-model of the ontology model.
859      * </p>
860      *
861      * @param uri The uri for the annotation property. May not be null.
862      * @return An AnnotationProperty resource.
863      */

864     public AnnotationProperty createAnnotationProperty( String JavaDoc uri );
865
866
867     /**
868      * <p>
869      * Answer a resource that represents an anonymous class description in this model. A new
870      * anonymous resource of <code>rdf:type C</code>, where C is the class type from the
871      * language profile.
872      * </p>
873      *
874      * @return An anonymous Class resource.
875      */

876     public OntClass createClass();
877
878
879     /**
880      * <p>
881      * Answer a resource that represents a class description node in this model. If a resource
882      * with the given uri exists in the model, it will be re-used. If not, a new one is created in
883      * the updateable sub-model of the ontology model.
884      * </p>
885      *
886      * @param uri The uri for the class node, or null for an anonymous class.
887      * @return A Class resource.
888      */

889     public OntClass createClass( String JavaDoc uri );
890
891
892     /**
893      * <p>Answer a resource representing the class that is the complement of the given argument class</p>
894      * @param uri The URI of the new complement class, or null for an anonymous class description.
895      * @param cls Resource denoting the class that the new class is a complement of
896      * @return A complement class
897      */

898     public ComplementClass createComplementClass( String JavaDoc uri, Resource cls );
899
900
901     /**
902      * <p>Answer a resource representing the class that is the enumeration of the given list of individuals</p>
903      * @param uri The URI of the new enumeration class, or null for an anonymous class description.
904      * @param members An optional list of resources denoting the individuals in the enumeration, or null.
905      * @return An enumeration class
906      */

907     public EnumeratedClass createEnumeratedClass( String JavaDoc uri, RDFList members );
908
909
910     /**
911      * <p>Answer a resource representing the class that is the union of the given list of class desctiptions</p>
912      * @param uri The URI of the new union class, or null for an anonymous class description.
913      * @param members A list of resources denoting the classes that comprise the union
914      * @return A union class description
915      */

916     public UnionClass createUnionClass( String JavaDoc uri, RDFList members );
917
918
919     /**
920      * <p>Answer a resource representing the class that is the intersection of the given list of class descriptions.</p>
921      * @param uri The URI of the new intersection class, or null for an anonymous class description.
922      * @param members A list of resources denoting the classes that comprise the intersection
923      * @return An intersection class description
924      */

925     public IntersectionClass createIntersectionClass( String JavaDoc uri, RDFList members );
926
927
928     /**
929      * <p>
930      * Answer a resource that represents an anonymous property restriction in this model. A new
931      * anonymous resource of <code>rdf:type R</code>, where R is the restriction type from the
932      * language profile.
933      * </p>
934      * @param p The property that is restricted by this restriction, or null to omit from the restriction
935      * @return An anonymous Restriction resource.
936      */

937     public Restriction createRestriction( Property p );
938
939
940     /**
941      * <p>
942      * Answer a resource that represents a property restriction in this model. If a resource
943      * with the given uri exists in the model, it will be re-used. If not, a new one is created in
944      * the updateable sub-model of the ontology model.
945      * </p>
946      *
947      * @param uri The uri for the restriction node, or null for an anonymous restriction.
948      * @param p The property that is restricted by this restriction, or null to omit from the restriction
949      * @return A Restriction resource.
950      */

951     public Restriction createRestriction( String JavaDoc uri, Property p );
952
953
954     /**
955      * <p>Answer a class description defined as the class of those individuals that have the given
956      * resource as the value of the given property</p>
957      *
958      * @param uri The optional URI for the restriction, or null for an anonymous restriction (which
959      * should be the normal case)
960      * @param prop The property the restriction applies to
961      * @param value The value of the property, as a resource or RDF literal
962      * @return A new resource representing a has-value restriction
963      */

964     public HasValueRestriction createHasValueRestriction( String JavaDoc uri, Property prop, RDFNode value );
965
966
967     /**
968      * <p>Answer a class description defined as the class of those individuals that have at least
969      * one property with a value belonging to the given class</p>
970      *
971      * @param uri The optional URI for the restriction, or null for an anonymous restriction (which
972      * should be the normal case)
973      * @param prop The property the restriction applies to
974      * @param cls The class to which at least one value of the property belongs
975      * @return A new resource representing a some-values-from restriction
976      */

977     public SomeValuesFromRestriction createSomeValuesFromRestriction( String JavaDoc uri, Property prop, Resource cls );
978
979
980     /**
981      * <p>Answer a class description defined as the class of those individuals for which all values
982      * of the given property belong to the given class</p>
983      *
984      * @param uri The optional URI for the restriction, or null for an anonymous restriction (which
985      * should be the normal case)
986      * @param prop The property the restriction applies to
987      * @param cls The class to which any value of the property belongs
988      * @return A new resource representing an all-values-from restriction
989      */

990     public AllValuesFromRestriction createAllValuesFromRestriction( String JavaDoc uri, Property prop, Resource cls );
991
992
993     /**
994      * <p>Answer a class description defined as the class of those individuals that have exactly
995      * the given number of values for the given property.</p>
996      *
997      * @param uri The optional URI for the restriction, or null for an anonymous restriction (which
998      * should be the normal case)
999      * @param prop The property the restriction applies to
1000     * @param cardinality The exact cardinality of the property
1001     * @return A new resource representing a has-value restriction
1002     */

1003    public CardinalityRestriction createCardinalityRestriction( String JavaDoc uri, Property prop, int cardinality );
1004
1005
1006    /**
1007     * <p>Answer a class description defined as the class of those individuals that have at least
1008     * the given number of values for the given property.</p>
1009     *
1010     * @param uri The optional URI for the restriction, or null for an anonymous restriction (which
1011     * should be the normal case)
1012     * @param prop The property the restriction applies to
1013     * @param cardinality The minimum cardinality of the property
1014     * @return A new resource representing a min-cardinality restriction
1015     */

1016    public MinCardinalityRestriction createMinCardinalityRestriction( String JavaDoc uri, Property prop, int cardinality );
1017
1018
1019    /**
1020     * <p>Answer a class description defined as the class of those individuals that have at most
1021     * the given number of values for the given property.</p>
1022     *
1023     * @param uri The optional URI for the restriction, or null for an anonymous restriction (which
1024     * should be the normal case)
1025     * @param prop The property the restriction applies to
1026     * @param cardinality The maximum cardinality of the property
1027     * @return A new resource representing a mas-cardinality restriction
1028     */

1029    public MaxCardinalityRestriction createMaxCardinalityRestriction( String JavaDoc uri, Property prop, int cardinality );
1030
1031
1032    /**
1033     * <p>Answer a class description defined as the class of those individuals that have at most
1034     * the given number of values for the given property, all values of which belong to the given
1035     * class.</p>
1036     *
1037     * @param uri The optional URI for the restriction, or null for an anonymous restriction (which
1038     * should be the normal case)
1039     * @param prop The property the restriction applies to
1040     * @param cardinality The maximum cardinality of the property
1041     * @param cls The class to which all values of the restricted property should belong
1042     * @return A new resource representing a mas-cardinality restriction
1043     */

1044    public MaxCardinalityQRestriction createMaxCardinalityQRestriction( String JavaDoc uri, Property prop, int cardinality, OntClass cls );
1045
1046
1047    /**
1048     * <p>Answer a class description defined as the class of those individuals that have at least
1049     * the given number of values for the given property, all values of which belong to the given
1050     * class.</p>
1051     *
1052     * @param uri The optional URI for the restriction, or null for an anonymous restriction (which
1053     * should be the normal case)
1054     * @param prop The property the restriction applies to
1055     * @param cardinality The minimun cardinality of the property
1056     * @param cls The class to which all values of the restricted property should belong
1057     * @return A new resource representing a mas-cardinality restriction
1058     */

1059    public MinCardinalityQRestriction createMinCardinalityQRestriction( String JavaDoc uri, Property prop, int cardinality, OntClass cls );
1060
1061
1062    /**
1063     * <p>Answer a class description defined as the class of those individuals that have exactly
1064     * the given number of values for the given property, all values of which belong to the given
1065     * class.</p>
1066     *
1067     * @param uri The optional URI for the restriction, or null for an anonymous restriction (which
1068     * should be the normal case)
1069     * @param prop The property the restriction applies to
1070     * @param cardinality The cardinality of the property
1071     * @param cls The class to which all values of the restricted property should belong
1072     * @return A new resource representing a mas-cardinality restriction
1073     */

1074    public CardinalityQRestriction createCardinalityQRestriction( String JavaDoc uri, Property prop, int cardinality, OntClass cls );
1075
1076
1077    /**
1078     * <p>Answer a data range defined as the given set of concrete data values. DataRange resources
1079     * are necessarily bNodes.</p>
1080     *
1081     * @param literals A list of literals that will be the members of the data range,
1082     * or null to define an empty data range
1083     * @return A new data range containing the given literals as permissible values
1084     */

1085    public DataRange createDataRange( RDFList literals );
1086
1087
1088    /**
1089     * <p>
1090     * Answer a new, anonymous node representing the fact that a given set of classes are all
1091     * pair-wise distinct. <code>AllDifferent</code> is a feature of OWL only, and is something
1092     * of an anomoly in that it exists only to give a place to anchor the <code>distinctMembers</code>
1093     * property, which is the actual expression of the fact.
1094     * </p>
1095     *
1096     * @return A new AllDifferent resource
1097     */

1098    public AllDifferent createAllDifferent();
1099
1100
1101    /**
1102     * <p>
1103     * Answer a new, anonymous node representing the fact that a given set of classes are all
1104     * pair-wise distinct. <code>AllDifferent</code> is a feature of OWL only, and is something
1105     * of an anomoly in that it exists only to give a place to anchor the <code>distinctMembers</code>
1106     * property, which is the actual expression of the fact.
1107     * </p>
1108     * @param differentMembers A list of the class expressions that denote a set of mutually disjoint classes
1109     * @return A new AllDifferent resource
1110     */

1111    public AllDifferent createAllDifferent( RDFList differentMembers );
1112
1113
1114    /**
1115     * <p>
1116     * Answer a resource that represents a generic ontology node in this model. If a resource
1117     * with the given uri exists in the model, it will be re-used. If not, a new one is created in
1118     * the updateable sub-model of the ontology model.
1119     * </p>
1120     * <p>
1121     * This is a generic method for creating any known ontology value. The selector that determines
1122     * which resource to create is the same as as the argument to the {@link RDFNode#as as()}
1123     * method: the Java class object of the desired abstraction. For example, to create an
1124     * ontology class via this mechanism, use:
1125     * <code><pre>
1126     * OntClass c = (OntClass) myModel.createOntResource( OntClass.class, null,
1127     * "http://example.org/ex#Parrot" );
1128     * </pre></code>
1129     * </p>
1130     *
1131     * @param javaClass The Java class object that represents the ontology abstraction to create
1132     * @param rdfType Optional resource denoting the ontology class to which an individual or
1133     * axiom belongs, if that is the type of resource being created.
1134     * @param uri The uri for the ontology resource, or null for an anonymous resource.
1135     * @return An ontology resource, of the type specified by the <code>javaClass</code>
1136     */

1137    public OntResource createOntResource( Class JavaDoc javaClass, Resource rdfType, String JavaDoc uri );
1138
1139    /**
1140     * <p>Answer a resource presenting the {@link OntResource} facet, which has the
1141     * given URI.</p>
1142     * @param uri The URI of the resource, or null for an anonymous resource (aka bNode)
1143     * @return An OntResource with the given URI
1144     */

1145    public OntResource createOntResource( String JavaDoc uri );
1146
1147    /**
1148     * <p>
1149     * Answer a list of the imported URI's in this ontology model. Detection of <code>imports</code>
1150     * statments will be according to the local language profile. Note that, in order to allow this
1151     * method to be called during the imports closure process, we <b>only query the base model</b>,
1152     * thus side-stepping the any attached reasoner.
1153     * </p>
1154     *
1155     * @return The imported ontology URI's as a set. Note that since the underlying graph is
1156     * not ordered, the order of values in the list in successive calls to this method is
1157     * not guaranteed to be preserved.
1158     */

1159    public Set listImportedOntologyURIs();
1160
1161
1162    /**
1163     * <p>
1164     * Answer a list of the imported URI's in this ontology model, and optionally in the closure
1165     * of this model's imports. Detection of <code>imports</code>
1166     * statments will be according to the local language profile. Note that, in order to allow this
1167     * method to be called during the imports closure process, we <b>only query the base model</b>,
1168     * thus side-stepping the any attached reasoner.
1169     * </p>
1170     * @param closure If true, the set of uri's returned will include not only those directly
1171     * imported by this model, but those imported by the model's imports transitively.
1172     * @return The imported ontology URI's as a list. Note that since the underlying graph is
1173     * not ordered, the order of values in the list in successive calls to this method is
1174     * not guaranteed to be preserved.
1175     */

1176    public Set listImportedOntologyURIs( boolean closure );
1177
1178
1179    /**
1180     * <p>
1181     * Answer true if this model has had the given URI document imported into it. This is
1182     * important to know since an import only occurs once, and we also want to be able to
1183     * detect cycles of imports.
1184     * </p>
1185     *
1186     * @param uri An ontology URI
1187     * @return True if the document corresponding to the URI has been successfully loaded
1188     * into this model
1189     */

1190    public boolean hasLoadedImport( String JavaDoc uri );
1191
1192
1193    /**
1194     * <p>
1195     * Record that this model has now imported the document with the given
1196     * URI, so that it will not be re-imported in the future.
1197     * </p>
1198     *
1199     * @param uri A document URI that has now been imported into the model.
1200     */

1201    public void addLoadedImport( String JavaDoc uri );
1202
1203
1204    /**
1205     * <p>
1206     * Record that this model no longer imports the document with the given
1207     * URI.
1208     * </p>
1209     *
1210     * @param uri A document URI that is no longer imported into the model.
1211     */

1212    public void removeLoadedImport( String JavaDoc uri );
1213
1214
1215    /**
1216     * <p>
1217     * Answer the language profile (for example, OWL or DAML+OIL) that this model is
1218     * working to.
1219     * </p>
1220     *
1221     * @return A language profile
1222     */

1223    public Profile getProfile();
1224
1225
1226    /**
1227     * <p>
1228     * Answer the model maker associated with this model (used for constructing the
1229     * constituent models of the imports closure).
1230     * </p>
1231     * @deprecated use getImportModelMaker instead for consistency with name
1232     * changes to OntModelSpec to avoid ambiguity with base vs import makers.
1233     *
1234     * @return The local model maker
1235     */

1236    public ModelMaker getModelMaker();
1237
1238    /**
1239     * <p>
1240     * Answer the model maker associated with this model (used for constructing the
1241     * constituent models of the imports closure).
1242     * </p>
1243     *
1244     * @return The local model maker
1245     */

1246    public ModelMaker getImportModelMaker();
1247
1248    /**
1249     * <p>
1250     * Answer the sub-graphs of this model. A sub-graph is defined as a graph that
1251     * is used to contain the triples from an imported document.
1252     * </p>
1253     *
1254     * @return A list of graphs that are contained in this ontology model
1255     */

1256    public List getSubGraphs();
1257
1258
1259    /**
1260     * <p>Answer an iterator over the ontologies that this ontology imports,
1261     * each of which will have been wrapped as an ontology model using the same
1262     * {@link OntModelSpec} as this model. If this model has no imports,
1263     * the iterator will be non-null but will not have any values.</p>
1264     * @return An iterator, each value of which will be an <code>OntModel</code>
1265     * representing an imported ontology.
1266     */

1267    public ExtendedIterator listImportedModels();
1268
1269
1270    /**
1271     * <p>Answer an <code>OntModel</code> representing the imported ontology
1272     * with the given URI. If an ontology with that URI has not been imported,
1273     * answer null.</p>
1274     * @param uri The URI of an ontology that may have been imported into the
1275     * ontology represented by this model
1276     * @return A model representing the imported ontology with the given URI, or
1277     * null.
1278     */

1279    public OntModel getImportedModel( String JavaDoc uri );
1280
1281
1282    /**
1283     * <p>
1284     * Answer the base model of this model. The base model is the model
1285     * that contains the triples read from the source document for this
1286     * ontology. It is therefore this base model that will be updated if statements are
1287     * added to a model that is built from a union of documents (via the
1288     * <code>imports</code> statements in the source document).
1289     * </p>
1290     *
1291     * @return The base model for this ontology model
1292     */

1293    public Model getBaseModel();
1294
1295
1296    /**
1297     * <p>
1298     * Add the given model as one of the sub-models of the enclosed ontology union model. Will
1299     * cause the associated infererence engine (if any) to update, so this may be
1300     * an expensive operation in some cases.
1301     * </p>
1302     *
1303     * @param model A sub-model to add
1304     * @see #addSubModel( Model, boolean )
1305     */

1306    public void addSubModel( Model model );
1307
1308
1309    /**
1310     * <p>
1311     * Add the given model as one of the sub-models of the enclosed ontology union model.
1312     * </p>
1313     *
1314     * @param model A sub-model to add
1315     * @param rebind If true, rebind any associated inferencing engine to the new data (which
1316     * may be an expensive operation)
1317     */

1318    public void addSubModel( Model model, boolean rebind );
1319
1320
1321    /**
1322     * <p>
1323     * Remove the given model as one of the sub-models of the enclosed ontology union model. Will
1324     * cause the associated infererence engine (if any) to update, so this may be
1325     * an expensive operation in some cases.
1326     * </p>
1327     *
1328     * @param model A sub-model to remove
1329     * @see #addSubModel( Model, boolean )
1330     */

1331    public void removeSubModel( Model model );
1332
1333
1334    /**
1335     * <p>
1336     * Remove the given model as one of the sub-models of the enclosed ontology union model.
1337     * </p>
1338     *
1339     * @param model A sub-model to remove
1340     * @param rebind If true, rebind any associated inferencing engine to the new data (which
1341     * may be an expensive operation)
1342     */

1343    public void removeSubModel( Model model, boolean rebind );
1344
1345
1346    /**
1347     * <p>Answer true if the given node is a member of the base model of this ontology model.
1348     * This is an important distiction, because only the base model receives updates when the
1349     * ontology model is updated. Thus, removing properties of a resource that is not in the base
1350     * model will not actually side-effect the overall model.</p>
1351     * @param node An RDF node (Resource, Property or Literal) to test
1352     * @return True if the given node is from the base model
1353     */

1354    public boolean isInBaseModel( RDFNode node );
1355
1356
1357    /**
1358     * <p>Answer true if the given statement is defined in the base model of this ontology model.
1359     * This is an important distiction, because only the base model receives updates when the
1360     * ontology model is updated. Thus, removing a statement that is not in the base
1361     * model will not actually side-effect the overall model.</p>
1362     * @param stmt A statement to test
1363     * @return True if the given statement is from the base model
1364     */

1365    public boolean isInBaseModel( Statement stmt );
1366
1367
1368    /**
1369     * <p>
1370     * Answer true if this model is currently in <i>strict checking mode</i>. Strict
1371     * mode means
1372     * that converting a common resource to a particular language element, such as
1373     * an ontology class, will be subject to some simple syntactic-level checks for
1374     * appropriateness.
1375     * </p>
1376     *
1377     * @return True if in strict checking mode
1378     */

1379    public boolean strictMode();
1380
1381
1382    /**
1383     * <p>
1384     * Set the checking mode to strict or non-strict.
1385     * </p>
1386     *
1387     * @param strict
1388     * @see #strictMode()
1389     */

1390    public void setStrictMode( boolean strict );
1391
1392
1393    /**
1394     * <p>Set the flag that controls whether adding or removing <i>imports</i>
1395     * statements into the
1396     * model will result in the imports closure changing dynamically.</p>
1397     * @param dynamic If true, adding or removing an imports statement to the
1398     * model will result in a change in the imports closure. If false, changes
1399     * to the imports are not monitored dynamically. Default false.
1400     */

1401    public void setDynamicImports( boolean dynamic );
1402
1403
1404    /**
1405     * <p>Answer true if the imports closure of the model will be dynamically
1406     * updated as imports statements are added and removed.</p>
1407     * @return True if the imports closure is updated dynamically.
1408     */

1409    public boolean getDynamicImports();
1410
1411
1412    /**
1413     * <p>
1414     * Answer a reference to the document manager that this model is using to manage
1415     * ontology &lt;-&gt; mappings, and to load the imports closure. <strong>Note</strong>
1416     * by default, an ontology model is constructed with a reference to the shared,
1417     * global document manager. Thus changing the settings via this model's document
1418     * manager may affect other models also using the same instance.
1419     * </p>
1420     * @return A reference to this model's document manager
1421     */

1422    public OntDocumentManager getDocumentManager();
1423
1424
1425    /**
1426     * <p>Answer the ontology model specification that was used to construct this model</p>
1427     * @return An ont model spec instance.
1428     */

1429    public OntModelSpec getSpecification();
1430
1431
1432    /**
1433     * <p>
1434     * Answer the iterator over the resources from the graph that satisfy the given
1435     * query, followed by the answers to the alternative queries (if specified). A
1436     * typical scenario is that the main query gets resources of a given class (say,
1437     * <code>rdfs:Class</code>), while the altQueries query for aliases for that
1438     * type (such as <code>daml:Class</code>).
1439     * </p>
1440     *
1441     * @param query A query to run against the model
1442     * @param altQueries An optional list of subsidiary queries to chain on to the first
1443     * @return ExtendedIterator An iterator over the (assumed single) results of
1444     * executing the queries.
1445     */

1446    public ExtendedIterator queryFor( BindingQueryPlan query, List altQueries, Class JavaDoc asKey );
1447
1448
1449    /**
1450     * <p>If this OntModel is presenting an OWL model, answer the minimum OWL language
1451     * level that the constructs
1452     * used in this model lie entirely within.
1453     * This method requires that the separately downloadable
1454     * owlsyntax.jar is on the classpath.
1455     * The three possible return values are
1456     * {@link com.hp.hpl.jena.vocabulary.OWL#FULL_LANG FULL_LANG} for OWL-full,
1457     * {@link com.hp.hpl.jena.vocabulary.OWL#DL_LANG DL_LANG} for OWL-DL or
1458     * {@link com.hp.hpl.jena.vocabulary.OWL#LITE_LANG LITE_LANG} for OWL-lite.
1459     * Note that these URI's are <strong>not</strong> officially sanctioned by the WebOnt
1460     * working group. For unknown reasons, the working group chose not to assign official
1461     * URI's to represent the different OWL language levels. There is a slim chance that this
1462     * may change in future, in which case these return values will change apropriately.
1463     * In addition to the method return value,
1464     * the given <code>problems</problems> list, if non-null, will be filled with the syntax
1465     * problems detected by the syntax checker.
1466     * </p>
1467     * <p>
1468     * The Jena OWL syntax checker will normally list as problems those constructs used in
1469     * this model that are in OWL Full but not permitted in OWL DL. The exception to this
1470     * is if the {@linkplain #getProfile() language profile} for this model is
1471     * {@linkplain com.hp.hpl.jena.ontology.impl.OWLLiteProfile OWL Lite}, then the syntax checker will
1472     * test for constructs that lie in OWL-DL or OWL-Full and hence outside in OWL-Lite.
1473     * </p>
1474     * <p>
1475     * <strong>Note</strong> that peforming this test requires every statement in the model
1476     * to be examined, so it can be quite an expensive operation on large models, or on
1477     * persistent database models.
1478     * </p>
1479     *
1480     * @param problems A list that, if non-null, will have the various problems discovered by the OWL syntax
1481     * checker added to it.
1482     * @return A resource denoting the minimum OWL language level for this model
1483     * @exception OntologyException if this model is not an OWL model
1484     */

1485    public Resource getOWLLanguageLevel( List problems );
1486
1487
1488    // output operations
1489

1490    /**
1491     * <p>Write the model as an XML document.
1492     * It is often better to use an OutputStream rather than a Writer, since this
1493     * will avoid character encoding errors.
1494     * <strong>Note:</strong> This method is adapted for the ontology
1495     * model to write out only the base model (which contains the asserted data). To write
1496     * all triples, including imported data and inferred triples, use
1497     * {@link #writeAll( Writer, String, String ) writeAll }.
1498     * </p>
1499     *
1500     * @param writer A writer to which the XML will be written
1501     * @return this model
1502     */

1503    public Model write( Writer writer ) ;
1504
1505    /**
1506     * <p>Write a serialized represention of a model in a specified language.
1507     * It is often better to use an OutputStream rather than a Writer, since this
1508     * will avoid character encoding errors.
1509     * <strong>Note:</strong> This method is adapted for the ontology
1510     * model to write out only the base model (which contains the asserted data). To write
1511     * all triples, including imported data and inferred triples, use
1512     * {@link #writeAll( Writer, String, String ) writeAll }.
1513     * </p>
1514     * <p>The language in which to write the model is specified by the
1515     * <code>lang</code> argument. Predefined values are "RDF/XML",
1516     * "RDF/XML-ABBREV", "N-TRIPLE" and "N3". The default value,
1517     * represented by <code>null</code> is "RDF/XML".</p>
1518     * @param writer The output writer
1519     * @param lang The output language
1520     * @return this model
1521     */

1522    public Model write( Writer writer, String JavaDoc lang ) ;
1523
1524    /**
1525     * <p>Write a serialized represention of a model in a specified language.
1526     * It is often better to use an OutputStream rather than a Writer,
1527     * since this will avoid character encoding errors.
1528     * <strong>Note:</strong> This method is adapted for the ontology
1529     * model to write out only the base model (which contains the asserted data). To write
1530     * all triples, including imported data and inferred triples, use
1531     * {@link #writeAll( Writer, String, String ) writeAll }.
1532     * </p>
1533     * <p>The language in which to write the model is specified by the
1534     * <code>lang</code> argument. Predefined values are "RDF/XML",
1535     * "RDF/XML-ABBREV", "N-TRIPLE" and "N3". The default value,
1536     * represented by <code>null</code>, is "RDF/XML".</p>
1537     * @param writer The output writer
1538     * @param base The base uri for relative URI calculations.
1539     * <code>null</code> means use only absolute URI's.
1540     * @param lang The language in which the RDF should be written
1541     * @return this model
1542     */

1543    public Model write( Writer writer, String JavaDoc lang, String JavaDoc base );
1544
1545    /**
1546     * <p>Write a serialization of this model as an XML document.
1547     * <strong>Note:</strong> This method is adapted for the ontology
1548     * model to write out only the base model (which contains the asserted data). To write
1549     * all triples, including imported data and inferred triples, use
1550     * {@link #writeAll( OutputStream, String, String ) writeAll }.
1551     * </p>
1552     * <p>The language in which to write the model is specified by the
1553     * <code>lang</code> argument. Predefined values are "RDF/XML",
1554     * "RDF/XML-ABBREV", "N-TRIPLE" and "N3". The default value is
1555     * represented by <code>null</code> is "RDF/XML".</p>
1556     * @param out The output stream to which the XML will be written
1557     * @return This model
1558     */

1559    public Model write( OutputStream out );
1560
1561    /**
1562     * <p>Write a serialized represention of this model in a specified language.
1563     * <strong>Note:</strong> This method is adapted for the ontology
1564     * model to write out only the base model (which contains the asserted data). To write
1565     * all triples, including imported data and inferred triples, use
1566     * {@link #writeAll( OutputStream, String, String ) writeAll }.
1567     * </p>
1568     * <p>The language in which to write the model is specified by the
1569     * <code>lang</code> argument. Predefined values are "RDF/XML",
1570     * "RDF/XML-ABBREV", "N-TRIPLE" and "N3". The default value,
1571     * represented by <code>null</code>, is "RDF/XML".</p>
1572     * @param out The output stream to which the RDF is written
1573     * @param lang The output langauge
1574     * @return This model
1575     */

1576    public Model write( OutputStream out, String JavaDoc lang );
1577
1578    /**
1579     * <p>Write a serialized represention of a model in a specified language.
1580     * <strong>Note:</strong> This method is adapted for the ontology
1581     * model to write out only the base model (which contains the asserted data). To write
1582     * all triples, including imported data and inferred triples, use
1583     * {@link #writeAll( OutputStream, String, String ) writeAll }.
1584     * </p>
1585     * <p>The language in which to write the model is specified by the
1586     * <code>lang</code> argument. Predefined values are "RDF/XML",
1587     * "RDF/XML-ABBREV", "N-TRIPLE" and "N3". The default value,
1588     * represented by <code>null</code>, is "RDF/XML".</p>
1589     * @param out The output stream to which the RDF is written
1590     * @param base The base uri to use when writing relative URI's. <code>null</code>
1591     * means use only absolute URI's.
1592     * @param lang The language in which the RDF should be written
1593     * @return This model
1594     */

1595    public Model write( OutputStream out, String JavaDoc lang, String JavaDoc base );
1596
1597    /**
1598     * <p>Write a serialized represention of all of the contents of the model,
1599     * including inferred statements and statements imported from other
1600     * documents. To write only the data asserted in the base model, use
1601     * {@link #write( Writer, String, String ) write}.
1602     * It is often better to use an OutputStream rather than a Writer,
1603     * since this will avoid character encoding errors.
1604     * </p>
1605     * <p>The language in which to write the model is specified by the
1606     * <code>lang</code> argument. Predefined values are "RDF/XML",
1607     * "RDF/XML-ABBREV", "N-TRIPLE" and "N3". The default value,
1608     * represented by <code>null</code>, is "RDF/XML".</p>
1609     * @param writer The output writer
1610     * @param base The base uri for relative URI calculations.
1611     * <code>null</code> means use only absolute URI's.
1612     * @param lang The language in which the RDF should be written
1613     * @return This model
1614     */

1615    public Model writeAll( Writer writer, String JavaDoc lang, String JavaDoc base );
1616
1617    /**
1618     * <p>Write a serialized represention of all of the contents of the model,
1619     * including inferred statements and statements imported from other
1620     * documents. To write only the data asserted in the base model, use
1621     * {@link #write( OutputStream, String, String ) write}.
1622     * </p>
1623     * <p>The language in which to write the model is specified by the
1624     * <code>lang</code> argument. Predefined values are "RDF/XML",
1625     * "RDF/XML-ABBREV", "N-TRIPLE" and "N3". The default value,
1626     * represented by <code>null</code>, is "RDF/XML".</p>
1627     * @param out The output stream to which the RDF is written
1628     * @param base The base uri to use when writing relative URI's. <code>null</code>
1629     * means use only absolute URI's.
1630     * @param lang The language in which the RDF should be written
1631     * @return This model
1632     */

1633    public Model writeAll( OutputStream out, String JavaDoc lang, String JavaDoc base );
1634
1635
1636    /**
1637     * <p>Answer the ontology event manager for this model.</p>
1638     * @return This model's event manager
1639     */

1640    public OntEventManager getEventManager();
1641}
1642
1643
1644/*
1645    (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
1646    All rights reserved.
1647
1648    Redistribution and use in source and binary forms, with or without
1649    modification, are permitted provided that the following conditions
1650    are met:
1651
1652    1. Redistributions of source code must retain the above copyright
1653       notice, this list of conditions and the following disclaimer.
1654
1655    2. Redistributions in binary form must reproduce the above copyright
1656       notice, this list of conditions and the following disclaimer in the
1657       documentation and/or other materials provided with the distribution.
1658
1659    3. The name of the author may not be used to endorse or promote products
1660       derived from this software without specific prior written permission.
1661
1662    THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1663    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1664    OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1665    IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1666    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1667    NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1668    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1669    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1670    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1671    THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1672*/

1673
1674
Popular Tags