Revision 46775
Added by Sandro La Bruzzo about 7 years ago
scholix_controller.py | ||
---|---|---|
1 | 1 |
import connexion |
2 |
from swagger_server.models.ds_type import DSType |
|
2 |
|
|
3 |
from swagger_server.eu.dnetlib.DLIESConnector import DLIESConnector |
|
3 | 4 |
from swagger_server.models.error import Error |
4 | 5 |
from swagger_server.models.scholix import Scholix |
5 | 6 |
from datetime import date, datetime |
6 | 7 |
from typing import List, Dict |
7 | 8 |
from six import iteritems |
8 | 9 |
from ..util import deserialize_date, deserialize_datetime |
9 |
from swagger_server.eu.dnetlib.DLIESConnector import DLIESConnector |
|
10 | 10 |
|
11 | 11 |
|
12 |
def realtion_from_datasource_get(datasource, page=None):
|
|
12 |
def links_from_datasource_get(datasource, page=None):
|
|
13 | 13 |
""" |
14 | 14 |
Get all scholix relation collected from a datasource |
15 | 15 |
The realtionFromDatasource endpoint returns a list of scholix object collected from a specific datasource |
... | ... | |
27 | 27 |
return c.realtionFromDatasource(datasource, p) |
28 | 28 |
|
29 | 29 |
|
30 |
def realtion_to_pid_get(pid, pidType=None, page=None):
|
|
30 |
def links_from_pid_get(pid, pidType=None, typologyTarget=None, datasourceTarget=None, page=None):
|
|
31 | 31 |
""" |
32 |
Try to resolve a Persistent identifier
|
|
33 |
The realtionToPid endpoint returns a list of scholix object related to a specific persistent identifier
|
|
32 |
Retrieve all scholix links from a persistent identifier
|
|
33 |
The linksFromPid endpoint returns a list of scholix object related from a specific persistent identifier
|
|
34 | 34 |
:param pid: persistent Identifier |
35 | 35 |
:type pid: str |
36 | 36 |
:param pidType: Persistent Identifier Type |
37 | 37 |
:type pidType: str |
38 |
:param typologyTarget: typology target filter should be publication, dataset or unknown |
|
39 |
:type typologyTarget: str |
|
40 |
:param datasourceTarget: a datasource provenace filter of the target relation |
|
41 |
:type datasourceTarget: str |
|
38 | 42 |
:param page: The page of results |
39 | 43 |
:type page: int |
40 | 44 |
|
... | ... | |
44 | 48 |
p = 0 |
45 | 49 |
if page: |
46 | 50 |
p = page |
47 |
return c.realtionToPid(pid, pidType, p) |
|
48 |
|
|
49 |
|
|
50 |
def realtion_to_typology_get(typology, page=None): |
|
51 |
""" |
|
52 |
list of all scholix related to a particular typology |
|
53 |
The realtionToTypology endpoint returns a list of scholix object related to a specific typology (dataset, publication, unknown) |
|
54 |
:param typology: type of target object |
|
55 |
:type typology: str |
|
56 |
:param page: The page of results |
|
57 |
:type page: int |
|
58 |
|
|
59 |
:rtype: List[Scholix] |
|
60 |
""" |
|
61 |
c = DLIESConnector('ip-90-147-167-27.ct1.garrservices.it') |
|
62 |
p = 0 |
|
63 |
if page: |
|
64 |
p = page |
|
65 |
return c.realtionToTypology(typology, p) |
|
51 |
return c.realtionToPid(pid=pid, pidType=pidType, typology=typologyTarget, datasource=datasourceTarget, page=p) |
Also available in: Unified diff
uploaded a new version of dli_api