Commit 30b459f4 authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

RFT v0.2.1

parent 0dae831e
<div *ngIf="!LoggedIn()"> <router-outlet></router-outlet> </div>
<div *ngIf="!LoggedIn()">
<router-outlet></router-outlet>
</div>
<div *ngIf="LoggedIn()">
<mat-sidenav-container>
......@@ -17,7 +19,7 @@
<footer class="footer page-footer font-small ">
<!-- Copyright -->
<div class="footer-copyright text-center py-3">© 2021 Copyright:
<div class="footer-copyright text-center py-3">© 2022 Copyright:
<a href="https://depend.csd.auth.gr/">Depend Research Team</a>
</div>
<!-- Copyright -->
......@@ -30,4 +32,3 @@
</div>
<notifier-container></notifier-container>
\ No newline at end of file
......@@ -35,9 +35,27 @@ import { AddGroupboilComponent } from './components/add-groupboil/add-groupboil.
import { InstancesListComponent } from './components/instances-list/instances-list.component';
import { Ng2SearchPipeModule } from 'ng2-search-filter';
import { NgxEchartsModule } from 'ngx-echarts';
import { CourseDialogComponentComponent } from './components/course-dialog-component/course-dialog-component.component';
@NgModule({
imports: [
BrowserModule,
AppRoutingModule,
FormsModule,
ReactiveFormsModule,
Ng2SearchPipeModule,
HttpClientModule,
NgbModule,
NotifierModule,
BrowserAnimationsModule,
MaterialModule,
FlexLayoutModule,
NgxEchartsModule.forRoot({
echarts: () => import('echarts')
}),
],
declarations: [
AppComponent,
LoginComponent,
......@@ -57,22 +75,7 @@ import { NgxEchartsModule } from 'ngx-echarts';
GroupboilComponent,
AddGroupboilComponent,
InstancesListComponent,
],
imports: [
BrowserModule,
AppRoutingModule,
ReactiveFormsModule,
FormsModule,
Ng2SearchPipeModule,
HttpClientModule,
NgbModule,
NotifierModule,
BrowserAnimationsModule,
MaterialModule,
FlexLayoutModule,
NgxEchartsModule.forRoot({
echarts: () => import('echarts')
}),
CourseDialogComponentComponent,
],
providers: [
AuthService,
......@@ -83,6 +86,6 @@ import { NgxEchartsModule } from 'ngx-echarts';
multi: true,
},
],
bootstrap: [AppComponent]
bootstrap: [AppComponent],
})
export class AppModule { }
import { Component, OnInit } from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import { ActivatedRoute, Router } from '@angular/router';
import { Boilerplate } from 'src/app/models/boilerplate.model';
import { BoilerplateService } from 'src/app/services/boilerplate.service';
import { NotifierService } from "angular-notifier";
......@@ -41,19 +41,20 @@ export class AddBoilerplateComponent implements OnInit {
};
if (data.title != "") {
data.title = data.title?.replace(/[^\w\s]/gi, ' ')
data.title = data.title?.replace(/ /g,"_")}
data.title = data.title?.replace(/ /g, "_")
}
this.boilerplatelService.create(this.route.snapshot.params.gb, data)
.subscribe(
response => {
this.notifier.notify("success",(JSON.stringify(response)));
this.notifier.notify("success", "Requirement " + this.boilerplate.title + " created");
this.submitted = true;
this.router.navigate(['/groupboilerplates/'+this.route.snapshot.params.gb+'/boilerplates/details/'+response.id]);
this.router.navigate(['/groupboilerplates/' + this.route.snapshot.params.gb + '/boilerplates/details/' + response.id]);
},
error => {
console.log(error);
//error, warning, success, info, default
this.notifier.notify("warning",(JSON.stringify(error["error"]["title"][0])));
this.notifier.notify("warning", (JSON.stringify(error["error"]["title"][0])));
});
}
......@@ -69,39 +70,39 @@ export class AddBoilerplateComponent implements OnInit {
}
prefixs = [
{name: 'P1', details: "If/Unless <logical expression>", explanation: 'Expresses a logical condition. Paraphrases: in case, provided that, on condition that.'},
{name: 'P2', details: "As soon as <occuring functionality>", explanation: 'Expresses a temporal stimulation concerned with the point in time of an completed occuring functionality. Paraphrases: in the moment, immediately, once.'},
{name: 'P3', details: "As long as <occuring functionality>", explanation: 'Expresses a temporal condition concerned with a period. The prefix clause and the main clause take place simultaneously. Paraphrases: meanwhile'},
{ name: 'P1', details: "If/Unless <logical expression>", explanation: 'Expresses a logical condition. Paraphrases: in case, provided that, on condition that.' },
{ name: 'P2', details: "As soon as <occuring functionality>", explanation: 'Expresses a temporal stimulation concerned with the point in time of an completed occuring functionality. Paraphrases: in the moment, immediately, once.' },
{ name: 'P3', details: "As long as <occuring functionality>", explanation: 'Expresses a temporal condition concerned with a period. The prefix clause and the main clause take place simultaneously. Paraphrases: meanwhile' },
];
mains = [
{name: 'M1', details: "system/function shall [not] set [<quantifier>] item [to stateValue]", explanation: 'Sets item Paraphrases: initiate, reset, update.'},
{name: 'M2', details: "system/function shall [not] set state to stateValue", explanation: 'Sets state to value Paraphrases: initiate, reset, update.'},
{name: 'M3', details: "system/function shall [not] send [<quantifier>] item", explanation: 'Sends item Paraphrases: forward.'},
{name: 'M4', details: "system/function shall [not] receive [<quantifier>] item", explanation: 'Receives item Paraphrases: accept, acquire.'},
{name: 'M5', details: "system/function shall [not] ingest flow", explanation: 'Ingests flow. Paraphrases: get.'},
{name: 'M6', details: "system/function shall [not] emit flow", explanation: 'Emits flow. Paraphrases: produce.'},
{name: 'M7', details: "system shall [not] perform function", explanation: 'System requirement. Paraphrases: execute.'},
{name: 'M8', details: "function shall [not] invoke function", explanation: 'Function invokes another function. Paraphrases: call, request'},
{name: 'M9', details: "system shall [not] present interface [to system]", explanation: 'Presents interface. Paraphrases: provide'},
{name: 'M10', details: "system/interface shall [not] transfer flow/item", explanation: 'Transfers TraversingConcept. Paraphrases: transmit, broadcast'},
{name: 'M11', details: "system shall [not] interact with system [using <connection>] [as defined in <text>]", explanation: 'System requirement expressing interface interraction'},
{name: 'M12', details: "system shall [not] have state state [with values stateSet]", explanation: 'System requirement expressing system modes'},
{name: 'M13', details: "system state stateValue shall [not] have substate state [with values stateSet]", explanation: 'System requirement expressing system sub modes per mode'},
{name: 'M14', details: "system item shall [not] take values from stateSet", explanation: 'System requirement expressing item stateSet'},
{name: 'M15', details: "system item shall [not] be composed from item", explanation: 'System requirement expressing item decomposition stateSet'},
{name: 'M16', details: "system shall [not] contain system", explanation: 'System decomposition.'},
{ name: 'M1', details: "system/function shall [not] set [<quantifier>] item [to stateValue]", explanation: 'Sets item Paraphrases: initiate, reset, update.' },
{ name: 'M2', details: "system/function shall [not] set state to stateValue", explanation: 'Sets state to value Paraphrases: initiate, reset, update.' },
{ name: 'M3', details: "system/function shall [not] send [<quantifier>] item", explanation: 'Sends item Paraphrases: forward.' },
{ name: 'M4', details: "system/function shall [not] receive [<quantifier>] item", explanation: 'Receives item Paraphrases: accept, acquire.' },
{ name: 'M5', details: "system/function shall [not] ingest flow", explanation: 'Ingests flow. Paraphrases: get.' },
{ name: 'M6', details: "system/function shall [not] emit flow", explanation: 'Emits flow. Paraphrases: produce.' },
{ name: 'M7', details: "system shall [not] perform function", explanation: 'System requirement. Paraphrases: execute.' },
{ name: 'M8', details: "function shall [not] invoke function", explanation: 'Function invokes another function. Paraphrases: call, request' },
{ name: 'M9', details: "system shall [not] present interface [to system]", explanation: 'Presents interface. Paraphrases: provide' },
{ name: 'M10', details: "system/interface shall [not] transfer flow/item", explanation: 'Transfers TraversingConcept. Paraphrases: transmit, broadcast' },
{ name: 'M11', details: "system shall [not] interact with system [using <connection>] [as defined in <text>]", explanation: 'System requirement expressing interface interraction' },
{ name: 'M12', details: "system shall [not] have state state [with values stateSet]", explanation: 'System requirement expressing system modes' },
{ name: 'M13', details: "system state stateValue shall [not] have substate state [with values stateSet]", explanation: 'System requirement expressing system sub modes per mode' },
{ name: 'M14', details: "system item shall [not] take values from stateSet", explanation: 'System requirement expressing item stateSet' },
{ name: 'M15', details: "system item shall [not] be composed from item", explanation: 'System requirement expressing item decomposition stateSet' },
{ name: 'M16', details: "system shall [not] contain system", explanation: 'System decomposition.' },
];
suffixs = [
{name: 'S1', details: "<numerical-afirmative> j <closed-interval> [per <time-unit>]", explanation: ''},
{name: 'S2', details: "after/before flow", explanation: ''},
{name: 'S3', details: "[every/for a period of/within/for at least] <number> <time-unit> [from flow]", explanation: ''},
{name: 'S4', details: "at the beginning/at the end", explanation: ''},
{name: 'S5', details: "at even intervals", explanation: ''},
{name: 'S6', details: "sequentially", explanation: ''},
{ name: 'S1', details: "<numerical-afirmative> j <closed-interval> [per <time-unit>]", explanation: '' },
{ name: 'S2', details: "after/before flow", explanation: '' },
{ name: 'S3', details: "[every/for a period of/within/for at least] <number> <time-unit> [from flow]", explanation: '' },
{ name: 'S4', details: "at the beginning/at the end", explanation: '' },
{ name: 'S5', details: "at even intervals", explanation: '' },
{ name: 'S6', details: "sequentially", explanation: '' },
];
systems = [{pos:"Prefix", data: this.prefixs}, {pos:"Main", data: this.mains}, {pos:"Suffix", data: this.suffixs}]
systems = [{ pos: "Prefix", data: this.prefixs }, { pos: "Main", data: this.mains }, { pos: "Suffix", data: this.suffixs }]
}
......@@ -5,28 +5,21 @@
</ol>
</nav>
<div class="submit-form">
<div [hidden]="!submitted">
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
</div>
<div class="submit-form">
<form name="myForm" ngNativeValidate>
<div class="form-group">
<label for="title_bgroup">Requirement Title</label>
<input type="text" class="form-control" id="title_bgroup"
required
[(ngModel)]="groupboilerplate.title_bgroup" name="title_bgroup">
<label for="title_bgroup">Project title</label>
<input type="text" class="form-control" id="title_bgroup" required [(ngModel)]="groupboilerplate.title_bgroup"
name="title_bgroup">
</div>
<div class="form-group">
<label for="description">Description of project</label>
<textarea
type="text"
class="form-control"
id="description"
required
[(ngModel)]="groupboilerplate.description"
name="description"
></textarea>
<textarea type="text" class="form-control" id="description" required [(ngModel)]="groupboilerplate.description"
name="description"></textarea>
</div>
</form>
<button (click)="saveBoilerplate()" class="btn btn-success" >Submit</button>
</div>
\ No newline at end of file
<button (click)="saveBoilerplate()" class="btn btn-success">Submit</button>
</div>
\ No newline at end of file
import { Component, OnInit } from '@angular/core';
import {Router} from '@angular/router';
import { Router } from '@angular/router';
import { GroupBoilerplate } from 'src/app/models/boilerplate.model';
import { BoilerplateService } from 'src/app/services/boilerplate.service';
import { NotifierService } from "angular-notifier";
......@@ -18,7 +18,7 @@ export class AddGroupboilComponent implements OnInit {
submitted = false;
private readonly notifier: NotifierService;
constructor(private boilerplatelService: BoilerplateService, private router:Router, notifierService: NotifierService) {
constructor(private boilerplatelService: BoilerplateService, private router: Router, notifierService: NotifierService) {
this.notifier = notifierService;
}
......@@ -27,20 +27,21 @@ export class AddGroupboilComponent implements OnInit {
saveBoilerplate(): void {
const data = {
title_bgroup: this.groupboilerplate.title_bgroup,
description: this.groupboilerplate.description,
description: this.groupboilerplate.description ? this.groupboilerplate.description : this.groupboilerplate.title_bgroup,
};
this.submitted = true;
this.boilerplatelService.creategroupboil(data)
.subscribe(
response => {
this.notifier.notify("success",(JSON.stringify(response)));
this.submitted = true;
this.notifier.notify("success", "Project " + this.groupboilerplate.title_bgroup + ' created');
this.submitted = false;
this.router.navigate(['/groupboilerplates']);
},
error => {
console.log(error);
//error, warning, success, info, default
this.notifier.notify("warning",(JSON.stringify(error["error"]["title"][0])));
this.submitted = false;
this.notifier.notify("warning", (JSON.stringify(error["error"]["title"][0])));
});
}
newBoilerplate(): void {
......
......@@ -9,28 +9,18 @@
</ol>
</nav>
<mat-grid-list cols="2">
<div class="first">
<div class="first">
<div *ngIf="currentboilerplate.id" class="edit-form">
<form ngNativeValidate>
<div class="form-group" style="display:flex; flex-direction: row; align-items: center">
<label for="title" style="margin-right: 50px;">Requirement title</label>
<input
name="title"
id="title"
type="text"
class="form-control"
required
[(ngModel)]="currentboilerplate.title"
(change)="this.updateBoilerplate()"
style="width: 63%;"/>
<input name="title" id="title" type="text" class="form-control" required
[(ngModel)]="currentboilerplate.title" (change)="this.updateBoilerplate()" style="width: 63%;" />
</div>
<div style="display: flex; flex-grow: grow; margin-top: 50px; ">
<form class="form-group form-inline ">
<mat-checkbox class="example-full-width"
[(ngModel)]="currentboilerplate.has_prefix"
(change)="this.updateBoilerplate()"
name="has_prefix"
>Prefix
<mat-checkbox class="example-full-width" [(ngModel)]="currentboilerplate.has_prefix"
(change)="this.updateBoilerplate()" name="has_prefix">Prefix
</mat-checkbox>
</form>
<div *ngIf="this.currentboilerplate.has_prefix" style="margin-left: 50px;">
......@@ -40,11 +30,8 @@
<mat-divider></mat-divider>
<div style="display: flex; flex-grow: grow; margin-top: 50px;">
<form class="form-group form-inline ">
<mat-checkbox class="example-full-width"
[(ngModel)]="currentboilerplate.has_main"
name="has_prefix"
[disabled]="true"
>Main
<mat-checkbox class="example-full-width" [(ngModel)]="currentboilerplate.has_main" name="has_prefix"
[disabled]="true">Main
</mat-checkbox>
</form>
<div *ngIf="this.currentboilerplate.has_main" style="margin-left: 50px;">
......@@ -54,11 +41,8 @@
<mat-divider></mat-divider>
<div style="display: flex; flex-grow: grow; margin-top: 50px;">
<form class="form-group form-inline ">
<mat-checkbox class="example-full-width"
[(ngModel)]="this.currentboilerplate.has_suffix"
(change)="this.updateBoilerplate()"
name="has_suffix"
>Suffix
<mat-checkbox class="example-full-width" [(ngModel)]="this.currentboilerplate.has_suffix"
(change)="this.updateBoilerplate()" name="has_suffix">Suffix
</mat-checkbox>
</form>
<div *ngIf="this.currentboilerplate.has_suffix" style="margin-left: 50px;">
......@@ -68,16 +52,11 @@
</form>
<div class="list row">
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="start">
<input class="btn btn-success"
type="button"
value=" Update Boilerplate"
(click)="updateDetailsOfBoilerplate()"/>
<input class="btn btn-success" type="button" value=" Update Boilerplate"
(click)="updateDetailsOfBoilerplate()" />
</div>
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<input class="btn btn-warning"
type="button"
value="Delete Boilerplate"
(click)="deleteBoilerplate()"/>
<input class="btn btn-warning" type="button" value="Delete Boilerplate" (click)="deleteBoilerplate()" />
</div>
</div>
<p>{{ message }}</p>
......@@ -88,17 +67,19 @@
<div *ngIf="!currentboilerplate.id">
<mat-spinner style="margin: auto;"></mat-spinner>
</div>
</div>
</div>
<!-- Dictionary -->
<div class="second">
<!-- Dictionary -->
<div class="second">
<div class="search-hero">
<input class="form-control" type="text" name="search" [(ngModel)]="searchText" autocomplete="off" placeholder="Start searching for a System, Function, etc.">
<input class="form-control" type="text" name="search" [(ngModel)]="searchText" autocomplete="off"
placeholder="Start searching for a System, Function, etc.">
</div>
<mat-tab-group mat-align-tabs="center">
<div *ngFor="let section of systems| filter:searchText">
<mat-tab label={{section.Name}}>
<div *ngFor="let item of section.TheClasses| filter:searchText">
<div *ngIf="item.Class">
<mat-accordion>
<mat-expansion-panel>
<mat-expansion-panel-header>
......@@ -111,7 +92,10 @@
</mat-expansion-panel-header>
{{ item.Comment }}
<ul>
<button mat-button [matMenuTriggerFor]="menu" #menuTrigger><h4><b>Instances</b></h4></button>
<button mat-button [matMenuTriggerFor]="menu"
[matMenuTriggerData]="{section: section.Name ,class: item.Class}" #menuTrigger>
<h4><b>Instances</b></h4>
</button>
<div *ngFor="let instan of item.Instance_of_Class| filter:searchText">
<li>
<mat-expansion-panel hideToggle>
......@@ -125,7 +109,8 @@
</li>
</div>
</ul>
<ul> <h4><b>Subclasses</b></h4>
<ul>
<h4><b>Subclasses</b></h4>
<div *ngFor="let sub of item.Subclass| filter:searchText">
<li>
<mat-expansion-panel hideToggle>
......@@ -135,7 +120,11 @@
</mat-panel-title>
</mat-expansion-panel-header>
<p>{{sub.SubclassComment}}</p>
<ul> <h5>Instances</h5>
<ul> <button mat-button [matMenuTriggerFor]="menu"
[matMenuTriggerData]="{section: section.Name ,class: item.Class, subclass: sub.SubClass_name}"
#menuTrigger>
<h5>Instances</h5>
</button>
<div *ngFor="let instansub of sub.InstanceOfSubclass| filter:searchText">
<li>
<mat-expansion-panel hideToggle>
......@@ -158,13 +147,19 @@
</mat-expansion-panel>
</mat-accordion>
</div>
<ul> <div *ngIf= checklen(section.GeneralInstances)><h4><b>Instances</b></h4></div>
</div>
<ul>
<div *ngIf=checklen(section.GeneralInstances)>
<button mat-button [matMenuTriggerFor]="menu" [matMenuTriggerData]="{section: section.Name}" #menuTrigger>
<h4>Instances</h4>
</button>
</div>
<div *ngFor="let genin of section.GeneralInstances| filter:searchText">
<li>
<mat-expansion-panel hideToggle>
<mat-expansion-panel-header>
<mat-panel-title>
{{genin.GeneralInstances}}
{{genin.Instance}}
</mat-panel-title>
</mat-expansion-panel-header>
{{genin.Comment}}
......@@ -179,9 +174,10 @@
<div *ngIf="!checklen(systems)">
<mat-spinner style="margin: auto;"></mat-spinner>
</div>
</div>
</mat-grid-list >
</div>
</mat-grid-list>
<mat-menu #menu="matMenu">
<button mat-menu-item >Add Instances</button>
<ng-template let-class="class" let-section="section" let-subclass="subclass" matMenuContent><button mat-menu-item
(click)="openDialog(section, class, subclass)">Add Instances</button> </ng-template>
</mat-menu>
\ No newline at end of file
......@@ -7,39 +7,31 @@
<div class="list row">
<div class="col-md-14">
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<input
type="text"
class="form-control"
placeholder="Search"
(keyup)="applyFilter($event)"
#input/>
<input type="text" class="form-control" placeholder="Search" (keyup)="applyFilter($event)" #input />
</div>
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<ul fxLayout fxLayoutGap="15px" class="navigation-items">
<div>
<input class="btn btn-success" type="button" value="Add Requirement" routerLink="add-boilerplate"/>
<input class="btn btn-success" type="button" value="Add Requirement" routerLink="add-boilerplate" />
</div>
</ul>
</div>
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<ul *ngFor="let inf of infer;" fxLayout fxLayoutGap="15px" class="navigation-items">
<div>
<input class="btn btn-info"
[disabled] = "exporting"
type="button"
value="Inferencing"
(click)="updateInfer(inf.id)"/>
<input class="btn btn-info" [disabled]="exporting" type="button" value="Inferencing"
(click)="updateInfer(inf.id)" />
</div>
</ul>
</div>
</div>
</div>
<div [hidden] = "!showSpinner">
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
<div [hidden]="!showSpinner">
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
</div>
<div class="mat-elevation-z8">
<table mat-table [dataSource]="newdataSource" class="mat-elevation-z8">
<table mat-table [dataSource]="newdataSource" class="mat-elevation-z8">
<!-- Position Column -->
<ng-container matColumnDef="id">
<th mat-header-cell *matHeaderCellDef> No. </th>
......@@ -54,7 +46,9 @@
<!-- Name Column -->
<ng-container matColumnDef="title_data">
<th mat-header-cell *matHeaderCellDef> Title </th>
<td mat-cell *matCellDef="let element" matTooltip={{get_metrics(element.title_data)}}>{{element.title_data}} <span *ngIf="get_metrics(element.title_data).length > 0" matBadge={{get_metrics(element.title_data).length}} matBadgeColor="warn" matBadgeSize="small" position="above">&nbsp;&nbsp; </span>
<td mat-cell *matCellDef="let element" matTooltip={{get_metrics(element.title_data)}}>{{element.title_data}} <span
*ngIf="get_metrics(element.title_data).length > 0" matBadge={{get_metrics(element.title_data).length}}
matBadgeColor="warn" matBadgeSize="small" position="above">&nbsp;&nbsp; </span>
</td>
</ng-container>
......@@ -78,14 +72,15 @@
<tr mat-header-row *matHeaderRowDef="newdisplayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: newdisplayedColumns;"></tr>
</table>
<mat-paginator #paginator [pageSizeOptions]="[10, 20]" showFirstLastButtons></mat-paginator>
</table>
<mat-paginator #paginator [pageSizeOptions]="[10, 20]" showFirstLastButtons></mat-paginator>
</div>
<div echarts [options]="chartOption" class="demo-chart"></div>
<div class="content">
<div fxLayout="row wrap">
<div fxFlex="33%">
<div fxFlex="33.3%">
<mat-card class="example-card">
<mat-card-header>
<div class="example-header-image"></div>
......@@ -93,18 +88,22 @@
<mat-card-subtitle>{{getnumreq()}}</mat-card-subtitle>
</mat-card-header>
</mat-card>
</div>
<div fxFlex="33.3%">
<mat-card class="example-card">
<mat-card-header>
<div class="example-header-image"></div>
<mat-card-title>Complete Requirement</mat-card-title>
<mat-card-subtitle>{{getnumreq()}}</mat-card-subtitle>
<mat-card-subtitle>{{getnumreq() - getincreq()}}</mat-card-subtitle>
</mat-card-header>
</mat-card>
</div>
<div fxFlex="33.3%">
<mat-card class="example-card">
<mat-card-header>
<div class="example-header-image"></div>
<mat-card-title>Incomplete Requirement</mat-card-title>
<mat-card-subtitle>{{getnumreq()}}</mat-card-subtitle>
<mat-card-subtitle>{{getincreq()}}</mat-card-subtitle>
</mat-card-header>
</mat-card>
</div>
......
......@@ -5,8 +5,8 @@ import { InferenceResults } from 'src/app/models/boilerplate.model';
import { BoilerplateService } from 'src/app/services/boilerplate.service';
import { PrefixService } from 'src/app/services/prefix.service';
import { ActivatedRoute, Router } from '@angular/router';
import {MatTableDataSource} from '@angular/material/table';
import {MatPaginator} from '@angular/material/paginator';
import { MatTableDataSource } from '@angular/material/table';
import { MatPaginator } from '@angular/material/paginator';
import { EChartsOption } from 'echarts';
import { NotifierService } from "angular-notifier";
......@@ -34,12 +34,12 @@ export class BoilerplateListComponent implements OnInit {
type: 'pie',
radius: ['40%', '70%'],
data: [
{value: 0, name: '1'},
{value: 0, name: '2'},
{value: 0, name: '3'},
{value: 0, name: '4'},
{value: 0, name: '5'} ]
},
{ value: 0, name: '1' },
{ value: 0, name: '2' },
{ value: 0, name: '3' },
{ value: 0, name: '4' },
{ value: 0, name: '5' }]
}
],
};
private readonly notifier: NotifierService;
......@@ -54,27 +54,28 @@ export class BoilerplateListComponent implements OnInit {
currentIndex = -1;
title = '';
displayedColumns: string[] = ['id', 'title', 'has_prefix', 'has_main', 'has_suffix', 'action'];
newdisplayedColumns: string[] = ['id','title_data' ,'prefix_data', 'main_data', 'suffix_data', 'action'];
dataSource :Boilerplate[] = [{}];
thenewdataSource:BoilerplateData[] = [{}];
newdisplayedColumns: string[] = ['id', 'title_data', 'prefix_data', 'main_data', 'suffix_data', 'action'];
dataSource: Boilerplate[] = [{}];
thenewdataSource: BoilerplateData[] = [{}];
newdataSource = new MatTableDataSource(this.thenewdataSource);
infer:InferenceResults[] = [{}];
infer: InferenceResults[] = [{}];
//when inference button is pressed
showSpinner = false;
exporting = false;
list_of_inference_metrics = ["IncompleteRequirement", "AmbiguousRequirement","InconsistentRequirement","NoisyRequirement","OpaqueRequirement","RedundantRequirement"]
list_of_inference_metrics = ["IncompleteRequirement", "AmbiguousRequirement", "InconsistentRequirement", "NoisyRequirement", "OpaqueRequirement", "RedundantRequirement"]
@ViewChild(MatPaginator) paginator= this.newdataSource.paginator;
@ViewChild(MatPaginator) paginator = this.newdataSource.paginator;
dataofboilerplates: any [] = [];
aprefix: any [] = [];
dataofboilerplates: any[] = [];
aprefix: any[] = [];
main: any;
suffix: any;
constructor(private boilerplateService: BoilerplateService, private prefixService: PrefixService, private route: ActivatedRoute,
private router: Router, notifierService: NotifierService) { this.notifier = notifierService;
private router: Router, notifierService: NotifierService) {
this.notifier = notifierService;
}
......@@ -102,11 +103,11 @@ export class BoilerplateListComponent implements OnInit {
this.boilerplateService.getAllData(this.route.snapshot.params.gb)
.subscribe(
data => {
this.boilerplatesdata =data;
this.boilerplatesdata = data;
this.thenewdataSource = data;
this.newdataSource = new MatTableDataSource(this.thenewdataSource);
this.newdataSource.paginator = this.paginator;
console.log(data)
//console.log(data)
},
error => {
console.log(error);
......@@ -127,13 +128,13 @@ export class BoilerplateListComponent implements OnInit {
SearchTitle(): void {
if (this.title != ''){
if (this.title != '') {
this.boilerplateService.findByTitle(this.route.snapshot.params.gb, this.title)
.subscribe(
data => {
this.boilerplates = data;
this.dataSource = data;
console.log(data);
//console.log(data);
},
error => {
console.log(error);
......@@ -145,30 +146,35 @@ export class BoilerplateListComponent implements OnInit {
}
}
GetRoute(): void {
this.router.navigate(['/groupboilerplates/'+ this.route.snapshot.params.gb +'/boilerplates/add-boilerplate'])
this.router.navigate(['/groupboilerplates/' + this.route.snapshot.params.gb + '/boilerplates/add-boilerplate'])
}
GetRoutedit(id: any): void {
this.router.navigate(['/groupboilerplates/'+ this.route.snapshot.params.gb +'/boilerplates'+ id])
this.router.navigate(['/groupboilerplates/' + this.route.snapshot.params.gb + '/boilerplates' + id])
}
getInfer(): void{
getInfer(): void {
this.boilerplateService.getAllInfer(this.route.snapshot.params.gb)
.subscribe(
data => {
this.currentInfer = data[0];
this.infer = data;
const obj = JSON.parse(this.currentInfer['inference_data'].replace(/'/g,"\""))
const obj = JSON.parse(this.currentInfer['inference_data'].replace(/'/g, "\""))
var final = []
for (let i of this.list_of_inference_metrics){
if(obj[i] != undefined){
for (let i of this.list_of_inference_metrics) {
if (obj[i] != undefined) {
final.push({ value: obj[i].length, name: i })
}
}
console.log(final);
final.push({value: obj[i].length, name: i})}
if (this.chartOption?.series ){
this.chartOption.series = [{
type: 'pie',
radius: ['40%', '70%'],
data: final,
}]}}
}]
},
error => {
console.log(error);
......@@ -192,7 +198,7 @@ export class BoilerplateListComponent implements OnInit {
console.log(error);
this.showSpinner = !this.showSpinner;
this.exporting = !this.exporting
this.notifier.notify("warning",(JSON.stringify(error["error"]["detail"])));
this.notifier.notify("warning", (JSON.stringify(error["error"]["detail"])));
});
}
......@@ -201,17 +207,21 @@ export class BoilerplateListComponent implements OnInit {
this.newdataSource.filter = filterValue.trim().toLowerCase();
}
get_metrics(i:any): any {
if (this.currentInfer?.inference_data){
const obj = JSON.parse(this.currentInfer['inference_data'].replace(/'/g,"\""))
if (obj[i]){
get_metrics(i: any): any {
if (this.currentInfer?.inference_data) {
const obj = JSON.parse(this.currentInfer['inference_data'].replace(/'/g, "\""))
if (obj[i]) {
return obj[i]
}
}
return 0
}
getnumreq():any{
getnumreq(): any {
return this.boilerplatesdata?.length
}
getincreq(): any {
return this.get_metrics('IncompleteRequirement').length;
}
}
<h1 mat-dialog-title>{{data.name}}</h1>
<div mat-dialog-content>
<mat-form-field appearance="fill">
<mat-label>Instance name</mat-label>
<input matInput required [(ngModel)]="data.instance">
</mat-form-field>
</div>
<div mat-dialog-content>
<mat-form-field appearance="fill">
<mat-label>Instance comment</mat-label>
<textarea matInput required [(ngModel)]="data.comment" ></textarea>
</mat-form-field>
</div>
<div mat-dialog-actions>
<button mat-button (click)="onNoClick()">Cancel</button>
<button mat-button [mat-dialog-close]="data" cdkFocusInitial>Add</button>
</div>
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CourseDialogComponentComponent } from './course-dialog-component.component';
describe('CourseDialogComponentComponent', () => {
let component: CourseDialogComponentComponent;
let fixture: ComponentFixture<CourseDialogComponentComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ CourseDialogComponentComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(CourseDialogComponentComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, Inject, OnInit } from '@angular/core';
import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';
export interface DialogData {
comment: string;
instance: string;
name?: string;
}
@Component({
selector: 'app-course-dialog-component',
templateUrl: './course-dialog-component.component.html',
styleUrls: ['./course-dialog-component.component.scss']
})
export class CourseDialogComponentComponent implements OnInit {
constructor(
public dialogRef: MatDialogRef<CourseDialogComponentComponent>,
@Inject(MAT_DIALOG_DATA) public data: DialogData,) {}
ngOnInit(): void {}
onNoClick(): void {
this.dialogRef.close();
}
}
......@@ -6,28 +6,19 @@
<div class="list row">
<div class="col-md-8">
<div class="input-group mb-3">
<input
type="text"
class="form-control"
placeholder="Search"
[(ngModel)]="title"
name="search"
autocomplete="off"
/>
<input type="text" class="form-control" placeholder="Search" [(ngModel)]="title" name="search"
autocomplete="off" />
<!-- (keyup.enter)="SearchTitle()"-->
<!-- (click)="SearchTitle()" -->
<div class="input-group-append">
<button
class="btn btn-primary"
type="button"
>Search
<button class="btn btn-primary" type="button">Search
</button>
</div>
</div>
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<ul fxLayout fxLayoutGap="15px" class="navigation-items">
<div>
<input class="btn btn-success" type="button" value="Add New project" routerLink="add-groupboil"/>
<input class="btn btn-success" type="button" value="Add New project" routerLink="add-groupboil" />
</div>
</ul>
</div>
......@@ -37,7 +28,8 @@
<div class="content">
<div fxLayout="row wrap">
<div fxFlex="20%" *ngFor="let gb of grouboilerplates| filter:title">
<mat-card class="example-card" routerLink="/groupboilerplates/{{gb.id}}/boilerplates">
<mat-card class="example-card">
<div routerLink="/groupboilerplates/{{gb.id}}/boilerplates">
<mat-card-header>
<div mat-card-avatar class="example-header-image"></div>
<mat-card-title>{{gb.title_bgroup}}</mat-card-title>
......@@ -49,11 +41,13 @@
{{gb.description}}
</p>
</mat-card-content>
</div>
<mat-card-actions>
<button class="btn btn-info" mat-button>EDIT</button>
<button class="btn btn-info" routerLink="/groupboilerplates/{{gb.id}}/boilerplates"
mat-button>EDIT</button>
<button class="btn btn-warning" (click)="deleteGroupBoilerplate(gb)" mat-button>DELETE</button>
</mat-card-actions>
</mat-card>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
import { Component, OnInit } from '@angular/core';
import { GroupBoilerplate } from 'src/app/models/boilerplate.model';
import { BoilerplateService } from 'src/app/services/boilerplate.service';
import { NotifierService } from "angular-notifier";
@Component({
selector: 'app-groupboil',
......@@ -11,8 +12,10 @@ export class GroupboilComponent implements OnInit {
grouboilerplates?: GroupBoilerplate[];
title = '';
constructor(private boilerplateService: BoilerplateService) { }
private readonly notifier: NotifierService;
constructor(private boilerplateService: BoilerplateService, notifierService: NotifierService) {
this.notifier = notifierService;
}
ngOnInit(): void {
this.retrievegroupBoilerplates();
......@@ -23,7 +26,7 @@ export class GroupboilComponent implements OnInit {
.subscribe(
data => {
this.grouboilerplates = data;
console.log(data);
//console.log(data);
},
error => {
console.log(error);
......@@ -32,15 +35,17 @@ export class GroupboilComponent implements OnInit {
}
deleteGroupBoilerplate(id: any): void {
if(confirm("Αre you sure you want to delete this Project?")) {
if (confirm("Αre you sure you want to delete this Project?")) {
this.boilerplateService.deletegroupboil(id.id)
.subscribe(
response => {
console.log(response);
//console.log(response);
this.notifier.notify("success", "Project deleted");
this.retrievegroupBoilerplates();
},
error => {
console.log(error);
this.notifier.notify("warning", (JSON.stringify(error["error"]["title"][0])));
});
}
}
......
......@@ -7,39 +7,37 @@ import { MainService } from 'src/app/services/main.service';
styleUrls: ['./instances-list.component.scss']
})
export class InstancesListComponent implements OnInit {
subjects:string[] = [];
subjects: string[] = [];
stateitem:string[] = [];
stateitem: string[] = [];
statevalue:string[] = [];
statevalue: string[] = [];
shall:string[] = [];
shall: string[] = [];
verb:string[] = [];
verb: string[] = [];
quantifier:string[] = [];
quantifier: string[] = [];
numunit:string[] = [];
numunit: string[] = [];
fifuintsysstatset:string[] = [];
fifuintsysstatset: string[] = [];
stsysconset:string[] = [];
stsysconset: string[] = [];
constructor(private mainService: MainService) { }
ngOnInit(): void {
this.getchoices();
console.log('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
}
getchoices(): void{
getchoices(): void {
this.mainService.getsubject()
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.subjects.push(data[x][1]);}
for (let x = 0; x < data.length; x++) {
this.subjects.push(data[x][1]);
}
},
error => {
console.log(error);
......@@ -49,9 +47,10 @@ export class InstancesListComponent implements OnInit {
.subscribe(
data => {
//no data from State and Item
console.log(data);
for (let x=0; x < data.length; x++ ){
this.stateitem.push(data[x][1]);}
//console.log(data);
for (let x = 0; x < data.length; x++) {
this.stateitem.push(data[x][1]);
}
},
error => {
console.log(error);
......@@ -59,8 +58,9 @@ export class InstancesListComponent implements OnInit {
this.mainService.getstatevalue()
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.statevalue.push(data[x][1]);}
for (let x = 0; x < data.length; x++) {
this.statevalue.push(data[x][1]);
}
},
error => {
console.log(error);
......@@ -68,8 +68,9 @@ export class InstancesListComponent implements OnInit {
this.mainService.getshall()
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.shall.push(data[x][1]);}
for (let x = 0; x < data.length; x++) {
this.shall.push(data[x][1]);
}
},
error => {
console.log(error);
......@@ -77,8 +78,9 @@ export class InstancesListComponent implements OnInit {
this.mainService.getverb()
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.verb.push(data[x][1]);}
for (let x = 0; x < data.length; x++) {
this.verb.push(data[x][1]);
}
},
error => {
console.log(error);
......@@ -86,8 +88,9 @@ export class InstancesListComponent implements OnInit {
this.mainService.getquantifier()
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.quantifier.push(data[x][1]);}
for (let x = 0; x < data.length; x++) {
this.quantifier.push(data[x][1]);
}
},
error => {
console.log(error);
......@@ -96,8 +99,9 @@ export class InstancesListComponent implements OnInit {
this.mainService.getnumunit()
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.numunit.push(data[x][1]);}
for (let x = 0; x < data.length; x++) {
this.numunit.push(data[x][1]);
}
},
error => {
console.log(error);
......@@ -105,8 +109,9 @@ export class InstancesListComponent implements OnInit {
this.mainService.getfifuintsysstatset()
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.fifuintsysstatset.push(data[x][1]);}
for (let x = 0; x < data.length; x++) {
this.fifuintsysstatset.push(data[x][1]);
}
},
error => {
console.log(error);
......@@ -114,8 +119,9 @@ export class InstancesListComponent implements OnInit {
this.mainService.getstsysconset()
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.stsysconset.push(data[x][1]);}
for (let x = 0; x < data.length; x++) {
this.stsysconset.push(data[x][1]);
}
},
error => {
console.log(error);
......
......@@ -2,9 +2,9 @@ import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Prefix } from 'src/app/models/prefix.model';
import { PrefixService } from 'src/app/services/prefix.service';
import {FormControl} from '@angular/forms';
import {Observable} from 'rxjs';
import {map, startWith} from 'rxjs/operators';
import { FormControl } from '@angular/forms';
import { Observable } from 'rxjs';
import { map, startWith } from 'rxjs/operators';
import { NotifierService } from "angular-notifier";
......@@ -16,27 +16,27 @@ import { NotifierService } from "angular-notifier";
})
export class PrefixDetailsComponent implements OnInit {
simpleprefixControl = new FormControl();
simpleprefix:string[] = [];
simpleprefix: string[] = [];
simpleprefixfilteredOptions: Observable<string[]>;
subjectsControl = new FormControl();
subjects:string[] = [];
subjects: string[] = [];
subjectsfilteredOptions: Observable<string[]>;
verbsControl = new FormControl();
verbs:string[] = [];
verbs: string[] = [];
verbsfilteredOptions: Observable<string[]>;
objectsControl = new FormControl();
objects:string[] = [];
objects: string[] = [];
objectsfilteredOptions: Observable<string[]>;
logic_conControl = new FormControl();
logic_con:string[] = [];
logic_con: string[] = [];
logic_confilteredOptions: Observable<string[]>;
public static id: any [] = [];
public static id: any[] = [];
private readonly notifier: NotifierService;
prefixs?: Prefix[];
......@@ -54,8 +54,9 @@ export class PrefixDetailsComponent implements OnInit {
message = '';
constructor(private prefixService: PrefixService,private route: ActivatedRoute,
private router: Router, notifierService: NotifierService) { this.notifier = notifierService;
constructor(private prefixService: PrefixService, private route: ActivatedRoute,
private router: Router, notifierService: NotifierService) {
this.notifier = notifierService;
this.simpleprefixfilteredOptions = this.simpleprefixControl.valueChanges.pipe(
startWith(""),
map(value => this._filter(this.simpleprefix, value))
......@@ -83,16 +84,16 @@ export class PrefixDetailsComponent implements OnInit {
this.getAllPrefix(this.route.snapshot.params.id);
}
displayFn(option:string): string {
displayFn(option: string): string {
if (option != null) {
let x = option.split(" : ");
if ( (x[x.length -2] == "") || (x[x.length -1]=="")) { return "";}
return (x[x.length -2]+" : "+x[x.length -1]);
if ((x[x.length - 2] == "") || (x[x.length - 1] == "")) { return ""; }
return (x[x.length - 2] + " : " + x[x.length - 1]);
}
return "";
}
private _filter(data:string[], value: string): string[] {
private _filter(data: string[], value: string): string[] {
const filterValue = value.toLowerCase();
return data.filter(option => option.toLowerCase().includes(filterValue));
}
......@@ -101,7 +102,7 @@ export class PrefixDetailsComponent implements OnInit {
this.prefixService.getAll(id)
.subscribe(
data => {
PrefixDetailsComponent.id.length =0;
PrefixDetailsComponent.id.length = 0;
this.prefixs = data;
//console.log(data);
for (var val of data) {
......@@ -120,7 +121,7 @@ export class PrefixDetailsComponent implements OnInit {
.subscribe(
data => {
this.currentprefix = data;
console.log(data)
//console.log(data)
this.simpleprefixControl.setValue(this.currentprefix.prefix);
this.subjectsControl.setValue(this.currentprefix.system_fun_item);
this.verbsControl.setValue(this.currentprefix.state_or_verb);
......@@ -139,19 +140,20 @@ export class PrefixDetailsComponent implements OnInit {
this.currentprefix.state_or_verb = this.verbsControl.value;
this.currentprefix.item_function_flow_statevalue = this.objectsControl.value;
this.currentprefix.logic_connective = this.logic_conControl.value;
for (let i=0; i<PrefixDetailsComponent.id.length; i++){
for (let i = 0; i < PrefixDetailsComponent.id.length; i++) {
this.prefixService.update(this.route.snapshot.params.id, PrefixDetailsComponent.id[i], this.currentprefix)
.subscribe(
response => {
this.message = response.message;
},
error => {
this.notifier.notify("warning",("PREFIX "+JSON.stringify(error["error"])));
});}
this.notifier.notify("warning", ("PREFIX " + JSON.stringify(error["error"])));
});
}
}
getchoices(prefix_group: any): void{
getchoices(prefix_group: any): void {
this.prefixService.getsimpleprefix(prefix_group)
.subscribe(
data => {
......@@ -176,35 +178,45 @@ export class PrefixDetailsComponent implements OnInit {
});
}
setprefix(strIntoObj: any): void{
for (let x=0; x < strIntoObj.length; x++ ){
if(this.simpleprefix.indexOf(strIntoObj[x][1]) == -1) {
this.simpleprefix.push((strIntoObj[x][1]));}}
setprefix(strIntoObj: any): void {
for (let x = 0; x < strIntoObj.length; x++) {
if (this.simpleprefix.indexOf(strIntoObj[x][1]) == -1) {
this.simpleprefix.push((strIntoObj[x][1]));
}
}
}
setverb(strIntoObj: any): void{
for (let x=0; x < strIntoObj.length; x++ ){
if(this.verbs.indexOf(strIntoObj[x][1]) == -1) {
this.verbs.push((strIntoObj[x][1]));}}
setverb(strIntoObj: any): void {
for (let x = 0; x < strIntoObj.length; x++) {
if (this.verbs.indexOf(strIntoObj[x][1]) == -1) {
this.verbs.push((strIntoObj[x][1]));
}
}
}
setsubject(strIntoObj: any): void{
for (let x=0; x < strIntoObj.length; x++ ){
if(this.subjects.indexOf(strIntoObj[x][1]) == -1) {
this.subjects.push((strIntoObj[x][1]));}}
setsubject(strIntoObj: any): void {
for (let x = 0; x < strIntoObj.length; x++) {
if (this.subjects.indexOf(strIntoObj[x][1]) == -1) {
this.subjects.push((strIntoObj[x][1]));
}
}
}
setobject(strIntoObj: any): void{
for (let x=0; x < strIntoObj.length; x++ ){
if(this.objects.indexOf(strIntoObj[x][1]) == -1) {
this.objects.push((strIntoObj[x][1]));}}
setobject(strIntoObj: any): void {
for (let x = 0; x < strIntoObj.length; x++) {
if (this.objects.indexOf(strIntoObj[x][1]) == -1) {
this.objects.push((strIntoObj[x][1]));
}
}
}
setlogcon(strIntoObj: any): void{
for (let x=0; x < strIntoObj.length; x++ ){
if(this.logic_con.indexOf(strIntoObj[x][1]) == -1) {
this.logic_con.push((strIntoObj[x][1]));}}
setlogcon(strIntoObj: any): void {
for (let x = 0; x < strIntoObj.length; x++) {
if (this.logic_con.indexOf(strIntoObj[x][1]) == -1) {
this.logic_con.push((strIntoObj[x][1]));
}
}
}
}
\ No newline at end of file
......@@ -2,9 +2,9 @@ import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Suffix } from 'src/app/models/suffix.model';
import { SuffixService } from 'src/app/services/suffix.service';
import {FormControl} from '@angular/forms';
import {Observable} from 'rxjs';
import {map, startWith} from 'rxjs/operators';
import { FormControl } from '@angular/forms';
import { Observable } from 'rxjs';
import { map, startWith } from 'rxjs/operators';
import { NotifierService } from "angular-notifier";
......@@ -16,20 +16,20 @@ import { NotifierService } from "angular-notifier";
export class SuffixDetailsComponent implements OnInit {
suffixControl = new FormControl();
suffix:string[] = [];
suffix: string[] = [];
suffixfilteredOptions: Observable<string[]>;
mumerical_unitsControl = new FormControl();
mumerical_units:string[] = [];
mumerical_units: string[] = [];
mumerical_unitsfilteredOptions: Observable<string[]>;
flowControl = new FormControl();
flow:string[] = [];
flow: string[] = [];
flowfilteredOptions: Observable<string[]>;
public static id: any [] = [];
public static id: any[] = [];
private readonly notifier: NotifierService;
suffixs?:Suffix[];
suffixs?: Suffix[];
currentsuffix: Suffix = {
s_choices: "",
......@@ -66,16 +66,16 @@ export class SuffixDetailsComponent implements OnInit {
}
displayFn(option:string): string {
displayFn(option: string): string {
if (option != null) {
let x = option.split(" : ");
if ( (x[x.length -2] == "") || (x[x.length -1]=="")) { return "";}
return (x[x.length -2]+" : "+x[x.length -1]);
if ((x[x.length - 2] == "") || (x[x.length - 1] == "")) { return ""; }
return (x[x.length - 2] + " : " + x[x.length - 1]);
}
return "";
}
private _filter(data:string[], value: string): string[] {
private _filter(data: string[], value: string): string[] {
const filterValue = value.toLowerCase();
return data.filter(option => option.toLowerCase().includes(filterValue));
}
......@@ -87,11 +87,11 @@ export class SuffixDetailsComponent implements OnInit {
data => {
SuffixDetailsComponent.id.length = 0;
this.suffixs = data;
console.log(data)
//console.log(data)
for (var val of data) {
this.getSuffix(id, val.id);
SuffixDetailsComponent.id.push(val.id);
console.log(val.id)
//console.log(val.id)
}
},
error => {
......@@ -120,25 +120,28 @@ export class SuffixDetailsComponent implements OnInit {
this.currentsuffix.s_choices = this.suffixControl.value;
this.currentsuffix.mumerical_units = this.mumerical_unitsControl.value;
this.currentsuffix.flow = this.flowControl.value;
for (let i=0; i<SuffixDetailsComponent.id.length; i++){
for (let i = 0; i < SuffixDetailsComponent.id.length; i++) {
this.suffixService.update(this.route.snapshot.params.id, SuffixDetailsComponent.id[i], this.currentsuffix)
.subscribe(
response => {
this.message = response.message;
},
error => {
this.notifier.notify("warning",("SUFFIX "+JSON.stringify(error["error"])));
});}
this.notifier.notify("warning", ("SUFFIX " + JSON.stringify(error["error"])));
});
}
}
getchoices(): void{
getchoices(): void {
this.suffixService.getsuffix()
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
if(this.suffix.indexOf(data[x][1]) == -1) {
this.suffix.push(data[x][1]);}}
for (let x = 0; x < data.length; x++) {
if (this.suffix.indexOf(data[x][1]) == -1) {
this.suffix.push(data[x][1]);
}
}
},
error => {
console.log(error);
......@@ -146,9 +149,11 @@ export class SuffixDetailsComponent implements OnInit {
this.suffixService.getnumunits()
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
if(this.mumerical_units.indexOf(data[x][1]) == -1) {
this.mumerical_units.push(data[x][1]);}}
for (let x = 0; x < data.length; x++) {
if (this.mumerical_units.indexOf(data[x][1]) == -1) {
this.mumerical_units.push(data[x][1]);
}
}
},
error => {
console.log(error);
......@@ -156,9 +161,11 @@ export class SuffixDetailsComponent implements OnInit {
this.suffixService.getflow()
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
if(this.flow.indexOf(data[x][1]) == -1) {
this.flow.push(data[x][1]);}}
for (let x = 0; x < data.length; x++) {
if (this.flow.indexOf(data[x][1]) == -1) {
this.flow.push(data[x][1]);
}
}
},
error => {
console.log(error);
......
export class Boilerplate {
id?:any;
owner?:any;
id?: any;
owner?: any;
group_of_boilerplate?: any;
title?: string;
has_prefix?: boolean;
......@@ -9,7 +9,7 @@ export class Boilerplate {
}
export class BoilerplateData {
id?:any;
id?: any;
title_data?: string;
prefix_data?: string;
main_data?: string;
......@@ -17,36 +17,37 @@ export class BoilerplateData {
}
export class GroupBoilerplate {
id?:any;
id?: any;
title_bgroup?: string;
description?: string;
}
export class InferenceResults {
id?:any;
id?: any;
infer_group_of_boilerplate?: any;
inference_data?: any;
}
export class Sections {
Name?:string;
Name?: string;
TheClasses?: Classes[];
GeneralInstances?:Instances[];
GeneralInstances?: Instances[];
}
export class Classes {
Class?:string;
Class?: string;
Comment?: string;
Subclass?:SubClasses[];
Instance_of_Class?:Instances[];
Subclass?: SubClasses[];
Instance_of_Class?: Instances[];
}
export class SubClasses {
SubClass_name?:string;
SubclassComment?:string
InstanceOfSubclass?:Instances[];
SubClass_name?: any;
SubclassComment?: any
InstanceOfSubclass?: Instances[];
}
export class Instances {
Instance?: any;
Comment?: any;
}
......@@ -164,4 +164,8 @@ export class MainService {
getmainsyntax(): Observable<any> {
return this.http.get(`http://155.207.131.19:8000/api-auth/mainsyntax`);
}
setinstances(gb : any, instance: any, comment:any): Observable<any> {
return this.http.get(`${baseUrl2}${gb}`+`/main/choices/add`+`/${instance}`+`/${comment}/`);
}
}
import json
import os
from django.db import models
from jsonfield import JSONField
#from django.contrib.postgres.fields import ArrayField
......@@ -73,18 +74,31 @@ def create_extra_prefix(instance, now_prefix):
prefix.save()
def create_infer_result(instance):
infer = InferenceResults(owner_infer= instance.boilerplate_owner, infer_group_of_boilerplate = instance, ontology_file=instance.ontology_file)
def create_infer_result(instance, destination):
infer = InferenceResults(owner_infer= instance.boilerplate_owner, infer_group_of_boilerplate = instance, ontology_file=destination)
infer.save()
#Here we have to give and the ontology file of the Boilerplate Group to get the current instances
def initialize_instances(instance):
try :
g = Graph()
file_name = instance.title_bgroup.replace('/', '')
save_path = "../../Ontologies/"+file_name+"/"
if (os.path.exists("../../Ontologies/"+file_name+"/") == False):
os.mkdir("../../Ontologies/"+file_name)
completeName = os.path.join(save_path, file_name)
g.load(instance.ontology_file, format="turtle")
destination=save_path+file_name+'.ttl'
g.serialize(destination, format='turtle')
except:
print('Cannot load Ontology')
classes_inctances = BoilerplateGroupClassesInstances ( classes_instances_owner= instance.boilerplate_owner, classes_instances_group_of_boilerplate = instance,
ontology_file=instance.ontology_file )
ontology_file= destination)
classes_inctances.save()
dict = BoilerplateGroupDictionary( classes_instances_owner_dic= instance.boilerplate_owner, classes_instances_group_of_boilerplate_dic = instance,
ontology_file_dic=instance.ontology_file )
ontology_file_dic= destination)
dict.save()
return destination
'''Update instaces of the ontology after the inferencing'''
def update_instances(instance):
......@@ -108,13 +122,13 @@ def update_instances(instance):
inteface_choices=json.dumps(INTERFACE_CHOICES), connection_choices=json.dumps(CONNECTION_CHOICES), flow_choices=json.dumps(FLOW_CHOICES),
state_choices=json.dumps(STATE_CHOICES),state_set_choices=json.dumps(STATE_SET_CHOICES), state_value_choices=json.dumps(STATE_VALUE_CHOICES),
main_verb_choices=json.dumps(VERB_CHOICES), numerical_affirmative_choices=json.dumps(NUMERICAL_AFFIRMATIVE_CHOICES),
suffix_choices=json.dumps(S_CHOICES) )
suffix_choices=json.dumps(S_CHOICES), ontology_file=instance.ontology_file )
Dict_list=[]
sao_names=['SAO#System', 'SAO#Function', 'SAO#Item', 'SAO#Interface', 'SAO#Connection', 'SAO#Flow', 'SAO#State', 'SAO#StateSet', 'SAO#StateValue']
for i in sao_names:
Dict_list.append(get_dmo_classes_and_comment(i, g))
#Dictionary_Data_list.append
BoilerplateGroupDictionary.objects.filter(classes_instances_owner_dic= instance.owner_infer, classes_instances_group_of_boilerplate_dic = instance.infer_group_of_boilerplate).update(Dictionary_Data =Dict_list)
BoilerplateGroupDictionary.objects.filter(classes_instances_owner_dic= instance.owner_infer, classes_instances_group_of_boilerplate_dic = instance.infer_group_of_boilerplate).update(ontology_file_dic =instance.ontology_file, Dictionary_Data =Dict_list)
......@@ -122,14 +136,14 @@ def update_instances(instance):
class BoilerplateGroup(models.Model):
boilerplate_owner = models.ForeignKey(User, related_name='boilerplate_group_owner', on_delete=models.CASCADE)
#add Boilerplate path, so each Boilerplate Group can hace it's own Ontology file
ontology_file = models.CharField(default="../../Ontologies/Autonomy_v1.ttl", max_length=100, blank=True)
ontology_file = models.CharField(default="../../Ontologies/2022_AOCS.ttl", max_length=100, blank=True)
title_bgroup = models.CharField(max_length=100, unique=True)
description = models.CharField(max_length=500)
def save(self, **kwargs):
super(BoilerplateGroup, self).save(**kwargs)
initialize_instances(self)
create_infer_result(self)
destination = initialize_instances(self)
create_infer_result(self, destination)
......
......@@ -6,7 +6,7 @@ from reqman.apps.reqtool.rest_api.services.parse_ontologies import *
#HERE
#Ontology_file = "../../Ontologies/Autonomy_v1.ttl"
Ontology_file = "../../Ontologies/Autonomy_v1.ttl"
Ontology_file = "../../Ontologies/2022_AOCS.ttl"
list_of_inference_metrics = ["IncompleteRequirement", "AmbiguousRequirement",
"InconsistentRequirement","NoisyRequirement","OpaqueRequirement","RedundantRequirement"]
......@@ -21,11 +21,11 @@ def getclassofprefix(prefix):
def getclassofmain(main):
return(findclassofmain(main))
def getinstancefile(data):
def getinstancefile(data, g):
datam = data.split(":")
out_list = get_file_and_instances('SAO#'+ datam[0].strip())
out_list = get_file_and_instances('SAO#'+ datam[0].strip(), g)
for j in range(0,(len(out_list)-1),2):
if out_list[j]==data:
if ( datam[len(datam) -2].strip()+' : '+ datam[len(datam) -1].strip() ) in out_list[j]:
splitter = out_list[j].split(" : ")
instance_file = out_list[j+1]
break
......@@ -51,7 +51,7 @@ def inferencing(ontfile, project, boilerlate, prefix, main, suffix):
#findclassofmain(listofmain)
ontology_with_new_req = exportboiltottl(ontfile, project, listofprefix, listofboil, listofmain, listofsuffix)
infer_result = shacl(ontology_with_new_req)
ontology_with_new_req_and_infer = ontology_with_new_req+"infer.ttl"
ontology_with_new_req_and_infer = ontology_with_new_req #+"infer.ttl"
#find in which metrics the requirements belongs e.g. title:REQ-1 is only an Incomplete req (and Ambiguous req),
# so -> 'REQ-1' : [Incomplete] ('REQ-1' : [Incomplete, Ambiguous])
for met in infer_result:
......@@ -80,7 +80,7 @@ def exportboiltottl(ontfile,project, prefix, boilerplate, main, suffix):
else :
g.load(ontfile, format="turtle")
#remove the requirements from the RDO-instances
previous_req = URIRef("http://delab.csd.auth.gr/ontologies/2018/RDO-instances")
previous_req = URIRef("http://delab.csd.auth.gr/ontologies/2018/RDO-instances#")
g.remove((previous_req, None, None))
for i in range(len(boilerplate)):
title = boilerplate[i][0]['title']
......@@ -96,7 +96,7 @@ def exportboiltottl(ontfile,project, prefix, boilerplate, main, suffix):
g.add((per_instances+("SystemStateValueContraint_"+title), rbo+"isRelatedToState", lo + prefix_attr_splitter[1].strip()))
for j in prefixmodel:
if prefix[i][0][j] != "":
sub_instance_file, prefix_subject_splitter = getinstancefile(prefix[i][0][j])
sub_instance_file, prefix_subject_splitter = getinstancefile(prefix[i][0][j], g)
g.add((per_instances+("SystemStateValueContraint_"+title), rbo+"isRelatedTo"+prefix_subject_splitter[0], URIRef(str(sub_instance_file))+"#"+ str(prefix_subject_splitter[len(prefix_subject_splitter) -1])))
else:
prefix_verb_splitter = prefix[i][0]['state_or_verb'].split(" : ")
......@@ -105,13 +105,14 @@ def exportboiltottl(ontfile,project, prefix, boilerplate, main, suffix):
g.add((per_instances+(prefix_verb_splitter[0]+"OccuringFunctionality"+title), rbo+"isRelatedToAction", lo + prefix_verb_splitter[1].strip()))
for j in prefixmodel:
if prefix[i][0][j] != "":
sub_instance_file, prefix_subject_splitter = getinstancefile(prefix[i][0][j])
sub_instance_file, prefix_subject_splitter = getinstancefile(prefix[i][0][j], g)
g.add((per_instances+(prefix_verb_splitter[0]+"OccuringFunctionality"+title), rbo+"isRelatedTo"+prefix_subject_splitter[0], URIRef(str(sub_instance_file))+"#"+ str(prefix_subject_splitter[len(prefix_subject_splitter) -1])))
if (boilerplate[i][0]['has_main'] == True): #If the requirement has Main
g.add((per_instances + title, rdo + 'hasMain', per_instances+(title+"_"+ main[i][0]['main_choices'])))
g.add((per_instances+(title+"_"+ main[i][0]['main_choices']), RDF.type, rbo + main[i][0]['main_choices']))
if main[i][0]['sys_fun_inter'] != "":
instance_file, splitter_1 = getinstancefile(main[i][0]['sys_fun_inter'])
print(main[i][0]['sys_fun_inter'])
instance_file, splitter_1 = getinstancefile(main[i][0]['sys_fun_inter'], g)
g.add((per_instances+(title+"_"+ main[i][0]['main_choices']), rbo+"isRelatedToSubject", URIRef(str(instance_file))+"#"+ str(splitter_1[len(splitter_1) -1])))
if main[i][0]['verb'] != "":
mainverb = main[i][0]['verb'].split(':')
......@@ -119,7 +120,7 @@ def exportboiltottl(ontfile,project, prefix, boilerplate, main, suffix):
mainmodel=["flow_function_interface_item_system_state_stateset", "state_item_before_verb", "statevalue_before_verb", "statevalue_system_connection_stateset"]
for j in mainmodel:
if main[i][0][j] != "":
instance_file, splitter_1 = getinstancefile(main[i][0][j])
instance_file, splitter_1 = getinstancefile(main[i][0][j], g)
g.add((per_instances+(title+"_"+ main[i][0]['main_choices']), rbo+"isRelatedTo"+splitter_1[0], URIRef(str(instance_file))+"#"+ str(splitter_1[len(splitter_1) -1])))
if main[i][0]['quantifier'] != "":
g.add((per_instances+(title+"_"+ main[i][0]['main_choices']), sao+"isRelatedTo", (per_instances+(title+"_"+ (main[i][0]['quantifier']).replace(" ", "")))))
......@@ -142,7 +143,10 @@ def exportboiltottl(ontfile,project, prefix, boilerplate, main, suffix):
g.add((per_instances+(title+"_"+ suffix[i][0]['suffix_choices']), RDF.type, URIRef(rbo+ suffix[i][0]['suffix_choices'])))
#g.remove((per_instances + title, None, None))
try :
g.serialize(destination=ontfile+'.ttl', format='turtle')
return (ontfile)
except:
g.serialize(destination=save_path+file_name+'.ttl', format='turtle')
return (save_path+file_name)
#print(g.serialize(format="turtle").decode("utf-8"))
......
......@@ -13,7 +13,8 @@ Ontology_file = "../../Ontologies/Autonomy_v1.ttl"
subClass_instances = "../../Ontologies/instances_subclass.txt"
#HERE
list_of_DSO = ["http://delab.csd.auth.gr/ontologies/2018/SAO#","http://delab.csd.auth.gr/ontologies/2018/DSO#", "http://delab.csd.auth.gr/ontologies/2018/DSO-Automotive#", "http://delab.csd.auth.gr/ontologies/2018/DSO-Automotive-AVP#", "http://delab.csd.auth.gr/ontologies/2018/DSO-Automotive-AVP-instances#"]
#list_of_DSO = ["http://delab.csd.auth.gr/ontologies/2018/SAO#","http://delab.csd.auth.gr/ontologies/2018/DSO#", "http://delab.csd.auth.gr/ontologies/2018/DSO-Automotive#", "http://delab.csd.auth.gr/ontologies/2018/DSO-Automotive-AVP#", "http://delab.csd.auth.gr/ontologies/2018/DSO-Automotive-AVP-instances#","http://delab.csd.auth.gr/ontologies/2018/RDO-instances#"]
list_of_DSO = ["http://delab.csd.auth.gr/ontologies/2018/SAO#","http://delab.csd.auth.gr/ontologies/2018/DSO#", "http://delab.csd.auth.gr/ontologies/2018/DSO-AOCS#", "http://delab.csd.auth.gr/ontologies/2018/DSO-AOCS-instances#","http://delab.csd.auth.gr/ontologies/2018/RDO-instances#"]
#list_of_RMO = ["RMO", "RMO-instances", "DSO-AOCS-instances", "<http://delab.csd.auth.gr/ontologies/2018/RDO-instances"]
#list_of_RMO = ["RMO", "RMO-instances", "DSO-Automotive-AVP-instances", "<http://delab.csd.auth.gr/ontologies/2018/DSO-Automotive-AVP-instances"]
DSO = ["http://delab.csd.auth.gr/ontologies/2018/DSO#"]
......@@ -76,7 +77,7 @@ def get_verb_instances(keyword):
'''Get Verbs - return tuple'''
def get_verb_file_and_instances(keyword):
get_file_and_instances(keyword)
get_file_and_instances(keyword, g)
keywordspl = keyword.split("#")
in_list = []
out_list = []
......@@ -165,7 +166,7 @@ out_list = []
# A dict with all the info of classes, subclasses and instances
info_dict = {}
def get_file_and_instances(keyword):
def get_file_and_instances(keyword, g):
out_list = []
keywordspl = keyword.split("#")
in_list = [keywordspl[len(keywordspl)-1]]
......@@ -258,7 +259,7 @@ def get_dmo_classes_and_comment(keyword, g):
pop = URIRef(urired2 + spl[len(spl) - 1])
for q1, w1, m1 in g.triples((pop, RDFS.comment, None)):
find_comment_gen_instance = (str(m1).replace("\r","")).replace("\n","")
dmo_dic_in = {'GeneralInstances': spl[len(spl) - 1], "Comment": find_comment_gen_instance}
dmo_dic_in = {'Instance': spl[len(spl) - 1], "Comment": find_comment_gen_instance}
dic_list_in.append(dmo_dic_in)
for comment in out_list_instance:
instance_list = []
......@@ -323,7 +324,7 @@ def get_dmo_classes_and_comment(keyword, g):
return Dictionary_Data
#return dic_list_backup
else:
dmo_dic_backup = {"Class": " ", "Comment":" "}
dmo_dic_backup = {"Class": "", "Comment":""}
dic_list_backup.append(dmo_dic_backup)
Dictionary_Data = { "Name":section, "TheClasses" : dic_list_backup, "GeneralInstances": dic_list_in}
return Dictionary_Data
......
......@@ -34,6 +34,7 @@ urlpatterns = [
#MAIN CHOICES DATA
path('groupboilerplates/<int:groupboil>/main/choices/', main_req_views.MainChoicesViewSet.as_view(), name='mainchoices'),
path('groupboilerplates/<int:groupboil>/main/choices/add/<str:instance>/<str:comment>/', main_req_views.MainChoicesAPIView.as_view(), name='setmainchoices'),
path('main/choices/shall/', main_req_views.ShallChoicesViewSet.as_view(), name='mainshall'),
#SUFFIX CHOICES DATA
......
import os
from rdflib import Graph, URIRef
from rest_framework.generics import ListCreateAPIView, RetrieveUpdateDestroyAPIView, ListAPIView
from rest_framework import permissions
......@@ -61,6 +63,10 @@ class BoilerplateGroupDetailsAPIView(RetrieveUpdateDestroyAPIView):
#Custom actions when DELETE
def perform_destroy(self, instance):
try:
os.system('rm -rf ../../Ontologies/' + instance.title_bgroup +'/')
except:
print('No file exist')
instance.delete()
......@@ -116,6 +122,22 @@ class BoilerplateDetailsAPIView(RetrieveUpdateDestroyAPIView):
#Custom actions when DELETE
def perform_destroy(self, instance):
#boildata = BoilerplateData.objects.filter(boilerplate_data_id=self.kwargs['pk'])
#data = BoilerplateGroupClassesInstances.objects.filter(classes_instances_owner= boildata.values('owner_data')[0]['owner_data'], classes_instances_group_of_boilerplate = boildata.values('group_of_boilerplate_data')[0]['group_of_boilerplate_data'])
#g = Graph()
#g.load(data.values('ontology_file')[0]['ontology_file'], format="turtle")
#rdo_instance= URIRef("http://delab.csd.auth.gr/ontologies/2018/RDO-instances#" + boildata.values('title_data')[0]['title_data'])
#g.remove((rdo_instance, None, None))
#g.remove((None, None, rdo_instance))
#prefix = Prefix.objects.filter(prefix_boilerplate = instance)
#pre_instance= URIRef("http://delab.csd.auth.gr/ontologies/2018/RDO-instances#" + boildata.values('title_data')[0]['title_data'] +'_'+ prefix.values('simple_prefix')[0]['simple_prefix'])
#g.remove((pre_instance, None, None))
#g.remove((None, None, pre_instance))
#main = Main.objects.filter(boilerplate_of_main = instance)
#rdo_instance= URIRef("http://delab.csd.auth.gr/ontologies/2018/RDO-instances#" + boildata.values('title_data')[0]['title_data'] +'_'+ main.values('main_choices')[0]['main_choices'])
#g.remove((rdo_instance, None, None))
#g.remove((None, None, rdo_instance))
#g.serialize(data.values('ontology_file')[0]['ontology_file'], format='turtle')
instance.delete()
......@@ -232,10 +254,10 @@ class InferDetailsAPIView(RetrieveUpdateDestroyAPIView):
prefixdata.append(self.getprefixdata(id.boilerplate_data_id.id))
maindata.append(self.getmaindata(id.boilerplate_data_id.id))
suffixdata.append(self.getsuffixdata(id.boilerplate_data_id.id))
try:
#try:
metrics, onto_file = inference.inferencing(instance['ontology_file'], project_title, boildata, prefixdata, maindata, suffixdata)
except:
raise APIException("Not all instances in the Ontology")
#except:
# raise APIException("Not all instances in the Ontology")
instance.update(inference_data = metrics, ontology_file=onto_file)
serializer.save()
......@@ -254,7 +276,7 @@ class InferDetailsAPIView(RetrieveUpdateDestroyAPIView):
class PrefixChoicesViewSet(ListAPIView):
"""
API view to retrieve, update or delete
API view to retrieve list of Prefix choices
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = BoilerplateGroupClassesInstancesSerializer
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment