01: package org.openrdf.sail.rdbms.managers;
02:
03: import java.sql.SQLException;
04: import java.util.Map;
05:
06: import info.aduna.collections.LRUMap;
07:
08: import org.openrdf.sail.rdbms.model.RdbmsURI;
09:
10: public class PredicateManager {
11: private UriManager uris;
12: private Map<Number, String> predicates = new LRUMap<Number, String>(
13: 64);
14:
15: public void setUriManager(UriManager uris) {
16: this .uris = uris;
17: }
18:
19: public Number getIdOfPredicate(RdbmsURI uri) throws SQLException,
20: InterruptedException {
21: Number id = uris.getInternalId(uri);
22: synchronized (predicates) {
23: predicates.put(id, uri.stringValue());
24: }
25: return id;
26: }
27:
28: public String getPredicateUri(Number id) {
29: synchronized (predicates) {
30: return predicates.get(id);
31: }
32: }
33:
34: public void remove(Number id) {
35: synchronized (predicates) {
36: predicates.remove(id);
37: }
38: }
39: }
|