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
8f734d18
Commit
8f734d18
authored
May 19, 2022
by
Thodoris Nestoridis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Download Ontology File
parent
92968860
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
1 deletion
+49
-1
boilerplate-list.component.html
...mponents/boilerplate-list/boilerplate-list.component.html
+6
-0
boilerplate-list.component.ts
...components/boilerplate-list/boilerplate-list.component.ts
+12
-0
boilerplate.service.ts
...l/ReqmanAngular11/src/app/services/boilerplate.service.ts
+4
-0
.gitignore
reqtool/reqman/.gitignore
+1
-0
urls.py
reqtool/reqman/api/reqman/apps/reqtool/rest_api/urls.py
+1
-0
requirements_views.py
.../reqman/apps/reqtool/rest_api/views/requirements_views.py
+25
-1
No files found.
reqtool/ReqmanAngular11/src/app/components/boilerplate-list/boilerplate-list.component.html
View file @
8f734d18
...
...
@@ -24,6 +24,12 @@
</div>
</ul>
</div>
<div
fxFlex
fxLayout
fxHide
.
xs
fxLayoutAlign=
"end"
>
<div>
<input
class=
"btn btn-info"
[
disabled
]="
exporting
"
type=
"button"
value=
"Download"
(
click
)="
getCurrentOntology
()"
/>
</div>
</div>
</div>
</div>
...
...
reqtool/ReqmanAngular11/src/app/components/boilerplate-list/boilerplate-list.component.ts
View file @
8f734d18
...
...
@@ -85,6 +85,18 @@ export class BoilerplateListComponent implements OnInit {
this
.
getInfer
();
}
getCurrentOntology
():
void
{
this
.
boilerplateService
.
getCurrentOntolgies
(
this
.
route
.
snapshot
.
params
.
gb
)
.
subscribe
(
res
=>
{
var
url
=
window
.
URL
.
createObjectURL
(
res
);
window
.
open
(
url
);
},
error
=>
{
this
.
notifier
.
notify
(
"warning"
,
'Fail to download ontology file'
);
});
}
retrieveBoilerplates
():
void
{
this
.
boilerplateService
.
getAll
(
this
.
route
.
snapshot
.
params
.
gb
)
.
subscribe
(
...
...
reqtool/ReqmanAngular11/src/app/services/boilerplate.service.ts
View file @
8f734d18
...
...
@@ -75,4 +75,8 @@ export class BoilerplateService {
return
this
.
http
.
get
(
`
${
genericbaseUrl
}
`
+
`/ontologies`
+
`/`
);
}
getCurrentOntolgies
(
gb
:
any
):
Observable
<
any
>
{
return
this
.
http
.
get
(
`
${
genericbaseUrl
}
`
+
`/getontology/
${
gb
}
`
,
{
responseType
:
"blob"
});
}
}
reqtool/reqman/.gitignore
View file @
8f734d18
...
...
@@ -35,6 +35,7 @@ tramp
# eshell files
/eshell/history
/eshell/lastdir
../Ontologies
# elpa packages
/elpa/
...
...
reqtool/reqman/api/reqman/apps/reqtool/rest_api/urls.py
View file @
8f734d18
...
...
@@ -8,6 +8,7 @@ urlpatterns = [
path
(
'users/'
,
user_views
.
UserList
.
as_view
(),
name
=
'api-user-list'
),
path
(
'users/<uuid:pk>/'
,
user_views
.
UserDetail
.
as_view
(),
name
=
'api-post-details'
),
path
(
'ontologies/'
,
requirements_views
.
OntologiesChoicesViewSet
.
as_view
(),
name
=
'api-get-ontologies'
),
path
(
'getontology/<int:groupboil>/'
,
requirements_views
.
GetOntology
.
as_view
(),
name
=
'get-current-ontology'
),
path
(
'groupboilerplates/'
,
requirements_views
.
BoilerplateGroupCreateAPIView
.
as_view
(),
name
=
'api-groupboilerplates-create'
),
path
(
'groupboilerplates/<int:pk>/'
,
requirements_views
.
BoilerplateGroupDetailsAPIView
.
as_view
(),
name
=
'api-groupboilerplates-list'
),
...
...
reqtool/reqman/api/reqman/apps/reqtool/rest_api/views/requirements_views.py
View file @
8f734d18
...
...
@@ -39,7 +39,7 @@ class OntologiesChoicesViewSet(APIView):
data
=
json
.
loads
(
text
)
except
:
pass
list_ontology
=
[
'Default'
]
list_ontology
=
[
'
/
Default'
]
for
i
in
data
[
'datasets'
]
:
list_ontology
.
append
(
i
[
'ds.name'
])
ONTOLOGIES_CHOICES
=
tuple
((
str
(
n
),
str
(
n
))
for
n
in
(
list_ontology
))
...
...
@@ -308,3 +308,27 @@ class PrefixChoicesViewSet(ListAPIView):
group_pk
=
self
.
kwargs
[
'groupboil'
]
queryset_cl
=
BoilerplateGroupClassesInstances
.
objects
.
filter
(
classes_instances_group_of_boilerplate
=
group_pk
)
return
queryset_cl
import
mimetypes
class
GetOntology
(
APIView
):
serializer_class
=
BoilerplateGroupClassesInstances
def
get
(
self
,
request
,
groupboil
,
format
=
None
):
data
=
BoilerplateGroupClassesInstances
.
objects
.
filter
(
classes_instances_group_of_boilerplate
=
groupboil
)
filename
=
data
.
values
(
'ontology_file'
)[
0
][
'ontology_file'
]
+
'infer.ttl'
filepath
=
data
.
values
(
'ontology_file'
)[
0
][
'ontology_file'
]
+
'infer.ttl'
try
:
path
=
open
(
filepath
,
'r'
)
except
:
raise
APIException
(
"Fail to download ontology file"
)
# Set the mime type
mime_type
,
_
=
mimetypes
.
guess_type
(
filepath
)
# Set the return value of the HttpResponse
response
=
HttpResponse
(
path
,
content_type
=
mime_type
)
# Set the HTTP header for sending to browser
response
[
'Content-Disposition'
]
=
"attachment; filename=
%
s"
%
filename
# Return the response value
return
response
\ No newline at end of file
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