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.reference;
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.NameMapper;
18: import nz.org.take.r2ml.XmlTypeHandler;
19: import nz.org.take.r2ml.util.DataPredicates;
20:
21: public class DefaultNameMapper implements NameMapper {
22:
23: private Map<QName, String[]> slotNames = new HashMap<QName, String[]>();
24: private Map<QName, String> attrPredNames = new HashMap<QName, String>();
25:
26: public DefaultNameMapper() {
27: addSlotNames(new QName(DataPredicates.NS_SWRLB, "equal"),
28: new String[] { "equal1", "equal2" });
29: addSlotNames(new QName(DataPredicates.NS_SWRLB, "notEqual"),
30: new String[] { "unEqual1", "unEqual2" });
31: addSlotNames(new QName(DataPredicates.NS_SWRLB, "greaterThan"),
32: new String[] { "high", "low" });
33: addSlotNames(new QName(DataPredicates.NS_SWRLB, "lessThan"),
34: new String[] { "low", "high" });
35: }
36:
37: public String[] getSlotNames(QName predicateID) {
38: String[] names = slotNames.get(predicateID);
39: return names;
40: }
41:
42: public void addSlotNames(QName predicateName, String[] names) {
43: this .slotNames.put(predicateName, names);
44: }
45:
46: protected void addSlotNames(String predicateName, String[] names) {
47: addSlotNames(new QName("", predicateName), names);
48: }
49:
50: public void addSlotNames(Map<QName, String[]> names) {
51: slotNames.putAll(names);
52: }
53:
54: }
|