View Javadoc

1   /*
2    * $Id: Ontology.java,v 1.16 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.GenericThing;
13  import com.bbn.swede.core.dom.OASTException;
14  import com.bbn.swede.core.dom.OASTNode;
15  
16  /***
17   * Custom class node implementation for owl:Ontology.
18   * @author jlerner
19   */
20  public class Ontology extends ClassNode
21  {
22     /***
23      * Default constructor for Ontology nodes.
24      */
25     public Ontology()
26     {
27  
28     }
29     
30     /***
31      * URI for the Dublin Core Element Set ontology.
32      */
33     public static final String S_URI_DC =
34        "http://orlando.drc.com/SemanticWeb/OWL/Ontology/DC/ver/0.1.0/dces-ont#";
35     /***
36      * URI for the DRC versioning ontology.
37      */
38     public static final String S_URI_VES =
39        "http://orlando.drc.com/SemanticWeb/OWL/Ontology/VES/ver/0.1.0/drc-ves-ont#";
40     /***
41      * Manually creates an Ontology node.  Use this constructor to build a node
42      * based on specific parameters rather than parsed text.  Text to represent
43      * a manually generated node can be requested later using
44      * <code>generateNodeText()</code>.
45      * @param title A title for the ontology, or <code>null</code> for none.
46      * @param version A version number, or <code>null</code> for none.
47      * @param email A contact e-mail address, or <code>null</code> for none.
48      * @param creator A creator name, or <code>null</code> for none.
49      * @param contributor A contributor name, or <code>null</code> for none.
50      * @param releaseDate A release date, or <code>null</code> for none.
51      * @param releaseLevel A release level, or <code>null</code> for none.
52      * @param status A status description, or <code>null</code> for none.
53      * @param comment Comment text to be added as an rdfs:comment, or 
54      *                <code>null</code> for none.
55      * @see OASTNode#generateNodeText()
56      */
57     public Ontology(
58        String title,
59        String version,
60        String email,
61        String creator,
62        String contributor,
63        String releaseDate,
64        String releaseLevel,
65        String status,
66        String comment)
67     {
68        try
69        {
70           addAttribute("rdf:about", "");
71  
72           GenericThing thing = new GenericThing("ves:VersionData");
73           thing.addPropertyLiteral("dc:title", title);
74           thing.addPropertyLiteral("ves:version", version);
75           thing.addPropertyLiteral("ves:email", email);
76           thing.addPropertyLiteral("dc:creator", creator);
77           thing.addPropertyLiteral("dc:contributor", contributor);
78           thing.addPropertyLiteral("ves:releaseDate", releaseDate);
79           thing.addPropertyLiteral("ves:releaseLevel", releaseLevel);
80           thing.addPropertyLiteral("ves:status", status);
81  
82           if (thing.getChildren().length > 0)
83           {
84              addPropertyTag("ves:versioning", thing);
85              addPropertyResource("owl:imports", S_URI_DC);
86              addPropertyResource("owl:imports", S_URI_VES);
87           }
88           addPropertyLiteral("rdfs:comment", comment);
89        }
90        catch (OASTException e)
91        {
92           //Do nothing.  The API operations are all in-memory and won't
93           //trigger exceptions.
94        }
95     }
96  
97     /*
98      *  (non-Javadoc)
99      * @see com.bbn.swede.core.dom.OASTNode#allowedChildren()
100     */
101    protected int[] allowedChildren()
102    {
103       return null;
104    }
105 
106    /*
107     *  (non-Javadoc)
108     * @see com.bbn.swede.core.dom.OASTNode#getNodeType()
109     */
110    public int getNodeType()
111    {
112       return OASTNode.OWL_ONTOLOGY;
113    }
114 
115 }