View Javadoc

1   /*
2    * $Id: OWLClass.java,v 1.4 2005/05/31 16:26:41 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   package com.bbn.swede.core.resources;
9   
10  import com.bbn.swede.core.IOWLClass;
11  import com.hp.hpl.jena.rdf.model.Resource;
12  
13  /***
14   * Implementation for OWL class elements.
15   * @author jlerner
16   */
17  public class OWLClass extends OWLElement implements IOWLClass
18  {
19     /***
20      * The Jena resource represented by this OWL class element.
21      */
22     protected Resource _jenaResource;
23     /***
24      * Creates an OWL class element based on a Jena resource.
25      * @param res The Jena resource.
26      */
27     OWLClass(Resource res)
28     {
29        _jenaResource = res;
30        _sElementName =
31           (res.isAnon() ? res.getId().toString() : res.getLocalName());
32     }
33  
34     /* (non-Javadoc)
35      * @see com.bbn.swede.core.IOWLClass#isAnonymous()
36      */
37     public boolean isAnonymous()
38     {
39        Resource res = getJenaResource();
40        boolean toReturn = true;
41        if(res != null)
42        {
43           toReturn = res.isAnon();
44        }
45        return toReturn;
46     }
47     /*
48      *  (non-Javadoc)
49      * @see com.bbn.swede.core.IOWLElement#getURI()
50      */
51     public String getURI()
52     {
53        return _jenaResource.getURI();
54     }
55  
56     /***
57      * Retrieves the Jena resource this OWL class element is based on.
58      * @return The Jena resource.
59      */
60     public Resource getJenaResource()
61     {
62        return _jenaResource;
63     }
64  }