Commit 8d8ed690 authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

1) new infernce (java), 2) automate user registrat

parent bf053d5f
......@@ -238,27 +238,27 @@
<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}"
#menuTrigger>
<h5>Instances</h5>
<h5>AAA-Instances</h5>
</button>
<div
*ngFor="let subsubsubsubinstansub of subsubsubsub.SubInstanceOfSubclass| filter:searchText">
<li>
<mat-expansion-panel hideToggle>
<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"
fxLayoutAlign="space-around center">{{subsubsubsubinstansub.Instance}}</span>
<div style="margin-bottom: 4px;">
<button
*ngIf="section.Name == 'Function' || section.Name == 'System' || section.Name == 'Item' "
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)">
<mat-icon>add</mat-icon>
*ngIf="section.Name == 'Function' || section.Name == 'System' || section.Name == 'Item' "
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)">
<mat-icon>add</mat-icon>
</button>
<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>
</div>
</mat-panel-title>
......
......@@ -27,5 +27,10 @@
top: 1%;
right: 0px;
height:100%;
overflow:auto;
overflow:auto;
}
.d-flex{
overflow-x: auto;
white-space: nowrap;
}
\ No newline at end of file
......@@ -69,22 +69,26 @@
</ng-container>
<!-- Name Column -->
<ng-container matColumnDef="prefix_data">
<ng-container matColumnDef="prefix_data" >
<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>
<!-- Name Column -->
<ng-container matColumnDef="title_data">
<th mat-header-cell *matHeaderCellDef> Title </th>
<td mat-cell *matCellDef="let element" matTooltip={{get_metrics(element.title_data)}}> {{element.title_data}}
<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}}
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>
</ng-container>
<ng-container matColumnDef="main_data">
<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 matColumnDef="suffix_data">
......@@ -107,7 +111,9 @@
<mat-paginator #paginator [pageSizeOptions]="[20, 50]" showFirstLastButtons></mat-paginator>
</div>
<div *ngIf="!this.spinnerchart">
<div echarts [options]="chartOption" class="demo-chart"></div>
</div>
<div class="content">
<div fxLayout="row wrap">
......
......@@ -24,4 +24,15 @@ table {
.mat-row:hover .mat-cell {
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 {
}
],
};
spinnerchart=true;
private readonly notifier: NotifierService;
boilerplates?: Boilerplate[];
boilerplatesdata?: BoilerplateData[];
......@@ -67,6 +69,8 @@ export class BoilerplateListComponent implements OnInit {
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;
......@@ -186,12 +190,13 @@ export class BoilerplateListComponent implements OnInit {
}
}
//console.log(final);
this.chartOption.series = [{
type: 'pie',
radius: ['40%', '70%'],
data: final,
}]
this.spinnerchart = false;
},
error => {
console.log(error);
......@@ -227,12 +232,42 @@ export class BoilerplateListComponent implements OnInit {
get_metrics(i: any): any {
if (this.currentInfer?.inference_data) {
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]) {
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
}
getnumreq(): any {
return this.boilerplatesdata?.length
}
......
......@@ -285,6 +285,7 @@ def exportboiltottl(ontfile,project, prefix, boilerplate, main, suffix):
g.serialize(destination=save_path+file_name+'.ttl', format='turtle')
return (save_path+file_name)
#print(g.serialize(format="turtle").decode("utf-8"))
import time
def shacl(ontotlogy_file):
metrics_dict = {}
......@@ -294,21 +295,15 @@ def shacl(ontotlogy_file):
shutil.copyfile(file1, target)
final_result = ''
target1 = target.replace(" ","\ ")
for i in range(30):
print(i+1, 'Cycle of inferencing')
#result = subprocess.check_output(["./reqman/apps/reqtool/rest_api/services/shacl-1.3.2/bin/shaclinfer.sh", "-datafile", target])
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)
except:
raise APIException("Problem during the Inferencing")
if(result==final_result):
break
final_result=result
file_object = open(target, 'a')
res = str(result,'utf-8')
file_object.write(res.strip())
file_object.close()
open('tempOnt.ttl', 'w').close()
shutil.copyfile(target1, 'tempOnt.ttl')
cmd = ['java', '-jar', 'reqman/apps/reqtool/rest_api/services/inference/teoProjectUbuntu.jar']
try:
output = subprocess.check_output(cmd)
except:
raise APIException("Problem during the Inferencing")
shutil.copyfile('ontology.ttl', target)
os.remove('ontology.ttl')
#need to fiil with all the metrics
g = Graph()
gon = Graph()
......
......@@ -292,7 +292,7 @@ class InferDetailsAPIView(RetrieveUpdateDestroyAPIView):
maindata.append(self.getmaindata(id.boilerplate_data_id.id))
suffixdata.append(self.getsuffixdata(id.boilerplate_data_id.id))
#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:
# raise APIException("Not all instances in the Ontology")
instance.update(inference_data = metrics, ontology_file=onto_file)
......
......@@ -25,9 +25,17 @@ def signup(request):
mail = data['email']
username = data['username']
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(
'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,
['nestorid@gapps.auth.gr'],
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