Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
Requirement Formalization Tool
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thodoris Nestoridis
Requirement Formalization Tool
Commits
a80c458d
Commit
a80c458d
authored
Feb 13, 2022
by
Thodoris Nestoridis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
5 step instances level, details about inference results
parent
e52b17aa
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
1024 additions
and
442 deletions
+1024
-442
boilerplate-details.component.html
...ts/boilerplate-details/boilerplate-details.component.html
+150
-45
boilerplate-details.component.ts
...ents/boilerplate-details/boilerplate-details.component.ts
+167
-36
boilerplate-list.component.html
...mponents/boilerplate-list/boilerplate-list.component.html
+2
-2
boilerplate-list.component.ts
...components/boilerplate-list/boilerplate-list.component.ts
+10
-8
main-details.component.html
...c/app/components/main-details/main-details.component.html
+7
-5
suffix-details.component.html
...p/components/suffix-details/suffix-details.component.html
+57
-67
suffix-details.component.ts
...app/components/suffix-details/suffix-details.component.ts
+55
-27
boilerplate.model.ts
reqtool/ReqmanAngular11/src/app/models/boilerplate.model.ts
+21
-0
suffix.service.ts
reqtool/ReqmanAngular11/src/app/services/suffix.service.ts
+5
-0
main_req.py
reqtool/reqman/api/reqman/apps/reqtool/models/main_req.py
+11
-6
requirements.py
...ool/reqman/api/reqman/apps/reqtool/models/requirements.py
+16
-9
suffix_req.py
reqtool/reqman/api/reqman/apps/reqtool/models/suffix_req.py
+20
-7
inference.py
...an/api/reqman/apps/reqtool/rest_api/services/inference.py
+140
-51
parse_ontologies.py
...reqman/apps/reqtool/rest_api/services/parse_ontologies.py
+293
-123
urls.py
reqtool/reqman/api/reqman/apps/reqtool/rest_api/urls.py
+3
-3
main_req_views.py
.../api/reqman/apps/reqtool/rest_api/views/main_req_views.py
+64
-14
suffix_req_views.py
...pi/reqman/apps/reqtool/rest_api/views/suffix_req_views.py
+3
-39
No files found.
reqtool/ReqmanAngular11/src/app/components/boilerplate-details/boilerplate-details.component.html
View file @
a80c458d
This diff is collapsed.
Click to expand it.
reqtool/ReqmanAngular11/src/app/components/boilerplate-details/boilerplate-details.component.ts
View file @
a80c458d
This diff is collapsed.
Click to expand it.
reqtool/ReqmanAngular11/src/app/components/boilerplate-list/boilerplate-list.component.html
View file @
a80c458d
...
@@ -46,8 +46,8 @@
...
@@ -46,8 +46,8 @@
<!-- Name Column -->
<!-- Name Column -->
<ng-container
matColumnDef=
"title_data"
>
<ng-container
matColumnDef=
"title_data"
>
<th
mat-header-cell
*
matHeaderCellDef
>
Title
</th>
<th
mat-header-cell
*
matHeaderCellDef
>
Title
</th>
<td
mat-cell
*
matCellDef=
"let element"
matTooltip=
{{get_metrics(element.title_data)}}
>
{{element.title_data}}
<span
<td
mat-cell
*
matCellDef=
"let element"
matTooltip=
{{get_metrics(element.title_data)}}
>
{{element.title_data}}
*
ngIf=
"get_metrics(element.title_data).length > 0"
matBadge=
{{get_metrics(element.title_data).length}}
<span
*
ngIf=
"get_metrics(element.title_data).length > 0"
matBadge=
{{get_metrics(element.title_data).length}}
matBadgeColor=
"warn"
matBadgeSize=
"small"
position=
"above"
>
</span>
matBadgeColor=
"warn"
matBadgeSize=
"small"
position=
"above"
>
</span>
</td>
</td>
</ng-container>
</ng-container>
...
...
reqtool/ReqmanAngular11/src/app/components/boilerplate-list/boilerplate-list.component.ts
View file @
a80c458d
...
@@ -156,19 +156,21 @@ export class BoilerplateListComponent implements OnInit {
...
@@ -156,19 +156,21 @@ export class BoilerplateListComponent implements OnInit {
this
.
boilerplateService
.
getAllInfer
(
this
.
route
.
snapshot
.
params
.
gb
)
this
.
boilerplateService
.
getAllInfer
(
this
.
route
.
snapshot
.
params
.
gb
)
.
subscribe
(
.
subscribe
(
data
=>
{
data
=>
{
console
.
log
(
data
);
this
.
currentInfer
=
data
[
0
];
this
.
currentInfer
=
data
[
0
];
this
.
infer
=
data
;
this
.
infer
=
data
;
const
obj
=
JSON
.
parse
(
this
.
currentInfer
[
'inference_data'
].
replace
(
/'/g
,
"
\"
"
))
if
(
data
[
0
])
{
var
final
=
[]
const
obj
=
JSON
.
parse
(
this
.
currentInfer
[
'inference_data'
].
replace
(
/'/g
,
"
\"
"
))
for
(
let
i
of
this
.
list_of_inference_metrics
)
{
var
final
=
[]
if
(
obj
[
i
]
!=
undefined
)
{
for
(
let
i
of
this
.
list_of_inference_metrics
)
{
if
(
obj
[
i
]
!=
undefined
)
{
final
.
push
({
value
:
obj
[
i
].
length
,
name
:
i
})
final
.
push
({
value
:
obj
[
i
].
length
,
name
:
i
})
}
}
}
}
}
console
.
log
(
final
);
//console.log(final);
this
.
chartOption
.
series
=
[{
this
.
chartOption
.
series
=
[{
type
:
'pie'
,
type
:
'pie'
,
radius
:
[
'40%'
,
'70%'
],
radius
:
[
'40%'
,
'70%'
],
...
...
reqtool/ReqmanAngular11/src/app/components/main-details/main-details.component.html
View file @
a80c458d
<div
fxLayoutAlign=
"end"
>
<div
fxLayoutAlign=
"end"
>
<
mat-chip
color=
"primary"
>
MAIN TEMPLATE : {{this.main}}
</mat-chip
>
<
h2><span
class=
"badge badge-secondary"
>
MAIN TEMPLATE : {{this.main}}
</span></h2
>
</div>
</div>
<div
class=
"form-row"
>
<div
class=
"form-row"
>
<div
class=
"col"
>
<div
class=
"col"
>
...
@@ -91,9 +91,10 @@
...
@@ -91,9 +91,10 @@
<mat-label>
Quantifier
</mat-label>
<mat-label>
Quantifier
</mat-label>
<input
placeholder=
"Pick one"
aria-label=
"Number"
matInput
[
formControl
]="
quantifierControl
"
type=
"text"
<input
placeholder=
"Pick one"
aria-label=
"Number"
matInput
[
formControl
]="
quantifierControl
"
type=
"text"
[
matAutocomplete
]="
autoquantifier
"
>
[
matAutocomplete
]="
autoquantifier
"
>
<mat-autocomplete
autoActiveFirstOption
#
autoquantifier=
"matAutocomplete"
>
<mat-autocomplete
autoActiveFirstOption
#
autoquantifier=
"matAutocomplete"
showPanel=
"true"
[
displayWith
]="
displayFn
"
>
<mat-option
*
ngFor=
"let option of quantifierfilteredOptions | async"
[
value
]="
option
"
>
<mat-option
*
ngFor=
"let option of quantifierfilteredOptions | async"
[
value
]="
option
"
>
{{option}}
{{option
.split(" : ").pop()
}}
</mat-option>
</mat-option>
</mat-autocomplete>
</mat-autocomplete>
</mat-form-field>
</mat-form-field>
...
@@ -116,9 +117,10 @@
...
@@ -116,9 +117,10 @@
<mat-label>
Number Unit
</mat-label>
<mat-label>
Number Unit
</mat-label>
<input
type=
"text"
placeholder=
"Pick one"
aria-label=
"Number"
matInput
[
formControl
]="
numunitControl
"
<input
type=
"text"
placeholder=
"Pick one"
aria-label=
"Number"
matInput
[
formControl
]="
numunitControl
"
[
matAutocomplete
]="
autonumunit
"
>
[
matAutocomplete
]="
autonumunit
"
>
<mat-autocomplete
autoActiveFirstOption
#
autonumunit=
"matAutocomplete"
>
<mat-autocomplete
autoActiveFirstOption
#
autonumunit=
"matAutocomplete"
showPanel=
"true"
[
displayWith
]="
displayFn
"
>
<mat-option
*
ngFor=
"let option of numunitfilteredOptions | async"
[
value
]="
option
"
>
<mat-option
*
ngFor=
"let option of numunitfilteredOptions | async"
[
value
]="
option
"
>
{{option}}
{{option
.split(" : ").pop()
}}
</mat-option>
</mat-option>
</mat-autocomplete>
</mat-autocomplete>
</mat-form-field>
</mat-form-field>
...
...
reqtool/ReqmanAngular11/src/app/components/suffix-details/suffix-details.component.html
View file @
a80c458d
<div
class=
"form-row"
>
<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"
>
<mat-label>
Suffix
</mat-label>
<mat-label
*
ngIf=
"this.suffixControl.value !=null"
>
Suffix :{{this.suffixControl.value.slice(0,
<input
type=
"text"
this.suffixControl.value.indexOf(':'))}}
</mat-label>
placeholder=
"Pick one"
<input
type=
"text"
placeholder=
"Pick one"
aria-label=
"Number"
matInput
[
formControl
]="
suffixControl
"
required
aria-label=
"Number"
[
matAutocomplete
]="
autosuffix
"
>
matInput
<mat-autocomplete
autoActiveFirstOption
#
autosuffix=
"matAutocomplete"
showPanel=
"true"
[
formControl
]="
suffixControl
"
[
displayWith
]="
displayFn
"
>
required
<mat-option
*
ngFor=
"let option of suffixfilteredOptions | async"
[
value
]="
option
"
>
[
matAutocomplete
]="
autosuffix
"
{{option.split(" : ").pop()}}
>
</mat-option>
<mat-autocomplete
autoActiveFirstOption
#
autosuffix=
"matAutocomplete"
>
</mat-autocomplete>
<mat-option
*
ngFor=
"let option of suffixfilteredOptions | async"
[
value
]="
option
"
>
</mat-form-field>
{{option}}
</form>
</mat-option>
</div>
</mat-autocomplete>
<div
class=
"col"
>
</mat-form-field>
<form
class=
"form-group form-inline"
>
</form>
<mat-form-field
class=
"example-full-width"
>
</div>
<mat-label>
Numerical Value
</mat-label>
<div
class=
"col"
>
<input
type=
"text"
matInput
[(
ngModel
)]="
currentsuffix
.
numerical
"
name=
"numerical"
>
<form
class=
"form-group form-inline"
>
</mat-form-field>
<mat-form-field
class=
"example-full-width"
>
</form>
<mat-label>
Numerical Value
</mat-label>
</div>
<input
type=
"text"
matInput
[(
ngModel
)]="
currentsuffix
.
numerical
"
name=
"numerical"
>
<div
class=
"col"
>
</mat-form-field>
<form
class=
"form-group form-inline"
>
</form>
<mat-form-field
class=
"example-full-width"
>
</div>
<mat-label
*
ngIf=
"this.mumerical_unitsControl.value !=null"
>
Numerical Value
<div
class=
"col"
>
: {{this.mumerical_unitsControl.value.slice(0,
<form
class=
"form-group form-inline"
>
this.mumerical_unitsControl.value.indexOf(':'))}}
</mat-label>
<mat-form-field
class=
"example-full-width"
>
<input
type=
"text"
placeholder=
"Pick one"
aria-label=
"Number"
matInput
[
formControl
]="
mumerical_unitsControl
"
<mat-label>
Unit
</mat-label>
[
matAutocomplete
]="
autonumsuffix
"
>
<input
type=
"text"
<mat-autocomplete
autoActiveFirstOption
#
autonumsuffix=
"matAutocomplete"
showPanel=
"true"
placeholder=
"Pick one"
[
displayWith
]="
displayFn
"
>
aria-label=
"Number"
<mat-option
*
ngFor=
"let option of mumerical_unitsfilteredOptions | async"
[
value
]="
option
"
>
matInput
{{option.split(" : ").pop()}}
[
formControl
]="
mumerical_unitsControl
"
</mat-option>
[
matAutocomplete
]="
automumerical_units
"
</mat-autocomplete>
>
</mat-form-field>
<mat-autocomplete
autoActiveFirstOption
#
automumerical_units=
"matAutocomplete"
>
</form>
<mat-option
*
ngFor=
"let option of mumerical_unitsfilteredOptions | async"
[
value
]="
option
"
>
</div>
{{option}}
<div
class=
"col"
*
ngIf=
"this.mumerical_unitsControl.value !=null"
>
</mat-option>
<form
class=
"form-group form-inline"
</mat-autocomplete>
[
ngStyle
]="
showflow
(
this
.
suffixControl
.
value
)
?
{'
visibility
'
:
'
visible
'}
:
{'
visibility
'
:
'
hidden
'}"
>
</mat-form-field>
<mat-form-field
class=
"example-full-width"
>
</form>
<mat-label
*
ngIf=
"flowControl.value !=null"
>
Flow or Function : {{flowControl.value.slice(0,
</div>
flowControl.value.indexOf(':'))}}
</mat-label>
<div
class=
"col"
>
<input
type=
"text"
placeholder=
"Pick one"
aria-label=
"Number"
matInput
[
formControl
]="
flowControl
"
required
<form
class=
"form-group form-inline"
>
[
matAutocomplete
]="
autoflow
"
>
<mat-form-field
class=
"example-full-width"
>
<mat-autocomplete
autoActiveFirstOption
#
autoflow=
"matAutocomplete"
showPanel=
"true"
[
displayWith
]="
displayFn
"
>
<mat-label
*
ngIf=
"flowControl.value !=null"
>
Flow : {{flowControl.value.slice(0, flowControl.value.indexOf(':'))}}
</mat-label>
<mat-option
*
ngFor=
"let option of flowfilteredOptions | async"
[
value
]="
option
"
>
<mat-label>
Flow
</mat-label>
{{option.split(" : ").pop()}}
<input
type=
"text"
</mat-option>
placeholder=
"Pick one"
</mat-autocomplete>
aria-label=
"Number"
</mat-form-field>
matInput
</form>
[
formControl
]="
flowControl
"
</div>
[
matAutocomplete
]="
autoflow
"
>
<mat-autocomplete
autoActiveFirstOption
#
autoflow=
"matAutocomplete"
showPanel=
"true"
[
displayWith
]="
displayFn
"
>
<mat-option
*
ngFor=
"let option of flowfilteredOptions | async"
[
value
]="
option
"
>
{{option.split(" : ").pop()}}
</mat-option>
</mat-autocomplete>
</mat-form-field>
</form>
</div>
</div>
</div>
\ No newline at end of file
reqtool/ReqmanAngular11/src/app/components/suffix-details/suffix-details.component.ts
View file @
a80c458d
...
@@ -26,6 +26,7 @@ export class SuffixDetailsComponent implements OnInit {
...
@@ -26,6 +26,7 @@ export class SuffixDetailsComponent implements OnInit {
flowControl
=
new
FormControl
();
flowControl
=
new
FormControl
();
flow
:
string
[]
=
[];
flow
:
string
[]
=
[];
flowfilteredOptions
:
Observable
<
string
[]
>
;
flowfilteredOptions
:
Observable
<
string
[]
>
;
flowControlisDivVisible
=
false
public
static
id
:
any
[]
=
[];
public
static
id
:
any
[]
=
[];
private
readonly
notifier
:
NotifierService
;
private
readonly
notifier
:
NotifierService
;
...
@@ -61,7 +62,10 @@ export class SuffixDetailsComponent implements OnInit {
...
@@ -61,7 +62,10 @@ export class SuffixDetailsComponent implements OnInit {
}
}
ngOnInit
():
void
{
ngOnInit
():
void
{
this
.
getchoices
();
//this.getchoices();
this
.
getflowchoices
(
this
.
route
.
snapshot
.
params
.
gb
);
console
.
log
(
'aaa'
,
this
.
route
.
snapshot
.
params
.
gb
);
this
.
getAllSuffix
(
this
.
route
.
snapshot
.
params
.
id
);
this
.
getAllSuffix
(
this
.
route
.
snapshot
.
params
.
id
);
}
}
...
@@ -75,6 +79,16 @@ export class SuffixDetailsComponent implements OnInit {
...
@@ -75,6 +79,16 @@ export class SuffixDetailsComponent implements OnInit {
return
""
;
return
""
;
}
}
showflow
(
option
:
string
):
boolean
{
this
.
flowControlisDivVisible
=
false
if
(
option
!=
null
)
{
let
x
=
option
.
split
(
" : "
);
if
((
x
[
x
.
length
-
2
]
==
""
)
||
(
x
[
x
.
length
-
1
]
==
""
))
{
return
false
;
}
if
(
x
[
x
.
length
-
2
]
==
'EventRelated'
||
x
[
x
.
length
-
2
]
==
'TimeRangeRelated'
||
x
[
x
.
length
-
2
]
==
'ExecutionRelated'
)
{
this
.
flowControlisDivVisible
=
true
;
return
true
;
}
}
return
false
;
}
private
_filter
(
data
:
string
[],
value
:
string
):
string
[]
{
private
_filter
(
data
:
string
[],
value
:
string
):
string
[]
{
const
filterValue
=
value
.
toLowerCase
();
const
filterValue
=
value
.
toLowerCase
();
return
data
.
filter
(
option
=>
option
.
toLowerCase
().
includes
(
filterValue
));
return
data
.
filter
(
option
=>
option
.
toLowerCase
().
includes
(
filterValue
));
...
@@ -119,7 +133,7 @@ export class SuffixDetailsComponent implements OnInit {
...
@@ -119,7 +133,7 @@ export class SuffixDetailsComponent implements OnInit {
updateSuffix
():
void
{
updateSuffix
():
void
{
this
.
currentsuffix
.
s_choices
=
this
.
suffixControl
.
value
;
this
.
currentsuffix
.
s_choices
=
this
.
suffixControl
.
value
;
this
.
currentsuffix
.
mumerical_units
=
this
.
mumerical_unitsControl
.
value
;
this
.
currentsuffix
.
mumerical_units
=
this
.
mumerical_unitsControl
.
value
;
this
.
currentsuffix
.
flow
=
this
.
flowControl
.
value
;
if
(
this
.
flowControlisDivVisible
)
{
this
.
currentsuffix
.
flow
=
this
.
flowControl
.
value
;
}
else
{
this
.
currentsuffix
.
flow
=
''
}
for
(
let
i
=
0
;
i
<
SuffixDetailsComponent
.
id
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
SuffixDetailsComponent
.
id
.
length
;
i
++
)
{
this
.
suffixService
.
update
(
this
.
route
.
snapshot
.
params
.
id
,
SuffixDetailsComponent
.
id
[
i
],
this
.
currentsuffix
)
this
.
suffixService
.
update
(
this
.
route
.
snapshot
.
params
.
id
,
SuffixDetailsComponent
.
id
[
i
],
this
.
currentsuffix
)
.
subscribe
(
.
subscribe
(
...
@@ -133,32 +147,50 @@ export class SuffixDetailsComponent implements OnInit {
...
@@ -133,32 +147,50 @@ export class SuffixDetailsComponent implements OnInit {
}
}
get
choices
(
):
void
{
get
flowchoices
(
prefix_group
:
any
):
void
{
this
.
suffixService
.
getsuffix
(
)
this
.
suffixService
.
getsuffix
flow
(
prefix_group
)
.
subscribe
(
.
subscribe
(
data
=>
{
data
=>
{
for
(
let
x
=
0
;
x
<
data
.
length
;
x
++
)
{
//set flow choices
if
(
this
.
suffix
.
indexOf
(
data
[
x
][
1
])
==
-
1
)
{
this
.
setflow
(
JSON
.
parse
(
data
[
0
].
flow_choices
));
this
.
suffix
.
push
(
data
[
x
][
1
]
);
this
.
setflow
(
JSON
.
parse
(
data
[
0
].
function_choices
)
);
}
this
.
setsuffix
(
JSON
.
parse
(
data
[
0
].
suffix_choices
));
}
this
.
setmumerical_units
(
JSON
.
parse
(
data
[
0
].
number_unit_choices
));
},
},
error
=>
{
error
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
});
});
this
.
suffixService
.
getnumunits
()
}
.
subscribe
(
setflow
(
strIntoObj
:
any
):
void
{
data
=>
{
for
(
let
x
=
0
;
x
<
strIntoObj
.
length
;
x
++
)
{
for
(
let
x
=
0
;
x
<
data
.
length
;
x
++
)
{
if
(
this
.
flow
.
indexOf
(
strIntoObj
[
x
][
1
])
==
-
1
)
{
if
(
this
.
mumerical_units
.
indexOf
(
data
[
x
][
1
])
==
-
1
)
{
this
.
flow
.
push
((
strIntoObj
[
x
][
1
]));
this
.
mumerical_units
.
push
(
data
[
x
][
1
]);
}
}
}
}
}
},
error
=>
{
setsuffix
(
strIntoObj
:
any
):
void
{
console
.
log
(
error
);
for
(
let
x
=
0
;
x
<
strIntoObj
.
length
;
x
++
)
{
});
if
(
this
.
suffix
.
indexOf
(
strIntoObj
[
x
][
1
])
==
-
1
)
{
this
.
suffixService
.
getflow
()
this
.
suffix
.
push
((
strIntoObj
[
x
][
1
]));
}
}
}
setmumerical_units
(
strIntoObj
:
any
):
void
{
for
(
let
x
=
0
;
x
<
strIntoObj
.
length
;
x
++
)
{
if
(
this
.
mumerical_units
.
indexOf
(
strIntoObj
[
x
][
1
])
==
-
1
)
{
this
.
mumerical_units
.
push
((
strIntoObj
[
x
][
1
]));
}
}
}
}
/*this.suffixService.getflow()
.subscribe(
.subscribe(
data => {
data => {
for (let x = 0; x < data.length; x++) {
for (let x = 0; x < data.length; x++) {
...
@@ -169,8 +201,4 @@ export class SuffixDetailsComponent implements OnInit {
...
@@ -169,8 +201,4 @@ export class SuffixDetailsComponent implements OnInit {
},
},
error => {
error => {
console.log(error);
console.log(error);
});
});*/
\ No newline at end of file
}
}
reqtool/ReqmanAngular11/src/app/models/boilerplate.model.ts
View file @
a80c458d
...
@@ -45,6 +45,27 @@ export class SubClasses {
...
@@ -45,6 +45,27 @@ export class SubClasses {
SubClass_name
?:
any
;
SubClass_name
?:
any
;
SubclassComment
?:
any
SubclassComment
?:
any
InstanceOfSubclass
?:
Instances
[];
InstanceOfSubclass
?:
Instances
[];
SubSubClass
?:
SubSubClasses
[];
}
export
class
SubSubClasses
{
SubSubClass_name
?:
any
;
SubSubclassComment
?:
any
SubInstanceOfSubclass
?:
Instances
[];
SubSubClass
?:
SubSubSubClasses
[];
}
export
class
SubSubSubClasses
{
SubSubClass_name
?:
any
;
SubSubclassComment
?:
any
SubInstanceOfSubclass
?:
Instances
[];
SubSubClass
?:
SubSubSubSubClasses
[];
}
export
class
SubSubSubSubClasses
{
SubSubClass_name
?:
any
;
SubSubclassComment
?:
any
SubInstanceOfSubclass
?:
Instances
[];
}
}
export
class
Instances
{
export
class
Instances
{
...
...
reqtool/ReqmanAngular11/src/app/services/suffix.service.ts
View file @
a80c458d
...
@@ -6,6 +6,7 @@ import { environment } from '../../environments/environment';
...
@@ -6,6 +6,7 @@ import { environment } from '../../environments/environment';
const
baseUrl
=
environment
.
apiroot
+
'api-auth/groupboilerplates/0/boilerplates/'
;
const
baseUrl
=
environment
.
apiroot
+
'api-auth/groupboilerplates/0/boilerplates/'
;
const
Url
=
'/suffix/'
;
const
Url
=
'/suffix/'
;
const
baseUrl2
=
environment
.
apiroot
+
'api-auth/groupboilerplates/'
;
@
Injectable
({
@
Injectable
({
providedIn
:
'root'
providedIn
:
'root'
...
@@ -45,5 +46,9 @@ export class SuffixService {
...
@@ -45,5 +46,9 @@ export class SuffixService {
getflow
():
Observable
<
any
>
{
getflow
():
Observable
<
any
>
{
return
this
.
http
.
get
(
environment
.
apiroot
+
`api-auth/suffix/choices/flow/`
);
return
this
.
http
.
get
(
environment
.
apiroot
+
`api-auth/suffix/choices/flow/`
);
}
}
getsuffixflow
(
gb
:
any
):
Observable
<
any
>
{
return
this
.
http
.
get
(
`
${
baseUrl2
}${
gb
}
`
+
`/prefix/choices/simpleprefix/`
);
}
}
}
reqtool/reqman/api/reqman/apps/reqtool/models/main_req.py
View file @
a80c458d
...
@@ -45,11 +45,17 @@ MAIN_CHOICES = ( ("",""), ("M1", "M1"),
...
@@ -45,11 +45,17 @@ MAIN_CHOICES = ( ("",""), ("M1", "M1"),
#FUNCTION_INSTANCES_COMMENTS = get_dmo_instance_and_comment("SAO#Function")
#FUNCTION_INSTANCES_COMMENTS = get_dmo_instance_and_comment("SAO#Function")
#
#
SHALL_CHOICES
=
(
(
"shall"
,
"shall"
),
(
"shall not"
,
"shall not"
))
SHALL_CHOICES
=
(
(
"shall"
,
"shall"
),
(
"shall not"
,
"shall not"
))
QUANTIFIER_CHOICES
=
(
(
"None"
,
"None"
),
(
"All"
,
"All"
),
(
"Only"
,
"Only"
),
#QUANTIFIER_CHOICES = ( ("None","None"), ("All", "All"), ("Only", "Only"),
(
"More Than"
,
"More Than"
),
(
"Less Than"
,
"Less Than"
),
(
"Exactly"
,
"Exactly"
),
# ("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
=
((
""
,
""
),(
"m/s"
,
"m/s"
),
(
"m/s^2"
,
"m/s^2"
),
(
"m/s^3"
,
"m/s^3"
),
(
"rad"
,
"rad"
),
(
"rad/s"
,
"rad/s"
),
(
"Hz"
,
"Hz"
),
(
"METERS"
,
"METERS"
),
(
"KILOMETERS"
,
"KILOMETERS"
),
(
"VOLT"
,
"VOLT"
),
(
"Number"
,
"Number"
))
#NUMBER_UNITS_CHOICES = (("",""),("m/s","m/s"), ("m/s^2","m/s^2"), ("m/s^3","m/s^3"), ("rad","rad"), ("rad/s","rad/s"), ("Hz","Hz"), ("METERS","METERS"), ("KILOMETERS","KILOMETERS"), ("VOLT","VOLT"), ("Number", "Number"))
##g = Graph()
#g.load('../../Ontologies/2022_AOCS.ttl', format="turtle")
#PREFIX_SYNTAX = get_prefix_syntax(g)
#S_CHOICES = get_instances_g("RBO#Preposition",g) + get_instances_g("RBO#NumericalAffirmative",g)
#print(S_CHOICES)
#ITEM
#ITEM
#ITEM_CHOICES = get_instances("SAO#Item")
#ITEM_CHOICES = get_instances("SAO#Item")
#ITEM_CLASSES_COMMENTS = get_dmo_classes_and_comment("SAO#Item")
#ITEM_CLASSES_COMMENTS = get_dmo_classes_and_comment("SAO#Item")
...
@@ -91,7 +97,6 @@ NUMBER_UNITS_CHOICES = (("",""),("m/s","m/s"), ("m/s^2","m/s^2"), ("m/s^3","m/s^
...
@@ -91,7 +97,6 @@ NUMBER_UNITS_CHOICES = (("",""),("m/s","m/s"), ("m/s^2","m/s^2"), ("m/s^3","m/s^
#VERB_CHOICES = get_verb_instances("LO#Verb")
#VERB_CHOICES = get_verb_instances("LO#Verb")
VERB_CHOICES
=
get_verb_file_and_instances
(
"LO#Verb"
)
VERB_CHOICES
=
get_verb_file_and_instances
(
"LO#Verb"
)
#test to add M
#test to add M
CLASS_CHOICES
=
((
"SYSTEM"
,
"SYSTEM"
),
(
"FUNCTION"
,
"FUNCTION"
),
(
"SHALL"
,
"SHALL/SHALL NOT"
),
CLASS_CHOICES
=
((
"SYSTEM"
,
"SYSTEM"
),
(
"FUNCTION"
,
"FUNCTION"
),
(
"SHALL"
,
"SHALL/SHALL NOT"
),
(
"QUANTIFIER"
,
"QUANTIFIER"
),
(
"NUMBER_UNITS"
,
"NUMBER_UNITS"
),
(
"ITEM"
,
"ITEM"
),
(
"QUANTIFIER"
,
"QUANTIFIER"
),
(
"NUMBER_UNITS"
,
"NUMBER_UNITS"
),
(
"ITEM"
,
"ITEM"
),
...
...
reqtool/reqman/api/reqman/apps/reqtool/models/requirements.py
View file @
a80c458d
...
@@ -36,6 +36,9 @@ LOGICAL_EXPRESSION = ( ("",""),
...
@@ -36,6 +36,9 @@ LOGICAL_EXPRESSION = ( ("",""),
#Need fixing
#Need fixing
#VERB_CHOICES_PREFIX = ( ("",""))
#VERB_CHOICES_PREFIX = ( ("",""))
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/RDO-instances#"
]
#,
list_of_RBO
=
[
"http://delab.csd.auth.gr/ontologies/2018/LO#"
,
"http://delab.csd.auth.gr/ontologies/2018/RBO#"
,
"http://delab.csd.auth.gr/ontologies/2018/LO-instances#"
]
#list_of_LO = ["http://delab.csd.auth.gr/ontologies/2018/LO#","http://delab.csd.auth.gr/ontologies/2018/RBO#","http://delab.csd.auth.gr/ontologies/2018/LO-instances#"]
#Must read this info from the Ontology
#Must read this info from the Ontology
...
@@ -106,15 +109,19 @@ def update_instances(instance):
...
@@ -106,15 +109,19 @@ def update_instances(instance):
g
.
load
(
instance
.
ontology_file
,
format
=
"turtle"
)
g
.
load
(
instance
.
ontology_file
,
format
=
"turtle"
)
#PREFIX_SYNTAX = get_prefix_syntax(g)
#PREFIX_SYNTAX = get_prefix_syntax(g)
VERB_CHOICES_PREFIX
=
get_prefix_verbs
(
g
)
VERB_CHOICES_PREFIX
=
get_prefix_verbs
(
g
)
SYSTEM_CHOICES
=
get_instances_g
(
"SAO#System"
,
g
)
SYSTEM_CHOICES
=
get_instances_g
(
"SAO#System"
,
g
,
list_of_DSO
)
FUNCTION_CHOICES
=
get_instances_g
(
"SAO#Function"
,
g
)
FUNCTION_CHOICES
=
get_instances_g
(
"SAO#Function"
,
g
,
list_of_DSO
)
ITEM_CHOICES
=
get_instances_g
(
"SAO#Item"
,
g
)
ITEM_CHOICES
=
get_instances_g
(
"SAO#Item"
,
g
,
list_of_DSO
)
INTERFACE_CHOICES
=
get_instances_g
(
"SAO#Interface"
,
g
)
INTERFACE_CHOICES
=
get_instances_g
(
"SAO#Interface"
,
g
,
list_of_DSO
)
CONNECTION_CHOICES
=
get_instances_g
(
"SAO#Connection"
,
g
)
CONNECTION_CHOICES
=
get_instances_g
(
"SAO#Connection"
,
g
,
list_of_DSO
)
FLOW_CHOICES
=
get_instances_g
(
"SAO#Flow"
,
g
)
FLOW_CHOICES
=
get_instances_g
(
"SAO#Flow"
,
g
,
list_of_DSO
)
STATE_CHOICES
=
get_instances_g
(
"SAO#State"
,
g
)
STATE_CHOICES
=
get_instances_g
(
"SAO#State"
,
g
,
list_of_DSO
)
STATE_SET_CHOICES
=
get_instances_g
(
"SAO#StateSet"
,
g
)
STATE_SET_CHOICES
=
get_instances_g
(
"SAO#StateSet"
,
g
,
list_of_DSO
)
STATE_VALUE_CHOICES
=
get_instances_g
(
"SAO#StateValue"
,
g
)
STATE_VALUE_CHOICES
=
get_instances_g
(
"SAO#StateValue"
,
g
,
list_of_DSO
)
NUMBER_UNITS_CHOICES
=
get_instances_g
(
"RBO#NumberUnit"
,
g
,
list_of_RBO
)
QUANTIFIER_CHOICES
=
get_instances_g
(
"RBO#Quantifier"
,
g
,
list_of_RBO
)
NUMERICAL_AFFIRMATIVE_CHOICES
=
get_instances_g
(
"RBO#NumericalAffirmative"
,
g
,
list_of_RBO
)
S_CHOICES
=
get_instances_g
(
"RBO#Preposition"
,
g
,
list_of_RBO
)
+
get_instances_g
(
"RBO#NumericalAffirmative"
,
g
,
list_of_RBO
)
BoilerplateGroupClassesInstances
.
objects
.
filter
(
classes_instances_owner
=
instance
.
owner_infer
,
classes_instances_group_of_boilerplate
=
instance
.
infer_group_of_boilerplate
)
.
update
(
BoilerplateGroupClassesInstances
.
objects
.
filter
(
classes_instances_owner
=
instance
.
owner_infer
,
classes_instances_group_of_boilerplate
=
instance
.
infer_group_of_boilerplate
)
.
update
(
prefix_choices
=
json
.
dumps
(
PREFIX_CHOICES
),
prefix_logcon_choices
=
json
.
dumps
(
LOGIC_CONNECTIVE
),
prefix_verb_choices
=
json
.
dumps
(
STATE_CHOICES
+
VERB_CHOICES_PREFIX
),
prefix_choices
=
json
.
dumps
(
PREFIX_CHOICES
),
prefix_logcon_choices
=
json
.
dumps
(
LOGIC_CONNECTIVE
),
prefix_verb_choices
=
json
.
dumps
(
STATE_CHOICES
+
VERB_CHOICES_PREFIX
),
main_class_choices
=
json
.
dumps
(
MAIN_CHOICES
),
system_choices
=
json
.
dumps
(
SYSTEM_CHOICES
),
function_choices
=
json
.
dumps
(
FUNCTION_CHOICES
),
main_class_choices
=
json
.
dumps
(
MAIN_CHOICES
),
system_choices
=
json
.
dumps
(
SYSTEM_CHOICES
),
function_choices
=
json
.
dumps
(
FUNCTION_CHOICES
),
...
...
reqtool/reqman/api/reqman/apps/reqtool/models/suffix_req.py
View file @
a80c458d
...
@@ -18,16 +18,26 @@ SUFFIX_CHOICES = (("",""), ('S1', 'S1: <numerical-affirmative> j <closed-interva
...
@@ -18,16 +18,26 @@ 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
=
((
""
,
""
),(
"m/s"
,
"m/s"
),
(
"m/s^2"
,
"m/s^2"
),
(
"m/s^3"
,
"m/s^3"
),
(
"rad"
,
"rad"
),
(
"rad/s"
,
"rad/s"
),
(
"Hz"
,
"Hz"
),
(
"METERS"
,
"METERS"
),
(
"KILOMETERS"
,
"KILOMETERS"
),
(
"VOLT"
,
"VOLT"
))
#NUMBER_UNITS_CHOICES = (("",""),("m/s","m/s"), ("m/s^2","m/s^2"), ("m/s^3","m/s^3"), ("rad","rad"), ("rad/s","rad/s"), ("Hz","Hz"), ("METERS","METERS"), ("KILOMETERS","KILOMETERS"), ("VOLT","VOLT"))
TIME_UNITS_CHOICES
=
((
"SECONDS"
,
"SECONDS"
),
(
"MINUTES"
,
"MINUTES"
),
(
"MILLISECONDS"
,
"MILLISECONDS"
),
(
"CYCLES"
,
"CYCLES"
))
FLOW_CHOICES
=
get_instances
(
"SAO#Flow"
)
#TIME_UNITS_CHOICES = (("SECONDS","SECONDS"), ("MINUTES","MINUTES"), ("MILLISECONDS","MILLISECONDS"), ("CYCLES","CYCLES"))
#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"
))
S5_6_CHOICES
=
((
"AT EVEN INTERVALS"
,
"AT EVEN INTERVALS"
),
(
"SEQUENTIALLY"
,
"SEQUENTIALLY"
))
#S_CHOICES = NUMERICAL_AFFIRMATIVE_CHOICES + S2_CHOICES + S3_CHOICES + S4_CHOICES + S5_6_CHOICES
S_CHOICES
=
NUMERICAL_AFFIRMATIVE_CHOICES
+
S2_CHOICES
+
S3_CHOICES
+
S4_CHOICES
+
S5_6_CHOICES
'''g = Graph()
g.load('../../Ontologies/2022_AOCS.ttl', format="turtle")
S_CHOICES = get_instances_g("RBO#Preposition",g) + get_instances_g("RBO#NumericalAffirmative",g)
FLOW_CHOICES=(("SECONDS","SECONDS"), ("MINUTES","MINUTES"), ("MILLISECONDS","MILLISECONDS"), ("CYCLES","CYCLES"))
NUMBER_UNITS_CHOICES=get_instances_g("LO#NumberUnit",g)
SYSTEM_CHOICES = get_instances_g("SAO#System",g)
print(SYSTEM_CHOICES)'''
def
create_suffix
(
instance
):
def
create_suffix
(
instance
):
...
@@ -49,13 +59,16 @@ class Suffix(models.Model):
...
@@ -49,13 +59,16 @@ class Suffix(models.Model):
boilerplate_of_suffix
=
models
.
ForeignKey
(
'reqtool.Boilerplate'
,
related_name
=
'suffix_boilerplate'
,
on_delete
=
models
.
CASCADE
)
boilerplate_of_suffix
=
models
.
ForeignKey
(
'reqtool.Boilerplate'
,
related_name
=
'suffix_boilerplate'
,
on_delete
=
models
.
CASCADE
)
suffix_owner
=
models
.
ForeignKey
(
User
,
related_name
=
'suffix_owner'
,
on_delete
=
models
.
CASCADE
)
suffix_owner
=
models
.
ForeignKey
(
User
,
related_name
=
'suffix_owner'
,
on_delete
=
models
.
CASCADE
)
#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)
s_choices
=
models
.
CharField
(
max_length
=
100
,
blank
=
True
)
#if S1
#if S1
numerical
=
models
.
CharField
(
blank
=
True
,
null
=
True
,
max_length
=
10
)
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, max_length=100, blank=True)
mumerical_units
=
models
.
CharField
(
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
flow
=
models
.
CharField
(
choices
=
FLOW_CHOICES
,
max_length
=
100
,
blank
=
True
)
#flow = models.CharField(choices=FLOW_CHOICES, max_length=100, blank=True)
flow
=
models
.
CharField
(
max_length
=
100
,
blank
=
True
)
#find suffix
#find suffix
suffix_choices
=
models
.
CharField
(
choices
=
SUFFIX_CHOICES
,
max_length
=
100
,
blank
=
True
)
suffix_choices
=
models
.
CharField
(
choices
=
SUFFIX_CHOICES
,
max_length
=
100
,
blank
=
True
)
#custom suffix
#custom suffix
...
...
reqtool/reqman/api/reqman/apps/reqtool/rest_api/services/inference.py
View file @
a80c458d
This diff is collapsed.
Click to expand it.
reqtool/reqman/api/reqman/apps/reqtool/rest_api/services/parse_ontologies.py
View file @
a80c458d
This diff is collapsed.
Click to expand it.
reqtool/reqman/api/reqman/apps/reqtool/rest_api/urls.py
View file @
a80c458d
...
@@ -38,9 +38,9 @@ urlpatterns = [
...
@@ -38,9 +38,9 @@ urlpatterns = [
path
(
'main/choices/shall/'
,
main_req_views
.
ShallChoicesViewSet
.
as_view
(),
name
=
'mainshall'
),
path
(
'main/choices/shall/'
,
main_req_views
.
ShallChoicesViewSet
.
as_view
(),
name
=
'mainshall'
),
#SUFFIX CHOICES DATA
#SUFFIX CHOICES DATA
path
(
'suffix/choices/suffix/'
,
suffix_req_views
.
SuffixChoicesViewSet
.
as_view
(),
name
=
'suffixsuffix'
),
##
path('suffix/choices/suffix/', suffix_req_views.SuffixChoicesViewSet.as_view(), name='suffixsuffix'),
path
(
'suffix/choices/numunits/'
,
suffix_req_views
.
NumChoicesViewSet
.
as_view
(),
name
=
'suffixnum'
),
#
path('suffix/choices/numunits/', suffix_req_views.NumChoicesViewSet.as_view(), name='suffixnum'),
path
(
'suffix/choices/flow/'
,
suffix_req_views
.
FlowChoicesViewSet
.
as_view
(),
name
=
'suffixflow'
),
#
path('suffix/choices/flow/', suffix_req_views.FlowChoicesViewSet.as_view(), name='suffixflow'),
#Dictionary
#Dictionary
path
(
'groupboilerplates/<int:groupboil>/dictionary/'
,
main_req_views
.
DictionaryViewSet
.
as_view
(),
name
=
'dictionary'
),
path
(
'groupboilerplates/<int:groupboil>/dictionary/'
,
main_req_views
.
DictionaryViewSet
.
as_view
(),
name
=
'dictionary'
),
...
...
reqtool/reqman/api/reqman/apps/reqtool/rest_api/views/main_req_views.py
View file @
a80c458d
...
@@ -97,7 +97,9 @@ class MainDetailsAPIView(RetrieveUpdateDestroyAPIView):
...
@@ -97,7 +97,9 @@ class MainDetailsAPIView(RetrieveUpdateDestroyAPIView):
if
(
instance
[
'mumerical_units'
]
not
in
numunit_data
):
if
(
instance
[
'mumerical_units'
]
not
in
numunit_data
):
raise
APIException
(
"MAIN : Instance of Number Unit does not exist"
)
raise
APIException
(
"MAIN : Instance of Number Unit does not exist"
)
curmain_choices
=
inference
.
getclassofmain
(
instance
)
curmain_choices
=
inference
.
getclassofmain
(
instance
)
if
curmain_choices
[
0
]
==
'ERROR'
:
if
(
curmain_choices
==
None
):
raise
APIException
(
"Main choices not in [M1-M16]"
)
if
(
curmain_choices
[
0
]
==
'ERROR'
):
raise
APIException
(
"Main choices not in [M1-M16]"
)
raise
APIException
(
"Main choices not in [M1-M16]"
)
else
:
else
:
instance
=
serializer
.
save
(
main_choices
=
curmain_choices
[
0
])
instance
=
serializer
.
save
(
main_choices
=
curmain_choices
[
0
])
...
@@ -136,7 +138,7 @@ class MainChoicesAPIView(APIView):
...
@@ -136,7 +138,7 @@ class MainChoicesAPIView(APIView):
#print(Dictdata.values('Dictionary_Data')[0]['Dictionary_Data'])
#print(Dictdata.values('Dictionary_Data')[0]['Dictionary_Data'])
class_prefix
=
self
.
getClassontologyfile
(
g
,
es_instance
)
class_prefix
=
self
.
getClassontologyfile
(
g
,
es_instance
)
for
s
,
p
,
o
in
g
.
triples
((
URIRef
(
"http://delab.csd.auth.gr/ontologies/2018/RDO-instances#"
+
es_instance
[
len
(
es_instance
)
-
1
]
.
strip
()
)
,
RDF
.
type
,
URIRef
(
class_prefix
))):
for
s
,
p
,
o
in
g
.
triples
((
URIRef
(
"http://delab.csd.auth.gr/ontologies/2018/RDO-instances#"
)
+
es_instance
[
len
(
es_instance
)
-
1
]
.
strip
(
)
,
RDF
.
type
,
URIRef
(
class_prefix
))):
raise
APIException
(
"This instance already exist"
)
raise
APIException
(
"This instance already exist"
)
try
:
try
:
g
.
add
((
URIRef
(
"http://delab.csd.auth.gr/ontologies/2018/RDO-instances#"
+
es_instance
[
len
(
es_instance
)
-
1
]
.
strip
()
)
,
RDF
.
type
,
URIRef
(
class_prefix
)
))
g
.
add
((
URIRef
(
"http://delab.csd.auth.gr/ontologies/2018/RDO-instances#"
+
es_instance
[
len
(
es_instance
)
-
1
]
.
strip
()
)
,
RDF
.
type
,
URIRef
(
class_prefix
)
))
...
@@ -146,6 +148,7 @@ class MainChoicesAPIView(APIView):
...
@@ -146,6 +148,7 @@ class MainChoicesAPIView(APIView):
raise
APIException
(
"Cannot Add instance"
)
raise
APIException
(
"Cannot Add instance"
)
tempDict
=
[]
tempDict
=
[]
flag
=
0
flag
=
0
#PROBLEMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
for
sao
in
Dictdata
.
values
(
'Dictionary_Data'
)[
0
][
'Dictionary_Data'
]:
for
sao
in
Dictdata
.
values
(
'Dictionary_Data'
)[
0
][
'Dictionary_Data'
]:
if
sao
[
'Name'
]
==
es_instance
[
0
]
.
strip
():
if
sao
[
'Name'
]
==
es_instance
[
0
]
.
strip
():
for
sao2
in
sao
[
'TheClasses'
]:
for
sao2
in
sao
[
'TheClasses'
]:
...
@@ -154,22 +157,54 @@ class MainChoicesAPIView(APIView):
...
@@ -154,22 +157,54 @@ class MainChoicesAPIView(APIView):
for
sao3
in
sao2
[
'Subclass'
]:
for
sao3
in
sao2
[
'Subclass'
]:
if
sao3
[
'SubClass_name'
]
==
es_instance
[
2
]
.
strip
():
if
sao3
[
'SubClass_name'
]
==
es_instance
[
2
]
.
strip
():
flag
=
2
flag
=
2
if
(
sao3
[
'InstanceOfSubclass'
]
==
''
):
print
(
sao3
)
sao3
[
'InstanceOfSubclass'
]
=
[]
for
sao4
in
sao3
[
'SubSubClass'
]:
sao3
[
'InstanceOfSubclass'
]
.
append
({
"Instance"
:
es_instance
[
3
]
.
strip
(),
"Comment"
:
comment
})
if
es_instance
[
3
]
and
sao4
[
'SubSubClass_name'
]
==
es_instance
[
3
]
.
strip
():
else
:
flag
=
3
sao3
[
'InstanceOfSubclass'
]
.
append
({
"Instance"
:
es_instance
[
3
]
.
strip
(),
"Comment"
:
comment
})
for
sao5
in
sao4
[
'SubSubClass'
]:
if
es_instance
[
4
]
and
sao5
[
'SubSubClass_name'
]
==
es_instance
[
4
]
.
strip
():
flag
=
4
for
sao6
in
sao5
[
'SubSubClass'
]:
if
es_instance
[
5
]
and
sao6
[
'SubSubClass_name'
]
==
es_instance
[
5
]
.
strip
():
flag
=
5
if
(
flag
==
5
):
if
(
sao6
[
'SubInstanceOfSubclass'
]
==
''
):
sao6
[
'SubInstanceOfSubclass'
]
=
[]
sao6
[
'SubInstanceOfSubclass'
]
.
append
({
"Instance"
:
es_instance
[
6
]
.
strip
(),
"Comment"
:
comment
})
else
:
sao6
[
'SubInstanceOfSubclass'
]
.
append
({
"Instance"
:
es_instance
[
6
]
.
strip
(),
"Comment"
:
comment
})
if
(
flag
==
4
):
if
(
sao5
[
'SubInstanceOfSubclass'
]
==
''
):
sao5
[
'SubInstanceOfSubclass'
]
=
[]
sao5
[
'SubInstanceOfSubclass'
]
.
append
({
"Instance"
:
es_instance
[
5
]
.
strip
(),
"Comment"
:
comment
})
else
:
sao5
[
'SubInstanceOfSubclass'
]
.
append
({
"Instance"
:
es_instance
[
5
]
.
strip
(),
"Comment"
:
comment
})
if
(
flag
==
3
):
if
(
sao4
[
'SubInstanceOfSubclass'
]
==
''
):
sao4
[
'SubInstanceOfSubclass'
]
=
[]
sao4
[
'SubInstanceOfSubclass'
]
.
append
({
"Instance"
:
es_instance
[
4
]
.
strip
(),
"Comment"
:
comment
})
else
:
sao4
[
'InstanceOfSubclass'
]
.
append
({
"Instance"
:
es_instance
[
4
]
.
strip
(),
"Comment"
:
comment
})
# SubSubClass_name
if
(
flag
==
2
):
if
(
sao3
[
'InstanceOfSubclass'
]
==
''
):
sao3
[
'InstanceOfSubclass'
]
=
[]
sao3
[
'InstanceOfSubclass'
]
.
append
({
"Instance"
:
es_instance
[
3
]
.
strip
(),
"Comment"
:
comment
})
else
:
sao3
[
'InstanceOfSubclass'
]
.
append
({
"Instance"
:
es_instance
[
3
]
.
strip
(),
"Comment"
:
comment
})
if
(
flag
==
1
):
if
(
flag
==
1
):
if
(
sao2
[
'Instance_of_Class'
]
==
''
):
if
(
sao2
[
'Instance_of_Class'
]
==
''
):
print
(
'sao2'
)
sao2
[
'Instance_of_Class'
]
=
[]
sao2
[
'Instance_of_Class'
]
=
[]
sao2
[
'Instance_of_Class'
]
.
append
({
"Instance"
:
es_instance
[
2
]
.
strip
(),
"Comment"
:
comment
})
sao2
[
'Instance_of_Class'
]
.
append
({
"Instance"
:
es_instance
[
2
]
.
strip
(),
"Comment"
:
comment
})
else
:
else
:
sao2
[
'Instance_of_Class'
]
.
append
({
"Instance"
:
es_instance
[
2
]
.
strip
(),
"Comment"
:
comment
})
sao2
[
'Instance_of_Class'
]
.
append
({
"Instance"
:
es_instance
[
2
]
.
strip
(),
"Comment"
:
comment
})
if
(
flag
==
0
):
if
(
flag
==
0
):
sao
[
'GeneralInstances'
]
.
append
({
"Instance"
:
es_instance
[
1
]
.
strip
(),
"Comment"
:
comment
})
sao
[
'GeneralInstances'
]
.
append
({
"Instance"
:
es_instance
[
1
]
.
strip
(),
"Comment"
:
comment
})
print
(
'aaaaaaaaaaaaaaaaa'
,
flag
)
tempDict
.
append
(
sao
)
tempDict
.
append
(
sao
)
Dictdata
.
update
(
Dictionary_Data
=
tempDict
)
Dictdata
.
update
(
Dictionary_Data
=
tempDict
)
if
(
len
(
es_instance
)
==
2
):
instance
=
es_instance
[
0
]
+
': '
+
instance
if
(
es_instance
[
0
]
.
strip
()
==
'System'
):
if
(
es_instance
[
0
]
.
strip
()
==
'System'
):
m
=
data
.
values
(
'system_choices'
)[
0
][
'system_choices'
][:
-
1
]
m
=
data
.
values
(
'system_choices'
)[
0
][
'system_choices'
][:
-
1
]
if
(
len
(
m
)
==
1
):
if
(
len
(
m
)
==
1
):
...
@@ -204,13 +239,12 @@ class MainChoicesAPIView(APIView):
...
@@ -204,13 +239,12 @@ class MainChoicesAPIView(APIView):
return
HttpResponse
(
'Update Instance'
)
return
HttpResponse
(
'Update Instance'
)
if
(
es_instance
[
0
]
.
strip
()
==
'Flow'
):
if
(
es_instance
[
0
]
.
strip
()
==
'Flow'
):
m
=
data
.
values
(
'flow_choices'
)[
0
][
'flow_choices'
][:
-
1
]
m
=
data
.
values
(
'flow_choices'
)[
0
][
'flow_choices'
][:
-
1
]
print
(
'data'
,
m
)
if
(
len
(
m
)
==
1
):
if
(
len
(
m
)
==
1
):
m
+=
'["'
+
instance
+
'","'
+
instance
+
'"]'
+
']'
m
+=
'["'
+
instance
+
'","'
+
instance
+
'"]'
+
']'
else
:
else
:
m
+=
',["'
+
instance
+
'","'
+
instance
+
'"]'
+
']'
m
+=
',["'
+
instance
+
'","'
+
instance
+
'"]'
+
']'
data
.
update
(
flow_choices
=
str
(
m
))
print
(
m
)
print
(
m
)
data
.
update
(
flow_choices
=
str
(
m
))
return
HttpResponse
(
'Update Instance'
)
return
HttpResponse
(
'Update Instance'
)
if
(
es_instance
[
0
]
.
strip
()
==
'State'
):
if
(
es_instance
[
0
]
.
strip
()
==
'State'
):
m
=
data
.
values
(
'state_choices'
)[
0
][
'state_choices'
][:
-
1
]
m
=
data
.
values
(
'state_choices'
)[
0
][
'state_choices'
][:
-
1
]
...
@@ -236,6 +270,14 @@ class MainChoicesAPIView(APIView):
...
@@ -236,6 +270,14 @@ class MainChoicesAPIView(APIView):
m
+=
',["'
+
instance
+
'","'
+
instance
+
'"]'
+
']'
m
+=
',["'
+
instance
+
'","'
+
instance
+
'"]'
+
']'
data
.
update
(
state_value_choices
=
str
(
m
))
data
.
update
(
state_value_choices
=
str
(
m
))
return
HttpResponse
(
'Update Instance'
)
return
HttpResponse
(
'Update Instance'
)
if
(
es_instance
[
0
]
.
strip
()
==
'Connection'
):
m
=
data
.
values
(
'connection_choices'
)[
0
][
'connection_choices'
][:
-
1
]
if
(
len
(
m
)
==
1
):
m
+=
'["'
+
instance
+
'","'
+
instance
+
'"]'
+
']'
else
:
m
+=
',["'
+
instance
+
'","'
+
instance
+
'"]'
+
']'
data
.
update
(
connection_choices
=
str
(
m
))
return
HttpResponse
(
'Update Instance'
)
...
@@ -248,10 +290,18 @@ class MainChoicesAPIView(APIView):
...
@@ -248,10 +290,18 @@ class MainChoicesAPIView(APIView):
raise
APIException
(
"There is no file for instances"
)
raise
APIException
(
"There is no file for instances"
)
def
getClassontologyfile
(
self
,
g
,
es_instance
):
def
getClassontologyfile
(
self
,
g
,
es_instance
):
for
ns_prefix
,
namespace
in
g
.
namespaces
():
if
(
len
(
es_instance
)
==
2
):
for
s
,
p
,
o
in
g
.
triples
((
URIRef
(
namespace
+
es_instance
[
len
(
es_instance
)
-
2
]
.
strip
()
)
,
None
,
None
)):
for
ns_prefix
,
namespace
in
g
.
namespaces
():
return
URIRef
(
namespace
+
es_instance
[
len
(
es_instance
)
-
2
]
.
strip
()
)
for
s
,
p
,
o
in
g
.
triples
((
URIRef
(
'http://delab.csd.auth.gr/ontologies/2018/SAO#'
+
es_instance
[
len
(
es_instance
)
-
2
]
.
strip
()
)
,
None
,
None
)):
raise
APIException
(
"There is no Class in the Ontology "
)
print
(
p
,
s
)
return
URIRef
(
'http://delab.csd.auth.gr/ontologies/2018/SAO#'
+
es_instance
[
len
(
es_instance
)
-
2
]
.
strip
()
)
raise
APIException
(
"There is no Class in the Ontology "
)
else
:
for
ns_prefix
,
namespace
in
g
.
namespaces
():
for
s
,
p
,
o
in
g
.
triples
((
URIRef
(
namespace
+
es_instance
[
len
(
es_instance
)
-
2
]
.
strip
()
)
,
None
,
None
)):
return
URIRef
(
namespace
+
es_instance
[
len
(
es_instance
)
-
2
]
.
strip
()
)
raise
APIException
(
"There is no Class in the Ontology "
)
...
...
reqtool/reqman/api/reqman/apps/reqtool/rest_api/views/suffix_req_views.py
View file @
a80c458d
...
@@ -14,8 +14,8 @@ from reqman.apps.reqtool.rest_api.services import fuseki
...
@@ -14,8 +14,8 @@ from reqman.apps.reqtool.rest_api.services import fuseki
from
rest_framework.response
import
Response
from
rest_framework.response
import
Response
from
rest_framework.views
import
APIView
from
rest_framework.views
import
APIView
from
reqman.apps.reqtool.models.suffix_req
import
S_CHOICES
,
NUMBER_UNITS_CHOICES
,
TIME_UNITS_CHOICES
,
FLOW_CHOICES
#
from reqman.apps.reqtool.models.suffix_req import S_CHOICES, NUMBER_UNITS_CHOICES, TIME_UNITS_CHOICES, FLOW_CHOICES
from
reqman.apps.reqtool.models.suffix_req
import
NUMERICAL_AFFIRMATIVE_CHOICES
,
S2_CHOICES
,
S3_CHOICES
,
S4_CHOICES
,
S5_6_CHOICES
#
from reqman.apps.reqtool.models.suffix_req import NUMERICAL_AFFIRMATIVE_CHOICES, S2_CHOICES, S3_CHOICES, S4_CHOICES, S5_6_CHOICES
from
reqman.apps.reqtool.models.requirements
import
BoilerplateData
from
reqman.apps.reqtool.models.requirements
import
BoilerplateData
...
@@ -77,42 +77,6 @@ class SuffixDetailsAPIView(RetrieveUpdateDestroyAPIView):
...
@@ -77,42 +77,6 @@ class SuffixDetailsAPIView(RetrieveUpdateDestroyAPIView):
instance
.
delete
()
instance
.
delete
()
def
getclassofsuffix
(
self
,
suffix
):
def
getclassofsuffix
(
self
,
suffix
):
for
sys
in
NUMERICAL_AFFIRMATIVE_CHOICES
:
return
(
"S1"
)
if
sys
[
0
]
==
suffix
:
return
(
"S1"
)
for
sys
in
S2_CHOICES
:
if
sys
[
0
]
==
suffix
:
return
(
"S2"
)
for
sys
in
S3_CHOICES
:
if
sys
[
0
]
==
suffix
:
return
(
"S3"
)
for
sys
in
S4_CHOICES
:
if
sys
[
0
]
==
suffix
:
return
(
"S4"
)
#special case only one option for S5, S6
if
S5_6_CHOICES
[
0
][
0
]
==
suffix
:
return
(
"S5"
)
if
S5_6_CHOICES
[
1
][
0
]
==
suffix
:
return
(
"S6"
)
class
SuffixChoicesViewSet
(
APIView
):
def
get
(
self
,
request
):
response
=
Response
(
S_CHOICES
)
return
response
class
NumChoicesViewSet
(
APIView
):
def
get
(
self
,
request
):
response
=
Response
(
NUMBER_UNITS_CHOICES
+
TIME_UNITS_CHOICES
)
return
response
class
FlowChoicesViewSet
(
APIView
):
def
get
(
self
,
request
):
response
=
Response
(
FLOW_CHOICES
)
return
response
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment