View Javadoc

1   /*
2    * @author Giorgos Anestis, TUC/MUSIC
3    * 
4    * @version 2.0 
5    */
6   package org.dbe.studio.tools.ontologyviewer.metamodels.odm;
7   
8   import java.util.Vector;
9   
10  /***
11   * The instance of an OntologyClass. It contains its type (class) as well as
12   * its Datatype Properties (attributes)
13   * 
14   */
15  public abstract class OdmOntologyClassInst {
16  
17  	String name;
18  	String id;
19  	Vector annotationProps;  //list of OdmAnnotationProperty class instances
20  	
21  	OdmOntology theOntology;
22  	OdmOntologyClass type;	
23  	
24  	/***
25  	 * Default constructor 
26  	 */
27  	public OdmOntologyClassInst() {
28  		super();
29  		
30  	}
31  
32  	public OdmOntologyClassInst(OdmOntology ont, String name, String id, OdmOntologyClass type) {				
33  		
34  		// It keeps a reference to the ontology it belongs to
35  		theOntology = ont;			
36  		//It keeps a reference to the class whose it is instance
37  		this.type = type;
38  		//It adds itself to the class extension it belongs to !!
39  		this.type.addClassInstance(this);
40  		
41  		this.name = name;
42  		this.id = id;		
43  		
44  		//It adds itself to the ontology it belongs to !!
45  		theOntology.addClassInstance(this);
46  	}	
47  	
48  	public void addAnnotationProp(OdmAnnotationProperty ap) {
49  		if ( annotationProps == null ) {
50  			annotationProps = new Vector();
51  		}
52  		annotationProps.add(ap);
53  		
54  	}
55  	
56  	public void removeAnnotationProp(OdmAnnotationProperty ap) {
57  		if (annotationProps != null) {
58  			annotationProps.remove(ap);
59  		}
60  	}
61  		
62  	public void setName(String name) {
63  		this.name = name;
64  	}
65  	
66  	public void setId(String id) {
67  		this.id = id;
68  	}
69  	
70  	public void setType(OdmOntologyClass type) {
71  		this.type = type;
72  	}
73  	
74  	public void setOntology(OdmOntology ont) {
75  		theOntology = ont;
76  	}
77  	
78  	public void setAnnotationProps(Vector a) {
79  		annotationProps = a;
80  	}
81  	
82  	public String getName() {
83  		return name;
84  	}
85  	
86  	public String getId() {
87  		return id;
88  	}
89  	
90  	public OdmOntologyClass getType() {
91  		return type;
92  	}
93  	
94  	public OdmOntology getOntology() {
95  		return theOntology;
96  	}
97  	
98  	public Vector getAnnotationProps() {
99  		return annotationProps;
100 	}
101 }