Skip to content

Package: Metamodel

Metamodel

Coverage

1: /**
2: * Copyright (C) 2022 Czech Technical University in Prague
3: *
4: * This program is free software: you can redistribute it and/or modify it under
5: * the terms of the GNU General Public License as published by the Free Software
6: * Foundation, either version 3 of the License, or (at your option) any
7: * later version.
8: *
9: * This program is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12: * details. You should have received a copy of the GNU General Public License
13: * along with this program. If not, see <http://www.gnu.org/licenses/>.
14: */
15: package cz.cvut.kbss.jopa.model.metamodel;
16:
17: import cz.cvut.kbss.jopa.NonJPA;
18:
19: import java.net.URI;
20: import java.util.Set;
21:
22: /**
23: * Provides access to the metamodel of persistent entities in the persistence
24: * unit.
25: */
26: public interface Metamodel {
27: /**
28: * Return the metamodel entity type representing the entity.
29: *
30: * @param cls the type of the represented entity
31: * @return the metamodel entity type
32: * @throws IllegalArgumentException if not an entity
33: */
34: <X> EntityType<X> entity(Class<X> cls);
35:
36: /**
37: * Returns the metamodel entity types representing the specified ontological class.
38: * <p>
39: * Note that since multiple entity types can be mapped to the same ontological class, this method returns a set of
40: * entity types instead of just one.
41: *
42: * @param classIri Identifier of the ontological class
43: * @return A set of entity types mapped to the specified class IRI, possibly empty
44: */
45: @NonJPA
46: Set<EntityType<?>> getMappedEntities(String classIri);
47:
48: /**
49: * Return the metamodel managed types.
50: *
51: * @return the metamodel managed types
52: */
53: Set<ManagedType<?>> getManagedTypes();
54:
55: /**
56: * Return the metamodel entity types.
57: *
58: * @return the metamodel entity types
59: */
60: Set<EntityType<?>> getEntities();
61:
62: /**
63: * Get the set of classes that contain inferred attributes. These classes
64: * are handled specially since inferred attributes can be influenced by
65: * changes to any other attributes in any other entity.
66: *
67: * @return The set of classes with inferred attributes.
68: */
69: @NonJPA
70: Set<Class<?>> getInferredClasses();
71:
72: /**
73: * Gets a set of URIs that should be added to module extraction signature.
74: * <p>
75: * The returned collection is not modifiable.
76: *
77: * @return A set of URIs
78: */
79: @NonJPA
80: Set<URI> getModuleExtractionExtraSignature();
81:
82: /**
83: * Adds the specified URI to the module extraction signature.
84: * <p>
85: * Note that a module including the specified URI will be created when a new
86: * resource level transaction is started. When that will be is
87: * implementation dependent. However it must be guaranteed that all
88: * subsequent connections provided by OntoDriver will include the URI in
89: * extracted modules.
90: *
91: * @param uri The URI to add
92: * @throws NullPointerException If {@code uri} is {@code null}
93: */
94: @NonJPA
95: void addUriToModuleExtractionSignature(URI uri);
96: }