Skip to content

Package: Metamodel

Metamodel

Coverage

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