1
18
19 package gate.creole.ontology;
20
21 public class DatatypePropertyImpl extends PropertyImpl
22 implements DatatypeProperty{
23 private Object range;
24
25 public DatatypePropertyImpl(String aName, OClass aDomain, String aString, Ontology aKB) {
26 super(aName, aDomain, aKB);
27 range = aString;
28 }
29
30 public DatatypePropertyImpl(String aName, OClass aDomain, Number number, Ontology aKB) {
31 super(aName, aDomain, aKB);
32 range = number;
33 }
34
35 public boolean isValueCompatible(Object value) {
36 if (value instanceof String)
37 return true;
38 else if (value instanceof Number)
39 return true;
40 return false;
41 }
42
43 public Object getRange() {
44 return range;
45 }
46
47 public String toString() {
48 return this.getName() + "(" + this.getDomain() + "," + this.range + ")" +
49 "\n sub-propertyOf "
50 + this.getSubPropertyOf().toString() +
51 "\n samePropertyAs " +
52 this.getSamePropertyAs().toString();
53 }
54
55 }