View Javadoc

1   /*
2    * $Id: RDFSNamespaceSuggester.java,v 1.4 2005/02/28 22:39:40 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.editor.contentassist;
10  
11  import com.bbn.swede.core.dom.OASTNode;
12  
13  /***
14   * Subclass of DefaultNamespaceSuggester preloaded with all of the
15   * classes and properties of the RDFS namespace.
16   * 
17   * @author aperezlo
18   */
19  public class RDFSNamespaceSuggester extends DefaultNamespaceSuggester
20  {
21     /***
22      * Default constructor.
23      *
24      */
25     public RDFSNamespaceSuggester()
26     {
27        super();
28        int type = ISuggestionCandidate.UNKNOWN;
29        for(int i = 0; i < OASTNode.AS_RDFS.length; i++)
30        {
31           type = Character.isUpperCase(OASTNode.AS_RDFS[i].charAt(0)) 
32              ? ISuggestionCandidate.CLASS : ISuggestionCandidate.PROPERTY;
33           _elements.add(new DefaultSuggestionCandidate(OASTNode.AS_RDFS[i], type));
34        }
35  
36        _uri = OASTNode.S_RDFS_URI;
37     }
38     
39     /***
40      * Indicates whether the suggestor has any completion proposals for the text
41      * typed so far.  This implementation always returns true.
42      * @param alreadyTyped what has already been typed by the user (with any namespaces removed)
43      * @return <code>true</code>
44      * @see com.bbn.swede.editor.contentassist.INamespaceSuggester#hasSuggestions(java.lang.String)
45      */
46     public boolean hasSuggestions(String alreadyTyped) 
47     { 
48        return true; 
49     }
50  }