01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 2008.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.sail.rdbms.schema;
07:
08: import java.util.Arrays;
09:
10: /**
11: * Indicates the different type of internal id used within the store and some
12: * basic properties.
13: *
14: * @author James Leigh
15: *
16: */
17: public enum ValueType {
18: // 0000 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101
19: URI, URI_LONG, BNODE, SIMPLE, SIMPLE_LONG, TYPED, TYPED_LONG, NUMERIC, DATETIME, DATETIME_ZONED, LANG, LANG_LONG, XML, B14, B15, B16;
20:
21: private int index;
22: static {
23: for (ValueType type : values()) {
24: type.index = Arrays.asList(values()).indexOf(type);
25: }
26: }
27:
28: public int index() {
29: return index;
30: }
31:
32: public boolean isBNode() {
33: return BNODE.equals(this );
34: }
35:
36: public boolean isURI() {
37: return URI.equals(this ) || URI_LONG.equals(this );
38: }
39:
40: public boolean isLiteral() {
41: return !BNODE.equals(this ) && !URI.equals(this )
42: && !URI_LONG.equals(this );
43: }
44:
45: public boolean isSimpleLiteral() {
46: return SIMPLE.equals(this ) || SIMPLE_LONG.equals(this );
47: }
48:
49: public boolean isLanguageLiteral() {
50: return LANG.equals(this ) || LANG_LONG.equals(this );
51: }
52:
53: public boolean isTypedLiteral() {
54: return isLiteral() && !isSimpleLiteral()
55: && !isLanguageLiteral();
56: }
57:
58: public boolean isNumericLiteral() {
59: return NUMERIC.equals(this );
60: }
61:
62: public boolean isCalendarLiteral() {
63: return DATETIME.equals(this ) || DATETIME_ZONED.equals(this );
64: }
65:
66: public boolean isLong() {
67: return URI_LONG.equals(this) || SIMPLE_LONG.equals(this)
68: || LANG_LONG.equals(this) || TYPED_LONG.equals(this)
69: || XML.equals(this);
70: }
71: }
|