View Javadoc

1   /*
2    * $Id: IOWLModel.java,v 1.12 2005/06/01 17:38:38 jlerner Exp $
3    *
4    * Copyright (c) 1999-2004, BBN Technologies, LLC.
5    * All rights reserved.
6    * http://www.daml.org/legal/opensource/bbn_license.html
7    */
8   
9   package com.bbn.swede.core;
10  
11  import org.eclipse.core.resources.IFolder;
12  import org.eclipse.core.resources.IResource;
13  import org.eclipse.core.resources.IWorkspace;
14  
15  /***
16   * Protocol specific to the OWL model element.
17   * @author jlerner
18   * @author tself
19   */
20  public interface IOWLModel extends IOWLElement
21  {
22     /***
23      * Adds any IOWLElement (except IOWLProject) to model.
24      * @param e IOWLElement object
25      * @return IOWLElement representing the object added
26      */
27     IOWLElement add(IOWLElement e);
28  
29     /***
30      * Returns an OWL project with a given name, which may or may not exist.
31      * @param sProjectName name of the desired project
32      * @return an OWL project with the specified name
33      */
34     IOWLProject getOWLProject(String sProjectName);
35  
36     /***
37      * Returns the OWL projects within the model.
38      * @return An array containing all OWL projects in the model, or an empty
39      *         array if there are none
40      */
41     IOWLProject[] getOWLProjects();
42  
43     /***
44      * Returns the workspace associated with this OWL model.
45      * @return the workspace associated with this OWL model
46      */
47     IWorkspace getWorkspace();
48  
49     /***
50      * Indicates whether the OWL model contains an IOWLElement based on the
51      * given resource.
52      * @param resource the resource to locate in the OWL model
53      * @return <code>true</code> if the specified resource exists in the model
54      */
55     boolean contains(IResource resource);
56  
57     /***
58      * Creates an OWL folder based on an Eclipse folder resource.  If the folder
59      * does not contain any OWL elements, no OWL folder will be created.
60      * @param folder The folder to integrate into the OWL model
61      * @return An IOWLFolder representing the folder resource.  This may be
62      *         one that already existed in the model, or <code>null</code> if
63      *         <code>folder</code> contains now OWL elements.
64      */
65     IOWLFolder makeOWLFolder(IFolder folder);
66  
67     /***
68      * Returns the OWL documents in this project that were
69      * imported from the web.
70      * @param proj IOWLProject to search in
71      * @return Array of IOWLExternalDocument objects
72      */
73     IOWLExternalDocument[] getImportedDocuments(IOWLProject proj);
74  
75     /***
76      * Returns the OWL document imported from a URI into this project.
77      * @param proj The project to check for the document
78      * @param uri external URI of document
79      * @return IOWLExternalDocument of local cached copy of the document, or
80      *         <code>null</code> if no document exists in <code>proj</code> with
81      *         the given URI.
82      */
83     IOWLExternalDocument getImportedDocument(IOWLProject proj, String uri);
84     
85     /***
86      * <p>Tells the model to associate the globally available Ontology Library 
87      * with a Semantic Web project.</p>
88      * 
89      * <p>If the name is not that of an available library, no change will 
90      * occur to the project's library registry, and the method will
91      * return false.  Otherwise, the library will be added, and the 
92      * method will return true.</p>
93      * @param project The project
94      * @param libraryNameToAdd The name of the library to add
95      * @return <code>true</code> if the library is added successfully,
96      *         <code>false</code> if there is no library matching the specified
97      *         name.
98      */
99     boolean addLibrary(IOWLProject project, String libraryNameToAdd);
100 
101    /***
102     * <p>Tells the model to disassociate a globally available Ontology Library
103     * from a specific Semantic Web project.</p>
104     * 
105     * <p>If the name is not included in the project's registry, no change will 
106     * occur, and the method will return false.  Otherwise, the library will 
107     * be removed, and the method will return true.</p>
108     * @param project The project
109     * @param libraryNameToRemove The name of the library to remove
110     * @return <code>true</code> if the library reference is removed successfully,
111     *         <code>false</code> if there was no reference to remove.
112     */   
113    boolean removeLibrary(IOWLProject project, String libraryNameToRemove);
114    
115    
116    /***
117     * Builds the OWL model.  Only the first level of the model (i.e. the 
118     * projects) is determined, as further levels of detail are not needed until
119     * element info is requested for a project.
120     */
121    void build();
122 }