View Javadoc

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