1   /*
2    * ObjectPropertyImpl.java
3    *
4    * Copyright (c) 2002, The University of Sheffield.
5    *
6    * This file is part of GATE (see http://gate.ac.uk/), and is free
7    * software, licenced under the GNU Library General Public License,
8    * Version 2, June1991.
9    *
10   * A copy of this licence is included in the distribution in the file
11   * licence.html, and is also available at http://gate.ac.uk/gate/licence.html.
12   *
13   * Kalina Bontcheva 11/2003
14   *
15   *
16   *  $Id: ObjectPropertyImpl.java,v 1.1 2004/07/23 17:48:08 kalina Exp $
17   */
18  
19  package gate.creole.ontology;
20  
21  import java.util.HashSet;
22  import java.util.Set;
23  
24  public class ObjectPropertyImpl extends PropertyImpl implements ObjectProperty {
25  
26    private OClass range;
27    private Set inversePropertiesSet;
28  
29    public ObjectPropertyImpl(String aName, OClass aDomain, OClass aRange,
30                                Ontology aKB) {
31      super(aName, aDomain, aKB);
32      range = aRange;
33      inversePropertiesSet = new HashSet();
34    }
35  
36    public boolean isValueCompatible(Object value) {
37      if (value instanceof OClass)
38        return true;
39      return false;
40    }
41  
42    public Object getRange() {
43      return range;
44    }
45  
46    public Set getInverseProperties() {
47      return this.inversePropertiesSet;
48    }
49  
50    public void setInverseOf(Property theInverse) {
51      this.inversePropertiesSet.add(theInverse);
52    }
53  
54    public String toString() {
55      return this.getName() + "(" + this.getDomain() + "," + this.range + ")" +
56              "\n sub-propertyOf "
57              + this.getSubPropertyOf().toString() +
58              "\n samePropertyAs " +
59              this.getSamePropertyAs().toString();
60    }
61  
62  }