Commit 7524bcf9 authored by Thodoris Nestoridis's avatar Thodoris Nestoridis
parents 0b415de0 8d8ed690
...@@ -238,27 +238,27 @@ ...@@ -238,27 +238,27 @@
<ul> <button mat-button [matMenuTriggerFor]="menu" <ul> <button mat-button [matMenuTriggerFor]="menu"
[matMenuTriggerData]="{section: section.Name ,class: item.Class, subclass: sub.SubClass_name, subsubclass:subsub.SubSubClass_name , subsubsubclass: subsubsub.SubSubClass_name, subsubsubsubclass: subsubsubsub.SubSubClass_name}" [matMenuTriggerData]="{section: section.Name ,class: item.Class, subclass: sub.SubClass_name, subsubclass:subsub.SubSubClass_name , subsubsubclass: subsubsub.SubSubClass_name, subsubsubsubclass: subsubsubsub.SubSubClass_name}"
#menuTrigger> #menuTrigger>
<h5>Instances</h5> <h5>AAA-Instances</h5>
</button> </button>
<div <div
*ngFor="let subsubsubsubinstansub of subsubsubsub.SubInstanceOfSubclass| filter:searchText"> *ngFor="let subsubsubsubinstansub of subsubsubsub.SubInstanceOfSubclass| filter:searchText">
<li> <li>
<mat-expansion-panel hideToggle> <mat-expansion-panel hideToggle>
<mat-expansion-panel-header> <mat-expansion-panel-header>
<mat-panel-title class="d-flex justify-content-between"> <mat-panel-title class="d-flex justify-content-between" >
<span div fxLayout="row" <span div fxLayout="row"
fxLayoutAlign="space-around center">{{subsubsubsubinstansub.Instance}}</span> fxLayoutAlign="space-around center">{{subsubsubsubinstansub.Instance}}</span>
<div style="margin-bottom: 4px;"> <div style="margin-bottom: 4px;">
<button <button
*ngIf="section.Name == 'Function' || section.Name == 'System' || section.Name == 'Item' " *ngIf="section.Name == 'Function' || section.Name == 'System' || section.Name == 'Item' "
mat-mini-fab color="primary" style="margin-right: 8px;" mat-mini-fab color="primary" style="margin-right: 8px;"
(click)="openInstanceDialog(subsubsubsubinstansub.Instance, section.Name, item.Class, sub.SubClass_name, subsub.SubSubClass_name, subsubsub.SubSubClass_name, subsubsubsub.SubSubClass_name)"> (click)="openInstanceDialog(subsubsubsubinstansub.Instance, section.Name, item.Class, sub.SubClass_name, subsub.SubSubClass_name, subsubsub.SubSubClass_name, subsubsubsub.SubSubClass_name)">
<mat-icon>add</mat-icon> <mat-icon>add</mat-icon>
</button> </button>
<button mat-mini-fab color="warn" <button mat-mini-fab color="warn"
(click)="deleteInstance(section.Name , item.Class, sub.SubClass_name, subsub.SubSubClass_name , subsubsub.SubSubClass_name, subsubsubsub.SubSubClass_name, subsubsubsubinstansub.Instance, subsubsubsubinstansub.Comment)"> (click)="deleteInstance(section.Name , item.Class, sub.SubClass_name, subsub.SubSubClass_name , subsubsub.SubSubClass_name, subsubsubsub.SubSubClass_name, subsubsubsubinstansub.Instance, subsubsubsubinstansub.Comment)">
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>
</button> </button>
</div> </div>
</mat-panel-title> </mat-panel-title>
......
...@@ -27,5 +27,10 @@ ...@@ -27,5 +27,10 @@
top: 1%; top: 1%;
right: 0px; right: 0px;
height:100%; height:100%;
overflow:auto; overflow:auto;
}
.d-flex{
overflow-x: auto;
white-space: nowrap;
} }
\ No newline at end of file
...@@ -69,22 +69,26 @@ ...@@ -69,22 +69,26 @@
</ng-container> </ng-container>
<!-- Name Column --> <!-- Name Column -->
<ng-container matColumnDef="prefix_data"> <ng-container matColumnDef="prefix_data" >
<th mat-header-cell *matHeaderCellDef> Prefix </th> <th mat-header-cell *matHeaderCellDef> Prefix </th>
<td mat-cell *matCellDef="let element">{{element.prefix_data}} </td> <td mat-cell *matCellDef="let element" [matTooltip]="element.prefix_data && element.prefix_data.length > 70 ? element.prefix_data : null"
matTooltipClass="custom-tooltip" matTooltipPosition="above">{{element.prefix_data && element.prefix_data.length > 70 ? element.prefix_data.substr(0, 70) +'...': element.prefix_data}}</td>
</ng-container> </ng-container>
<!-- 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}} <td mat-cell *matCellDef="let element" [matTooltip]="get_metrics(element.title_data).length > 0 ? get_metrics(element.title_data) : null"> {{element.title_data}}
<span *ngIf="get_metrics(element.title_data).length > 0" matBadge={{get_metrics(element.title_data).length}} <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> matBadgeColor="warn" matBadgeSize="small" position="above"> &nbsp;&nbsp; </span>
<span *ngIf="get_secondary_metrics(element.title_data).length > 0" matBadge={{get_secondary_metrics(element.title_data).length}}
matBadgeColor="accent" matBadgeSize="small" position="above"> &nbsp;&nbsp; </span>
</td> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="main_data"> <ng-container matColumnDef="main_data">
<th mat-header-cell *matHeaderCellDef> Main </th> <th mat-header-cell *matHeaderCellDef> Main </th>
<td mat-cell *matCellDef="let element"> {{element.main_data}} </td> <td mat-cell *matCellDef="let element" [matTooltip]="element.main_data && element.main_data.length > 70 ? element.main_data : null"
matTooltipClass="custom-tooltip" matTooltipPosition="above">{{element.main_data && element.main_data.length > 70 ? element.main_data.substr(0, 70) +'...': element.main_data}}</td>
</ng-container> </ng-container>
<ng-container matColumnDef="suffix_data"> <ng-container matColumnDef="suffix_data">
...@@ -107,7 +111,9 @@ ...@@ -107,7 +111,9 @@
<mat-paginator #paginator [pageSizeOptions]="[20, 50]" showFirstLastButtons></mat-paginator> <mat-paginator #paginator [pageSizeOptions]="[20, 50]" showFirstLastButtons></mat-paginator>
</div> </div>
<div *ngIf="!this.spinnerchart">
<div echarts [options]="chartOption" class="demo-chart"></div> <div echarts [options]="chartOption" class="demo-chart"></div>
</div>
<div class="content"> <div class="content">
<div fxLayout="row wrap"> <div fxLayout="row wrap">
......
...@@ -24,4 +24,15 @@ table { ...@@ -24,4 +24,15 @@ table {
.mat-row:hover .mat-cell { .mat-row:hover .mat-cell {
border-color: currentColor; border-color: currentColor;
}
::ng-deep .custom-tooltip {
background-color: #333;
color: #fff;
font-size: 14px;
padding: 8px;
border-radius: 4px;
max-width: 600px !important;
white-space: normal;
word-wrap: break-word;
} }
\ No newline at end of file
...@@ -43,6 +43,8 @@ export class BoilerplateListComponent implements OnInit { ...@@ -43,6 +43,8 @@ export class BoilerplateListComponent implements OnInit {
} }
], ],
}; };
spinnerchart=true;
private readonly notifier: NotifierService; private readonly notifier: NotifierService;
boilerplates?: Boilerplate[]; boilerplates?: Boilerplate[];
boilerplatesdata?: BoilerplateData[]; boilerplatesdata?: BoilerplateData[];
...@@ -67,6 +69,8 @@ export class BoilerplateListComponent implements OnInit { ...@@ -67,6 +69,8 @@ export class BoilerplateListComponent implements OnInit {
list_of_inference_metrics = ["IncompleteRequirement", "AmbiguousRequirement", "InconsistentRequirement", "NoisyRequirement", "OpaqueRequirement", "RedundantRequirement"] list_of_inference_metrics = ["IncompleteRequirement", "AmbiguousRequirement", "InconsistentRequirement", "NoisyRequirement", "OpaqueRequirement", "RedundantRequirement"]
list_of_primary_inference_metrics = ["IncompleteRequirement", "AmbiguousRequirement", "InconsistentRequirement", "RedundantRequirement"]
list_of_secondary_inference_metrics = ["NoisyRequirement", "OpaqueRequirement"]
@ViewChild(MatPaginator) paginator = this.newdataSource.paginator; @ViewChild(MatPaginator) paginator = this.newdataSource.paginator;
...@@ -186,12 +190,13 @@ export class BoilerplateListComponent implements OnInit { ...@@ -186,12 +190,13 @@ export class BoilerplateListComponent implements OnInit {
} }
} }
//console.log(final); //console.log(final);
this.chartOption.series = [{ this.chartOption.series = [{
type: 'pie', type: 'pie',
radius: ['40%', '70%'], radius: ['40%', '70%'],
data: final, data: final,
}] }]
this.spinnerchart = false;
}, },
error => { error => {
console.log(error); console.log(error);
...@@ -227,12 +232,42 @@ export class BoilerplateListComponent implements OnInit { ...@@ -227,12 +232,42 @@ export class BoilerplateListComponent implements OnInit {
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, "\""))
var final = []
if (obj[i]) {
for (let j in obj[i]){
//console.log(obj[i][j])
if(this.list_of_primary_inference_metrics.includes(obj[i][j])){
final.push(obj[i][j])
}
}
//return obj[i]
}
//final.push({ value: obj[i].length, name: i })
return final;
}
return 0
}
get_secondary_metrics(i: any): any {
if (this.currentInfer?.inference_data) {
const obj = JSON.parse(this.currentInfer['inference_data'].replace(/'/g, "\""))
var final = []
if (obj[i]) { if (obj[i]) {
return obj[i] for (let j in obj[i]){
//console.log(obj[i][j])
if(this.list_of_secondary_inference_metrics.includes(obj[i][j])){
final.push(obj[i][j])
}
}
//return obj[i]
} }
//final.push({ value: obj[i].length, name: i })
return final;
} }
return 0 return 0
} }
getnumreq(): any { getnumreq(): any {
return this.boilerplatesdata?.length return this.boilerplatesdata?.length
} }
......
...@@ -285,6 +285,7 @@ def exportboiltottl(ontfile,project, prefix, boilerplate, main, suffix): ...@@ -285,6 +285,7 @@ def exportboiltottl(ontfile,project, prefix, boilerplate, main, suffix):
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"))
import time
def shacl(ontotlogy_file): def shacl(ontotlogy_file):
metrics_dict = {} metrics_dict = {}
...@@ -294,21 +295,15 @@ def shacl(ontotlogy_file): ...@@ -294,21 +295,15 @@ def shacl(ontotlogy_file):
shutil.copyfile(file1, target) shutil.copyfile(file1, target)
final_result = '' final_result = ''
target1 = target.replace(" ","\ ") target1 = target.replace(" ","\ ")
for i in range(30): open('tempOnt.ttl', 'w').close()
print(i+1, 'Cycle of inferencing') shutil.copyfile(target1, 'tempOnt.ttl')
#result = subprocess.check_output(["./reqman/apps/reqtool/rest_api/services/shacl-1.3.2/bin/shaclinfer.sh", "-datafile", target]) cmd = ['java', '-jar', 'reqman/apps/reqtool/rest_api/services/inference/teoProjectUbuntu.jar']
try: try:
result = subprocess.check_output("./reqman/apps/reqtool/rest_api/services/shacl-1.4.2/bin/shaclinfer.sh -datafile "+target1+" | grep -v -e 'WARN OntDocumentManager' -e 'at org.' -e 'org.apache.' -e '@' ",shell=True, timeout=360) output = subprocess.check_output(cmd)
except: except:
raise APIException("Problem during the Inferencing") raise APIException("Problem during the Inferencing")
if(result==final_result): shutil.copyfile('ontology.ttl', target)
break os.remove('ontology.ttl')
final_result=result
file_object = open(target, 'a')
res = str(result,'utf-8')
file_object.write(res.strip())
file_object.close()
#need to fiil with all the metrics #need to fiil with all the metrics
g = Graph() g = Graph()
gon = Graph() gon = Graph()
......
...@@ -292,7 +292,7 @@ class InferDetailsAPIView(RetrieveUpdateDestroyAPIView): ...@@ -292,7 +292,7 @@ class InferDetailsAPIView(RetrieveUpdateDestroyAPIView):
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)
......
...@@ -25,9 +25,17 @@ def signup(request): ...@@ -25,9 +25,17 @@ def signup(request):
mail = data['email'] mail = data['email']
username = data['username'] username = data['username']
password = data['password1'] password = data['password1']
user = User.objects.create_user(email=mail, password=password)
send_mail(
'Welcome to our site',
f'Hi {username},\n\nThanks for signing up for our site!',
settings.EMAIL_HOST_USER,
[mail],
fail_silently=False,
)
send_mail( send_mail(
'New register from Requirement tool', 'New register from Requirement tool',
' Username :'+username+'\n Mail:'+mail+' \n Password:'+password, ' Username :'+username+'\n Mail:'+mail+' \n Fullname:'+username+'/n',
settings.EMAIL_HOST_USER, settings.EMAIL_HOST_USER,
['nestorid@gapps.auth.gr'], ['nestorid@gapps.auth.gr'],
fail_silently=False, fail_silently=False,
......
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