-
Notifications
You must be signed in to change notification settings - Fork 14
/
Lists.java
110 lines (101 loc) · 5 KB
/
Lists.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/**
* Copyright (C) 2016 Czech Technical University in Prague
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cz.cvut.kbss.ontodriver;
import cz.cvut.kbss.ontodriver.descriptor.ReferencedListDescriptor;
import cz.cvut.kbss.ontodriver.descriptor.ReferencedListValueDescriptor;
import cz.cvut.kbss.ontodriver.descriptor.SimpleListDescriptor;
import cz.cvut.kbss.ontodriver.descriptor.SimpleListValueDescriptor;
import cz.cvut.kbss.ontodriver.exception.OntoDriverException;
import cz.cvut.kbss.ontodriver.model.Axiom;
import cz.cvut.kbss.ontodriver.model.NamedResource;
import java.util.List;
/**
* This interface is used to work with ontology sequences. </p>
* <p>
* Currently, two kinds of sequences are supported:
* <ul>
* <li><b>Simple lists</b> - simple LISP-style singly-linked lists, where each node is the subject of a statement pointing to the next node,</li>
* <li><b>Referenced lists</b> - lists, where each node points to the next element and also to its contents.</li>
* </ul>
*
* @author kidney
*/
public interface Lists {
/**
* Loads simple list specified by the descriptor. </p>
* <p>
* The returned axioms should be iterable in the same order as they were put into the sequence in the ontology.
*
* @param descriptor Describes the list's properties as well as the context from which the list should be loaded.
* @return Axioms matching the specified list descriptor
* @throws OntoDriverException If an ontology access error occurs
* @throws IllegalStateException If called on a closed connection
*/
List<Axiom<NamedResource>> loadSimpleList(SimpleListDescriptor descriptor) throws OntoDriverException;
/**
* Persists simple list values specified by the descriptor. </p>
* <p>
* The sequence is persisted in the order in which it appears in the descriptor.
*
* @param descriptor List values descriptor
* @throws OntoDriverException If an ontology access error occurs
* @throws IllegalStateException If called on a closed connection
*/
void persistSimpleList(SimpleListValueDescriptor descriptor) throws OntoDriverException;
/**
* Updates simple list based on values specified in the descriptor. </p>
* <p>
* It is up to the driver implementation to decide whether the old list will be removed and the new values inserted
* or whether a merge will be performed.
*
* @param descriptor List values descriptor
* @throws OntoDriverException If an ontology access error occurs
* @throws IllegalStateException If called on a closed connection
*/
void updateSimpleList(SimpleListValueDescriptor descriptor) throws OntoDriverException;
/**
* Loads referenced list specified by the descriptor. </p>
* <p>
* The returned axioms should be iterable in the same order as they were put into the sequence in the ontology.
*
* @param descriptor Describes list's properties, including node content assertion. Also may specify context from
* which the list should be loaded
* @return Axioms matching the specified list descriptor
* @throws OntoDriverException If an ontology access error occurs
* @throws IllegalStateException If called on a closed connection
*/
List<Axiom<NamedResource>> loadReferencedList(ReferencedListDescriptor descriptor) throws OntoDriverException;
/**
* Persists referenced list values specified by the descriptor. </p>
* <p>
* The sequence is persisted in the order in which it appears in the descriptor.
*
* @param descriptor List values descriptor
* @throws OntoDriverException If an ontology access error occurs
* @throws IllegalStateException If called on a closed connection
*/
void persistReferencedList(ReferencedListValueDescriptor descriptor) throws OntoDriverException;
/**
* Updates referenced list based on the values in the specified list descriptor. </p>
* <p>
* It is up to the driver implementation whether the update will be realized by removing the old list and persisting
* the new values, or by merging the new list into the old one.
*
* @param descriptor List values descriptor
* @throws OntoDriverException If an ontology access error occurs
* @throws IllegalStateException If called on a closed connection
*/
void updateReferencedList(ReferencedListValueDescriptor descriptor) throws OntoDriverException;
}