01: /*
02: * Copyright 2007 Bastian Schenke Licensed under the Apache License, Version 2.0 (the "License");
03: * you may not use this file except in compliance with the License.
04: * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
05: * Unless required by applicable law or agreed to in writing, software distributed under the
06: * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
07: * either express or implied. See the License for the specific language governing permissions
08: * and limitations under the License.
09: */
10: package nz.org.take.r2ml.util;
11:
12: import java.util.HashMap;
13: import java.util.Map;
14:
15: import javax.xml.namespace.QName;
16:
17: import nz.org.take.r2ml.R2MLException;
18:
19: /**
20: * @author Bastian Schenke (bastian.schenke(at)googlemail.com)
21: *
22: */
23: public class DataPredicates {
24:
25: public static final String NS_SWRLB = "http://www.w3.org/2003/11/swrlb";
26: private static Map<QName, String> dataPredicateNames = new HashMap<QName, String>();
27:
28: static {
29: dataPredicateNames.put(new QName(NS_SWRLB, "equal"), "==");
30: dataPredicateNames.put(new QName(NS_SWRLB, "notEqual"), "!=");
31: dataPredicateNames.put(new QName(NS_SWRLB, "lessThan"), "<");
32: dataPredicateNames.put(new QName(NS_SWRLB, "lessThanOrEqual"),
33: "<=");
34: dataPredicateNames.put(new QName(NS_SWRLB, "greaterThan"), ">");
35: dataPredicateNames.put(
36: new QName(NS_SWRLB, "greaterThanOrEqual"), ">=");
37: }
38:
39: public static String getComparisonSymbol(QName datatypePredicateID)
40: throws R2MLException {
41: if (datatypePredicateID == null) {
42: throw new R2MLException("undefined predicateID");
43: }
44: return dataPredicateNames.get(datatypePredicateID);
45: }
46:
47: }
|