View Javadoc

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