Commit 2a3b6646 authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

ui changes

parent ad19a7d0
......@@ -2,7 +2,7 @@
<div class="col">
<form class="form-group form-inline">
<mat-form-field class="example-full-width">
<mat-label>Subject</mat-label>
<mat-label *ngIf="this.subjectsControl.value !=null" >Subject : {{this.subjectsControl.value.slice(0, this.subjectsControl.value.indexOf(':'))}}</mat-label>
<input type="text"
placeholder="Pick one"
aria-label="Number"
......@@ -10,9 +10,9 @@
[formControl]="subjectsControl"
[matAutocomplete]="automainsub"
style="width: 100%;">
<mat-autocomplete autoActiveFirstOption #automainsub="matAutocomplete">
<mat-option *ngFor="let option of subjectsfilteredOptions | async" [value]="option">
{{option}}
<mat-autocomplete autoActiveFirstOption #automainsub="matAutocomplete" showPanel="true" [displayWith]="displayFn">
<mat-option *ngFor="let option of subjectsfilteredOptions | async" [value]="option">
{{option.split(" : ").pop()}}
</mat-option>
</mat-autocomplete>
</mat-form-field>
......@@ -21,7 +21,7 @@
<div class="col">
<form class="form-group form-inline">
<mat-form-field class="example-full-width">
<mat-label>State or Item</mat-label>
<mat-label *ngIf="this.stateitemControl.value !=null">State or Item : {{this.stateitemControl.value.slice(0, this.stateitemControl.value.indexOf(':'))}}</mat-label>
<input type="text"
placeholder="Pick one"
aria-label="Number"
......@@ -29,9 +29,9 @@
[formControl]="stateitemControl"
[matAutocomplete]="autostateitem"
>
<mat-autocomplete autoActiveFirstOption #autostateitem="matAutocomplete">
<mat-autocomplete autoActiveFirstOption #autostateitem="matAutocomplete" showPanel="true" [displayWith]="displayFn">
<mat-option *ngFor="let option of stateitemfilteredOptions | async" [value]="option">
{{option}}
{{option.split(" : ").pop()}}
</mat-option>
</mat-autocomplete>
</mat-form-field>
......@@ -40,7 +40,7 @@
<div class="col">
<form class="form-group form-inline">
<mat-form-field class="example-full-width">
<mat-label>State Value</mat-label>
<mat-label *ngIf="statevalueControl.value !=null">State Value : {{statevalueControl.value.slice(0, statevalueControl.value.indexOf(':'))}}</mat-label>
<input type="text"
placeholder="Pick one"
aria-label="Number"
......@@ -48,15 +48,15 @@
[formControl]="statevalueControl"
[matAutocomplete]="autostatevalue"
>
<mat-autocomplete autoActiveFirstOption #autostatevalue="matAutocomplete">
<mat-autocomplete autoActiveFirstOption #autostatevalue="matAutocomplete" showPanel="true" [displayWith]="displayFn">
<mat-option *ngFor="let option of statevaluefilteredOptions | async" [value]="option">
{{option}}
{{option.split(" : ").pop()}}
</mat-option>
</mat-autocomplete>
</mat-form-field>
</form>
</div>
</div>
</div>
<div class="form-row">
<div class="col">
<form class="form-group form-inline">
......@@ -144,11 +144,12 @@
</form>
</div>
</div>
<!-- <mat-label *ngIf=".value !=null">State or Item : {{.value.slice(0, .value.indexOf(':'))}}</mat-label> -->
<div class="form-row">
<div class="col">
<form class="form-group form-inline">
<mat-form-field class="example-full-width">
<mat-label>Object</mat-label>
<mat-label *ngIf="fifuintsysstatsetControl.value !=null">Object : {{fifuintsysstatsetControl.value.slice(0, fifuintsysstatsetControl.value.indexOf(':'))}}</mat-label>
<input type="text"
placeholder="Pick one"
aria-label="Number"
......@@ -156,9 +157,9 @@
[formControl]="fifuintsysstatsetControl"
[matAutocomplete]="autofifuintsysstatset"
>
<mat-autocomplete autoActiveFirstOption #autofifuintsysstatset ="matAutocomplete">
<mat-autocomplete autoActiveFirstOption #autofifuintsysstatset ="matAutocomplete" showPanel="true" [displayWith]="displayFn">
<mat-option *ngFor="let option of fifuintsysstatsetfilteredOptions | async" [value]="option">
{{option}}
{{option.split(" : ").pop()}}
</mat-option>
</mat-autocomplete>
</mat-form-field>
......@@ -167,7 +168,7 @@
<div class="col">
<form class="form-group form-inline">
<mat-form-field class="example-full-width">
<mat-label>Connection</mat-label>
<mat-label *ngIf="stsysconsetControl.value !=null">Connection : {{stsysconsetControl.value.slice(0, stsysconsetControl.value.indexOf(':'))}}</mat-label>
<input type="text"
placeholder="Pick one"
aria-label="Number"
......@@ -175,9 +176,9 @@
[formControl]="stsysconsetControl"
[matAutocomplete]="autostsysconset"
>
<mat-autocomplete autoActiveFirstOption #autostsysconset ="matAutocomplete">
<mat-autocomplete autoActiveFirstOption #autostsysconset ="matAutocomplete" showPanel="true" [displayWith]="displayFn">
<mat-option *ngFor="let option of stsysconsetfilteredOptions | async" [value]="option">
{{option}}
{{option.split(" : ").pop()}}
</mat-option>
</mat-autocomplete>
</mat-form-field>
......
......@@ -3,4 +3,4 @@
}
.mat-autocomplete {
width: 100%;
}
\ No newline at end of file
}
......@@ -117,10 +117,18 @@ export class MainDetailsComponent implements OnInit {
this.getAllMain(this.route.snapshot.params.id);
}
displayFn(option:string): string {
if (option != null) {
let x = option.split(" : ");
if ( (x[x.length -2] == "") || (x[x.length -1]=="")) { return "";}
return (x[x.length -2]+" : "+x[x.length -1]);
}
return "";
}
private _filter(data:string[], value: string): string[] {
const filterValue = value.toLowerCase();
return data.filter(option => option.toLowerCase().indexOf(filterValue) === 0);
return data.filter(option => option.toLowerCase().includes(filterValue));
}
getAllMain(id: string): void {
......@@ -192,7 +200,7 @@ export class MainDetailsComponent implements OnInit {
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.subjects.push(data[x][1]);}
this.subjects.push((data[x][1]));}
},
error => {
console.log(error);
......
......@@ -21,7 +21,7 @@
<div class="col">
<form class="example-form form-inline">
<mat-form-field>
<mat-label>Subject</mat-label>
<mat-label *ngIf="subjectsControl.value !=null">Subject : {{subjectsControl.value.slice(0, subjectsControl.value.indexOf(':'))}}</mat-label>
<input type="text"
placeholder="Pick one"
aria-label="Number"
......@@ -29,9 +29,9 @@
[formControl]="subjectsControl"
[matAutocomplete]="autosub"
>
<mat-autocomplete autoActiveFirstOption #autosub="matAutocomplete">
<mat-autocomplete autoActiveFirstOption #autosub="matAutocomplete" showPanel="true" [displayWith]="displayFn">
<mat-option *ngFor="let option of subjectsfilteredOptions | async" [value]="option">
{{option}}
{{option.split(" : ").pop()}}
</mat-option>
</mat-autocomplete>
</mat-form-field>
......@@ -63,7 +63,7 @@
<div class="col">
<form class="example-form form-inline">
<mat-form-field>
<mat-label>Object</mat-label>
<mat-label *ngIf="objectsControl.value !=null">Object : {{objectsControl.value.slice(0, objectsControl.value.indexOf(':'))}}</mat-label>
<input type="text"
placeholder="Pick one"
aria-label="Number"
......@@ -71,9 +71,9 @@
[formControl]="objectsControl"
[matAutocomplete]="autobjects"
>
<mat-autocomplete autoActiveFirstOption #autobjects="matAutocomplete">
<mat-autocomplete autoActiveFirstOption #autobjects="matAutocomplete" showPanel="true" [displayWith]="displayFn">
<mat-option *ngFor="let option of objectsfilteredOptions | async" [value]="option">
{{option}}
{{option.split(" : ").pop()}}
</mat-option>
</mat-autocomplete>
</mat-form-field>
......
......@@ -82,10 +82,19 @@ export class PrefixDetailsComponent implements OnInit {
this.getAllPrefix(this.route.snapshot.params.id);
}
displayFn(option:string): string {
if (option != null) {
let x = option.split(" : ");
if ( (x[x.length -2] == "") || (x[x.length -1]=="")) { return "";}
return (x[x.length -2]+" : "+x[x.length -1]);
}
return "";
}
private _filter(data:string[], value: string): string[] {
const filterValue = value.toLowerCase();
return data.filter(option => option.toLowerCase().indexOf(filterValue) === 0);
return data.filter(option => option.toLowerCase().includes(filterValue));
}
getAllPrefix(id: string): void {
......
......@@ -48,6 +48,7 @@
<div class="col">
<form class="form-group form-inline">
<mat-form-field class="example-full-width">
<mat-label *ngIf="flowControl.value !=null">Flow : {{flowControl.value.slice(0, flowControl.value.indexOf(':'))}}</mat-label>
<mat-label>Flow</mat-label>
<input type="text"
placeholder="Pick one"
......@@ -56,9 +57,9 @@
[formControl]="flowControl"
[matAutocomplete]="autoflow"
>
<mat-autocomplete autoActiveFirstOption #autoflow="matAutocomplete">
<mat-autocomplete autoActiveFirstOption #autoflow="matAutocomplete" showPanel="true" [displayWith]="displayFn">
<mat-option *ngFor="let option of flowfilteredOptions | async" [value]="option">
{{option}}
{{option.split(" : ").pop()}}
</mat-option>
</mat-autocomplete>
</mat-form-field>
......
......@@ -65,9 +65,18 @@ export class SuffixDetailsComponent implements OnInit {
this.getAllSuffix(this.route.snapshot.params.id);
}
displayFn(option:string): string {
if (option != null) {
let x = option.split(" : ");
if ( (x[x.length -2] == "") || (x[x.length -1]=="")) { return "";}
return (x[x.length -2]+" : "+x[x.length -1]);
}
return "";
}
private _filter(data:string[], value: string): string[] {
const filterValue = value.toLowerCase();
return data.filter(option => option.toLowerCase().indexOf(filterValue) === 0);
return data.filter(option => option.toLowerCase().includes(filterValue));
}
......
......@@ -34,6 +34,7 @@ def inferencing(project, boilerlate, prefix, main, suffix):
def exportboiltottl(project, prefix, boilerplate, main, suffix):
#print(out_list) A list with the values and the file that is the instance
per_instances = URIRef("http://delab.csd.auth.gr/ontologies/2018/RDO-instances#")
rdo = URIRef("http://delab.csd.auth.gr/ontologies/2018/RDO#")
rbo = URIRef("http://delab.csd.auth.gr/ontologies/2018/RBO#")
......@@ -57,7 +58,7 @@ def exportboiltottl(project, prefix, boilerplate, main, suffix):
spliter_1 = out_list[j].split(" : ")
instance_file = out_list[j+1]
break
g.add((per_instances+(title+"_"+ main[i][0]['main_choices']), rbo+"isRelatedToSubject", URIRef(str(instance_file))+"#"+ str(spliter_1[1])))
g.add((per_instances+(title+"_"+ main[i][0]['main_choices']), rbo+"isRelatedToSubject", URIRef(str(instance_file))+"#"+ str(spliter_1[len(spliter_1) -1])))
if main[i][0]['verb'] != "":
g.add((per_instances+(title+"_"+ main[i][0]['main_choices']), rbo+"isRelatedToAction", lo + main[i][0]['verb']))
if main[i][0]['flow_function_interface_item_system_state_stateset'] != "":
......@@ -66,7 +67,7 @@ def exportboiltottl(project, prefix, boilerplate, main, suffix):
spliter_1 = out_list[j].split(" : ")
instance_file = out_list[j+1]
break
g.add((per_instances+(title+"_"+ main[i][0]['main_choices']), rbo+"isRelatedTo"+spliter_1[0], URIRef(str(instance_file))+"#"+ str(spliter_1[1])))
g.add((per_instances+(title+"_"+ main[i][0]['main_choices']), rbo+"isRelatedTo"+spliter_1[0], URIRef(str(instance_file))+"#"+ str(spliter_1[len(spliter_1) -1])))
if (boilerplate[i][0]['has_suffix'] == True):
......
......@@ -68,7 +68,7 @@ def get_instances(keyword):
#new code
out_list.append(extra)
#return tuple((str(keywordspl[len(keywordspl)-1]+" : "+n), str(keywordspl[len(keywordspl)-1]+" : "+n) ) for n in (out_list))
return tuple((str(out_list[n+1]+" : "+out_list[n]), str(out_list[n+1]+" : "+out_list[n]) ) for n in range(0, len(out_list), 2))
return tuple((str(keywordspl[len(keywordspl)-1]+" : "+out_list[n+1]+" : "+out_list[n]), str(keywordspl[len(keywordspl)-1]+" : "+out_list[n+1]+" : "+out_list[n]) ) for n in range(0, len(out_list), 2))
# A list with the values and the file that is the instance
out_list = []
......@@ -88,7 +88,7 @@ def get_file_and_instances(keyword):
for s, p, o in g.triples((None, RDF.type, per)):
spl = s.split("#")
uri = spl[len(spl) - 2].split("/")
out_list.append(keywordspl[len(keywordspl)-1]+" : " +spl[len(spl) - 1])
out_list.append(keywordspl[len(keywordspl)-1]+" : "+extra+" : " +spl[len(spl) - 1])
out_list.append(str(spl[len(spl) - 2]))
#return out_list#tuple((out_list[i+1], out_list[i]) for i in range(0, (len(out_list) - 1), 2) )
......
......@@ -63,7 +63,10 @@ class MainDetailsAPIView(RetrieveUpdateDestroyAPIView):
def perform_update(self, serializer):
instance = serializer.validated_data
#add data in thn Model BoilerplateData
mn = (instance['sys_fun_inter'] + ' ' + instance['shall'] + ' ' + instance['verb'] + ' ' + instance['flow_function_interface_item_system_state_stateset'])
es_instance = instance['sys_fun_inter'].rsplit(':', 1)
ev_instance =instance['verb'].rsplit(':', 1)
eo_instance = instance['flow_function_interface_item_system_state_stateset'].rsplit(':', 1)
mn = (es_instance[len(es_instance)-1] + ' ' + instance['shall'] + ' ' + ev_instance[len(ev_instance)-1] + ' ' + eo_instance[len(eo_instance)-1])
BoilerplateData.objects.filter(owner_data=instance['boilerplate_of_main'].owner, boilerplate_data_id = instance['boilerplate_of_main']).update(main_data = mn )
curmain_choices = inference.getclassofmain(instance)
#instance['main_choices'] = curmain_choices[0]
......
......@@ -170,7 +170,9 @@ class PrefixDetailsAPIView(RetrieveUpdateDestroyAPIView):
def perform_update(self, serializer):
instance = serializer.validated_data
#add data in thn Model BoilerplateData
pr = (instance['prefix'] + ' ' + instance['system_fun_item'] + ' ' + instance['state_or_verb'] + ' ' + instance['item_function_flow_statevalue'])
es_instance = instance['system_fun_item'].rsplit(':', 1)
eo_instance = instance['item_function_flow_statevalue'].rsplit(':', 1)
pr = (instance['prefix'] + ' ' + es_instance[len(es_instance)-1] + ' ' + instance['state_or_verb'] + ' ' + eo_instance[len(eo_instance)-1])
BoilerplateData.objects.filter(owner_data=instance['prefix_boilerplate'].owner, boilerplate_data_id = instance['prefix_boilerplate']).update(prefix_data = pr )
sprefix = self.simple_prefix(instance["prefix"])
serializer.save(simple_prefix = sprefix)
......
......@@ -59,7 +59,8 @@ class SuffixDetailsAPIView(RetrieveUpdateDestroyAPIView):
def perform_update(self, serializer):
instance = serializer.validated_data
#add data in thn Model BoilerplateData
sf = (instance['s_choices'] + ' ' + str(instance['numerical']) + ' ' + instance['mumerical_units'] + ' ' + instance['flow'])
eo_instance = instance['flow'].rsplit(':', 1)
sf = (instance['s_choices'] + ' ' + str(instance['numerical']) + ' ' + instance['mumerical_units'] + ' ' + eo_instance[len(eo_instance)-1])
BoilerplateData.objects.filter(owner_data=instance['boilerplate_of_suffix'].owner, boilerplate_data_id = instance['boilerplate_of_suffix']).update(suffix_data = sf )
ssuffix_choice = self.getclassofsuffix(instance["s_choices"])
serializer.save(suffix_choices = ssuffix_choice)
......
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