Commit c45a0da1 authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

Fix bugs.

parent e4ff295f
......@@ -36,7 +36,7 @@
(change)="this.updateBoilerplate()" name="has_prefix">Prefix
</mat-checkbox>
</form>
<div *ngIf="this.currentboilerplate.has_prefix" style="margin-left: 50px;">
<div *ngIf="this.currentboilerplate.has_prefix" style="margin-left: 30px;">
<app-prefix-details></app-prefix-details>
</div>
</div>
......@@ -47,7 +47,7 @@
[disabled]="true">Main
</mat-checkbox>
</form>
<div *ngIf="this.currentboilerplate.has_main" style="margin-left: 50px;">
<div *ngIf="this.currentboilerplate.has_main" style="margin-left: 30px;">
<app-main-details></app-main-details>
</div>
</div>
......@@ -58,7 +58,7 @@
(change)="this.updateBoilerplate()" name="has_suffix">Suffix
</mat-checkbox>
</form>
<div *ngIf="this.currentboilerplate.has_suffix" style="margin-left: 50px;">
<div *ngIf="this.currentboilerplate.has_suffix" style="margin-left: 30px;">
<app-suffix-details></app-suffix-details>
</div>
</div>
......@@ -113,11 +113,29 @@
</mat-expansion-panel-header>
<p>Details : {{item.explanation}}</p>
</mat-expansion-panel>
</mat-accordion>
</div>
</mat-expansion-panel>
</mat-accordion>
</div>
<mat-accordion>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Find triples
</mat-panel-title>
<mat-panel-description>
<h5>You can search the information that is in the DSOs for a specifix input</h5>
</mat-panel-description>
</mat-expansion-panel-header>
<div class="list row">
<input fxFlex fxLayout fxHide.xs class="form-control" type="text" name="search" [(ngModel)]="searchTextinstances" autocomplete="off"
placeholder="Searching for properties about an Class/Instance in the DSO.">
<button fxLayout fxLayoutGap="15px" (click)="searchInstance()" class="btn btn-success">Search</button></div>
<p [innerHTML]="searchInstance_list"></p>
</mat-expansion-panel>
</mat-accordion>
</mat-tab>
</div>
<mat-tab label={{section.Name}}>
......@@ -320,6 +338,23 @@
</mat-accordion>
</div>
</div>
<mat-accordion>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Find triples
</mat-panel-title>
<mat-panel-description>
<h5>You can search the information that is in the DSOs for a specifix input</h5>
</mat-panel-description>
</mat-expansion-panel-header>
<div class="list row">
<input fxFlex fxLayout fxHide.xs class="form-control" type="text" name="search" [(ngModel)]="searchTextinstances" autocomplete="off"
placeholder="Searching for properties about an Class/Instance in the DSO.">
<button fxLayout fxLayoutGap="15px" (click)="searchInstance()" class="btn btn-success">Search</button></div>
<p [innerHTML]="searchInstance_list"></p>
</mat-expansion-panel>
</mat-accordion>
<ul>
<button mat-button [matMenuTriggerFor]="menu" [matMenuTriggerData]="{section: section.Name}" #menuTrigger>
<h4>Instances</h4>
......@@ -341,7 +376,6 @@
</li>
</div>
</ul>
</mat-tab>
</div>
</mat-tab-group>
......
......@@ -18,11 +18,11 @@
}
.first{
width: 68%;
width: 65%;
}
.second{
width: 32%;
width: 35%;
position: absolute;
top: 1%;
right: 0px;
......
......@@ -40,9 +40,11 @@ export class BoilerplateDetailsComponent implements OnInit {
message = '';
searchText = '';
searchOntology = '';
searchTextinstances = '';
addinstance = '';
mes_list = [] as any;
searchInstance_list = [] as any;
private readonly notifier: NotifierService;
......@@ -66,6 +68,21 @@ export class BoilerplateDetailsComponent implements OnInit {
this.getInfer();
}
searchInstance(): void {
this.boilerplateService.searchinstances(this.route.snapshot.params.gb, this.searchTextinstances).subscribe(
data => {
console.log(data);
},
error => {
if(error.error.detail){ this.notifier.notify("warning", (JSON.stringify(error.error.detail))); }
if(error.error.text != 'There is no Class in the Ontology'){
this.searchInstance_list = [error.error.text]
//console.log(error.error.text);
}
});
}
getInfer(): void {
this.boilerplateService.getAllInfer(this.route.snapshot.params.gb)
.subscribe(
......
......@@ -5,9 +5,8 @@
<div class="col">
<form class="form-group form-inline" ngNativeValidate>
<mat-form-field class="example-full-width">
<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" matInput [formControl]="subjectsControl" required
<mat-label *ngIf="this.subjectsControl.value !=null">Subject : {{this.subjectsControl.value.split(':')[0]}}:{{this.subjectsControl.value.split(':')[1]}}</mat-label>
<input type="text" placeholder="Pick one" aria-label="Subject" matInput [formControl]="subjectsControl" required
[matAutocomplete]="automainsub" style="width: 100%;">
<mat-autocomplete autoActiveFirstOption #automainsub="matAutocomplete" showPanel="true"
[displayWith]="displayFn">
......@@ -22,8 +21,7 @@
<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>
<mat-label *ngIf="this.stateitemControl.value !=null">State or Item : {{this.stateitemControl.value.split(':')[0]}}:{{this.stateitemControl.value.split(':')[1]}} </mat-label>
<input type="text" placeholder="Pick one" aria-label="Number" matInput [formControl]="stateitemControl"
[matAutocomplete]="autostateitem">
<mat-autocomplete autoActiveFirstOption #autostateitem="matAutocomplete" showPanel="true"
......@@ -39,8 +37,7 @@
<form class="form-group form-inline"
[ngStyle]="(statevalueControlisDivVisible) ? {'visibility': 'visible'} : {'visibility': 'hidden'}">
<mat-form-field class="example-full-width">
<mat-label *ngIf="statevalueControl.value !=null">State Value : {{statevalueControl.value.slice(0,
statevalueControl.value.indexOf(':'))}}</mat-label>
<mat-label *ngIf="statevalueControl.value !=null">State Value : {{this.statevalueControl.value.split(':')[0]}}:{{this.statevalueControl.value.split(':')[1]}}</mat-label>
<input type="text" placeholder="Pick one" aria-label="Number" matInput [formControl]="statevalueControl"
[matAutocomplete]="autostatevalue">
<mat-autocomplete autoActiveFirstOption #autostatevalue="matAutocomplete" showPanel="true"
......@@ -72,8 +69,7 @@
<form class="form-group form-inline"
[ngStyle]="(verbControlisDivVisible) ? {'visibility': 'visible'} : {'visibility': 'hidden'}">
<mat-form-field class="example-full-width">
<mat-label *ngIf="verbControl.value !=null">Verb : {{verbControl.value.slice(0, verbControl.value.indexOf(' :
'))}}</mat-label>
<mat-label *ngIf="verbControl.value !=null">Verb : {{this.verbControl.value.split(':')[0]}}</mat-label>
<input type="text" placeholder="Pick one" aria-label="Number" matInput [formControl]="verbControl" required
[matAutocomplete]="autoverb">
<mat-autocomplete autoActiveFirstOption #autoverb="matAutocomplete" showPanel="true" [displayWith]="displayFn">
......@@ -132,8 +128,7 @@
<div class="col">
<form class="form-group form-inline">
<mat-form-field class="example-full-width">
<mat-label *ngIf="fifuintsysstatsetControl.value !=null">Object : {{fifuintsysstatsetControl.value.slice(0,
fifuintsysstatsetControl.value.indexOf(':'))}}</mat-label>
<mat-label *ngIf="fifuintsysstatsetControl.value !=null">Object : {{this.fifuintsysstatsetControl.value.split(':')[0]}}:{{this.fifuintsysstatsetControl.value.split(':')[1]}}</mat-label>
<input type="text" placeholder="Pick one" aria-label="Number" matInput [formControl]="fifuintsysstatsetControl"
required [matAutocomplete]="autofifuintsysstatset">
<mat-autocomplete autoActiveFirstOption #autofifuintsysstatset="matAutocomplete" showPanel="true"
......@@ -149,8 +144,7 @@
<form class="form-group form-inline"
[ngStyle]="(stsysconsetControlisDivVisible) ? {'visibility': 'visible'} : {'visibility': 'hidden'}">
<mat-form-field class="example-full-width">
<mat-label *ngIf="stsysconsetControl.value !=null">StateSet or StateValue or System or Connection :
{{stsysconsetControl.value.slice(0, stsysconsetControl.value.indexOf(':'))}}</mat-label>
<mat-label *ngIf="stsysconsetControl.value !=null">StateSet or StateValue or System or Connection : {{this.stsysconsetControl.value.split(':')[0]}}:{{this.stsysconsetControl.value.split(':')[1]}}</mat-label>
<input placeholder="Pick one" aria-label="Number" type="text" matInput [formControl]="stsysconsetControl"
[matAutocomplete]="autostsysconset">
<mat-autocomplete autoActiveFirstOption #autostsysconset="matAutocomplete" showPanel="true"
......
......@@ -199,7 +199,7 @@ export class MainDetailsComponent implements OnInit {
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 (x[x.length - 1]);
}
return "";
}
......
......@@ -22,7 +22,7 @@
<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>
<mat-label *ngIf="subjectsControl.value !=null">Subject : {{this.subjectsControl.value.split(':')[0]}}:{{this.subjectsControl.value.split(':')[1]}}</mat-label>
<input type="text"
placeholder="Pick one"
aria-label="Number"
......@@ -45,6 +45,7 @@
<form class="form-group form-inline">
<mat-form-field class="example-full-width">
<mat-label>Verb or State</mat-label>
<mat-label *ngIf="verbsControl.value !=null">Subject : {{this.verbsControl.value.split(':')[0]}}</mat-label>
<input type="text"
placeholder="Pick one"
aria-label="Number"
......@@ -66,7 +67,7 @@
<div class="col">
<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>
<mat-label *ngIf="objectsControl.value !=null">Object : {{this.objectsControl.value.split(':')[0]}}:{{this.objectsControl.value.split(':')[1]}}</mat-label>
<input type="text"
placeholder="Pick one"
aria-label="Number"
......@@ -84,7 +85,7 @@
</form>
</div>
<div class="col">
<form class="form-group form-inline" >
<form matTooltip="Under development" matTooltipPosition="right" class="form-group form-inline" >
<fieldset disabled>
<mat-form-field class="example-full-width">
<mat-label>Logic connectivity</mat-label>
......
......@@ -88,7 +88,7 @@ export class PrefixDetailsComponent implements OnInit {
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 (x[x.length - 1]);
}
return "";
}
......
......@@ -2,8 +2,7 @@
<div class="col">
<form class="form-group form-inline" ngNativeValidate>
<mat-form-field class="example-full-width">
<mat-label *ngIf="this.suffixControl.value !=null">Suffix :{{this.suffixControl.value.slice(0,
this.suffixControl.value.indexOf(':'))}}</mat-label>
<mat-label *ngIf="this.suffixControl.value !=null">Suffix : {{this.suffixControl.value.split(':')[0]}}:{{this.suffixControl.value.split(':')[1]}}</mat-label>
<input type="text" placeholder="Pick one" aria-label="Number" matInput [formControl]="suffixControl" required
[matAutocomplete]="autosuffix">
<mat-autocomplete autoActiveFirstOption #autosuffix="matAutocomplete" showPanel="true"
......@@ -27,8 +26,7 @@
<form class="form-group form-inline">
<mat-form-field class="example-full-width">
<mat-label *ngIf="this.mumerical_unitsControl.value !=null">Numerical Value
: {{this.mumerical_unitsControl.value.slice(0,
this.mumerical_unitsControl.value.indexOf(':'))}}</mat-label>
: {{this.mumerical_unitsControl.value.split(':')[0]}}:{{this.mumerical_unitsControl.value.split(':')[1]}}</mat-label>
<input type="text" placeholder="Pick one" aria-label="Number" matInput [formControl]="mumerical_unitsControl"
[matAutocomplete]="autonumsuffix">
<mat-autocomplete autoActiveFirstOption #autonumsuffix="matAutocomplete" showPanel="true"
......@@ -44,8 +42,7 @@
<form class="form-group form-inline"
[ngStyle]=" showflow(this.suffixControl.value) ? {'visibility': 'visible'} : {'visibility': 'hidden'}">
<mat-form-field class="example-full-width">
<mat-label *ngIf="flowControl.value !=null">Flow or Function : {{flowControl.value.slice(0,
flowControl.value.indexOf(':'))}}</mat-label>
<mat-label *ngIf="flowControl.value !=null">Flow or Function : {{this.flowControl.value.split(':')[0]}}:{{this.flowControl.value.split(':')[1]}}</mat-label>
<input type="text" placeholder="Pick one" aria-label="Number" matInput [formControl]="flowControl" required
[matAutocomplete]="autoflow">
<mat-autocomplete autoActiveFirstOption #autoflow="matAutocomplete" showPanel="true" [displayWith]="displayFn">
......
......@@ -74,7 +74,7 @@ export class SuffixDetailsComponent implements OnInit {
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 (x[x.length - 1]);
}
return "";
}
......
......@@ -47,7 +47,6 @@ export class BoilerplateService {
}
get(gb: any, id: any): Observable<Boilerplate> {
console.log(id)
return this.http.get(`${baseUrlgb}${gb}${baseUrl}${id}`);
}
......@@ -67,4 +66,8 @@ export class BoilerplateService {
return this.http.get<Boilerplate[]>(`${baseUrlgb}${gb}${baseUrl}title=${title}`);
}
searchinstances(gb: any, instance: any): Observable<any> {
return this.http.get(`${baseUrlgb}${gb}`+`/search`+`/${instance}`);
}
}
......@@ -251,13 +251,17 @@ def shacl(ontotlogy_file):
target = ontotlogy_file+"infer.ttl"
open(target, 'w').close()
shutil.copyfile(file1, target)
for i in range(3):
final_result = ''
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 "+target+" | grep -v -e 'WARN OntDocumentManager' -e 'at org.' -e 'org.apache.' -e '@'",shell=True)
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())
......@@ -299,12 +303,14 @@ def shacl(ontotlogy_file):
sub=str(s3).split("#")
ver=str(p3).split("#")
obj=str(o3).split("#")
req_dict[get_title2[1]].append(sub[1]+' '+ ver[1]+' '+ obj[1])
if(len(sub)>1 and len(ver)>1 and len(obj)>1):
req_dict[get_title2[1]].append('<i>'+sub[1]+'</i> <u>'+ ver[1]+'</u> <i>'+obj[1]+'</i>')
for s3, p3, o3 in gon.triples((o1, None, None)):
sub=str(s3).split("#")
ver=str(p3).split("#")
obj=str(o3).split("#")
req_dict[get_title2[1]].append('<i>'+sub[1]+'</i> <u>'+ ver[1]+'</u> <i>'+obj[1]+'</i>')
if(len(sub)>1 and len(ver)>1 and len(obj)>1):
req_dict[get_title2[1]].append('<i>'+sub[1]+'</i> <u>'+ ver[1]+'</u> <i>'+obj[1]+'</i>')
metrics_dict[inf_metr2].append(req_dict)
#print(metrics_dict)
......
# TopBraid SHACL API
**An open source implementation of the W3C Shapes Constraint Language (SHACL) based on Apache Jena.**
Contact: Holger Knublauch (holger@topquadrant.com)
Can be used to perform SHACL constraint checking and rule inferencing in any Jena-based Java application.
This API also serves as a reference implementation of the SHACL spec.
Coverage:
* [SHACL Core and SHACL-SPARQL validation](https://www.w3.org/TR/shacl/)
* [SHACL Advanced Features (Rules etc)](https://www.w3.org/TR/shacl-af/)
Former Coverage until version 1.4.0
* [SHACL Compact Syntax](https://w3c.github.io/shacl/shacl-compact-syntax/)
Former Coverage until version 1.3.2
* [SHACL JavaScript Extensions](https://www.w3.org/TR/shacl-js/)
The TopBraid SHACL API is internally used by the European Commission's generic [SHACL-based RDF validator](https://www.itb.ec.europa.eu/shacl/any/upload) (used to validate RDF content against SHACL shapes)
and [SHACL shape validator](https://www.itb.ec.europa.eu/shacl/shacl/upload) (used to validate SHACL shapes themselves).
The same code is used in the TopBraid products (currently aligned with the TopBraid 7.1 release).
Feedback and questions should become GitHub issues or sent to TopBraid Users mailing list:
https://groups.google.com/forum/#!forum/topbraid-users
Please prefix your messages with [SHACL API]
To get started, look at the class ValidationUtil in
the package org.topbraid.shacl.validation.
There is also an [Example Test Case](../master/src/test/java/org/topbraid/shacl/ValidationExample.java)
## Application dependency
Releases are available in the central maven repository:
```
<dependency>
<groupId>org.topbraid</groupId>
<artifactId>shacl</artifactId>
<version>*VER*</version>
</dependency>
```
## Command Line Usage
Download the latest release from:
`https://repo1.maven.org/maven2/org/topbraid/shacl/`
The binary distribution is:
`https://repo1.maven.org/maven2/org/topbraid/shacl/*VER*/shacl-*VER*-bin.zip`.
Two command line utilities are included: shaclvalidate (performs constraint validation) and shaclinfer (performs SHACL rule inferencing).
To use them, set up your environment similar to https://jena.apache.org/documentation/tools/ (note that the SHACL download includes Jena).
For example, on Windows:
```
SET SHACLROOT=C:\Users\Holger\Desktop\shacl-1.4.1-bin
SET PATH=%PATH%;%SHACLROOT%\bin
```
As another example, for Linux, add to .bashrc these lines:
```
# for shacl
export SHACLROOT=/home/holger/shacl/shacl-1.4.1-bin/shacl-1.4.1/bin
export PATH=$SHACLROOT:$PATH
```
Both tools take the following parameters, for example:
`shaclvalidate.bat -datafile myfile.ttl -shapesfile myshapes.ttl`
where `-shapesfile` is optional and falls back to using the data graph as shapes graph.
Add -validateShapes in case you want to include the metashapes (from the tosh namespace in particular).
Currently only Turtle (.ttl) files are supported.
The tools print the validation report or the inferences graph to the output screen.
......@@ -47,4 +47,8 @@ urlpatterns = [
path('groupboilerplates/<int:groupboil>/dictionary/', main_req_views.DictionaryViewSet.as_view(), name='dictionary'),
path('mainsyntax/', main_req_views.MainSyntaxViewSet.as_view(), name='mainsyntax'),
#Search In Ontology
path('groupboilerplates/<int:groupboil>/search/<str:instance>/', main_req_views.SearchinOntologyAPIView.as_view(), name='setmainchoices'),
]
\ No newline at end of file
......@@ -67,7 +67,21 @@ class MainDetailsAPIView(RetrieveUpdateDestroyAPIView):
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])
stateitem_instance, statevalue_instance,quantifier_instance,numunit_instance, stsysconset_instance = [[""], [""], [""], [""], [""]]
numinstance=''
if instance['state_item_before_verb']:
stateitem_instance = instance['state_item_before_verb'].rsplit(':', 1)
if instance['statevalue_before_verb']:
statevalue_instance = instance['statevalue_before_verb'].rsplit(':', 1)
if instance['quantifier']:
quantifier_instance = instance['quantifier'].rsplit(':', 1)
if instance['mumerical_units']:
numunit_instance = instance['mumerical_units'].rsplit(':', 1)
if instance['statevalue_system_connection_stateset']:
stsysconset_instance = instance['statevalue_system_connection_stateset'].rsplit(':', 1)
if instance['numerical']:
numinstance= instance['numerical']
mn = (es_instance[len(es_instance)-1] + ' ' + stateitem_instance[len(stateitem_instance)-1] + ' ' + statevalue_instance[len(statevalue_instance)-1] + ' ' + instance['shall'] + ' ' + ev_instance[len(ev_instance)-1] + ' ' + quantifier_instance[len(quantifier_instance)-1] +' '+numinstance +' ' + numunit_instance[len(numunit_instance)-1] + ' ' + eo_instance[len(eo_instance)-1] + ' ' + stsysconset_instance[len(stsysconset_instance)-1])
boildata = BoilerplateData.objects.filter(owner_data=instance['boilerplate_of_main'].owner, boilerplate_data_id = instance['boilerplate_of_main'])
boildata.update(main_data = mn )
#get instances of the ontology that this boilerplate belongs
......@@ -126,6 +140,40 @@ class MainChoicesViewSet(ListAPIView):
queryset_cl= BoilerplateGroupClassesInstances.objects.filter(classes_instances_group_of_boilerplate = group_pk)
return queryset_cl
class SearchinOntologyAPIView(APIView):
def get(self, request, instance, groupboil, format=None):
data = BoilerplateGroupClassesInstances.objects.filter(classes_instances_group_of_boilerplate = groupboil)
g = Graph()
g.load(data.values('ontology_file')[0]['ontology_file'], format="turtle")
data = (self.getClassontology(g, instance))
return HttpResponse(data)
def getClassontology(self, g, instance):
info = []
for ns_prefix, namespace in g.namespaces():
for s, p, o in g.triples((URIRef( namespace+ instance.strip() ) ,None, None)):
info = []
for s1, p1, o1 in g.triples((URIRef( namespace+ instance.strip() ) ,None, None)):
sub=str(s1).split("#")
ver=str(p1).split("#")
obj=str(o1).split("#")
if(len(sub)>1 and len(ver)>1 and len(obj)>1):
info.append('<li> <i>'+sub[1]+'</i> <u>'+ ver[1]+'</u> <i>'+obj[1]+'</i> </li>')
for s2, p2, o2 in g.triples((None ,None, URIRef( namespace+ instance.strip()) )):
sub2=str(s2).split("#")
ver2=str(p2).split("#")
obj2=str(o2).split("#")
if(len(sub2)>1 and len(ver2)>1 and len(obj2)>1):
info.append('<li> <i>'+sub2[1]+'</i> <u>'+ ver2[1]+'</u> <i>'+obj2[1]+'</i> </li>')
if (len(info) > 0):
return info
else:
raise APIException("There is no Class in the Ontology")
class MainChoicesAPIView(APIView):
def get(self, request, groupboil, instance, comment, format=None):
data = BoilerplateGroupClassesInstances.objects.filter(classes_instances_group_of_boilerplate = groupboil)
......
......@@ -238,7 +238,6 @@ class InferDetailsAPIView(RetrieveUpdateDestroyAPIView):
queryset_infer = InferenceResults.objects.filter(infer_group_of_boilerplate = group_pk)
return queryset_infer
##############################HERE########################
#Custom actions when PUT
def perform_update(self, serializer):
instance = serializer.validated_data
......
......@@ -59,8 +59,15 @@ class SuffixDetailsAPIView(RetrieveUpdateDestroyAPIView):
def perform_update(self, serializer):
instance = serializer.validated_data
#add data in thn Model BoilerplateData
eo_instance = instance['flow'].rsplit(':', 1)
sf = (instance['s_choices'] + ' ' + str(instance['numerical']) + ' ' + instance['mumerical_units'] + ' ' + eo_instance[len(eo_instance)-1])
flow_instance, num_instance, mumerical_units_instance = [[""], [""], [""]]
eV_instance = instance['s_choices'].rsplit(':', 1)
if instance['flow']:
flow_instance = instance['flow'].rsplit(':', 1)
if instance['numerical']:
num_instance = instance['numerical'].rsplit(':', 1)
if instance['mumerical_units']:
mumerical_units_instance = instance['mumerical_units'].rsplit(':', 1)
sf = (eV_instance[len(eV_instance)-1] + ' ' + num_instance[len(num_instance)-1] + ' ' + mumerical_units_instance[len(mumerical_units_instance)-1] + ' ' + flow_instance[len(flow_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