feat: Merge View (RDFA-344)#176
Conversation
…s-profile-diagrams # Conflicts: # frontend/src/routes/mainpage/packageNavigation/DatasetSection.svelte
…s-profile-diagrams # Conflicts: # backend/src/main/java/org/rdfarchitect/database/inmemory/GraphWithContext.java # backend/src/main/java/org/rdfarchitect/database/inmemory/GraphWithContextCollection.java # backend/src/main/java/org/rdfarchitect/database/inmemory/InMemoryDatabase.java # backend/src/main/java/org/rdfarchitect/database/inmemory/InMemoryDatabaseImpl.java # backend/src/main/java/org/rdfarchitect/database/inmemory/SessionDataStore.java # backend/src/main/java/org/rdfarchitect/services/diagrams/CustomDiagramService.java # backend/src/main/java/org/rdfarchitect/services/dl/select/QueryDiagramLayoutService.java # backend/src/main/java/org/rdfarchitect/services/dl/update/UpdateDiagramLayoutService.java # backend/src/main/java/org/rdfarchitect/services/dl/update/classlayout/UpdateClassLayoutService.java # frontend/src/lib/rendering/svelteflow/components/SvelteFlowClassContextMenu.svelte
Signed-off-by: Philipp Kirchner <philipp.kirchner@soptim.de>
|
|
||
| import java.util.List; | ||
|
|
||
| @EqualsAndHashCode(callSuper = true) |
|
|
||
| @EqualsAndHashCode(callSuper = true) | ||
| @Data | ||
| @SuperBuilder(toBuilder = true) |
| @Data | ||
| @AllArgsConstructor | ||
| public class CrossProfileDiagramColorDataDTO { | ||
| Map<String, String> graphColors; |
| private List<GraphSourcedDTO<AttributeDTO>> attributes; | ||
| private List<GraphSourcedDTO<EnumEntryDTO>> enumEntries; | ||
| private List<GraphSourcedDTO<AssociationPairDTO>> associationPairs; | ||
| private List<CIMSStereotype> stereotypes; |
| private List<GraphSourcedDTO<SuperClassDTO>> superClasses; | ||
| private List<GraphSourcedDTO<AttributeDTO>> attributes; | ||
| private List<GraphSourcedDTO<EnumEntryDTO>> enumEntries; | ||
| private List<GraphSourcedDTO<AssociationPairDTO>> associationPairs; |
| private List<ClassSourceDTO> sources; | ||
| private List<GraphSourcedDTO<SuperClassDTO>> superClasses; | ||
| private List<GraphSourcedDTO<AttributeDTO>> attributes; | ||
| private List<GraphSourcedDTO<EnumEntryDTO>> enumEntries; |
| private String label; | ||
| private List<ClassSourceDTO> sources; | ||
| private List<GraphSourcedDTO<SuperClassDTO>> superClasses; | ||
| private List<GraphSourcedDTO<AttributeDTO>> attributes; |
| private String classUri; | ||
| private String label; | ||
| private List<ClassSourceDTO> sources; | ||
| private List<GraphSourcedDTO<SuperClassDTO>> superClasses; |
| private UUID uuid; | ||
| private String classUri; | ||
| private String label; | ||
| private List<ClassSourceDTO> sources; |
rema-soptim
left a comment
There was a problem hiding this comment.
A few things i noticed, while using the new feature. This is not a complete test
- When opening a large merge view (full cgmes 2.4.15), the application is frozen for multiple seconds, before showing a loading animation for the diagram
- the same goes for expanding an (especially) collapsing the merged diagram section in the navigation
- clicked the merged view button once triggers a collapse or expand. instead this should happen on a double click.
- Deleting a Graph unselects the merged view instead of just reloading it.
- show Package Prefix setting only works in navigation not in the diagram
| <CheckBoxEditControl | ||
| label="Use colored properties in merged view" | ||
| value={localSettings["useColoredPropertiesInMergedView"]} | ||
| callOnInputTrue={() => | ||
| (localSettings["useColoredPropertiesInMergedView"] = true)} | ||
| callOnInputFalse={() => | ||
| (localSettings["useColoredPropertiesInMergedView"] = false)} | ||
| labelFirst={false} | ||
| /> |
There was a problem hiding this comment.
| <CheckBoxEditControl | |
| label="Use colored properties in merged view" | |
| value={localSettings["useColoredPropertiesInMergedView"]} | |
| callOnInputTrue={() => | |
| (localSettings["useColoredPropertiesInMergedView"] = true)} | |
| callOnInputFalse={() => | |
| (localSettings["useColoredPropertiesInMergedView"] = false)} | |
| labelFirst={false} | |
| /> | |
| <CheckBoxEditControl | |
| label="Use colored properties in merged view" | |
| bind:value={localSettings["useColoredPropertiesInMergedView"]} | |
| labelFirst={false} | |
| /> |
This can also be done for the other checkboxes
| editorState.selectedClassType.updateValue(classType); | ||
| editorState.selectedDiagram.updateValue({ | ||
| type: DiagramType.PACKAGE, | ||
| type: diagramType, | ||
| id: classNavEntry.parent?.id ?? "default", | ||
| }); |
There was a problem hiding this comment.
Wouldn't it make more sense to also add the selectedClassType into the selectedClassUUID and create a new selectedClass:
{
type: ...,
uuid: ...,
}
Since they are pretty much always updates together. Also this would reduce the risk of forgetting to reset/update only one of them since they must be kept in sync anyway.
| }; | ||
|
|
||
| export const ClassType = { | ||
| NORMAL_CLASS: "normalClass", |
There was a problem hiding this comment.
"normalClass" sounds ambiguous, consider renaming to "singleClass"
| function shortName(uri) { | ||
| const match = uri.match(/[#/]([^#/]+)\/?$/); | ||
| return match ? match[1] : uri; | ||
| } | ||
| </script> |
There was a problem hiding this comment.
Preferably use the existing uri class to separate the uri prefix from suffix to ensure consistent behavior across components.
| function snapshotOriginal() { | ||
| originalJson = JSON.stringify( | ||
| colorEntries.map(e => ({ graphURI: e.graphURI, color: e.color })), | ||
| ); | ||
| } | ||
|
|
There was a problem hiding this comment.
Why create a new map? Can't you just stringify the object directly? Same for the hasChanges derived
| ); | ||
|
|
||
| $effect(() => { | ||
| if (!datasetNavEntry.label) return; |
There was a problem hiding this comment.
Is this case even possible? This would be a dataset without a label right?
| function getGraphLabel(graphURI) { | ||
| if (!graphURI) return graphURI; | ||
| const hashIndex = graphURI.lastIndexOf("#"); | ||
| const slashIndex = graphURI.lastIndexOf("/"); | ||
| const splitIndex = Math.max(hashIndex, slashIndex); | ||
| return splitIndex >= 0 ? graphURI.slice(splitIndex + 1) : graphURI; | ||
| } | ||
| </script> |
There was a problem hiding this comment.
Here again, preferably use the existing uri class if possible to split prefix and suffix
| function extractGraphLabel(graphUri) { | ||
| const hash = graphUri.lastIndexOf("#"); | ||
| const slash = graphUri.lastIndexOf("/"); | ||
| const idx = Math.max(hash, slash); | ||
| return idx >= 0 ? graphUri.substring(idx + 1) : graphUri; | ||
| } | ||
|
|
Summary
Adds the Merge View. In the merge view all classes of an dataset are merged based on their URI and displayed in one diagram.
Related Issues
Checklist
git commit -s) for DCOTesting Notes