Commit a17a67c6 authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

Ontology version with Automotive

parent e6c217cf
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -68,7 +68,7 @@ export class AddBoilerplateComponent implements OnInit {
prefixs = [
{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: 'P3', details: "As long as <occuring functionality>", explanation: 'Expresses a temporal condition concerned with a period. The pre x 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 = [
......
......@@ -4,19 +4,14 @@
<li class="breadcrumb-item" aria-current="page">Add Project</li>
</ol>
</nav>
<div>
<div class="submit-form">
<div class="submit-form">
<form name="myForm" ngNativeValidate>
<div class="form-group">
<label for="title">Requirement Title</label>
<input
type="text"
class="form-control"
id="title_bgroup"
<label for="title_bgroup">Requirement Title</label>
<input type="text" class="form-control" id="title_bgroup"
required
[(ngModel)]="groupboilerplate.title_bgroup"
name="title_bgroup"
/>
[(ngModel)]="groupboilerplate.title_bgroup" name="title_bgroup">
</div>
<div class="form-group">
<label for="description">Description of project</label>
......@@ -29,6 +24,7 @@
name="description"
></textarea>
</div>
</form>
<button (click)="saveBoilerplate()" class="btn btn-success" >Submit</button>
......
......@@ -23,7 +23,7 @@
[(ngModel)]="currentboilerplate.title"
style="width: 63%;"/>
</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 ">
<mat-checkbox class="example-full-width"
[(ngModel)]="currentboilerplate.has_prefix"
......@@ -113,12 +113,12 @@
<div *ngFor="let instan of item.Instance_of_Class| filter:searchText">
<li>
<mat-expansion-panel hideToggle>
<p>Description.</p>
<mat-expansion-panel-header>
<mat-panel-title>
{{instan.Instance}}
</mat-panel-title>
</mat-expansion-panel-header>
<p>{{instan.Comment}}</p>
</mat-expansion-panel>
</li>
</div>
......@@ -139,9 +139,10 @@
<mat-expansion-panel hideToggle>
<mat-expansion-panel-header>
<mat-panel-title>
{{ instansub.instance}}
{{ instansub.Instance}}
</mat-panel-title>
</mat-expansion-panel-header>
<p>{{instansub.Comment}}</p>
</mat-expansion-panel>
</li>
......@@ -159,12 +160,12 @@
<div *ngFor="let genin of section.GeneralInstances| filter:searchText">
<li>
<mat-expansion-panel hideToggle>
<p>Description.</p>
<mat-expansion-panel-header>
<mat-panel-title>
{{genin.GeneralInstances}}
</mat-panel-title>
</mat-expansion-panel-header>
{{genin.Comment}}
</mat-expansion-panel>
</li>
</div>
......
<div class="form-row">
<div fxLayoutAlign="end"> <mat-chip color="primary"> MAIN TEMPLATE : {{this.main}}</mat-chip> </div>
<div class="form-row">
<div class="col">
<form class="form-group form-inline" ngNativeValidate>
<mat-form-field class="example-full-width">
......@@ -20,7 +21,7 @@
</form>
</div>
<div class="col">
<form class="form-group form-inline" [ngStyle]="(stateitemControlisDivVisible) ? {'visibility': 'visible'} : {'visibility': 'hidden'}">
<form class="form-group form-inline" [ngStyle]="(stateitemControlisDivVisible) ? {'visibility': 'visible'} : {'visibility': 'hidden'}">
<mat-form-field class="example-full-width">
<mat-label *ngIf="this.stateitemControl.value !=null">State or Item : {{this.stateitemControl.value.slice(0, this.stateitemControl.value.indexOf(':'))}}</mat-label>
<input type="text"
......@@ -124,7 +125,7 @@
<form class="form-group form-inline" [ngStyle]="(numericalisDivVisible) ? {'visibility': 'visible'} : {'visibility': 'hidden'}">
<mat-form-field class="example-full-width">
<mat-label>Numerical Value</mat-label>
<input type="number" matInput value=0 [(ngModel)]="currentmain.numerical" name="numerical">
<input type="text" matInput [(ngModel)]="currentmain.numerical" name="numerical">
</mat-form-field>
</form>
</div>
......
......@@ -86,6 +86,7 @@ export class MainDetailsComponent implements OnInit {
statevalue_system_connection_stateset: "",
};
message = '';
main = '';
constructor(
private mainService: MainService,
......@@ -173,8 +174,9 @@ export class MainDetailsComponent implements OnInit {
if (this.mainsyntax[x].Attributes.length > 1){
this.stsysconsetControlisDivVisible = true;
//add the connection data
return 1;
}
this.main = this.mainsyntax[x].Id
return 1;
}
}
}
......@@ -192,6 +194,7 @@ export class MainDetailsComponent implements OnInit {
this.numericalisDivVisible = false;
// Extra Attribute
this.stsysconsetControlisDivVisible = false;
this.main = "No boilerplate with this syntax"
}
}
......
......@@ -19,16 +19,16 @@
</mat-form-field>
</form>
</div>
<div class="col">
<form class="example-form form-inline">
<mat-form-field>
<div class="col" style="width: 300px;">
<form class="form-group form-inline">
<mat-form-field class="example-full-width">
<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"
matInput
required
[formControl]="subjectsControl"
required
[matAutocomplete]="autosub"
>
<mat-autocomplete autoActiveFirstOption #autosub="matAutocomplete" showPanel="true" [displayWith]="displayFn">
......@@ -42,8 +42,8 @@
</div>
<div class="form-row">
<div class="col">
<form class="example-form form-inline">
<mat-form-field>
<form class="form-group form-inline">
<mat-form-field class="example-full-width">
<mat-label>Verb or State</mat-label>
<input type="text"
placeholder="Pick one"
......@@ -64,8 +64,8 @@
</div>
<div class="form-row">
<div class="col">
<form class="example-form form-inline">
<mat-form-field>
<form class="form-group form-inline">
<mat-form-field class="example-full-width">
<mat-label *ngIf="objectsControl.value !=null">Object : {{objectsControl.value.slice(0, objectsControl.value.indexOf(':'))}}</mat-label>
<input type="text"
placeholder="Pick one"
......@@ -84,9 +84,9 @@
</form>
</div>
<div class="col">
<form class="example-form form-inline" >
<form class="form-group form-inline" >
<fieldset disabled>
<mat-form-field>
<mat-form-field class="example-full-width">
<mat-label>Logic connectivity</mat-label>
<input type="text"
placeholder="Pick one"
......
.example-form {
min-width: 150px;
max-width: 500px;
width: auto;
}
.example-full-width {
width: 100%;
}
.mat-autocomplete {
width: 100%;
}
\ No newline at end of file
......@@ -23,7 +23,7 @@
<form class="form-group form-inline">
<mat-form-field class="example-full-width">
<mat-label>Numerical Value</mat-label>
<input type="number" matInput value=0 [(ngModel)]="currentsuffix.numerical" name="numerical">
<input type="text" matInput [(ngModel)]="currentsuffix.numerical" name="numerical">
</mat-form-field>
</form>
</div>
......@@ -36,7 +36,6 @@
aria-label="Number"
matInput
[formControl]="mumerical_unitsControl"
required
[matAutocomplete]="automumerical_units"
>
<mat-autocomplete autoActiveFirstOption #automumerical_units="matAutocomplete">
......
......@@ -10,7 +10,7 @@ from reqman.apps.reqtool.rest_api.services.parse_ontologies import *
find_subclass_domain_range()
#MAIN SYNTAX
MAIN_SYNTAX = get_main_sytax()
#import pprint
import pprint
#pprint.pprint(get_main_sytax())
MAIN_CHOICES = ( ("",""), ("M1", "M1"),
......@@ -124,7 +124,7 @@ class Main(models.Model):
verb = models.CharField(choices=VERB_CHOICES, max_length=100)
#Between Verb - Object
quantifier = models.CharField(choices=QUANTIFIER_CHOICES, max_length=100, blank=True)
numerical = models.IntegerField(blank=True, null=True)
numerical = models.CharField(blank=True, null=True, max_length=10)
mumerical_units = models.CharField(choices=NUMBER_UNITS_CHOICES, max_length=100, blank=True)
#Οbject
flow_function_interface_item_system_state_stateset = models.CharField(choices=FLOW_CHOICES + FUNCTION_CHOICES + INTERFACE_CHOICES + ITEM_CHOICES + SYSTEM_CHOICES +STATE_CHOICES + STATE_SET_CHOICES, max_length=100)
......
......@@ -29,10 +29,10 @@ LOGICAL_EXPRESSION = ( ("",""),
VERB_CHOICES = get_verb_instances("LO#Verb")
PREFIX_CHOICES = ( ("If/Unless", "If/Unless"),
#Must read this info from the Ontology
PREFIX_CHOICES = ( ("If", "If"), ("Unless", "Unless"),
("As soon as", "As soon as"),
("As long as", "As long as")
("As long as", "As long as"), ("Once", "Once")
)
......@@ -72,7 +72,7 @@ def create_infer_result(instance):
class BoilerplateGroup(models.Model):
boilerplate_owner = models.ForeignKey(User, related_name='boilerplate_group_owner', on_delete=models.CASCADE)
title_bgroup = models.CharField(max_length=30, unique=True)
title_bgroup = models.CharField(max_length=100, unique=True)
description = models.CharField(max_length=500)
def save(self, **kwargs):
......
......@@ -19,11 +19,11 @@ SUFFIX_CHOICES = (("",""), ('S1', 'S1: <numerical-affirmative> j <closed-interva
NUMERICAL_AFFIRMATIVE_CHOICES = (("MORE THAN", "MORE THAN"), ("LESS THAN", "LESS THAN"), ("EXACTLY","EXACTLY"),
("AT LEAST", "AT LEAST"), ("AT MOST", "AT MOST"))
NUMBER_UNITS_CHOICES = (("",""), ("METERS","METERS"), ("KILOMETERS","KILOMETERS"), ("VOLT","VOLT"))
TIME_UNITS_CHOICES = (("SECONDS","SECONDS"), ("MINUTES","MINUTES"), ("MILLISECONDS","MILLISECONDS"))
TIME_UNITS_CHOICES = (("SECONDS","SECONDS"), ("MINUTES","MINUTES"), ("MILLISECONDS","MILLISECONDS"), ("CYCLES","CYCLES"))
FLOW_CHOICES = get_instances("SAO#Flow")
# FLOW returns ()
S2_CHOICES = (("BEFORE","BEFORE"), ("AFTER","AFTER"))
S3_CHOICES = (("EVERY","EVERY"), ("FOR A PERIOD OF","FOR A PERIOD OF"), ("WITHIN", "WITHIN"), ("for at least", "FOR AT LEAST"))
S3_CHOICES = (("EVERY","EVERY"), ("FOR A PERIOD OF","FOR A PERIOD OF"), ("WITHIN", "WITHIN"), ("FOR AT LEAST", "FOR AT LEAST"))
S4_CHOICES = (("AT THE BEGINNING","AT THE BEGINNING"), ("AT THE END","AT THE END"))
S5_6_CHOICES = (("AT EVEN INTERVALS","AT EVEN INTERVALS"), ("SEQUENTIALLY","SEQUENTIALLY"))
......@@ -51,7 +51,7 @@ class Suffix(models.Model):
#prefix templates
s_choices = models.CharField(choices=S_CHOICES, max_length=100, blank=True)
#if S1
numerical = models.IntegerField(blank=True, null=True)
numerical = models.CharField(blank=True, null=True, max_length=10)
mumerical_units = models.CharField(choices=NUMBER_UNITS_CHOICES + TIME_UNITS_CHOICES, max_length=100, blank=True)
#time_units = models.CharField(choices=TIME_UNITS_CHOICES, max_length=100, blank=True)
#if S2/S3
......
......@@ -4,7 +4,8 @@ from rdflib import ConjunctiveGraph, URIRef, RDFS, RDF, Namespace
from reqman.apps.reqtool.rest_api.services.parse_ontologies import *
from reqman.apps.reqtool.models.main_req import SYSTEM_CHOICES, FUNCTION_CHOICES, INTERFACE_CHOICES, FLOW_CHOICES, ITEM_CHOICES, STATE_CHOICES, STATE_SET_CHOICES
Ontology_file = "../../Ontologies/Mokos_18_1_7_47.ttl"
#HERE
Ontology_file = "../../Ontologies/Autonomy_v1.ttl"
main_syntax = get_main_sytax_inference()
......
......@@ -6,11 +6,15 @@ from rdflib import ConjunctiveGraph, URIRef, RDFS, RDF, Namespace
#call("./../../Ontologies/s-get http://155.207.131.19:3030/Mokos_18_1_7_47/data default >> ../../Ontologies/data.ttl", shell=True)
Ontology_file = "../../Ontologies/Mokos_18_1_7_47.ttl"
#Ontology_file = "../../Ontologies/Mokos_18_1_7_47.ttl"
Ontology_file = "../../Ontologies/Autonomy_v1.ttl"
subClass_instances = "../../Ontologies/instances_subclass.txt"
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#"]
list_of_RMO = ["RMO", "RMO-instances", "DSO-AOCS-instances", "<http://delab.csd.auth.gr/ontologies/2018/RDO-instances"]
#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_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"]
DSO = ["http://delab.csd.auth.gr/ontologies/2018/DSO#"]
Dictionary_Data = {}
......@@ -62,7 +66,12 @@ def get_verb_instances(keyword):
spliter_1 = data.split('$')
spliter_2 = spliter_1[0].split("#")
in_list.append(spliter_2[len(spliter_2) - 1])
return tuple((str(n), str(n)) for n in (in_list))
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(str(spl[1]))
return tuple((str(n), str(n)) for n in (out_list))
'''Get Instaces - return tuple'''
......@@ -77,6 +86,12 @@ def get_instances(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:
for uri in list_of_DSO:
per = URIRef(uri +extra)
for s, p, o in g.triples((None, RDFS.subClassOf, per)): #subClassOf
spl = s.split("#")
in_list.append(spl[len(spl) - 1])
for extra in in_list:
for uri in list_of_DSO:
p = URIRef(uri +extra)
......@@ -178,7 +193,12 @@ def get_dmo_classes_and_comment(keyword):
for s, p, o in g.triples((None, RDF.type, per)):
spl = s.split("#")
uri = spl[len(spl) - 2].split("/")
dmo_dic_in = {'GeneralInstances': spl[len(spl) - 1]}
find_comment_gen_instance = ""
for urired2 in list_of_DSO:
pop = URIRef(urired2 + spl[len(spl) - 1])
for q1, w1, m1 in g.triples((pop, RDFS.comment, None)):
find_comment_gen_instance = (str(m1).replace("\r","")).replace("\n","")
dmo_dic_in = {'GeneralInstances': spl[len(spl) - 1], "Comment": find_comment_gen_instance}
dic_list_in.append(dmo_dic_in)
for comment in out_list_instance:
instance_list = []
......@@ -187,7 +207,12 @@ def get_dmo_classes_and_comment(keyword):
per = URIRef(uri +comment)
for s2, p2, o2 in g.triples((None, RDF.type, per)):
spl = s2.split("#")
instance_dict = {"Instance": spl[len(spl) - 1]}
find_comment_main_instance = ""
for urired2 in list_of_DSO:
pop = URIRef(urired2 + spl[len(spl) - 1])
for q1, w1, m1 in g.triples((pop, RDFS.comment, None)):
find_comment_main_instance = (str(m1).replace("\r","")).replace("\n","")
instance_dict = {"Instance": spl[len(spl) - 1], "Comment": find_comment_main_instance}
instance_list.append(instance_dict)
name_class = ""
comment_class = ""
......@@ -200,7 +225,6 @@ def get_dmo_classes_and_comment(keyword):
comment_class = (str(o).replace("\r","")).replace("\n","")
suclass_dict = {}
subclass_list = []
sub_ins = []
sub_ins_dict = {}
for uri in list_of_DSO:
subclas_name = ""
......@@ -211,13 +235,20 @@ def get_dmo_classes_and_comment(keyword):
subclas_name = spl1[len(spl1) - 1]
kop = URIRef(uri + spl1[len(spl1) - 1])
find_comment = ""
find_comment_instance = ""
for q, w, m in g.triples((kop, RDFS.comment, None)):
find_comment = (str(m).replace("\r","")).replace("\n","")
per3 = uri + spl1[len(spl1) - 1]
for s2, p2, o2 in g.triples((None, RDF.type, per3)):
spl2 = s2.split("#")
sub_ins_dict = {"Instance": spl2[len(spl2) - 1]}
sub_ins.append(sub_ins_dict)
sub_ins = []
for urired in list_of_DSO:
per3 = URIRef(urired + spl1[len(spl1) - 1])
for s2, p2, o2 in g.triples((None, RDF.type, per3)):
spl2 = s2.split("#")
for urired2 in list_of_DSO:
kop2 = URIRef(urired2 + spl2[len(spl2) - 1])
for q1, w1, m1 in g.triples((kop2, RDFS.comment, None)):
find_comment_instance = (str(m1).replace("\r","")).replace("\n","")
sub_ins_dict = {"Instance": spl2[len(spl2) - 1], "Comment": find_comment_instance}
sub_ins.append(sub_ins_dict)
suclass_dict = {'SubClass_name': subclas_name, 'SubclassComment':find_comment, 'InstanceOfSubclass': sub_ins}
subclass_list.append(suclass_dict)
dmo_dic = {"Class": name_class, "Comment":comment_class, 'Subclass': subclass_list, 'Instance_of_Class':instance_list}
......@@ -329,13 +360,19 @@ def get_related_to_subject(bnodes_uriref):
'''Find Boilerplate Verb - return list'''
def get_verb(bnodes_uriref):
verb_list = []
out_list =[]
bnodes_uriref = [str(i) for i in bnodes_uriref]
for rel_to_sub in bnodes_uriref:
if "LO" in rel_to_sub:
tmp = rel_to_sub.split("#")
if tmp[1] != '':
verb_list.append(tmp[1])
return(verb_list)
for extra in verb_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(str(spl[1]))
return(out_list)
'''Check if Boilerplate has quantifier - return list'''
......@@ -378,8 +415,9 @@ def get_attribute(bnodes_uriref, subjects, related_subjects, verbs):
if not "isRelatedTo" in i:
if not "isRelatedto" in i:
tmp = i.split("#")
if tmp[1] != '':
tmp_list.append(tmp[1])
if(len(tmp) > 1):
if tmp[1] != '':
tmp_list.append(tmp[1])
tmp_list = list(filter(("nil").__ne__, tmp_list))
tmp_list = list(filter(("Restriction").__ne__, tmp_list))
......@@ -519,8 +557,8 @@ def get_prefix_syntax():
if tmp_list2:
ver = get_verb(tmp_list2)
prefix_dict[prefix]["Verbs"].append(ver)
for i in ver:
sub.remove(i)
#for i in ver:
# sub.remove(i)
prefix_dict[prefix]["Suject"] = sub
return prefix_dict
......
......@@ -83,6 +83,7 @@ class MainDetailsAPIView(RetrieveUpdateDestroyAPIView):
else:
BoilerplateData.objects.filter(owner_data=instance['boilerplate_of_main'].owner, boilerplate_data_id = instance['boilerplate_of_main']).update(main_data = mn )
instance = serializer.save(main_choices = curmain_choices[0])
#instance = serializer.save()
......
......@@ -158,19 +158,23 @@ class PrefixDetailsAPIView(RetrieveUpdateDestroyAPIView):
return queryset_prefix
def simple_prefix(self, prefix):
if prefix == "If/Unless":
if prefix == "If":
return "P1"
if prefix == "As soon as":
return "P2"
if prefix == "As long as":
return "P3"
if prefix == "Once":
return "P1"
if prefix == "Unless":
return "P1"
#Custom actions when PUT
def perform_update(self, serializer):
instance = serializer.validated_data
#add data in thn Model BoilerplateData
print(instance)
#print(instance)
es_instance = instance['system_fun_item'].rsplit(':', 1)
ev_instance =instance['state_or_verb'].rsplit(':', 1)
ei_instance = instance['item_function_flow_statevalue'].rsplit(':', 1)
......
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