View Javadoc

1   /*
2    * $Id: Klass.java,v 1.10 2005/06/01 14:36:02 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.dom.owl;
10  
11  import com.bbn.swede.core.dom.ClassNode;
12  import com.bbn.swede.core.dom.OASTException;
13  import com.bbn.swede.core.dom.OASTNode;
14  
15  /***
16   * Custom class node implementation for owl:Class.
17   * @author jlerner
18   */
19  public class Klass extends ClassNode
20  {
21     /***
22      * Default constructor for Klass nodes.
23      */
24     public Klass()
25     {
26     }
27  
28     /***
29      * Manually creates a Klass node.  Use this constructor to build a node
30      * based on specific parameters rather than based on parsed text.  Text to
31      * represent a manually created node can be requested later using
32      * <code>generateNodeText()</code>.
33      * @param sID The rdf:ID for the class.
34      * @param sComment An rdfs:comment to associate with the class, or
35      *                 <code>null</code> for no comment.
36      * @param sLabel An rdfs:label to associate with the class, or
37      *               <code>null</code> for no label.
38      * @see OASTNode#generateNodeText()
39      */
40     public Klass(String sID, String sComment, String sLabel)
41     {
42        try
43        {
44           if (sID != null)
45           {
46              addAttribute("rdf:ID", sID);
47           }
48           addPropertyLiteral("rdfs:comment", sComment);
49           addPropertyLiteral("rdfs:label", sLabel);
50        }
51        catch (OASTException e)
52        {
53           //Do nothing.  The API operations are all in-memory and won't
54           //trigger exceptions.
55        }
56     }
57  
58     /*
59      *  (non-Javadoc)
60      * @see com.bbn.swede.core.dom.OASTNode#allowedChildren()
61      */
62     protected int[] allowedChildren()
63     {
64        return null;
65     }
66  
67     /*
68      *  (non-Javadoc)
69      * @see com.bbn.swede.core.dom.OASTNode#getNodeType()
70      */
71     public int getNodeType()
72     {
73        return OASTNode.OWL_CLASS;
74     }
75  
76  }