1   /*
2    * OInstanceImpl.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 03/2003
14   *
15   *
16   *  $Id: OInstanceImpl.java,v 1.14 2006/02/05 23:48:47 valyt Exp $
17   */
18  package gate.creole.ontology;
19  
20  import java.util.HashMap;
21  import java.util.HashSet;
22  import java.util.Set;
23  
24  public class OInstanceImpl extends OntologyResourceImpl implements OInstance {
25    protected Object userData;
26    protected Set instanceClasses;
27  
28    public OInstanceImpl(String name, String comment, Set classes,
29            Ontology ontology) {
30      super(name, comment, ontology);
31      this.instanceClasses = new HashSet(classes);
32      this.instanceProperties = new HashMap();
33      setURI(ontology.getDefaultNameSpace() + name);
34    }
35  
36    public OInstanceImpl(String name, String comment, OClass aClass,
37            Ontology ontology) {
38      this(name, comment, new HashSet(), ontology);
39      instanceClasses.add(aClass);
40    }
41  
42    public Set getOClasses() {
43      return instanceClasses;
44    }
45  
46    public String toString() {
47      return getName();
48    }
49  
50    /**
51     * Sets the user data of this instance. To be used to store arbitrary data on
52     * instances.
53     */
54    public void setUserData(Object theUserData) {
55      userData = theUserData;
56    }
57  
58    /**
59     * Gets the user data of this instance.
60     * 
61     * @return the object which is user data
62     */
63    public Object getUserData() {
64      return userData;
65    }
66  
67    public void setDifferentFrom(OInstance theIndividual) {
68      System.out.println("setDifferentFrom not supported yet");
69    }
70  
71    public Set getDifferentFrom() {
72      System.out.println("getDifferentFrom not supported yet");
73      return null;
74    }
75  
76    public void setSameIndividualAs(OInstance theIndividual) {
77      System.out.println("setSameIndividualAs not supported yet");
78    }
79  
80    public Set getSameIndividualAs() {
81      System.out.println("getSameIndividualAs not supported yet");
82      return null;
83    }
84  }