Commit a17a67c6 authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

Ontology version with Automotive

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