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()"> <div *ngIf="LoggedIn()">
<mat-sidenav-container> <mat-sidenav-container>
...@@ -17,7 +19,7 @@ ...@@ -17,7 +19,7 @@
<footer class="footer page-footer font-small "> <footer class="footer page-footer font-small ">
<!-- Copyright --> <!-- 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> <a href="https://depend.csd.auth.gr/">Depend Research Team</a>
</div> </div>
<!-- Copyright --> <!-- Copyright -->
...@@ -30,4 +32,3 @@ ...@@ -30,4 +32,3 @@
</div> </div>
<notifier-container></notifier-container> <notifier-container></notifier-container>
\ No newline at end of file
...@@ -35,9 +35,27 @@ import { AddGroupboilComponent } from './components/add-groupboil/add-groupboil. ...@@ -35,9 +35,27 @@ import { AddGroupboilComponent } from './components/add-groupboil/add-groupboil.
import { InstancesListComponent } from './components/instances-list/instances-list.component'; import { InstancesListComponent } from './components/instances-list/instances-list.component';
import { Ng2SearchPipeModule } from 'ng2-search-filter'; import { Ng2SearchPipeModule } from 'ng2-search-filter';
import { NgxEchartsModule } from 'ngx-echarts'; import { NgxEchartsModule } from 'ngx-echarts';
import { CourseDialogComponentComponent } from './components/course-dialog-component/course-dialog-component.component';
@NgModule({ @NgModule({
imports: [
BrowserModule,
AppRoutingModule,
FormsModule,
ReactiveFormsModule,
Ng2SearchPipeModule,
HttpClientModule,
NgbModule,
NotifierModule,
BrowserAnimationsModule,
MaterialModule,
FlexLayoutModule,
NgxEchartsModule.forRoot({
echarts: () => import('echarts')
}),
],
declarations: [ declarations: [
AppComponent, AppComponent,
LoginComponent, LoginComponent,
...@@ -57,22 +75,7 @@ import { NgxEchartsModule } from 'ngx-echarts'; ...@@ -57,22 +75,7 @@ import { NgxEchartsModule } from 'ngx-echarts';
GroupboilComponent, GroupboilComponent,
AddGroupboilComponent, AddGroupboilComponent,
InstancesListComponent, InstancesListComponent,
], CourseDialogComponentComponent,
imports: [
BrowserModule,
AppRoutingModule,
ReactiveFormsModule,
FormsModule,
Ng2SearchPipeModule,
HttpClientModule,
NgbModule,
NotifierModule,
BrowserAnimationsModule,
MaterialModule,
FlexLayoutModule,
NgxEchartsModule.forRoot({
echarts: () => import('echarts')
}),
], ],
providers: [ providers: [
AuthService, AuthService,
...@@ -83,6 +86,6 @@ import { NgxEchartsModule } from 'ngx-echarts'; ...@@ -83,6 +86,6 @@ import { NgxEchartsModule } from 'ngx-echarts';
multi: true, multi: true,
}, },
], ],
bootstrap: [AppComponent] bootstrap: [AppComponent],
}) })
export class AppModule { } export class AppModule { }
import { Component, OnInit } from '@angular/core'; 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 { Boilerplate } from 'src/app/models/boilerplate.model';
import { BoilerplateService } from 'src/app/services/boilerplate.service'; import { BoilerplateService } from 'src/app/services/boilerplate.service';
import { NotifierService } from "angular-notifier"; import { NotifierService } from "angular-notifier";
...@@ -41,19 +41,20 @@ export class AddBoilerplateComponent implements OnInit { ...@@ -41,19 +41,20 @@ export class AddBoilerplateComponent implements OnInit {
}; };
if (data.title != "") { if (data.title != "") {
data.title = data.title?.replace(/[^\w\s]/gi, ' ') 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) this.boilerplatelService.create(this.route.snapshot.params.gb, data)
.subscribe( .subscribe(
response => { response => {
this.notifier.notify("success",(JSON.stringify(response))); this.notifier.notify("success", "Requirement " + this.boilerplate.title + " created");
this.submitted = true; 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 => { error => {
console.log(error); console.log(error);
//error, warning, success, info, default //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 { ...@@ -69,39 +70,39 @@ export class AddBoilerplateComponent implements OnInit {
} }
prefixs = [ prefixs = [
{name: 'P1', details: "If/Unless <logical expression>", explanation: 'Expresses a logical condition. Paraphrases: in case, provided that, on condition that.'}, { 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: '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: '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 = [ mains = [
{name: 'M1', details: "system/function shall [not] set [<quantifier>] item [to stateValue]", explanation: 'Sets item Paraphrases: initiate, reset, update.'}, { 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: '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: '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: '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: '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: '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: '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: '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: '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: '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: '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: '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: '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: '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: '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: 'M16', details: "system shall [not] contain system", explanation: 'System decomposition.' },
]; ];
suffixs = [ suffixs = [
{name: 'S1', details: "<numerical-afirmative> j <closed-interval> [per <time-unit>]", explanation: ''}, { name: 'S1', details: "<numerical-afirmative> j <closed-interval> [per <time-unit>]", explanation: '' },
{name: 'S2', details: "after/before flow", 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: '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: 'S4', details: "at the beginning/at the end", explanation: '' },
{name: 'S5', details: "at even intervals", explanation: ''}, { name: 'S5', details: "at even intervals", explanation: '' },
{name: 'S6', details: "sequentially", 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 @@ ...@@ -5,28 +5,21 @@
</ol> </ol>
</nav> </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> <form name="myForm" ngNativeValidate>
<div class="form-group"> <div class="form-group">
<label for="title_bgroup">Requirement Title</label> <label for="title_bgroup">Project title</label>
<input type="text" class="form-control" id="title_bgroup" <input type="text" class="form-control" id="title_bgroup" required [(ngModel)]="groupboilerplate.title_bgroup"
required name="title_bgroup">
[(ngModel)]="groupboilerplate.title_bgroup" name="title_bgroup">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="description">Description of project</label> <label for="description">Description of project</label>
<textarea <textarea type="text" class="form-control" id="description" required [(ngModel)]="groupboilerplate.description"
type="text" name="description"></textarea>
class="form-control"
id="description"
required
[(ngModel)]="groupboilerplate.description"
name="description"
></textarea>
</div> </div>
</form> </form>
<button (click)="saveBoilerplate()" class="btn btn-success" >Submit</button> <button (click)="saveBoilerplate()" class="btn btn-success">Submit</button>
</div>
\ No newline at end of file
</div>
\ No newline at end of file
import { Component, OnInit } from '@angular/core'; 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 { GroupBoilerplate } from 'src/app/models/boilerplate.model';
import { BoilerplateService } from 'src/app/services/boilerplate.service'; import { BoilerplateService } from 'src/app/services/boilerplate.service';
import { NotifierService } from "angular-notifier"; import { NotifierService } from "angular-notifier";
...@@ -18,7 +18,7 @@ export class AddGroupboilComponent implements OnInit { ...@@ -18,7 +18,7 @@ export class AddGroupboilComponent implements OnInit {
submitted = false; submitted = false;
private readonly notifier: NotifierService; 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; this.notifier = notifierService;
} }
...@@ -27,20 +27,21 @@ export class AddGroupboilComponent implements OnInit { ...@@ -27,20 +27,21 @@ export class AddGroupboilComponent implements OnInit {
saveBoilerplate(): void { saveBoilerplate(): void {
const data = { const data = {
title_bgroup: this.groupboilerplate.title_bgroup, 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) this.boilerplatelService.creategroupboil(data)
.subscribe( .subscribe(
response => { response => {
this.notifier.notify("success",(JSON.stringify(response))); this.notifier.notify("success", "Project " + this.groupboilerplate.title_bgroup + ' created');
this.submitted = true; this.submitted = false;
this.router.navigate(['/groupboilerplates']); this.router.navigate(['/groupboilerplates']);
}, },
error => { error => {
console.log(error); console.log(error);
//error, warning, success, info, default //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 { newBoilerplate(): void {
......
...@@ -9,28 +9,18 @@ ...@@ -9,28 +9,18 @@
</ol> </ol>
</nav> </nav>
<mat-grid-list cols="2"> <mat-grid-list cols="2">
<div class="first"> <div class="first">
<div *ngIf="currentboilerplate.id" class="edit-form"> <div *ngIf="currentboilerplate.id" class="edit-form">
<form ngNativeValidate> <form ngNativeValidate>
<div class="form-group" style="display:flex; flex-direction: row; align-items: center"> <div class="form-group" style="display:flex; flex-direction: row; align-items: center">
<label for="title" style="margin-right: 50px;">Requirement title</label> <label for="title" style="margin-right: 50px;">Requirement title</label>
<input <input name="title" id="title" type="text" class="form-control" required
name="title" [(ngModel)]="currentboilerplate.title" (change)="this.updateBoilerplate()" style="width: 63%;" />
id="title"
type="text"
class="form-control"
required
[(ngModel)]="currentboilerplate.title"
(change)="this.updateBoilerplate()"
style="width: 63%;"/>
</div> </div>
<div style="display: flex; flex-grow: grow; margin-top: 50px; "> <div style="display: flex; flex-grow: grow; margin-top: 50px; ">
<form class="form-group form-inline "> <form class="form-group form-inline ">
<mat-checkbox class="example-full-width" <mat-checkbox class="example-full-width" [(ngModel)]="currentboilerplate.has_prefix"
[(ngModel)]="currentboilerplate.has_prefix" (change)="this.updateBoilerplate()" name="has_prefix">Prefix
(change)="this.updateBoilerplate()"
name="has_prefix"
>Prefix
</mat-checkbox> </mat-checkbox>
</form> </form>
<div *ngIf="this.currentboilerplate.has_prefix" style="margin-left: 50px;"> <div *ngIf="this.currentboilerplate.has_prefix" style="margin-left: 50px;">
...@@ -40,11 +30,8 @@ ...@@ -40,11 +30,8 @@
<mat-divider></mat-divider> <mat-divider></mat-divider>
<div style="display: flex; flex-grow: grow; margin-top: 50px;"> <div style="display: flex; flex-grow: grow; margin-top: 50px;">
<form class="form-group form-inline "> <form class="form-group form-inline ">
<mat-checkbox class="example-full-width" <mat-checkbox class="example-full-width" [(ngModel)]="currentboilerplate.has_main" name="has_prefix"
[(ngModel)]="currentboilerplate.has_main" [disabled]="true">Main
name="has_prefix"
[disabled]="true"
>Main
</mat-checkbox> </mat-checkbox>
</form> </form>
<div *ngIf="this.currentboilerplate.has_main" style="margin-left: 50px;"> <div *ngIf="this.currentboilerplate.has_main" style="margin-left: 50px;">
...@@ -54,11 +41,8 @@ ...@@ -54,11 +41,8 @@
<mat-divider></mat-divider> <mat-divider></mat-divider>
<div style="display: flex; flex-grow: grow; margin-top: 50px;"> <div style="display: flex; flex-grow: grow; margin-top: 50px;">
<form class="form-group form-inline "> <form class="form-group form-inline ">
<mat-checkbox class="example-full-width" <mat-checkbox class="example-full-width" [(ngModel)]="this.currentboilerplate.has_suffix"
[(ngModel)]="this.currentboilerplate.has_suffix" (change)="this.updateBoilerplate()" name="has_suffix">Suffix
(change)="this.updateBoilerplate()"
name="has_suffix"
>Suffix
</mat-checkbox> </mat-checkbox>
</form> </form>
<div *ngIf="this.currentboilerplate.has_suffix" style="margin-left: 50px;"> <div *ngIf="this.currentboilerplate.has_suffix" style="margin-left: 50px;">
...@@ -68,16 +52,11 @@ ...@@ -68,16 +52,11 @@
</form> </form>
<div class="list row"> <div class="list row">
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="start"> <div fxFlex fxLayout fxHide.xs fxLayoutAlign="start">
<input class="btn btn-success" <input class="btn btn-success" type="button" value=" Update Boilerplate"
type="button" (click)="updateDetailsOfBoilerplate()" />
value=" Update Boilerplate"
(click)="updateDetailsOfBoilerplate()"/>
</div> </div>
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end"> <div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<input class="btn btn-warning" <input class="btn btn-warning" type="button" value="Delete Boilerplate" (click)="deleteBoilerplate()" />
type="button"
value="Delete Boilerplate"
(click)="deleteBoilerplate()"/>
</div> </div>
</div> </div>
<p>{{ message }}</p> <p>{{ message }}</p>
...@@ -88,17 +67,19 @@ ...@@ -88,17 +67,19 @@
<div *ngIf="!currentboilerplate.id"> <div *ngIf="!currentboilerplate.id">
<mat-spinner style="margin: auto;"></mat-spinner> <mat-spinner style="margin: auto;"></mat-spinner>
</div> </div>
</div> </div>
<!-- Dictionary --> <!-- Dictionary -->
<div class="second"> <div class="second">
<div class="search-hero"> <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> </div>
<mat-tab-group mat-align-tabs="center"> <mat-tab-group mat-align-tabs="center">
<div *ngFor="let section of systems| filter:searchText"> <div *ngFor="let section of systems| filter:searchText">
<mat-tab label={{section.Name}}> <mat-tab label={{section.Name}}>
<div *ngFor="let item of section.TheClasses| filter:searchText"> <div *ngFor="let item of section.TheClasses| filter:searchText">
<div *ngIf="item.Class">
<mat-accordion> <mat-accordion>
<mat-expansion-panel> <mat-expansion-panel>
<mat-expansion-panel-header> <mat-expansion-panel-header>
...@@ -111,7 +92,10 @@ ...@@ -111,7 +92,10 @@
</mat-expansion-panel-header> </mat-expansion-panel-header>
{{ item.Comment }} {{ item.Comment }}
<ul> <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"> <div *ngFor="let instan of item.Instance_of_Class| filter:searchText">
<li> <li>
<mat-expansion-panel hideToggle> <mat-expansion-panel hideToggle>
...@@ -125,7 +109,8 @@ ...@@ -125,7 +109,8 @@
</li> </li>
</div> </div>
</ul> </ul>
<ul> <h4><b>Subclasses</b></h4> <ul>
<h4><b>Subclasses</b></h4>
<div *ngFor="let sub of item.Subclass| filter:searchText"> <div *ngFor="let sub of item.Subclass| filter:searchText">
<li> <li>
<mat-expansion-panel hideToggle> <mat-expansion-panel hideToggle>
...@@ -135,7 +120,11 @@ ...@@ -135,7 +120,11 @@
</mat-panel-title> </mat-panel-title>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<p>{{sub.SubclassComment}}</p> <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"> <div *ngFor="let instansub of sub.InstanceOfSubclass| filter:searchText">
<li> <li>
<mat-expansion-panel hideToggle> <mat-expansion-panel hideToggle>
...@@ -158,13 +147,19 @@ ...@@ -158,13 +147,19 @@
</mat-expansion-panel> </mat-expansion-panel>
</mat-accordion> </mat-accordion>
</div> </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"> <div *ngFor="let genin of section.GeneralInstances| filter:searchText">
<li> <li>
<mat-expansion-panel hideToggle> <mat-expansion-panel hideToggle>
<mat-expansion-panel-header> <mat-expansion-panel-header>
<mat-panel-title> <mat-panel-title>
{{genin.GeneralInstances}} {{genin.Instance}}
</mat-panel-title> </mat-panel-title>
</mat-expansion-panel-header> </mat-expansion-panel-header>
{{genin.Comment}} {{genin.Comment}}
...@@ -179,9 +174,10 @@ ...@@ -179,9 +174,10 @@
<div *ngIf="!checklen(systems)"> <div *ngIf="!checklen(systems)">
<mat-spinner style="margin: auto;"></mat-spinner> <mat-spinner style="margin: auto;"></mat-spinner>
</div> </div>
</div> </div>
</mat-grid-list > </mat-grid-list>
<mat-menu #menu="matMenu"> <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> </mat-menu>
\ No newline at end of file
...@@ -7,39 +7,31 @@ ...@@ -7,39 +7,31 @@
<div class="list row"> <div class="list row">
<div class="col-md-14"> <div class="col-md-14">
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end"> <div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<input <input type="text" class="form-control" placeholder="Search" (keyup)="applyFilter($event)" #input />
type="text"
class="form-control"
placeholder="Search"
(keyup)="applyFilter($event)"
#input/>
</div> </div>
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end"> <div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<ul fxLayout fxLayoutGap="15px" class="navigation-items"> <ul fxLayout fxLayoutGap="15px" class="navigation-items">
<div> <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> </div>
</ul> </ul>
</div> </div>
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end"> <div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<ul *ngFor="let inf of infer;" fxLayout fxLayoutGap="15px" class="navigation-items"> <ul *ngFor="let inf of infer;" fxLayout fxLayoutGap="15px" class="navigation-items">
<div> <div>
<input class="btn btn-info" <input class="btn btn-info" [disabled]="exporting" type="button" value="Inferencing"
[disabled] = "exporting" (click)="updateInfer(inf.id)" />
type="button"
value="Inferencing"
(click)="updateInfer(inf.id)"/>
</div> </div>
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
<div [hidden] = "!showSpinner"> <div [hidden]="!showSpinner">
<mat-progress-bar mode="indeterminate"></mat-progress-bar> <mat-progress-bar mode="indeterminate"></mat-progress-bar>
</div> </div>
<div class="mat-elevation-z8"> <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 --> <!-- Position Column -->
<ng-container matColumnDef="id"> <ng-container matColumnDef="id">
<th mat-header-cell *matHeaderCellDef> No. </th> <th mat-header-cell *matHeaderCellDef> No. </th>
...@@ -54,7 +46,9 @@ ...@@ -54,7 +46,9 @@
<!-- Name Column --> <!-- Name Column -->
<ng-container matColumnDef="title_data"> <ng-container matColumnDef="title_data">
<th mat-header-cell *matHeaderCellDef> Title </th> <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> </td>
</ng-container> </ng-container>
...@@ -78,14 +72,15 @@ ...@@ -78,14 +72,15 @@
<tr mat-header-row *matHeaderRowDef="newdisplayedColumns"></tr> <tr mat-header-row *matHeaderRowDef="newdisplayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: newdisplayedColumns;"></tr> <tr mat-row *matRowDef="let row; columns: newdisplayedColumns;"></tr>
</table> </table>
<mat-paginator #paginator [pageSizeOptions]="[10, 20]" showFirstLastButtons></mat-paginator> <mat-paginator #paginator [pageSizeOptions]="[10, 20]" showFirstLastButtons></mat-paginator>
</div> </div>
<div echarts [options]="chartOption" class="demo-chart"></div> <div echarts [options]="chartOption" class="demo-chart"></div>
<div class="content"> <div class="content">
<div fxLayout="row wrap"> <div fxLayout="row wrap">
<div fxFlex="33%"> <div fxFlex="33.3%">
<mat-card class="example-card"> <mat-card class="example-card">
<mat-card-header> <mat-card-header>
<div class="example-header-image"></div> <div class="example-header-image"></div>
...@@ -93,18 +88,22 @@ ...@@ -93,18 +88,22 @@
<mat-card-subtitle>{{getnumreq()}}</mat-card-subtitle> <mat-card-subtitle>{{getnumreq()}}</mat-card-subtitle>
</mat-card-header> </mat-card-header>
</mat-card> </mat-card>
</div>
<div fxFlex="33.3%">
<mat-card class="example-card"> <mat-card class="example-card">
<mat-card-header> <mat-card-header>
<div class="example-header-image"></div> <div class="example-header-image"></div>
<mat-card-title>Complete Requirement</mat-card-title> <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-header>
</mat-card> </mat-card>
</div>
<div fxFlex="33.3%">
<mat-card class="example-card"> <mat-card class="example-card">
<mat-card-header> <mat-card-header>
<div class="example-header-image"></div> <div class="example-header-image"></div>
<mat-card-title>Incomplete Requirement</mat-card-title> <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-header>
</mat-card> </mat-card>
</div> </div>
......
...@@ -5,8 +5,8 @@ import { InferenceResults } from 'src/app/models/boilerplate.model'; ...@@ -5,8 +5,8 @@ import { InferenceResults } from 'src/app/models/boilerplate.model';
import { BoilerplateService } from 'src/app/services/boilerplate.service'; import { BoilerplateService } from 'src/app/services/boilerplate.service';
import { PrefixService } from 'src/app/services/prefix.service'; import { PrefixService } from 'src/app/services/prefix.service';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import {MatTableDataSource} from '@angular/material/table'; import { MatTableDataSource } from '@angular/material/table';
import {MatPaginator} from '@angular/material/paginator'; import { MatPaginator } from '@angular/material/paginator';
import { EChartsOption } from 'echarts'; import { EChartsOption } from 'echarts';
import { NotifierService } from "angular-notifier"; import { NotifierService } from "angular-notifier";
...@@ -34,12 +34,12 @@ export class BoilerplateListComponent implements OnInit { ...@@ -34,12 +34,12 @@ export class BoilerplateListComponent implements OnInit {
type: 'pie', type: 'pie',
radius: ['40%', '70%'], radius: ['40%', '70%'],
data: [ data: [
{value: 0, name: '1'}, { value: 0, name: '1' },
{value: 0, name: '2'}, { value: 0, name: '2' },
{value: 0, name: '3'}, { value: 0, name: '3' },
{value: 0, name: '4'}, { value: 0, name: '4' },
{value: 0, name: '5'} ] { value: 0, name: '5' }]
}, }
], ],
}; };
private readonly notifier: NotifierService; private readonly notifier: NotifierService;
...@@ -54,27 +54,28 @@ export class BoilerplateListComponent implements OnInit { ...@@ -54,27 +54,28 @@ export class BoilerplateListComponent implements OnInit {
currentIndex = -1; currentIndex = -1;
title = ''; title = '';
displayedColumns: string[] = ['id', 'title', 'has_prefix', 'has_main', 'has_suffix', 'action']; displayedColumns: string[] = ['id', 'title', 'has_prefix', 'has_main', 'has_suffix', 'action'];
newdisplayedColumns: string[] = ['id','title_data' ,'prefix_data', 'main_data', 'suffix_data', 'action']; newdisplayedColumns: string[] = ['id', 'title_data', 'prefix_data', 'main_data', 'suffix_data', 'action'];
dataSource :Boilerplate[] = [{}]; dataSource: Boilerplate[] = [{}];
thenewdataSource:BoilerplateData[] = [{}]; thenewdataSource: BoilerplateData[] = [{}];
newdataSource = new MatTableDataSource(this.thenewdataSource); newdataSource = new MatTableDataSource(this.thenewdataSource);
infer:InferenceResults[] = [{}]; infer: InferenceResults[] = [{}];
//when inference button is pressed //when inference button is pressed
showSpinner = false; showSpinner = false;
exporting = 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 [] = []; dataofboilerplates: any[] = [];
aprefix: any [] = []; aprefix: any[] = [];
main: any; main: any;
suffix: any; suffix: any;
constructor(private boilerplateService: BoilerplateService, private prefixService: PrefixService, private route: ActivatedRoute, 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 { ...@@ -102,11 +103,11 @@ export class BoilerplateListComponent implements OnInit {
this.boilerplateService.getAllData(this.route.snapshot.params.gb) this.boilerplateService.getAllData(this.route.snapshot.params.gb)
.subscribe( .subscribe(
data => { data => {
this.boilerplatesdata =data; this.boilerplatesdata = data;
this.thenewdataSource = data; this.thenewdataSource = data;
this.newdataSource = new MatTableDataSource(this.thenewdataSource); this.newdataSource = new MatTableDataSource(this.thenewdataSource);
this.newdataSource.paginator = this.paginator; this.newdataSource.paginator = this.paginator;
console.log(data) //console.log(data)
}, },
error => { error => {
console.log(error); console.log(error);
...@@ -127,13 +128,13 @@ export class BoilerplateListComponent implements OnInit { ...@@ -127,13 +128,13 @@ export class BoilerplateListComponent implements OnInit {
SearchTitle(): void { SearchTitle(): void {
if (this.title != ''){ if (this.title != '') {
this.boilerplateService.findByTitle(this.route.snapshot.params.gb, this.title) this.boilerplateService.findByTitle(this.route.snapshot.params.gb, this.title)
.subscribe( .subscribe(
data => { data => {
this.boilerplates = data; this.boilerplates = data;
this.dataSource = data; this.dataSource = data;
console.log(data); //console.log(data);
}, },
error => { error => {
console.log(error); console.log(error);
...@@ -145,30 +146,35 @@ export class BoilerplateListComponent implements OnInit { ...@@ -145,30 +146,35 @@ export class BoilerplateListComponent implements OnInit {
} }
} }
GetRoute(): void { 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 { 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) this.boilerplateService.getAllInfer(this.route.snapshot.params.gb)
.subscribe( .subscribe(
data => { data => {
this.currentInfer = data[0]; this.currentInfer = data[0];
this.infer = data; 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 = [] var final = []
for (let i of this.list_of_inference_metrics){ for (let i of this.list_of_inference_metrics) {
if(obj[i] != undefined){ 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 = [{ this.chartOption.series = [{
type: 'pie', type: 'pie',
radius: ['40%', '70%'], radius: ['40%', '70%'],
data: final, data: final,
}]}} }]
}, },
error => { error => {
console.log(error); console.log(error);
...@@ -192,7 +198,7 @@ export class BoilerplateListComponent implements OnInit { ...@@ -192,7 +198,7 @@ export class BoilerplateListComponent implements OnInit {
console.log(error); console.log(error);
this.showSpinner = !this.showSpinner; this.showSpinner = !this.showSpinner;
this.exporting = !this.exporting 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 { ...@@ -201,17 +207,21 @@ export class BoilerplateListComponent implements OnInit {
this.newdataSource.filter = filterValue.trim().toLowerCase(); this.newdataSource.filter = filterValue.trim().toLowerCase();
} }
get_metrics(i:any): any { get_metrics(i: any): any {
if (this.currentInfer?.inference_data){ if (this.currentInfer?.inference_data) {
const obj = JSON.parse(this.currentInfer['inference_data'].replace(/'/g,"\"")) const obj = JSON.parse(this.currentInfer['inference_data'].replace(/'/g, "\""))
if (obj[i]){ if (obj[i]) {
return obj[i] return obj[i]
} }
} }
return 0 return 0
} }
getnumreq():any{ getnumreq(): any {
return this.boilerplatesdata?.length 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 @@ ...@@ -6,28 +6,19 @@
<div class="list row"> <div class="list row">
<div class="col-md-8"> <div class="col-md-8">
<div class="input-group mb-3"> <div class="input-group mb-3">
<input <input type="text" class="form-control" placeholder="Search" [(ngModel)]="title" name="search"
type="text" autocomplete="off" />
class="form-control"
placeholder="Search"
[(ngModel)]="title"
name="search"
autocomplete="off"
/>
<!-- (keyup.enter)="SearchTitle()"--> <!-- (keyup.enter)="SearchTitle()"-->
<!-- (click)="SearchTitle()" --> <!-- (click)="SearchTitle()" -->
<div class="input-group-append"> <div class="input-group-append">
<button <button class="btn btn-primary" type="button">Search
class="btn btn-primary"
type="button"
>Search
</button> </button>
</div> </div>
</div> </div>
<div fxFlex fxLayout fxHide.xs fxLayoutAlign="end"> <div fxFlex fxLayout fxHide.xs fxLayoutAlign="end">
<ul fxLayout fxLayoutGap="15px" class="navigation-items"> <ul fxLayout fxLayoutGap="15px" class="navigation-items">
<div> <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> </div>
</ul> </ul>
</div> </div>
...@@ -37,7 +28,8 @@ ...@@ -37,7 +28,8 @@
<div class="content"> <div class="content">
<div fxLayout="row wrap"> <div fxLayout="row wrap">
<div fxFlex="20%" *ngFor="let gb of grouboilerplates| filter:title"> <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> <mat-card-header>
<div mat-card-avatar class="example-header-image"></div> <div mat-card-avatar class="example-header-image"></div>
<mat-card-title>{{gb.title_bgroup}}</mat-card-title> <mat-card-title>{{gb.title_bgroup}}</mat-card-title>
...@@ -49,11 +41,13 @@ ...@@ -49,11 +41,13 @@
{{gb.description}} {{gb.description}}
</p> </p>
</mat-card-content> </mat-card-content>
</div>
<mat-card-actions> <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> <button class="btn btn-warning" (click)="deleteGroupBoilerplate(gb)" mat-button>DELETE</button>
</mat-card-actions> </mat-card-actions>
</mat-card> </mat-card>
</div> </div>
</div> </div>
</div> </div>
\ No newline at end of file
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { GroupBoilerplate } from 'src/app/models/boilerplate.model'; import { GroupBoilerplate } from 'src/app/models/boilerplate.model';
import { BoilerplateService } from 'src/app/services/boilerplate.service'; import { BoilerplateService } from 'src/app/services/boilerplate.service';
import { NotifierService } from "angular-notifier";
@Component({ @Component({
selector: 'app-groupboil', selector: 'app-groupboil',
...@@ -11,8 +12,10 @@ export class GroupboilComponent implements OnInit { ...@@ -11,8 +12,10 @@ export class GroupboilComponent implements OnInit {
grouboilerplates?: GroupBoilerplate[]; grouboilerplates?: GroupBoilerplate[];
title = ''; title = '';
private readonly notifier: NotifierService;
constructor(private boilerplateService: BoilerplateService) { } constructor(private boilerplateService: BoilerplateService, notifierService: NotifierService) {
this.notifier = notifierService;
}
ngOnInit(): void { ngOnInit(): void {
this.retrievegroupBoilerplates(); this.retrievegroupBoilerplates();
...@@ -23,7 +26,7 @@ export class GroupboilComponent implements OnInit { ...@@ -23,7 +26,7 @@ export class GroupboilComponent implements OnInit {
.subscribe( .subscribe(
data => { data => {
this.grouboilerplates = data; this.grouboilerplates = data;
console.log(data); //console.log(data);
}, },
error => { error => {
console.log(error); console.log(error);
...@@ -32,15 +35,17 @@ export class GroupboilComponent implements OnInit { ...@@ -32,15 +35,17 @@ export class GroupboilComponent implements OnInit {
} }
deleteGroupBoilerplate(id: any): void { 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) this.boilerplateService.deletegroupboil(id.id)
.subscribe( .subscribe(
response => { response => {
console.log(response); //console.log(response);
this.notifier.notify("success", "Project deleted");
this.retrievegroupBoilerplates(); this.retrievegroupBoilerplates();
}, },
error => { 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'; ...@@ -7,39 +7,37 @@ import { MainService } from 'src/app/services/main.service';
styleUrls: ['./instances-list.component.scss'] styleUrls: ['./instances-list.component.scss']
}) })
export class InstancesListComponent implements OnInit { 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) { } constructor(private mainService: MainService) { }
ngOnInit(): void { ngOnInit(): void {
this.getchoices(); this.getchoices();
console.log('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
} }
getchoices(): void{ getchoices(): void {
this.mainService.getsubject() this.mainService.getsubject()
.subscribe( .subscribe(
data => { data => {
for (let x=0; x < data.length; x++ ){ for (let x = 0; x < data.length; x++) {
this.subjects.push(data[x][1]);} this.subjects.push(data[x][1]);
}
}, },
error => { error => {
console.log(error); console.log(error);
...@@ -49,9 +47,10 @@ export class InstancesListComponent implements OnInit { ...@@ -49,9 +47,10 @@ export class InstancesListComponent implements OnInit {
.subscribe( .subscribe(
data => { data => {
//no data from State and Item //no data from State and Item
console.log(data); //console.log(data);
for (let x=0; x < data.length; x++ ){ for (let x = 0; x < data.length; x++) {
this.stateitem.push(data[x][1]);} this.stateitem.push(data[x][1]);
}
}, },
error => { error => {
console.log(error); console.log(error);
...@@ -59,8 +58,9 @@ export class InstancesListComponent implements OnInit { ...@@ -59,8 +58,9 @@ export class InstancesListComponent implements OnInit {
this.mainService.getstatevalue() this.mainService.getstatevalue()
.subscribe( .subscribe(
data => { data => {
for (let x=0; x < data.length; x++ ){ for (let x = 0; x < data.length; x++) {
this.statevalue.push(data[x][1]);} this.statevalue.push(data[x][1]);
}
}, },
error => { error => {
console.log(error); console.log(error);
...@@ -68,8 +68,9 @@ export class InstancesListComponent implements OnInit { ...@@ -68,8 +68,9 @@ export class InstancesListComponent implements OnInit {
this.mainService.getshall() this.mainService.getshall()
.subscribe( .subscribe(
data => { data => {
for (let x=0; x < data.length; x++ ){ for (let x = 0; x < data.length; x++) {
this.shall.push(data[x][1]);} this.shall.push(data[x][1]);
}
}, },
error => { error => {
console.log(error); console.log(error);
...@@ -77,8 +78,9 @@ export class InstancesListComponent implements OnInit { ...@@ -77,8 +78,9 @@ export class InstancesListComponent implements OnInit {
this.mainService.getverb() this.mainService.getverb()
.subscribe( .subscribe(
data => { data => {
for (let x=0; x < data.length; x++ ){ for (let x = 0; x < data.length; x++) {
this.verb.push(data[x][1]);} this.verb.push(data[x][1]);
}
}, },
error => { error => {
console.log(error); console.log(error);
...@@ -86,8 +88,9 @@ export class InstancesListComponent implements OnInit { ...@@ -86,8 +88,9 @@ export class InstancesListComponent implements OnInit {
this.mainService.getquantifier() this.mainService.getquantifier()
.subscribe( .subscribe(
data => { data => {
for (let x=0; x < data.length; x++ ){ for (let x = 0; x < data.length; x++) {
this.quantifier.push(data[x][1]);} this.quantifier.push(data[x][1]);
}
}, },
error => { error => {
console.log(error); console.log(error);
...@@ -96,8 +99,9 @@ export class InstancesListComponent implements OnInit { ...@@ -96,8 +99,9 @@ export class InstancesListComponent implements OnInit {
this.mainService.getnumunit() this.mainService.getnumunit()
.subscribe( .subscribe(
data => { data => {
for (let x=0; x < data.length; x++ ){ for (let x = 0; x < data.length; x++) {
this.numunit.push(data[x][1]);} this.numunit.push(data[x][1]);
}
}, },
error => { error => {
console.log(error); console.log(error);
...@@ -105,8 +109,9 @@ export class InstancesListComponent implements OnInit { ...@@ -105,8 +109,9 @@ export class InstancesListComponent implements OnInit {
this.mainService.getfifuintsysstatset() this.mainService.getfifuintsysstatset()
.subscribe( .subscribe(
data => { data => {
for (let x=0; x < data.length; x++ ){ for (let x = 0; x < data.length; x++) {
this.fifuintsysstatset.push(data[x][1]);} this.fifuintsysstatset.push(data[x][1]);
}
}, },
error => { error => {
console.log(error); console.log(error);
...@@ -114,8 +119,9 @@ export class InstancesListComponent implements OnInit { ...@@ -114,8 +119,9 @@ export class InstancesListComponent implements OnInit {
this.mainService.getstsysconset() this.mainService.getstsysconset()
.subscribe( .subscribe(
data => { data => {
for (let x=0; x < data.length; x++ ){ for (let x = 0; x < data.length; x++) {
this.stsysconset.push(data[x][1]);} this.stsysconset.push(data[x][1]);
}
}, },
error => { error => {
console.log(error); console.log(error);
......
...@@ -2,9 +2,9 @@ import { Component, OnInit } from '@angular/core'; ...@@ -2,9 +2,9 @@ import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { Prefix } from 'src/app/models/prefix.model'; import { Prefix } from 'src/app/models/prefix.model';
import { PrefixService } from 'src/app/services/prefix.service'; import { PrefixService } from 'src/app/services/prefix.service';
import {FormControl} from '@angular/forms'; import { FormControl } from '@angular/forms';
import {Observable} from 'rxjs'; import { Observable } from 'rxjs';
import {map, startWith} from 'rxjs/operators'; import { map, startWith } from 'rxjs/operators';
import { NotifierService } from "angular-notifier"; import { NotifierService } from "angular-notifier";
...@@ -16,27 +16,27 @@ import { NotifierService } from "angular-notifier"; ...@@ -16,27 +16,27 @@ import { NotifierService } from "angular-notifier";
}) })
export class PrefixDetailsComponent implements OnInit { export class PrefixDetailsComponent implements OnInit {
simpleprefixControl = new FormControl(); simpleprefixControl = new FormControl();
simpleprefix:string[] = []; simpleprefix: string[] = [];
simpleprefixfilteredOptions: Observable<string[]>; simpleprefixfilteredOptions: Observable<string[]>;
subjectsControl = new FormControl(); subjectsControl = new FormControl();
subjects:string[] = []; subjects: string[] = [];
subjectsfilteredOptions: Observable<string[]>; subjectsfilteredOptions: Observable<string[]>;
verbsControl = new FormControl(); verbsControl = new FormControl();
verbs:string[] = []; verbs: string[] = [];
verbsfilteredOptions: Observable<string[]>; verbsfilteredOptions: Observable<string[]>;
objectsControl = new FormControl(); objectsControl = new FormControl();
objects:string[] = []; objects: string[] = [];
objectsfilteredOptions: Observable<string[]>; objectsfilteredOptions: Observable<string[]>;
logic_conControl = new FormControl(); logic_conControl = new FormControl();
logic_con:string[] = []; logic_con: string[] = [];
logic_confilteredOptions: Observable<string[]>; logic_confilteredOptions: Observable<string[]>;
public static id: any [] = []; public static id: any[] = [];
private readonly notifier: NotifierService; private readonly notifier: NotifierService;
prefixs?: Prefix[]; prefixs?: Prefix[];
...@@ -54,8 +54,9 @@ export class PrefixDetailsComponent implements OnInit { ...@@ -54,8 +54,9 @@ export class PrefixDetailsComponent implements OnInit {
message = ''; message = '';
constructor(private prefixService: PrefixService,private route: ActivatedRoute, constructor(private prefixService: PrefixService, private route: ActivatedRoute,
private router: Router, notifierService: NotifierService) { this.notifier = notifierService; private router: Router, notifierService: NotifierService) {
this.notifier = notifierService;
this.simpleprefixfilteredOptions = this.simpleprefixControl.valueChanges.pipe( this.simpleprefixfilteredOptions = this.simpleprefixControl.valueChanges.pipe(
startWith(""), startWith(""),
map(value => this._filter(this.simpleprefix, value)) map(value => this._filter(this.simpleprefix, value))
...@@ -83,16 +84,16 @@ export class PrefixDetailsComponent implements OnInit { ...@@ -83,16 +84,16 @@ export class PrefixDetailsComponent implements OnInit {
this.getAllPrefix(this.route.snapshot.params.id); this.getAllPrefix(this.route.snapshot.params.id);
} }
displayFn(option:string): string { displayFn(option: string): string {
if (option != null) { if (option != null) {
let x = option.split(" : "); let x = option.split(" : ");
if ( (x[x.length -2] == "") || (x[x.length -1]=="")) { return "";} if ((x[x.length - 2] == "") || (x[x.length - 1] == "")) { return ""; }
return (x[x.length -2]+" : "+x[x.length -1]); return (x[x.length - 2] + " : " + x[x.length - 1]);
} }
return ""; return "";
} }
private _filter(data:string[], value: string): string[] { private _filter(data: string[], value: string): string[] {
const filterValue = value.toLowerCase(); const filterValue = value.toLowerCase();
return data.filter(option => option.toLowerCase().includes(filterValue)); return data.filter(option => option.toLowerCase().includes(filterValue));
} }
...@@ -101,7 +102,7 @@ export class PrefixDetailsComponent implements OnInit { ...@@ -101,7 +102,7 @@ export class PrefixDetailsComponent implements OnInit {
this.prefixService.getAll(id) this.prefixService.getAll(id)
.subscribe( .subscribe(
data => { data => {
PrefixDetailsComponent.id.length =0; PrefixDetailsComponent.id.length = 0;
this.prefixs = data; this.prefixs = data;
//console.log(data); //console.log(data);
for (var val of data) { for (var val of data) {
...@@ -120,7 +121,7 @@ export class PrefixDetailsComponent implements OnInit { ...@@ -120,7 +121,7 @@ export class PrefixDetailsComponent implements OnInit {
.subscribe( .subscribe(
data => { data => {
this.currentprefix = data; this.currentprefix = data;
console.log(data) //console.log(data)
this.simpleprefixControl.setValue(this.currentprefix.prefix); this.simpleprefixControl.setValue(this.currentprefix.prefix);
this.subjectsControl.setValue(this.currentprefix.system_fun_item); this.subjectsControl.setValue(this.currentprefix.system_fun_item);
this.verbsControl.setValue(this.currentprefix.state_or_verb); this.verbsControl.setValue(this.currentprefix.state_or_verb);
...@@ -139,19 +140,20 @@ export class PrefixDetailsComponent implements OnInit { ...@@ -139,19 +140,20 @@ export class PrefixDetailsComponent implements OnInit {
this.currentprefix.state_or_verb = this.verbsControl.value; this.currentprefix.state_or_verb = this.verbsControl.value;
this.currentprefix.item_function_flow_statevalue = this.objectsControl.value; this.currentprefix.item_function_flow_statevalue = this.objectsControl.value;
this.currentprefix.logic_connective = this.logic_conControl.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) this.prefixService.update(this.route.snapshot.params.id, PrefixDetailsComponent.id[i], this.currentprefix)
.subscribe( .subscribe(
response => { response => {
this.message = response.message; this.message = response.message;
}, },
error => { 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) this.prefixService.getsimpleprefix(prefix_group)
.subscribe( .subscribe(
data => { data => {
...@@ -176,35 +178,45 @@ export class PrefixDetailsComponent implements OnInit { ...@@ -176,35 +178,45 @@ export class PrefixDetailsComponent implements OnInit {
}); });
} }
setprefix(strIntoObj: any): void{ setprefix(strIntoObj: any): void {
for (let x=0; x < strIntoObj.length; x++ ){ for (let x = 0; x < strIntoObj.length; x++) {
if(this.simpleprefix.indexOf(strIntoObj[x][1]) == -1) { if (this.simpleprefix.indexOf(strIntoObj[x][1]) == -1) {
this.simpleprefix.push((strIntoObj[x][1]));}} this.simpleprefix.push((strIntoObj[x][1]));
}
}
} }
setverb(strIntoObj: any): void{ setverb(strIntoObj: any): void {
for (let x=0; x < strIntoObj.length; x++ ){ for (let x = 0; x < strIntoObj.length; x++) {
if(this.verbs.indexOf(strIntoObj[x][1]) == -1) { if (this.verbs.indexOf(strIntoObj[x][1]) == -1) {
this.verbs.push((strIntoObj[x][1]));}} this.verbs.push((strIntoObj[x][1]));
}
}
} }
setsubject(strIntoObj: any): void{ setsubject(strIntoObj: any): void {
for (let x=0; x < strIntoObj.length; x++ ){ for (let x = 0; x < strIntoObj.length; x++) {
if(this.subjects.indexOf(strIntoObj[x][1]) == -1) { if (this.subjects.indexOf(strIntoObj[x][1]) == -1) {
this.subjects.push((strIntoObj[x][1]));}} this.subjects.push((strIntoObj[x][1]));
}
}
} }
setobject(strIntoObj: any): void{ setobject(strIntoObj: any): void {
for (let x=0; x < strIntoObj.length; x++ ){ for (let x = 0; x < strIntoObj.length; x++) {
if(this.objects.indexOf(strIntoObj[x][1]) == -1) { if (this.objects.indexOf(strIntoObj[x][1]) == -1) {
this.objects.push((strIntoObj[x][1]));}} this.objects.push((strIntoObj[x][1]));
}
}
} }
setlogcon(strIntoObj: any): void{ setlogcon(strIntoObj: any): void {
for (let x=0; x < strIntoObj.length; x++ ){ for (let x = 0; x < strIntoObj.length; x++) {
if(this.logic_con.indexOf(strIntoObj[x][1]) == -1) { if (this.logic_con.indexOf(strIntoObj[x][1]) == -1) {
this.logic_con.push((strIntoObj[x][1]));}} this.logic_con.push((strIntoObj[x][1]));
}
}
} }
} }
\ No newline at end of file
...@@ -2,9 +2,9 @@ import { Component, OnInit } from '@angular/core'; ...@@ -2,9 +2,9 @@ import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { Suffix } from 'src/app/models/suffix.model'; import { Suffix } from 'src/app/models/suffix.model';
import { SuffixService } from 'src/app/services/suffix.service'; import { SuffixService } from 'src/app/services/suffix.service';
import {FormControl} from '@angular/forms'; import { FormControl } from '@angular/forms';
import {Observable} from 'rxjs'; import { Observable } from 'rxjs';
import {map, startWith} from 'rxjs/operators'; import { map, startWith } from 'rxjs/operators';
import { NotifierService } from "angular-notifier"; import { NotifierService } from "angular-notifier";
...@@ -16,20 +16,20 @@ import { NotifierService } from "angular-notifier"; ...@@ -16,20 +16,20 @@ import { NotifierService } from "angular-notifier";
export class SuffixDetailsComponent implements OnInit { export class SuffixDetailsComponent implements OnInit {
suffixControl = new FormControl(); suffixControl = new FormControl();
suffix:string[] = []; suffix: string[] = [];
suffixfilteredOptions: Observable<string[]>; suffixfilteredOptions: Observable<string[]>;
mumerical_unitsControl = new FormControl(); mumerical_unitsControl = new FormControl();
mumerical_units:string[] = []; mumerical_units: string[] = [];
mumerical_unitsfilteredOptions: Observable<string[]>; mumerical_unitsfilteredOptions: Observable<string[]>;
flowControl = new FormControl(); flowControl = new FormControl();
flow:string[] = []; flow: string[] = [];
flowfilteredOptions: Observable<string[]>; flowfilteredOptions: Observable<string[]>;
public static id: any [] = []; public static id: any[] = [];
private readonly notifier: NotifierService; private readonly notifier: NotifierService;
suffixs?:Suffix[]; suffixs?: Suffix[];
currentsuffix: Suffix = { currentsuffix: Suffix = {
s_choices: "", s_choices: "",
...@@ -66,16 +66,16 @@ export class SuffixDetailsComponent implements OnInit { ...@@ -66,16 +66,16 @@ export class SuffixDetailsComponent implements OnInit {
} }
displayFn(option:string): string { displayFn(option: string): string {
if (option != null) { if (option != null) {
let x = option.split(" : "); let x = option.split(" : ");
if ( (x[x.length -2] == "") || (x[x.length -1]=="")) { return "";} if ((x[x.length - 2] == "") || (x[x.length - 1] == "")) { return ""; }
return (x[x.length -2]+" : "+x[x.length -1]); return (x[x.length - 2] + " : " + x[x.length - 1]);
} }
return ""; return "";
} }
private _filter(data:string[], value: string): string[] { private _filter(data: string[], value: string): string[] {
const filterValue = value.toLowerCase(); const filterValue = value.toLowerCase();
return data.filter(option => option.toLowerCase().includes(filterValue)); return data.filter(option => option.toLowerCase().includes(filterValue));
} }
...@@ -87,11 +87,11 @@ export class SuffixDetailsComponent implements OnInit { ...@@ -87,11 +87,11 @@ export class SuffixDetailsComponent implements OnInit {
data => { data => {
SuffixDetailsComponent.id.length = 0; SuffixDetailsComponent.id.length = 0;
this.suffixs = data; this.suffixs = data;
console.log(data) //console.log(data)
for (var val of data) { for (var val of data) {
this.getSuffix(id, val.id); this.getSuffix(id, val.id);
SuffixDetailsComponent.id.push(val.id); SuffixDetailsComponent.id.push(val.id);
console.log(val.id) //console.log(val.id)
} }
}, },
error => { error => {
...@@ -120,25 +120,28 @@ export class SuffixDetailsComponent implements OnInit { ...@@ -120,25 +120,28 @@ export class SuffixDetailsComponent implements OnInit {
this.currentsuffix.s_choices = this.suffixControl.value; this.currentsuffix.s_choices = this.suffixControl.value;
this.currentsuffix.mumerical_units = this.mumerical_unitsControl.value; this.currentsuffix.mumerical_units = this.mumerical_unitsControl.value;
this.currentsuffix.flow = this.flowControl.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) this.suffixService.update(this.route.snapshot.params.id, SuffixDetailsComponent.id[i], this.currentsuffix)
.subscribe( .subscribe(
response => { response => {
this.message = response.message; this.message = response.message;
}, },
error => { 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() this.suffixService.getsuffix()
.subscribe( .subscribe(
data => { data => {
for (let x=0; x < data.length; x++ ){ for (let x = 0; x < data.length; x++) {
if(this.suffix.indexOf(data[x][1]) == -1) { if (this.suffix.indexOf(data[x][1]) == -1) {
this.suffix.push(data[x][1]);}} this.suffix.push(data[x][1]);
}
}
}, },
error => { error => {
console.log(error); console.log(error);
...@@ -146,9 +149,11 @@ export class SuffixDetailsComponent implements OnInit { ...@@ -146,9 +149,11 @@ export class SuffixDetailsComponent implements OnInit {
this.suffixService.getnumunits() this.suffixService.getnumunits()
.subscribe( .subscribe(
data => { data => {
for (let x=0; x < data.length; x++ ){ for (let x = 0; x < data.length; x++) {
if(this.mumerical_units.indexOf(data[x][1]) == -1) { if (this.mumerical_units.indexOf(data[x][1]) == -1) {
this.mumerical_units.push(data[x][1]);}} this.mumerical_units.push(data[x][1]);
}
}
}, },
error => { error => {
console.log(error); console.log(error);
...@@ -156,9 +161,11 @@ export class SuffixDetailsComponent implements OnInit { ...@@ -156,9 +161,11 @@ export class SuffixDetailsComponent implements OnInit {
this.suffixService.getflow() this.suffixService.getflow()
.subscribe( .subscribe(
data => { data => {
for (let x=0; x < data.length; x++ ){ for (let x = 0; x < data.length; x++) {
if(this.flow.indexOf(data[x][1]) == -1) { if (this.flow.indexOf(data[x][1]) == -1) {
this.flow.push(data[x][1]);}} this.flow.push(data[x][1]);
}
}
}, },
error => { error => {
console.log(error); console.log(error);
......
export class Boilerplate { export class Boilerplate {
id?:any; id?: any;
owner?:any; owner?: any;
group_of_boilerplate?: any; group_of_boilerplate?: any;
title?: string; title?: string;
has_prefix?: boolean; has_prefix?: boolean;
...@@ -9,7 +9,7 @@ export class Boilerplate { ...@@ -9,7 +9,7 @@ export class Boilerplate {
} }
export class BoilerplateData { export class BoilerplateData {
id?:any; id?: any;
title_data?: string; title_data?: string;
prefix_data?: string; prefix_data?: string;
main_data?: string; main_data?: string;
...@@ -17,36 +17,37 @@ export class BoilerplateData { ...@@ -17,36 +17,37 @@ export class BoilerplateData {
} }
export class GroupBoilerplate { export class GroupBoilerplate {
id?:any; id?: any;
title_bgroup?: string; title_bgroup?: string;
description?: string; description?: string;
} }
export class InferenceResults { export class InferenceResults {
id?:any; id?: any;
infer_group_of_boilerplate?: any; infer_group_of_boilerplate?: any;
inference_data?: any; inference_data?: any;
} }
export class Sections { export class Sections {
Name?:string; Name?: string;
TheClasses?: Classes[]; TheClasses?: Classes[];
GeneralInstances?:Instances[]; GeneralInstances?: Instances[];
} }
export class Classes { export class Classes {
Class?:string; Class?: string;
Comment?: string; Comment?: string;
Subclass?:SubClasses[]; Subclass?: SubClasses[];
Instance_of_Class?:Instances[]; Instance_of_Class?: Instances[];
} }
export class SubClasses { export class SubClasses {
SubClass_name?:string; SubClass_name?: any;
SubclassComment?:string SubclassComment?: any
InstanceOfSubclass?:Instances[]; InstanceOfSubclass?: Instances[];
} }
export class Instances { export class Instances {
Instance?: any; Instance?: any;
Comment?: any;
} }
...@@ -164,4 +164,8 @@ export class MainService { ...@@ -164,4 +164,8 @@ export class MainService {
getmainsyntax(): Observable<any> { getmainsyntax(): Observable<any> {
return this.http.get(`http://155.207.131.19:8000/api-auth/mainsyntax`); 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 json
import os
from django.db import models from django.db import models
from jsonfield import JSONField from jsonfield import JSONField
#from django.contrib.postgres.fields import ArrayField #from django.contrib.postgres.fields import ArrayField
...@@ -73,18 +74,31 @@ def create_extra_prefix(instance, now_prefix): ...@@ -73,18 +74,31 @@ def create_extra_prefix(instance, now_prefix):
prefix.save() prefix.save()
def create_infer_result(instance): def create_infer_result(instance, destination):
infer = InferenceResults(owner_infer= instance.boilerplate_owner, infer_group_of_boilerplate = instance, ontology_file=instance.ontology_file) infer = InferenceResults(owner_infer= instance.boilerplate_owner, infer_group_of_boilerplate = instance, ontology_file=destination)
infer.save() infer.save()
#Here we have to give and the ontology file of the Boilerplate Group to get the current instances #Here we have to give and the ontology file of the Boilerplate Group to get the current instances
def initialize_instances(instance): 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, 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() classes_inctances.save()
dict = BoilerplateGroupDictionary( classes_instances_owner_dic= instance.boilerplate_owner, classes_instances_group_of_boilerplate_dic = instance, 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() dict.save()
return destination
'''Update instaces of the ontology after the inferencing''' '''Update instaces of the ontology after the inferencing'''
def update_instances(instance): def update_instances(instance):
...@@ -108,13 +122,13 @@ 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), 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), 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), 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=[] Dict_list=[]
sao_names=['SAO#System', 'SAO#Function', 'SAO#Item', 'SAO#Interface', 'SAO#Connection', 'SAO#Flow', 'SAO#State', 'SAO#StateSet', 'SAO#StateValue'] 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: for i in sao_names:
Dict_list.append(get_dmo_classes_and_comment(i, g)) Dict_list.append(get_dmo_classes_and_comment(i, g))
#Dictionary_Data_list.append #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): ...@@ -122,14 +136,14 @@ def update_instances(instance):
class BoilerplateGroup(models.Model): class BoilerplateGroup(models.Model):
boilerplate_owner = models.ForeignKey(User, related_name='boilerplate_group_owner', on_delete=models.CASCADE) 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 #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) title_bgroup = models.CharField(max_length=100, unique=True)
description = models.CharField(max_length=500) description = models.CharField(max_length=500)
def save(self, **kwargs): def save(self, **kwargs):
super(BoilerplateGroup, self).save(**kwargs) super(BoilerplateGroup, self).save(**kwargs)
initialize_instances(self) destination = initialize_instances(self)
create_infer_result(self) create_infer_result(self, destination)
......
...@@ -6,7 +6,7 @@ from reqman.apps.reqtool.rest_api.services.parse_ontologies import * ...@@ -6,7 +6,7 @@ from reqman.apps.reqtool.rest_api.services.parse_ontologies import *
#HERE #HERE
#Ontology_file = "../../Ontologies/Autonomy_v1.ttl" #Ontology_file = "../../Ontologies/Autonomy_v1.ttl"
Ontology_file = "../../Ontologies/Autonomy_v1.ttl" Ontology_file = "../../Ontologies/2022_AOCS.ttl"
list_of_inference_metrics = ["IncompleteRequirement", "AmbiguousRequirement", list_of_inference_metrics = ["IncompleteRequirement", "AmbiguousRequirement",
"InconsistentRequirement","NoisyRequirement","OpaqueRequirement","RedundantRequirement"] "InconsistentRequirement","NoisyRequirement","OpaqueRequirement","RedundantRequirement"]
...@@ -21,11 +21,11 @@ def getclassofprefix(prefix): ...@@ -21,11 +21,11 @@ def getclassofprefix(prefix):
def getclassofmain(main): def getclassofmain(main):
return(findclassofmain(main)) return(findclassofmain(main))
def getinstancefile(data): def getinstancefile(data, g):
datam = data.split(":") 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): 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(" : ") splitter = out_list[j].split(" : ")
instance_file = out_list[j+1] instance_file = out_list[j+1]
break break
...@@ -51,7 +51,7 @@ def inferencing(ontfile, project, boilerlate, prefix, main, suffix): ...@@ -51,7 +51,7 @@ def inferencing(ontfile, project, boilerlate, prefix, main, suffix):
#findclassofmain(listofmain) #findclassofmain(listofmain)
ontology_with_new_req = exportboiltottl(ontfile, project, listofprefix, listofboil, listofmain, listofsuffix) ontology_with_new_req = exportboiltottl(ontfile, project, listofprefix, listofboil, listofmain, listofsuffix)
infer_result = shacl(ontology_with_new_req) 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), #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]) # so -> 'REQ-1' : [Incomplete] ('REQ-1' : [Incomplete, Ambiguous])
for met in infer_result: for met in infer_result:
...@@ -80,7 +80,7 @@ def exportboiltottl(ontfile,project, prefix, boilerplate, main, suffix): ...@@ -80,7 +80,7 @@ def exportboiltottl(ontfile,project, prefix, boilerplate, main, suffix):
else : else :
g.load(ontfile, format="turtle") g.load(ontfile, format="turtle")
#remove the requirements from the RDO-instances #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)) g.remove((previous_req, None, None))
for i in range(len(boilerplate)): for i in range(len(boilerplate)):
title = boilerplate[i][0]['title'] title = boilerplate[i][0]['title']
...@@ -96,7 +96,7 @@ def exportboiltottl(ontfile,project, prefix, boilerplate, main, suffix): ...@@ -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())) g.add((per_instances+("SystemStateValueContraint_"+title), rbo+"isRelatedToState", lo + prefix_attr_splitter[1].strip()))
for j in prefixmodel: for j in prefixmodel:
if prefix[i][0][j] != "": 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]))) 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: else:
prefix_verb_splitter = prefix[i][0]['state_or_verb'].split(" : ") prefix_verb_splitter = prefix[i][0]['state_or_verb'].split(" : ")
...@@ -105,13 +105,14 @@ def exportboiltottl(ontfile,project, prefix, boilerplate, main, suffix): ...@@ -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())) g.add((per_instances+(prefix_verb_splitter[0]+"OccuringFunctionality"+title), rbo+"isRelatedToAction", lo + prefix_verb_splitter[1].strip()))
for j in prefixmodel: for j in prefixmodel:
if prefix[i][0][j] != "": 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]))) 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 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, 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'])) 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'] != "": 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]))) 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'] != "": if main[i][0]['verb'] != "":
mainverb = main[i][0]['verb'].split(':') mainverb = main[i][0]['verb'].split(':')
...@@ -119,7 +120,7 @@ def exportboiltottl(ontfile,project, prefix, boilerplate, main, suffix): ...@@ -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"] mainmodel=["flow_function_interface_item_system_state_stateset", "state_item_before_verb", "statevalue_before_verb", "statevalue_system_connection_stateset"]
for j in mainmodel: for j in mainmodel:
if main[i][0][j] != "": 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]))) 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'] != "": 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(" ", ""))))) 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): ...@@ -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.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)) #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') g.serialize(destination=save_path+file_name+'.ttl', format='turtle')
return (save_path+file_name) return (save_path+file_name)
#print(g.serialize(format="turtle").decode("utf-8")) #print(g.serialize(format="turtle").decode("utf-8"))
......
...@@ -13,7 +13,8 @@ Ontology_file = "../../Ontologies/Autonomy_v1.ttl" ...@@ -13,7 +13,8 @@ Ontology_file = "../../Ontologies/Autonomy_v1.ttl"
subClass_instances = "../../Ontologies/instances_subclass.txt" subClass_instances = "../../Ontologies/instances_subclass.txt"
#HERE #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-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"] #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#"] DSO = ["http://delab.csd.auth.gr/ontologies/2018/DSO#"]
...@@ -76,7 +77,7 @@ def get_verb_instances(keyword): ...@@ -76,7 +77,7 @@ def get_verb_instances(keyword):
'''Get Verbs - return tuple''' '''Get Verbs - return tuple'''
def get_verb_file_and_instances(keyword): def get_verb_file_and_instances(keyword):
get_file_and_instances(keyword) get_file_and_instances(keyword, g)
keywordspl = keyword.split("#") keywordspl = keyword.split("#")
in_list = [] in_list = []
out_list = [] out_list = []
...@@ -165,7 +166,7 @@ out_list = [] ...@@ -165,7 +166,7 @@ out_list = []
# A dict with all the info of classes, subclasses and instances # A dict with all the info of classes, subclasses and instances
info_dict = {} info_dict = {}
def get_file_and_instances(keyword): def get_file_and_instances(keyword, g):
out_list = [] out_list = []
keywordspl = keyword.split("#") keywordspl = keyword.split("#")
in_list = [keywordspl[len(keywordspl)-1]] in_list = [keywordspl[len(keywordspl)-1]]
...@@ -258,7 +259,7 @@ def get_dmo_classes_and_comment(keyword, g): ...@@ -258,7 +259,7 @@ def get_dmo_classes_and_comment(keyword, g):
pop = URIRef(urired2 + spl[len(spl) - 1]) pop = URIRef(urired2 + spl[len(spl) - 1])
for q1, w1, m1 in g.triples((pop, RDFS.comment, None)): for q1, w1, m1 in g.triples((pop, RDFS.comment, None)):
find_comment_gen_instance = (str(m1).replace("\r","")).replace("\n","") 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) dic_list_in.append(dmo_dic_in)
for comment in out_list_instance: for comment in out_list_instance:
instance_list = [] instance_list = []
...@@ -323,7 +324,7 @@ def get_dmo_classes_and_comment(keyword, g): ...@@ -323,7 +324,7 @@ def get_dmo_classes_and_comment(keyword, g):
return Dictionary_Data return Dictionary_Data
#return dic_list_backup #return dic_list_backup
else: else:
dmo_dic_backup = {"Class": " ", "Comment":" "} dmo_dic_backup = {"Class": "", "Comment":""}
dic_list_backup.append(dmo_dic_backup) dic_list_backup.append(dmo_dic_backup)
Dictionary_Data = { "Name":section, "TheClasses" : dic_list_backup, "GeneralInstances": dic_list_in} Dictionary_Data = { "Name":section, "TheClasses" : dic_list_backup, "GeneralInstances": dic_list_in}
return Dictionary_Data return Dictionary_Data
......
...@@ -34,6 +34,7 @@ urlpatterns = [ ...@@ -34,6 +34,7 @@ urlpatterns = [
#MAIN CHOICES DATA #MAIN CHOICES DATA
path('groupboilerplates/<int:groupboil>/main/choices/', main_req_views.MainChoicesViewSet.as_view(), name='mainchoices'), 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'), path('main/choices/shall/', main_req_views.ShallChoicesViewSet.as_view(), name='mainshall'),
#SUFFIX CHOICES DATA #SUFFIX CHOICES DATA
......
import os
from rdflib import Graph, URIRef
from rest_framework.generics import ListCreateAPIView, RetrieveUpdateDestroyAPIView, ListAPIView from rest_framework.generics import ListCreateAPIView, RetrieveUpdateDestroyAPIView, ListAPIView
from rest_framework import permissions from rest_framework import permissions
...@@ -61,6 +63,10 @@ class BoilerplateGroupDetailsAPIView(RetrieveUpdateDestroyAPIView): ...@@ -61,6 +63,10 @@ class BoilerplateGroupDetailsAPIView(RetrieveUpdateDestroyAPIView):
#Custom actions when DELETE #Custom actions when DELETE
def perform_destroy(self, instance): def perform_destroy(self, instance):
try:
os.system('rm -rf ../../Ontologies/' + instance.title_bgroup +'/')
except:
print('No file exist')
instance.delete() instance.delete()
...@@ -116,6 +122,22 @@ class BoilerplateDetailsAPIView(RetrieveUpdateDestroyAPIView): ...@@ -116,6 +122,22 @@ class BoilerplateDetailsAPIView(RetrieveUpdateDestroyAPIView):
#Custom actions when DELETE #Custom actions when DELETE
def perform_destroy(self, instance): 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() instance.delete()
...@@ -232,10 +254,10 @@ class InferDetailsAPIView(RetrieveUpdateDestroyAPIView): ...@@ -232,10 +254,10 @@ class InferDetailsAPIView(RetrieveUpdateDestroyAPIView):
prefixdata.append(self.getprefixdata(id.boilerplate_data_id.id)) prefixdata.append(self.getprefixdata(id.boilerplate_data_id.id))
maindata.append(self.getmaindata(id.boilerplate_data_id.id)) maindata.append(self.getmaindata(id.boilerplate_data_id.id))
suffixdata.append(self.getsuffixdata(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) metrics, onto_file = inference.inferencing(instance['ontology_file'], project_title, boildata, prefixdata, maindata, suffixdata)
except: #except:
raise APIException("Not all instances in the Ontology") # raise APIException("Not all instances in the Ontology")
instance.update(inference_data = metrics, ontology_file=onto_file) instance.update(inference_data = metrics, ontology_file=onto_file)
serializer.save() serializer.save()
...@@ -254,7 +276,7 @@ class InferDetailsAPIView(RetrieveUpdateDestroyAPIView): ...@@ -254,7 +276,7 @@ class InferDetailsAPIView(RetrieveUpdateDestroyAPIView):
class PrefixChoicesViewSet(ListAPIView): class PrefixChoicesViewSet(ListAPIView):
""" """
API view to retrieve, update or delete API view to retrieve list of Prefix choices
""" """
permission_classes = [permissions.IsAuthenticatedOrReadOnly] permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = BoilerplateGroupClassesInstancesSerializer 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