Commit 20927d60 authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

RFT Bugs (edit title, double choices, verbs)

parent 153ae27e
......@@ -21,6 +21,7 @@
class="form-control"
required
[(ngModel)]="currentboilerplate.title"
(change)="this.updateBoilerplate()"
style="width: 63%;"/>
</div>
<div style="display: flex; flex-grow: grow; margin-top: 50px; ">
......
import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Boilerplate } from 'src/app/models/boilerplate.model';
......@@ -25,6 +24,8 @@ export class BoilerplateDetailsComponent implements OnInit {
systems?: Sections [];
currentboilerplate: Boilerplate = {
group_of_boilerplate: this.route.snapshot.params.gb,
title: "",
has_prefix: false,
has_main: false,
has_suffix: false
......
......@@ -81,9 +81,9 @@
</form>
</div>
<div class="col">
<form class="form-group form-inline">
<form class="form-group form-inline" [ngStyle]="(verbControlisDivVisible) ? {'visibility': 'visible'} : {'visibility': 'hidden'}">
<mat-form-field class="example-full-width">
<mat-label>Verb</mat-label>
<mat-label *ngIf="verbControl.value !=null">Verb : {{verbControl.value.slice(0, verbControl.value.indexOf(' : '))}}</mat-label>
<input type="text"
placeholder="Pick one"
aria-label="Number"
......@@ -92,9 +92,9 @@
required
[matAutocomplete]="autoverb"
>
<mat-autocomplete autoActiveFirstOption #autoverb ="matAutocomplete">
<mat-autocomplete autoActiveFirstOption #autoverb="matAutocomplete" showPanel="true" [displayWith]="displayFn">
<mat-option *ngFor="let option of verbfilteredOptions | async" [value]="option">
{{option}}
{{option.split(" : ").pop()}}
</mat-option>
</mat-autocomplete>
</mat-form-field>
......
......@@ -46,6 +46,8 @@ export class MainDetailsComponent implements OnInit {
verbControl = new FormControl();
verb:string[] = [];
verbfilteredOptions: Observable<string[]>;
verbControlisDivVisible = true
quantifierControl = new FormControl( );
quantifier:string[] = [];
......@@ -148,10 +150,11 @@ export class MainDetailsComponent implements OnInit {
//console.log(this.mainsyntax[x])
//console.log(this.mainsyntax[x].Id)
for (let s=0; s < this.mainsyntax[x].Subject.length; s++ ){
console.log()
if (this.mainsyntax[x].Subject[s] == (this.subjectsControl.value.slice(0, this.subjectsControl.value.indexOf(':'))).replace(/\s/g, "")){
//console.log("okk")
for (let v=0; v < this.mainsyntax[x].Verbs.length; v++ ){
if (this.mainsyntax[x].Verbs[v] == ((this.verbControl.value).replace(/\s/g, ""))){
if (this.mainsyntax[x].Verbs[v] == (this.verbControl.value.split(" : ").pop()).replace(/\s/g, "")){
//console.log("Verb okk")
for (let a=0; a < this.mainsyntax[x].Attributes.length; a++ ){
if (this.mainsyntax[x].Attributes[a] == (this.fifuintsysstatsetControl.value.slice(0, this.fifuintsysstatsetControl.value.indexOf(':'))).replace(/\s/g, "")){
......@@ -233,7 +236,7 @@ export class MainDetailsComponent implements OnInit {
.subscribe(
data => {
this.currentmain = data;
//console.log(data)
console.log(data)
this.subjectsControl.setValue(this.currentmain.sys_fun_inter);
this.stateitemControl.setValue(this.currentmain.state_item_before_verb);
this.statevalueControl.setValue(this.currentmain.statevalue_before_verb);
......@@ -280,7 +283,8 @@ export class MainDetailsComponent implements OnInit {
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.subjects.push((data[x][1]));}
if(this.subjects.indexOf(data[x][1]) == -1) {
this.subjects.push((data[x][1]));}}
},
error => {
console.log(error);
......@@ -291,7 +295,8 @@ export class MainDetailsComponent implements OnInit {
data => {
//no data from State and Item
for (let x=0; x < data.length; x++ ){
this.stateitem.push(data[x][1]);}
if(this.stateitem.indexOf(data[x][1]) == -1) {
this.stateitem.push(data[x][1]);}}
},
error => {
console.log(error);
......@@ -300,7 +305,8 @@ export class MainDetailsComponent implements OnInit {
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.statevalue.push(data[x][1]);}
if(this.statevalue.indexOf(data[x][1]) == -1) {
this.statevalue.push(data[x][1]);}}
},
error => {
console.log(error);
......@@ -309,7 +315,8 @@ export class MainDetailsComponent implements OnInit {
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.shall.push(data[x][1]);}
if(this.shall.indexOf(data[x][1]) == -1) {
this.shall.push(data[x][1]);}}
},
error => {
console.log(error);
......@@ -318,7 +325,9 @@ export class MainDetailsComponent implements OnInit {
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.verb.push(data[x][1]);}
if(this.verb.indexOf(data[x][1]) == -1) {
this.verb.push(data[x][1]);}}
console.log(this.verb)
},
error => {
console.log(error);
......@@ -327,7 +336,8 @@ export class MainDetailsComponent implements OnInit {
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.quantifier.push(data[x][1]);}
if(this.quantifier.indexOf(data[x][1]) == -1) {
this.quantifier.push(data[x][1]);}}
},
error => {
console.log(error);
......@@ -337,7 +347,8 @@ export class MainDetailsComponent implements OnInit {
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.numunit.push(data[x][1]);}
if(this.numunit.indexOf(data[x][1]) == -1) {
this.numunit.push(data[x][1]);}}
},
error => {
console.log(error);
......@@ -346,7 +357,8 @@ export class MainDetailsComponent implements OnInit {
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.fifuintsysstatset.push(data[x][1]);}
if(this.fifuintsysstatset.indexOf(data[x][1]) == -1) {
this.fifuintsysstatset.push(data[x][1]);}}
},
error => {
console.log(error);
......@@ -355,7 +367,8 @@ export class MainDetailsComponent implements OnInit {
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.stsysconset.push(data[x][1]);}
if(this.stsysconset.indexOf(data[x][1]) == -1) {
this.stsysconset.push(data[x][1]);}}
},
error => {
console.log(error);
......
......@@ -156,7 +156,8 @@ export class PrefixDetailsComponent implements OnInit {
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.simpleprefix.push(data[x][1]);}
if(this.simpleprefix.indexOf(data[x][1]) == -1) {
this.simpleprefix.push(data[x][1]);}}
//this.simpleprefix = data;
},
error => {
......@@ -166,7 +167,8 @@ export class PrefixDetailsComponent implements OnInit {
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.logic_con.push(data[x][1]);}
if(this.logic_con.indexOf(data[x][1]) == -1) {
this.logic_con.push(data[x][1]);}}
},
error => {
console.log(error);
......@@ -175,7 +177,8 @@ export class PrefixDetailsComponent implements OnInit {
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.verbs.push(data[x][1]);}
if(this.verbs.indexOf(data[x][1]) == -1) {
this.verbs.push(data[x][1]);}}
},
error => {
console.log(error);
......@@ -184,7 +187,8 @@ export class PrefixDetailsComponent implements OnInit {
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.subjects.push(data[x][1]);}
if(this.subjects.indexOf(data[x][1]) == -1) {
this.subjects.push(data[x][1]);}}
},
error => {
console.log(error);
......@@ -193,7 +197,8 @@ export class PrefixDetailsComponent implements OnInit {
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.objects.push(data[x][1]);}
if(this.objects.indexOf(data[x][1]) == -1) {
this.objects.push(data[x][1]);}}
},
error => {
console.log(error);
......
......@@ -137,7 +137,8 @@ export class SuffixDetailsComponent implements OnInit {
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.suffix.push(data[x][1]);}
if(this.suffix.indexOf(data[x][1]) == -1) {
this.suffix.push(data[x][1]);}}
},
error => {
console.log(error);
......@@ -146,7 +147,8 @@ export class SuffixDetailsComponent implements OnInit {
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.mumerical_units.push(data[x][1]);}
if(this.mumerical_units.indexOf(data[x][1]) == -1) {
this.mumerical_units.push(data[x][1]);}}
},
error => {
console.log(error);
......@@ -155,7 +157,8 @@ export class SuffixDetailsComponent implements OnInit {
.subscribe(
data => {
for (let x=0; x < data.length; x++ ){
this.flow.push(data[x][1]);}
if(this.flow.indexOf(data[x][1]) == -1) {
this.flow.push(data[x][1]);}}
},
error => {
console.log(error);
......
export class Boilerplate {
id?:any;
owner?:any;
group_of_boilerplate?: any;
title?: string;
has_prefix?: boolean;
......
......@@ -88,7 +88,8 @@ STATE_VALUE_CHOICES =get_instances("SAO#StateValue")
STATEVALUES_CLASSES_COMMENTS = get_dmo_classes_and_comment("SAO#StateValue")
#
VERB_CHOICES = get_verb_instances("LO#Verb")
#VERB_CHOICES = get_verb_instances("LO#Verb")
VERB_CHOICES = get_verb_file_and_instances("LO#Verb")
#test to add M
......
......@@ -88,12 +88,12 @@ def findclassofmain(listofmain):
subsmain = main_syntax[('M'+str(i+1))]['Subject']
attrsmain = main_syntax[('M'+str(i+1))]['Attributes']
#for currentmain in range(len(listofmain)):
currentverb = listofmain['verb']
currentverb = listofmain['verb'].rsplit(' : ', 1)
currentsubject = listofmain['sys_fun_inter']
currentattr = listofmain['flow_function_interface_item_system_state_stateset']
for verbmain in verbsmain:
flag = 0
if (verbmain.upper() == currentverb.upper()):
if (verbmain.upper() == currentverb[len(currentverb)-1].upper() ):
for submain in subsmain:
flag = 0
if submain == "System":
......
......@@ -73,6 +73,25 @@ def get_verb_instances(keyword):
out_list.append(str(spl[1]))
return tuple((str(n), str(n)) for n in (out_list))
'''Get Verbs - return tuple'''
def get_verb_file_and_instances(keyword):
get_file_and_instances(keyword)
keywordspl = keyword.split("#")
in_list = []
out_list = []
with open('../../Ontologies/instances.txt') as f:
for data in f:
if (data.strip()).endswith(keyword):
spliter_1 = data.split('$')
spliter_2 = spliter_1[0].split("#")
in_list.append(spliter_2[len(spliter_2) - 1])
for extra in in_list:
per = URIRef("http://delab.csd.auth.gr/ontologies/2018/LO#" +extra)
for s, p, o in g.triples((None, RDF.type, per)):
spl = s.split("#")
out_list.append(extra + " : " + str(spl[1]))
return tuple((str(n), str(n)) for n in (out_list))
'''Get Instaces - return tuple'''
def get_instances(keyword):
......
......@@ -73,7 +73,7 @@ class MainDetailsAPIView(RetrieveUpdateDestroyAPIView):
instance = serializer.validated_data
#add data in thn Model BoilerplateData
es_instance = instance['sys_fun_inter'].rsplit(':', 1)
ev_instance =instance['verb'].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])
curmain_choices = inference.getclassofmain(instance)
......
......@@ -98,7 +98,7 @@ class BoilerplateList(ListAPIView):
def get_queryset(self):
group_gb = self.kwargs['groupboil']
title = self.kwargs['title_1']
print(title)
#print(title)
queryset_title = Boilerplate.objects.filter(title = title, group_of_boilerplate = group_gb)
return queryset_title
......@@ -118,6 +118,9 @@ class BoilerplateDetailsAPIView(RetrieveUpdateDestroyAPIView):
#print(serializer.validated_data['id'])
#if not Prefix.objects.filter(boilerplate = serializer.validated_data['id']) and (serializer.validated_data['b_prefix'] == True):
# serializer.validated_data['b_prefix'] = True
instance = serializer.validated_data
bd_title = instance['title']
BoilerplateData.objects.filter(boilerplate_data_id=self.kwargs['pk'], group_of_boilerplate_data = instance['group_of_boilerplate']).update(title_data = bd_title)
instance = serializer.save()
#write_fuseki = fuseki.FusekiActions()
......
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