Class ModelKnowledge
java.lang.Object
org.gcube.informationsystem.discovery.knowledge.ModelKnowledge
Manages the discovered knowledge for a specific model, including type
hierarchies and usage information.
- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether the knowledge base has been created.protected Map<AccessType,Discovery<Element>> A map of discovery instances, keyed by access type.The set of packages to be scanned.protected Map<AccessType,Tree<Class<Element>>> A map of class hierarchy trees, keyed by access type.protected Map<AccessType,UsageKnowledge> A map of usage knowledge, keyed by access type. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPackages(Collection<Package> packages) Adds a collection of packages to be scanned for model types.voidCreates the knowledge base by discovering types, building hierarchies, and gathering usage information.voidcreateKnowledge(boolean force) Creates the knowledge base, with an option to force recreation.getClassesTree(AccessType accessType) Returns the class hierarchy tree for a specific access type.getDiscovery(AccessType accessType) Returns the discovery instance for a specific access type.getUsageKnowledge(AccessType accessType) Returns the usage knowledge for a specific access type.
-
Field Details
-
created
protected boolean createdWhether the knowledge base has been created. -
usageKnowledges
A map of usage knowledge, keyed by access type. -
trees
A map of class hierarchy trees, keyed by access type. -
discoveries
A map of discovery instances, keyed by access type. -
packages
The set of packages to be scanned.
-
-
Constructor Details
-
ModelKnowledge
public ModelKnowledge()Constructs a newModelKnowledgeinstance.
-
-
Method Details
-
getUsageKnowledge
Returns the usage knowledge for a specific access type.- Parameters:
accessType- The access type.- Returns:
- The
UsageKnowledgefor the type. - Throws:
RuntimeException- if the knowledge has not yet been created.
-
createKnowledge
Creates the knowledge base, with an option to force recreation.- Parameters:
force-trueto force recreation of the knowledge base.- Throws:
Exception- if an error occurs during creation.
-
addPackages
Adds a collection of packages to be scanned for model types.- Parameters:
packages- The packages to add.
-
createKnowledge
Creates the knowledge base by discovering types, building hierarchies, and gathering usage information.- Throws:
Exception- if an error occurs during creation.
-
getClassesTree
Returns the class hierarchy tree for a specific access type.- Parameters:
accessType- The access type.- Returns:
- The
Treeof classes.
-
getDiscovery
Returns the discovery instance for a specific access type.- Parameters:
accessType- The access type.- Returns:
- The
Discoveryinstance.
-