2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017 Amdocs
7 * ===================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END============================================
20 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 package org.onap.aai.champcore;
24 import java.util.List;
26 import java.util.Optional;
27 import java.util.stream.Stream;
29 import org.onap.aai.champcore.exceptions.ChampIndexNotExistsException;
30 import org.onap.aai.champcore.exceptions.ChampMarshallingException;
31 import org.onap.aai.champcore.exceptions.ChampObjectNotExistsException;
32 import org.onap.aai.champcore.exceptions.ChampRelationshipNotExistsException;
33 import org.onap.aai.champcore.exceptions.ChampSchemaViolationException;
34 import org.onap.aai.champcore.exceptions.ChampTransactionException;
35 import org.onap.aai.champcore.exceptions.ChampUnmarshallingException;
36 import org.onap.aai.champcore.model.ChampObject;
37 import org.onap.aai.champcore.model.ChampObjectConstraint;
38 import org.onap.aai.champcore.model.ChampObjectIndex;
39 import org.onap.aai.champcore.model.ChampPartition;
40 import org.onap.aai.champcore.model.ChampRelationship;
41 import org.onap.aai.champcore.model.ChampRelationshipConstraint;
42 import org.onap.aai.champcore.model.ChampRelationshipIndex;
43 import org.onap.aai.champcore.model.ChampSchema;
45 public interface ChampGraph {
48 * Opens a transaction within the graph data store.
50 * @return - A transaction object.
52 public ChampTransaction openTransaction();
55 * Attempts to commit the supplied open transaction.
57 * @param transaction - The transaction to be committed.
59 * @throws ChampTransactionException - If an attempt to commit or rollback the transaction failed.
61 public void commitTransaction(ChampTransaction transaction) throws ChampTransactionException;
64 * Attempts to roll back the supplied open transaction.
66 * @param transaction - The transaction to be committed.
68 * @throws ChampTransactionException - If an attempt to commit or rollback the transaction failed.
70 public void rollbackTransaction(ChampTransaction transaction) throws ChampTransactionException;
73 * Create/Update an object.
75 * If the ChampObject key is present, an update will be attempted,
76 * otherwise a create will be attempted. Each implementation has different guarantees on
77 * validation - see the specific implementation for more details on this.
79 * @param object - The ChampObject that you wish to store in the graph
81 * @return The ChampObject as it was stored
83 * @throws ChampMarshallingException If the {@code object} is not able to be marshalled into the backend representation
84 * @throws ChampSchemaViolationException If the {@code object} violates the constraints specifed by {@link ChampGraph#retrieveSchema}
85 * @throws ChampObjectNotExistsException If {@link org.onap.aai.champcore.model.ChampObject#getKey}.isPresent() but the object cannot be found in the graph
86 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
88 public ChampObject storeObject(ChampObject object) throws ChampMarshallingException, ChampSchemaViolationException, ChampObjectNotExistsException, ChampTransactionException;
91 * Create/Update an object.
93 * If the ChampObject key is present, an update will be attempted,
94 * otherwise a create will be attempted. Each implementation has different guarantees on
95 * validation - see the specific implementation for more details on this.
97 * If a transaction context is not provided, then a transaction will be automatically
98 * created and committed for this operation only, otherwise, the supplied transaction
99 * will be used and it will be up to the caller to commit the transaction at its
102 * @param object - The ChampObject that you wish to store in the graph
103 * @param transaction - Optional transaction context to perform the operation in.
105 * @return The ChampObject as it was stored
107 * @throws ChampMarshallingException If the {@code object} is not able to be marshalled into the backend representation
108 * @throws ChampSchemaViolationException If the {@code object} violates the constraints specifed by {@link ChampGraph#retrieveSchema}
109 * @throws ChampObjectNotExistsException If {@link org.onap.aai.champcore.model.ChampObject#getKey}.isPresent() but the object cannot be found in the graph
110 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
112 public ChampObject storeObject(ChampObject object, Optional<ChampTransaction> transaction) throws ChampMarshallingException, ChampSchemaViolationException, ChampObjectNotExistsException, ChampTransactionException;
115 * Replace an object. ChampObject key is mandatory
117 * Each implementation has different guarantees on validation - see the specific implementation
118 * for more details on this.
120 * @param object - The ChampObject that you wish to replace in the graph
122 * @return The ChampObject as it was stored
124 * @throws ChampMarshallingException If the {@code object} is not able to be marshalled into the backend representation
125 * @throws ChampSchemaViolationException If the {@code object} violates the constraints specifed by {@link ChampGraph#retrieveSchema}
126 * @throws ChampObjectNotExistsException If {@link org.onap.aai.champcore.model.ChampObject#getKey} is not present or object not found in the graph
127 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
129 public ChampObject replaceObject(ChampObject object) throws ChampMarshallingException, ChampSchemaViolationException, ChampObjectNotExistsException, ChampTransactionException;
132 * Replace an object. ChampObject key is mandatory
134 * Each implementation has different guarantees on validation - see the specific implementation
135 * for more details on this.
137 * If a transaction context is not provided, then a transaction will be automatically
138 * created and committed for this operation only, otherwise, the supplied transaction
139 * will be used and it will be up to the caller to commit the transaction at its
142 * @param object - The ChampObject that you wish to replace in the graph
143 * @param transaction - Optional transaction context to perform the operation in.
145 * @return The ChampObject as it was stored
147 * @throws ChampMarshallingException If the {@code object} is not able to be marshalled into the backend representation
148 * @throws ChampSchemaViolationException If the {@code object} violates the constraints specifed by {@link ChampGraph#retrieveSchema}
149 * @throws ChampObjectNotExistsException If {@link org.onap.aai.champcore.model.ChampObject#getKey} is not present or object not found in the graph
150 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
152 public ChampObject replaceObject(ChampObject object, Optional<ChampTransaction> transaction) throws ChampMarshallingException, ChampSchemaViolationException, ChampObjectNotExistsException, ChampTransactionException;
155 * Retrieve an object by its key.
157 * @param key - The key of the ChampObject in the graph {@link org.onap.aai.champcore.model.ChampObject#getKey()}
159 * @return The {@link org.onap.aai.champcore.model.ChampObject} if it was present, otherwise {@link Optional#empty()}
161 * @throws ChampUnmarshallingException If the object was found, but could not be unmarshalled
162 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
164 public Optional<ChampObject> retrieveObject(Object key) throws ChampUnmarshallingException, ChampTransactionException;
168 * Retrieve an object by its key.
170 * If a transaction context is not provided, then a transaction will be automatically
171 * created and committed for this operation only, otherwise, the supplied transaction
172 * will be used and it will be up to the caller to commit the transaction at its
175 * @param key - The key of the ChampObject in the graph {@link org.onap.aai.champcore.model.ChampObject#getKey()}
176 * @param transaction - Optional transaction context to perform the operation in.
178 * @return The {@link org.onap.aai.champcore.model.ChampObject} if it was present, otherwise {@link Optional#empty()}
180 * @throws ChampUnmarshallingException If the object was found, but could not be unmarshalled
181 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
183 public Optional<ChampObject> retrieveObject(Object key, Optional<ChampTransaction> transaction) throws ChampUnmarshallingException, ChampTransactionException;
186 * Delete an object by its key.
188 * @param key - The key of the ChampObject in the graph {@link ChampObject#getKey}
190 * @throws ChampObjectNotExistsException If the object did not exist in the graph
191 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
193 public void deleteObject(Object key) throws ChampObjectNotExistsException, ChampTransactionException;
196 * Delete an object by its key.
198 * If a transaction context is not provided, then a transaction will be automatically
199 * created and committed for this operation only, otherwise, the supplied transaction
200 * will be used and it will be up to the caller to commit the transaction at its
203 * @param key - The key of the ChampObject in the graph {@link ChampObject#getKey}
204 * @param transaction - Optional transaction context to perform the operation in.
206 * @throws ChampObjectNotExistsException If the object did not exist in the graph
207 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
209 public void deleteObject(Object key, Optional<ChampTransaction> transaction) throws ChampObjectNotExistsException, ChampTransactionException;
212 * Retrieve all the objects whose properties match the given {@code queryParams}
214 * @param queryParams - The key/value pairs which are found in {@link ChampObject#getProperties}
216 * @return - A {@link Stream} where each {@link ChampObject#getProperties} contains the {@code queryParams}
218 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
220 public Stream<ChampObject> queryObjects(Map<String, Object> queryParams) throws ChampTransactionException;
224 * Retrieve all the objects whose properties match the given {@code queryParams}
226 * If a transaction context is not provided, then a transaction will be automatically
227 * created and committed for this operation only, otherwise, the supplied transaction
228 * will be used and it will be up to the caller to commit the transaction at its
231 * @param queryParams - The key/value pairs which are found in {@link ChampObject#getProperties}
232 * @param transaction - Optional transaction context to perform the operation in.
234 * @return - A {@link Stream} where each {@link ChampObject#getProperties} contains the {@code queryParams}
236 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
238 public Stream<ChampObject> queryObjects(Map<String, Object> queryParams, Optional<ChampTransaction> transaction) throws ChampTransactionException;
241 * Create/Update a relationship.
243 * If the ChampRelationship key is present, an update will be attempted,
244 * otherwise a create will be attempted. Each implementation has different guarantees on
245 * validation - see the specific implementation for more details on this.
247 * @param relationship - The ChampRelationship that you wish to store in the graph
249 * @return The ChampRelationship as it was stored
251 * @throws ChampMarshallingException If the {@code relationship} is not able to be marshalled into the backend representation
252 * @throws ChampSchemaViolationException If the {@code relationship} violates the constraints specifed by {@link ChampGraph#retrieveSchema}
253 * @throws ChampObjectNotExistsException If either the source or target object referenced by this relationship does not exist in the graph
254 * @throws ChampRelationshipNotExistsException If {@link org.onap.aai.champcore.model.ChampRelationship#getKey}.isPresent() but the object cannot be found in the graph
255 * @throws ChampUnmarshallingException If the edge which was created could not be unmarshalled into a ChampRelationship
256 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
258 public ChampRelationship storeRelationship(ChampRelationship relationship) throws ChampMarshallingException, ChampObjectNotExistsException, ChampSchemaViolationException, ChampRelationshipNotExistsException, ChampUnmarshallingException, ChampTransactionException;
262 * Create/Update a relationship.
264 * If the ChampRelationship key is present, an update will be attempted,
265 * otherwise a create will be attempted. Each implementation has different guarantees on
266 * validation - see the specific implementation for more details on this.
268 * If a transaction context is not provided, then a transaction will be automatically
269 * created and committed for this operation only, otherwise, the supplied transaction
270 * will be used and it will be up to the caller to commit the transaction at its
273 * @param relationship - The ChampRelationship that you wish to store in the graph
274 * @param transaction - Optional transaction context to perform the operation in.
276 * @return The ChampRelationship as it was stored
278 * @throws ChampMarshallingException If the {@code relationship} is not able to be marshalled into the backend representation
279 * @throws ChampSchemaViolationException If the {@code relationship} violates the constraints specifed by {@link ChampGraph#retrieveSchema}
280 * @throws ChampObjectNotExistsException If either the source or target object referenced by this relationship does not exist in the graph
281 * @throws ChampRelationshipNotExistsException If {@link org.onap.aai.champcore.model.ChampRelationship#getKey}.isPresent() but the object cannot be found in the graph
282 * @throws ChampUnmarshallingException If the edge which was created could not be unmarshalled into a ChampRelationship
283 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
285 public ChampRelationship storeRelationship(ChampRelationship relationship, Optional<ChampTransaction> transaction) throws ChampMarshallingException, ChampObjectNotExistsException, ChampSchemaViolationException, ChampRelationshipNotExistsException, ChampUnmarshallingException, ChampTransactionException;
288 * Replace a relationship.
290 * ChampRelationship key is mandatory. The main purpose of this method is to replace the
291 * entire properties of an existing relationship. Source/Target can't be updated with this method.
293 * Each implementation has different guarantees on validation - see the specific implementation
294 * for more details on this.
296 * @param relationship - The ChampRelationship that you wish to replace in the graph
298 * @return The ChampRelationship as it was stored
300 * @throws ChampMarshallingException If the {@code relationship} is not able to be marshalled into the backend representation
301 * @throws ChampSchemaViolationException If the {@code relationship} violates the constraints specifed by {@link ChampGraph#retrieveSchema}
302 * @throws ChampRelationshipNotExistsException If {@link org.onap.aai.champcore.model.ChampRelationship#getKey} is not present or object not found in the graph
303 * @throws ChampUnmarshallingException If the edge which was created could not be unmarshalled into a ChampRelationship
304 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
306 public ChampRelationship replaceRelationship(ChampRelationship relationship) throws ChampMarshallingException, ChampSchemaViolationException, ChampRelationshipNotExistsException, ChampUnmarshallingException, ChampTransactionException;
309 * Replace a relationship.
311 * ChampRelationship key is mandatory. The main purpose of this method is to replace the
312 * entire properties of an existing relationship. Source/Target can't be updated with this method.
314 * Each implementation has different guarantees on validation - see the specific implementation
315 * for more details on this.
317 * If a transaction context is not provided, then a transaction will be automatically
318 * created and committed for this operation only, otherwise, the supplied transaction
319 * will be used and it will be up to the caller to commit the transaction at its
322 * @param relationship - The ChampRelationship that you wish to replace in the graph
323 * @param transaction - Optional transaction context to perform the operation in.
325 * @return The ChampRelationship as it was stored
327 * @throws ChampMarshallingException If the {@code relationship} is not able to be marshalled into the backend representation
328 * @throws ChampSchemaViolationException If the {@code relationship} violates the constraints specifed by {@link ChampGraph#retrieveSchema}
329 * @throws ChampRelationshipNotExistsException If {@link org.onap.aai.champcore.model.ChampRelationship#getKey} is not present or object not found in the graph
330 * @throws ChampUnmarshallingException If the edge which was created could not be unmarshalled into a ChampRelationship
331 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
333 public ChampRelationship replaceRelationship(ChampRelationship relationship, Optional<ChampTransaction> transaction) throws ChampMarshallingException, ChampSchemaViolationException, ChampRelationshipNotExistsException, ChampUnmarshallingException, ChampTransactionException;
336 * Retrieve a relationship by its key.
338 * @param key - The key of the ChampRelationship in the graph
339 * {@link org.onap.aai.champcore.model.ChampRelationship#getKey()}
341 * @return The {@link org.onap.aai.champcore.model.ChampRelationship} if it was present, otherwise {@link Optional#empty()}
343 * @throws ChampUnmarshallingException If the relationship was found, but could not be unmarshalled
344 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
346 public Optional<ChampRelationship> retrieveRelationship(Object key) throws ChampUnmarshallingException, ChampTransactionException;
350 * Retrieve a relationship by its key.
352 * If a transaction context is not provided, then a transaction will be automatically
353 * created and committed for this operation only, otherwise, the supplied transaction
354 * will be used and it will be up to the caller to commit the transaction at its
357 * @param key - The key of the ChampRelationship in the graph
358 * {@link org.onap.aai.champcore.model.ChampRelationship#getKey()}
359 * @param transaction - Optional transaction context to perform the operation in.
361 * @return The {@link org.onap.aai.champcore.model.ChampRelationship} if it was present, otherwise {@link Optional#empty()}
363 * @throws ChampUnmarshallingException If the relationship was found, but could not be unmarshalled
364 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
366 public Optional<ChampRelationship> retrieveRelationship(Object key, Optional<ChampTransaction> transaction) throws ChampUnmarshallingException, ChampTransactionException;
369 * Delete a relationship by its key.
371 * @param relationship - The ChampRelationship in the graph ({@link ChampRelationship#getKey must be present})
373 * @throws ChampRelationshipNotExistsException If the object did not exist in the graph
374 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
376 public void deleteRelationship(ChampRelationship relationship) throws ChampRelationshipNotExistsException, ChampTransactionException;
379 * Delete a relationship by its key.
381 * If a transaction context is not provided, then a transaction will be automatically
382 * created and committed for this operation only, otherwise, the supplied transaction
383 * will be used and it will be up to the caller to commit the transaction at its
386 * @param relationship - The ChampRelationship in the graph ({@link ChampRelationship#getKey must be present})
387 * @param transaction - Optional transaction context to perform the operation in.
389 * @throws ChampRelationshipNotExistsException If the object did not exist in the graph
390 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
392 public void deleteRelationship(ChampRelationship relationship, Optional<ChampTransaction> transaction) throws ChampRelationshipNotExistsException, ChampTransactionException;
395 * Retrieve the relationships which are incident to the {@code object}
397 * @param object - The object you wish to find incident relationships for
399 * @return A {@link Stream} where each {@link ChampRelationship} has this {@code object} as either a source or target object
401 * @throws ChampUnmarshallingException If any of the ChampRelationship objects could not be unmarshalled
402 * @throws ChampObjectNotExistsException If the {@code object} does not exist in this graph
403 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
405 public Stream<ChampRelationship> retrieveRelationships(ChampObject object) throws ChampUnmarshallingException, ChampObjectNotExistsException, ChampTransactionException;
409 * Retrieve the relationships which are incident to the {@code object}
411 * If a transaction context is not provided, then a transaction will be automatically
412 * created and committed for this operation only, otherwise, the supplied transaction
413 * will be used and it will be up to the caller to commit the transaction at its
416 * @param object - The object you wish to find incident relationships for
417 * @param transaction - Optional transaction context to perform the operation in.
419 * @return A {@link Stream} where each {@link ChampRelationship} has this {@code object} as either a source or target object
421 * @throws ChampUnmarshallingException If any of the ChampRelationship objects could not be unmarshalled
422 * @throws ChampObjectNotExistsException If the {@code object} does not exist in this graph
423 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
425 public Stream<ChampRelationship> retrieveRelationships(ChampObject object, Optional<ChampTransaction> transaction) throws ChampUnmarshallingException, ChampObjectNotExistsException, ChampTransactionException;
428 * Retrieve the relationships whose properties match the given {@code queryParams}
430 * @param queryParams - The key/value pairs to search for in the {@link ChampRelationship#getProperties}
432 * @return A {@link Stream} where each {@link ChampRelationship#getProperties} contains the {@code queryParams}
434 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
436 public Stream<ChampRelationship> queryRelationships(Map<String, Object> queryParams) throws ChampTransactionException;
439 * Retrieve the relationships whose properties match the given {@code queryParams}
441 * If a transaction context is not provided, then a transaction will be automatically
442 * created and committed for this operation only, otherwise, the supplied transaction
443 * will be used and it will be up to the caller to commit the transaction at its
446 * @param queryParams - The key/value pairs to search for in the {@link ChampRelationship#getProperties}
447 * @param transaction - Optional transaction context to perform the operation in.
449 * @return A {@link Stream} where each {@link ChampRelationship#getProperties} contains the {@code queryParams}
451 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
453 public Stream<ChampRelationship> queryRelationships(Map<String, Object> queryParams, Optional<ChampTransaction> transaction) throws ChampTransactionException;
456 * Create/Update a {@link ChampPartition}. If any of the ChampObjects or ChampRelationships
457 * present in this ChampPartition already exist, an update will be attempted, otherwise a create
460 * Each implementation has different guarantees on validation -
461 * see the specific implementation details for more information on this.
463 * @param partition - The ChampPartition you wish to store in this graph
465 * @throws ChampMarshallingException If any of the objects or relationships contained in this
466 * partition could not be marshalled into its backed representation
467 * @throws ChampObjectNotExistsException If any of the objects being updated do not exist, or if a relationship
468 * contain objects which do not exist in the graph.
469 * @throws ChampSchemaViolationException If any of the objects or relationships violate the schema provided by {@link retrieveSchema}
470 * @throws ChampRelationshipNotExistsException If any of the relationships which are being updated do not exist
471 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
473 * @return The ChampPartition as is was stored in the graph (contains keys for each newly created object)
475 public ChampPartition storePartition(ChampPartition partition) throws ChampMarshallingException, ChampObjectNotExistsException, ChampSchemaViolationException, ChampRelationshipNotExistsException, ChampTransactionException;
478 * Create/Update a {@link ChampPartition}. If any of the ChampObjects or ChampRelationships
479 * present in this ChampPartition already exist, an update will be attempted, otherwise a create
482 * Each implementation has different guarantees on validation -
483 * see the specific implementation details for more information on this.
485 * If a transaction context is not provided, then a transaction will be automatically
486 * created and committed for this operation only, otherwise, the supplied transaction
487 * will be used and it will be up to the caller to commit the transaction at its
490 * @param partition - The ChampPartition you wish to store in this graph
491 * @param transaction - Optional transaction context to perform the operation in.
493 * @throws ChampMarshallingException If any of the objects or relationships contained in this
494 * partition could not be marshalled into its backed representation
495 * @throws ChampObjectNotExistsException If any of the objects being updated do not exist, or if a relationship
496 * contain objects which do not exist in the graph.
497 * @throws ChampSchemaViolationException If any of the objects or relationships violate the schema provided by {@link retrieveSchema}
498 * @throws ChampRelationshipNotExistsException If any of the relationships which are being updated do not exist
499 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
501 * @return The ChampPartition as is was stored in the graph (contains keys for each newly created object)
503 public ChampPartition storePartition(ChampPartition partition, Optional<ChampTransaction> transaction) throws ChampMarshallingException, ChampObjectNotExistsException, ChampSchemaViolationException, ChampRelationshipNotExistsException, ChampTransactionException;
506 * Delete the {@code partition} from the graph.
508 * @param partition - The partition to delete from the graph
510 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
512 public void deletePartition(ChampPartition partition) throws ChampTransactionException;
515 * Delete the {@code partition} from the graph.
517 * If a transaction context is not provided, then a transaction will be automatically
518 * created and committed for this operation only, otherwise, the supplied transaction
519 * will be used and it will be up to the caller to commit the transaction at its
522 * @param partition - The partition to delete from the graph
523 * @param transaction - Optional transaction context to perform the operation in.
525 * @throws ChampTransactionException If an attempt to commit or rollback the transaction failed.
527 public void deletePartition(ChampPartition partition, Optional<ChampTransaction> transaction) throws ChampTransactionException;
530 * Create/Update an object index on the graph
531 * @param index - The index to create on this {@code graph}
533 public void storeObjectIndex(ChampObjectIndex index);
536 * Retrieve an object index on the graph by its {@code indexName}
537 * @param indexName The name of the index to retrieve from the graph
538 * @return The {@link ChampObjectIndex} which matches the given @{code indexName} in the graph
540 public Optional<ChampObjectIndex> retrieveObjectIndex(String indexName);
543 * Retrieve the object indices on the graph
544 * @return A {@link Stream} where each {@link ChampObjectIndex} exists in the graph
546 public Stream<ChampObjectIndex> retrieveObjectIndices();
549 * Delete the object index on the graph by its {@code indexName}
550 * @param indexName The name of the index to delete from the graph
551 * @throws ChampIndexNotExistsException If an index does not exist with the given {@code indexName} in the graph
553 public void deleteObjectIndex(String indexName) throws ChampIndexNotExistsException;
556 * Create/Update a relationship index on the graph
557 * @param index The relationship index to create on the graph
559 public void storeRelationshipIndex(ChampRelationshipIndex index);
562 * Retrieve a relationship index from the graph
563 * @param indexName The name of the relationship index to retrieve from the graph
564 * @return The {@link ChampRelationshipIndex} which matches the given {@code indexName} in the graph
565 * or {@link Optional#empty} if no such relationship index exists
567 public Optional<ChampRelationshipIndex> retrieveRelationshipIndex(String indexName);
570 * Retrieve the relationship indices from the graph
571 * @return A {@link Stream} where each {@link ChampRelationshipIndex} exists in the graph
573 public Stream<ChampRelationshipIndex> retrieveRelationshipIndices();
576 * Delete a relationship index from the graph
577 * @param indexName THe name of the index to delete from the graph
578 * @throws ChampIndexNotExistsException If an index does not exist with the give {@code indexName} in the graph
580 public void deleteRelationshipIndex(String indexName) throws ChampIndexNotExistsException;
583 * Create/Update the schema for a graph
584 * @param schema The {@link ChampSchema} to create or update on the graph
585 * @throws ChampSchemaViolationException If this schema update would violate the current schema
587 public void storeSchema(ChampSchema schema) throws ChampSchemaViolationException;
590 * Retrieve the schema for a graph
591 * @return The {@link ChampSchema} for the graph
593 public ChampSchema retrieveSchema();
596 * Create/Update an object constraint on a schema
597 * @param objectConstraint The object constraint you wish to create/update for the graph
598 * @throws ChampSchemaViolationException If this schema update would violate the current schema
600 public void updateSchema(ChampObjectConstraint objectConstraint) throws ChampSchemaViolationException;
603 * Create/Update a relationship constraint on a schema
604 * @param schema The relationship constraint you wish to create/update for the graph
605 * @throws ChampSchemaViolationException If this schema update would violate the current schema
607 public void updateSchema(ChampRelationshipConstraint schema) throws ChampSchemaViolationException;
610 * Delete the schema for a graph
612 public void deleteSchema();
615 * Shutdown the ChampAPI. It is up to the caller to synchronize access to the ChampAPI
616 * so that shutting it down does not interfere with concurrent operations.
618 public void shutdown();
621 * Used to determine what the outcome of certain ChampGraph operations will be. For example,
622 * if this graph is not capable of deleting object indices, you can expect those calls to fail.
623 * @see ChampCapabilities
624 * @return What this graph is capable of performing
626 public ChampCapabilities capabilities();