Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi model graphical querying #81

Open
wants to merge 62 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
b05f2bc
Radiobutton-selection between SQL, Cypher, and MQL and fitting view o…
melsvab Feb 10, 2023
2140e75
resolved merge conflict
melsvab Feb 15, 2023
f4e1389
added input fields + fitting generated query to cypher. Active Namesp…
melsvab Feb 15, 2023
cea361a
changed selectedLanguage to lang and modified executeQuery()
melsvab Feb 15, 2023
4a8af47
first buggy prototype for MQL graphyical querying
melsvab Feb 17, 2023
1406f73
new prototype idea for mql
melsvab Feb 17, 2023
11f6d93
implemented or & nor, equal and not equal for mql
melsvab Feb 18, 2023
90ae085
extended cypher prototyp with additional input fields. Fixxed multipl…
melsvab Feb 19, 2023
6a35c66
extended mql querying with greater and lesser
melsvab Feb 21, 2023
a50de2f
added extra fields for relationship types in cypher
melsvab Feb 21, 2023
399bb46
added delete button for every new row in mql
melsvab Feb 22, 2023
4430b44
added dropdown for mql button
melsvab Feb 22, 2023
f71d37a
added first buggy prototype for mql for its properties. Bugs to fix: …
melsvab Feb 24, 2023
f1a9582
fixed smaller bugs for new prototype mql
melsvab Feb 25, 2023
189f1f4
now deleting through splice instead of leaving the indices values emp…
melsvab Feb 25, 2023
97be967
fixxing small bug for properties
melsvab Feb 25, 2023
293de5c
added and & or operators. TO DO: Fix new delete button bugs
melsvab Mar 5, 2023
49a075e
fixxed delete button for Logical Operators
melsvab Mar 5, 2023
bc0d65c
fixed small mistake for type in mql
melsvab Mar 5, 2023
53ba280
corrected the delete button function specifically for the logical ope…
melsvab Mar 6, 2023
e0a31c7
corrected comma bug in MQL
melsvab Mar 6, 2023
a155b91
added dynamic new fields for cypher
melsvab Mar 6, 2023
2b93c21
added hardcoded node & relationship labels to cypher
melsvab Mar 6, 2023
02fc7af
added simple drag function to the cypher labels
melsvab Mar 7, 2023
0c15719
corrected bug with not undefined dropdown when adding fieldkeyobject
melsvab Mar 7, 2023
9dbd644
added draggable mql rows
melsvab Mar 8, 2023
b1abc37
changed sidebar to support crossmodel
melsvab Mar 8, 2023
fb73879
added code generation for new dynamic cypher fields
melsvab Mar 11, 2023
1d6e43b
added operators to cypher where clause
melsvab Mar 11, 2023
96bc887
added operators to cypher where clause
melsvab Mar 11, 2023
1a2213b
corrected colors for labels in cypher similiar to data-graph.componen…
melsvab Mar 13, 2023
1500ee7
simplified and cleaned code for mql
melsvab Mar 13, 2023
0d87f74
added basic aggregate interface for mql
melsvab Mar 13, 2023
e0ea834
removed boolean operators and and or from the group stage
melsvab Mar 13, 2023
7ef36fc
added simple query generation for the group stage in the aggregate pi…
melsvab Mar 14, 2023
73d36c1
added tooltips to cypher
melsvab Mar 14, 2023
998e57a
added Modal + text for the find method in mql
melsvab Mar 14, 2023
f79277c
added Modal + text for cypher
melsvab Mar 14, 2023
c3d32b7
added sort stage and added unfinished basic modal text for the moment
melsvab Mar 14, 2023
48fd764
added dynamic return fields
melsvab Mar 15, 2023
9724cde
corrected small logical operator bug for mql
melsvab Mar 15, 2023
0e7771b
fixed the aggregation pipeline for mql and finished the modal text
melsvab Mar 21, 2023
2450de7
improved the id field in the group stage of the aggregation pipeline …
melsvab Mar 21, 2023
82a45a0
changed getColletion() to directly the collection
melsvab Mar 22, 2023
cd2b737
created one cypher property field modal for match
melsvab Mar 22, 2023
491fe84
made the modal more beautiful and added some tooltips
melsvab Mar 22, 2023
4651d92
Merge remote-tracking branch 'origin/multi-model-graphical-querying' …
melsvab Mar 22, 2023
8a244ce
made the match modal to adapt dynamically per added match field
melsvab Mar 23, 2023
7f5e5cb
input for nodes inside match modal is differentiated between field
melsvab Mar 23, 2023
c04b3de
added dynamic relationship modal for properties
melsvab Mar 24, 2023
83e68c7
made the cypher match modal only be usable for each one node
melsvab Mar 24, 2023
8c75e07
simplified the cypher match modal code
melsvab Mar 24, 2023
8955c47
added dropdown to return clause in cypher
melsvab Mar 24, 2023
4d67576
fixxed bug that dropdown value of the return clause does not get gene…
melsvab Mar 24, 2023
26e31eb
updating the help modal of cypher with the new features
melsvab Mar 24, 2023
3a8b6b2
fixxed delete button bug that parts of queries are shown of deleted rows
melsvab Mar 24, 2023
f0aad19
small improvemenets
melsvab Apr 1, 2023
78f4eb4
added automatic quotation marks around specific input and added a cle…
melsvab Apr 4, 2023
a68e8d3
removed appearance of undefined in cypher
melsvab Apr 5, 2023
13b39be
small fix to the mql generation code triggered by drag and drop
melsvab Apr 5, 2023
3e25332
adding cross-model querying support
melsvab Apr 23, 2023
ebc067d
adding additional comments
melsvab May 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added Modal + text for the find method in mql
melsvab committed Mar 14, 2023
commit 998e57af636a89f22323f0735227ad990c72afba
Original file line number Diff line number Diff line change
@@ -108,22 +108,46 @@ <h5>Query Result</h5>

<div class="label">
<!-- Node Labels -->
<div style="display: inline-block;" tooltip="Nodes represent entities in the graph database. They can have labels that describe their type and properties that store their attributes.">
<p>Node Labels:</p>
<div style="display: inline-block; margin-bottom:0.75em;" tooltip="Nodes represent entities in the graph database. They can have labels that describe their type and properties that store their attributes.">
<b>Node Labels:</b>
</div>
<div class="label-container">
<p *ngFor="let label of nodeLabels; let i = index" class="label-node" draggable="true" (dragstart)="drag($event)" [ngStyle]="{backgroundColor: generateColor(i)}">{{label}}</p>
</div>

<!-- Relationship Labels -->
<div style="display: inline-block;" tooltip="Relationships represent the connections between nodes in the graph database. They have a type, a direction, and can have properties that store additional information about the relationship.">
<p>Relationship Labels:</p>
<div style="display: inline-block; margin-bottom:0.75em" tooltip="Relationships represent the connections between nodes in the graph database. They have a type, a direction, and can have properties that store additional information about the relationship.">
<b>Relationship Labels:</b>
</div>
<div class="label-container">
<p *ngFor="let label of relationLabels; let i = index" class="label-relation" draggable="true" (dragstart)="drag($event)" [ngStyle]="{backgroundColor: generateColor(i + nodeLabels.length)}">{{label}}</p>
</div>
</div>

<!-- Modal for Cypher -->
<div class="row" style="justify-content: right; margin-bottom: 0.5em; padding-right: 1em;">
<button class="btn btn-primary pull-right" (click)="this.queryHelpCypher.show();"><i class="fa fa-lightbulb-o" aria-hidden="true"></i></button>
<div bsModal #queryHelpCypher="bs-modal" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" id="editUserModal3" (onHide)="onCloseModal()">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Query-Generation: Cypher</h4>

<button type="button" class="close" (click)="queryHelpCypher.hide()" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">

</div>
<div class="modal-footer">
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
</div>


<!-- Code for Graph - From data-view.component.html-->
<!-- <app-data-graph *ngIf="resultSet" [resultSet]="resultSet" [loading]="loading" [tableId]="tableId"
@@ -418,6 +442,8 @@ <h5>Query Result</h5>
</div>
</div>
</div>
</div>
</div>

<!-- graphical-UI for MQL -->
<div *ngIf="lang === 'mql'">
@@ -426,23 +452,97 @@ <h5>Query Result</h5>
<div *ngIf="collectionName !== undefined">

<p>Fill in the details:</p>
<div classe ="row">
<p>Choose what you want to do: </p>
<div class="btn-group-horizontal btn-group" id="radio-2" data-toggle="buttons">
<label class="btn btn-secondary">
<input type="radio" name="type" [(ngModel)]="mqlType" value="FIND" (ngModelChange)="generateMQL()">find
</label>
<label class="btn btn-secondary">
<input type="radio" name="type" [(ngModel)]="mqlType" value="AGGR" (ngModelChange)="generateMQL()">aggregate
</label>
<p>Choose what you want to do: </p>
<div classe ="row" style="display: flex; justify-content: space-between;">
<div>
<div class="btn-group-horizontal btn-group" id="radio-2" data-toggle="buttons">
<label class="btn btn-secondary" tooltip="The find method is used to retrieve documents from a collection based on specified criteria.">
<input type="radio" name="type" [(ngModel)]="mqlType" value="FIND" (ngModelChange)="generateMQL()">find
</label>
<label class="btn btn-secondary" tooltip="The aggregate method is used to perform advanced data processing and analysis on the documents in a collection.">
<input type="radio" name="type" [(ngModel)]="mqlType" value="AGGR" (ngModelChange)="generateMQL()">aggregate
</label>
</div>
</div>
<div *ngIf="mqlType!== undefined && mqlType ==='FIND'">
<!-- Modal for FIND -->
<button class="btn btn-primary pull-right" (click)="this.queryHelp.show();"><i class="fa fa-lightbulb-o" aria-hidden="true"></i></button>
<div bsModal #queryHelp="bs-modal" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" id="editUserModal" (onHide)="onCloseModal()">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Query-Generation: Find</h4>

<button type="button" class="close" (click)="queryHelp.hide()" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<b>Basics:</b>
<br>
You can begin to build your query by filling in the input fields. Here's an example of a find() query:
<br>
<br>
<ul><li><b>db.yourCollection.find({{"{" }} "name": "John"})</b></li></ul>
<i>{{ "{" }} "name": "John" }</i> specifies the criteria for selecting documents. In this case, the query will select documents where the value of the <i>name</i> field is equal to <i>"John"</i>.
<br>
<br>
To recreate this query, you can write <i>name</i> into the first input field. Next, select <i>equals</i> from the dropdown menu. Finally, enter <i>"John"</i> into the last input field. Don't forget the quotation marks if it is a string your looking for.
<br>
<br>
<b>Additional Features:</b>
<br>
If you want to add more criterias to your search, you can use the additional features. Here's a step-by-step guide:
<br>
<br><ul>
<li><b>Adding new keys:</b> You can add new keys by clicking on the plus-button. To delete a key, click on the trash-button.</li>

<li><b>Defining key-objects:</b> You can define key-objects by creating a new key and adding sub-keys to it through the plus-button. For example, if you want to add an <i>address</i> key containing sub-keys <i>street</i> and <i>number</i>, you can create a new key <i>address</i>, then add the key-object <i>street</i>, and then the object <i>number</i> to it.</li>

<li><b>Using Boolean Operators:</b> You can use Boolean Operators (AND, OR) to create more complex conditions. Every Boolean Operator should be closed by an END on the same depth level. You can do this throug the plus-button. You can add multiple Boolean Operators in succession to create nested conditions. Every row between the condition and its END is logically connected.</li>

<li><b>Drag and Drop:</b> You can also drag and drop rows to transfer them inside the logical Operators or insert them into a different order. This can be useful if you made a mistake and need to correct the order of the criteria.</li>
</ul>
</div>
<div class="modal-footer">
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
</div>
<div *ngIf="mqlType!== undefined && mqlType === 'AGGR'">
<!-- Modal for AGGR --- original from adapters.component.html -->
<button class="btn btn-primary pull-right" (click)="this.queryHelpAGGR.show();"><i class="fa fa-lightbulb-o" aria-hidden="true"></i></button>
<div bsModal #queryHelpAGGR="bs-modal" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" id="editUserModal2" (onHide)="onCloseModal()">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Query-Generation: Aggregation</h4>

<button type="button" class="close" (click)="queryHelpAGGR.hide()" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Here is the text? AGGR
</div>
<div class="modal-footer">
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
</div>
</div>

<!-- MQL Aggregate -->
<div *ngIf="mqlType === 'AGGR'"> <!-- Creating new field for each chosen column -->
<div class="text-fields">
<!-- Match Stage-->
<b>Match stage</b>
<div style="display: inline-block;" tooltip="The match stage in an aggregate pipeline is used to filter the documents in a collection similar to the find method.">
<b>Match stage</b>
</div>
<div class="mql-second-text-fields" style="margin-bottom:1em;">
<div *ngFor="let fieldNumber of fieldListMATCH; let i = index" draggable="true" (dragstart)="onDragStart($event, fieldNumber)"> <!-- index differentiates each field-->
<ng-container *ngIf="fieldNumber === 'AND' || fieldNumber === 'OR'">
@@ -545,7 +645,9 @@ <h5>Query Result</h5>
</div>

<!-- Group Stage-->
<b>Group stage</b>
<div style="display: inline-block;" tooltip="The group stage in an aggregate pipeline is used to group the documents in a collection by one or more fields and perform a variety of aggregations on the grouped data.">
<b>Group stage</b>
</div>
<div class="mql-second-text-fields">
<div *ngFor="let fieldNumber of fieldListGROUP; let i = index" draggable="true" (dragstart)="onDragStart($event, fieldNumber)"> <!-- index differentiates each field-->
<div class="row" [style.padding-left.em]="2*this.mqlFieldsGROUP[i][5]" (drop)="onDrop($event,'Aggr2')" (dragover)="onDragOver($event)">
@@ -763,8 +865,8 @@ <h5>Query Result</h5>
</div>
</div>
</div>

</div>

</div>
</div>

Original file line number Diff line number Diff line change
@@ -69,9 +69,6 @@
.show-error {
display: block !important;
}
.label {
margin-bottom:1.5em;
}

.cypher-sidebar {
background-color: #f0f3f5;
@@ -113,5 +110,3 @@
border: 1px solid black;
}



Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@ import {ViewInformation} from '../../../components/data-view/data-view.component
import {TableConfig} from '../../../components/data-view/data-table/table-config';
import * as d3 from 'd3';


@Component({
selector: 'app-graphical-querying',
templateUrl: './graphical-querying.component.html',
@@ -118,6 +119,8 @@ export class GraphicalQueryingComponent implements OnInit, AfterViewInit, OnDest

mqlType: string;

activeMode: string;


ngOnInit() {
this._leftSidebar.open();
@@ -427,6 +430,11 @@ export class GraphicalQueryingComponent implements OnInit, AfterViewInit, OnDest
return '"' + k.split('.').join('"."') + '"';
}

onCloseModal() {
this.activeMode = undefined;
}


setDefaultState(inputlang: string) { //sets the field values to zero if the user switches languages
switch (inputlang) {
case 'sql':