Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
10acdfee
Commit
10acdfee
authored
Jul 29, 2020
by
Zahra Najafabadi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working swagger
parent
6adaca17
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
12 deletions
+9
-12
swagger.yml
...hub/semantic-linking-microservice/app/configs/swagger.yml
+3
-3
repository.py
...ta-hub/semantic-linking-microservice/app/db/repository.py
+2
-2
main.py
src/data-hub/semantic-linking-microservice/app/main.py
+1
-1
req.txt
src/data-hub/semantic-linking-microservice/app/req.txt
+0
-1
raw-dataset.py
...hub/semantic-linking-microservice/app/rest/raw-dataset.py
+3
-5
No files found.
src/data-hub/semantic-linking-microservice/app/configs/swagger.yml
View file @
10acdfee
...
...
@@ -42,7 +42,7 @@ paths:
description
:
"
The
raw
dataset
to
be
added"
required
:
true
schema
:
$ref
:
"
#/definitions/Dataset
-UpperCase
"
$ref
:
"
#/definitions/Dataset"
responses
:
201
:
description
:
"
Successful
operation"
...
...
@@ -60,14 +60,14 @@ paths:
schema
:
$ref
:
"
#/definitions/DatasetCollection"
/raw_dataset/{name}
:
/raw_dataset/{name}
:
get
:
operationId
:
"
rest.raw-dataset.get_by_usecase"
tags
:
-
"
raw_dataset"
summary
:
"
Get
single
usecase
dataset"
parameters
:
-
name
:
"
usecas
e"
-
name
:
"
nam
e"
in
:
"
path"
description
:
"
Name
of
the
requested
usecase
dataset"
required
:
true
...
...
src/data-hub/semantic-linking-microservice/app/db/repository.py
View file @
10acdfee
...
...
@@ -22,7 +22,7 @@ class Repository(MongoRepositoryBase):
#region Raw_data
def
add_raw_data
(
self
,
dataset
:
json
):
def
add_raw_data
(
self
,
dataset
:
Raw_Dataset
):
super
()
.
insert_entry
(
self
.
_raw_dataset
,
dataset
.
to_serializable_dict
())
def
get_all_raw_data
(
self
)
->
List
[
Raw_Dataset
]:
...
...
@@ -31,7 +31,7 @@ class Repository(MongoRepositoryBase):
def
get_raw_data
(
self
,
usecase_name
)
->
Raw_Dataset
:
entries
=
super
()
.
get_entries
(
self
.
_raw_dataset
,
selection
=
{
'usecase_name'
:
usecase_name
})
entries
=
[
Raw_Dataset
(
e
)
for
e
in
entries
]
return
[
Raw_Dataset
(
e
)
for
e
in
entries
]
# end region
...
...
src/data-hub/semantic-linking-microservice/app/main.py
View file @
10acdfee
...
...
@@ -25,7 +25,7 @@ def message_received_callback(channel, method, properties, body):
app
=
connexion
.
App
(
__name__
,
specification_dir
=
'configs/'
)
app
.
add_api
(
'swagger.yml'
)
@
app
.
r
est
(
'/'
,
methods
=
[
'GET'
])
@
app
.
r
oute
(
'/'
,
methods
=
[
'GET'
])
def
api_root
():
return
'Endpoint of semantic-linking-microservice!'
...
...
src/data-hub/semantic-linking-microservice/app/req.txt
deleted
100644 → 0
View file @
6adaca17
pkg-resources==0.0.0
src/data-hub/semantic-linking-microservice/app/rest/raw-dataset.py
View file @
10acdfee
...
...
@@ -2,6 +2,7 @@ from flask import request, Response
from
db.repository
import
Repository
import
json
from
db.entities
import
Raw_Dataset
repo
=
Repository
()
...
...
@@ -15,10 +16,7 @@ def post():
def
_insert_raw_data
(
raw_dataset
:
json
):
'''Converts object keys from external source and inserts into database.'''
raw_dataset
[
'usecase_name'
]
=
raw_dataset
.
pop
(
'usecase_name'
)
raw_dataset
[
'properties'
]
=
raw_dataset
.
pop
(
'properties'
)
repo
.
add_raw_data
(
raw_dataset
)
repo
.
add_raw_data
(
Raw_Dataset
(
raw_dataset
))
def
get
():
return
[
dataset
.
to_serializable_dict
()
for
dataset
in
repo
.
get_all_raw_data
()]
...
...
@@ -26,7 +24,7 @@ def get():
def
get_by_usecase
(
name
):
res
=
repo
.
get_raw_data
(
name
)
if
res
is
not
None
:
return
res
.
to_serializable_dict
()
return
[
element
.
to_serializable_dict
()
for
element
in
res
]
else
:
return
Response
(
status
=
404
)
...
...
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