01: /**
02: * Copyright 2007 Jens Dietrich 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: */package nz.org.take;
10:
11: import java.util.Collection;
12: import java.util.List;
13:
14: /**
15: * Interface for containers managing knowledge.
16: * Knowledge bases are also knowlegde sources, the getKnowledgeBase method should return <b>this</b>.
17: * @author <a href="http://www-ist.massey.ac.nz/JBDietrich/">Jens Dietrich</a>
18: */
19:
20: public interface KnowledgeBase extends Annotatable, Visitable,
21: KnowledgeSource {
22:
23: /**
24: * Retrieve knowledge by id.
25: * @param id an id
26: * @return a knowledge element
27: */
28: public KnowledgeElement getElement(String id);
29:
30: /**
31: * Retrieve knowledge by predicate.
32: * @param p the predicate
33: * @return knowledge elements
34: */
35: public List<KnowledgeElement> getElements(Predicate p);
36:
37: /**
38: * Get all elements.
39: * @return knowledge elements
40: */
41: public List<KnowledgeElement> getElements();
42:
43: /**
44: * Get all queries.
45: * @return queries
46: */
47: public List<Query> getQueries();
48:
49: /**
50: * Get all predicates for which knowledge elements are available.
51: * @return predicates
52: */
53: public Collection<Predicate> getSupportedPredicates();
54:
55: /**
56: * Add an element.
57: * @param e an element
58: */
59: public void add(KnowledgeElement e);
60:
61: /**
62: * Remove an element, return true if this succeeded.
63: * @param e an element
64: * @return a boolean
65: */
66: public boolean remove(KnowledgeElement e);
67:
68: /**
69: * Add a query.
70: * @param q a query
71: */
72: public void add(Query q);
73:
74: /**
75: * Remove a query, return true if this succeeded.
76: * @param q a query
77: * @return a boolean
78: */
79: public boolean remove(Query q);
80:
81: }
|