Revision 50064
Added by Sandro La Bruzzo about 6 years ago
modules/dli-service-portal/trunk/DLI.py | ||
---|---|---|
133 | 133 |
|
134 | 134 |
|
135 | 135 |
|
136 |
@app.route('/api/queryPid/', methods=['post']) |
|
137 |
def query_pid(): |
|
138 |
if 'pid' in request.form: |
|
139 |
print "pid Request for %s "%request.form['pid'] |
|
140 |
connector = DLIESConnector() |
|
141 |
result = connector.query_by_id(request.form['pid']) |
|
142 |
return jsonify(result=result) |
|
143 |
|
|
144 |
|
|
136 | 145 |
@app.route('/api/post/', methods=['post', 'get']) |
137 | 146 |
def query_post(): |
138 | 147 |
action = None |
modules/dli-service-portal/trunk/static/partials/query.html | ||
---|---|---|
40 | 40 |
<f class="header blue-text flow-text"> {{ totalPages }}</f> |
41 | 41 |
</div> |
42 | 42 |
</div> |
43 |
<div class="row" ng-hide="result_query.length">
|
|
43 |
<div class="row" ng-show="searching">
|
|
44 | 44 |
<div class="col-lg-12 center-align"> |
45 | 45 |
<div class="loader"></div> |
46 | 46 |
</div> |
47 |
|
|
48 |
|
|
49 | 47 |
<!-- |
50 | 48 |
<div class="col l12 offset-l4 center-align"> |
51 | 49 |
<h5 class="red-text">No match found</h5> |
52 | 50 |
</div> --> |
53 | 51 |
</div> |
54 | 52 |
|
53 |
|
|
54 |
<div class="row centered" ng-hide="result_query.length"> |
|
55 |
<div class="text-center"> |
|
56 |
|
|
57 |
<h5 class="red-text">No match found</h5> |
|
58 |
</div> |
|
59 |
</div> |
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
55 | 67 |
<div class="row centered" ng-show="result_query.length"> |
56 | 68 |
<div class="text-center"> |
57 | 69 |
<ul class="pagination centered"> |
modules/dli-service-portal/trunk/static/partials/index.html | ||
---|---|---|
4 | 4 |
margin-bottom:5px !important; |
5 | 5 |
margin-top:5px !important; |
6 | 6 |
} |
7 |
|
|
8 |
.form-control { |
|
9 |
border: 0px solid #ffffff; |
|
10 |
} |
|
7 | 11 |
</style> |
8 | 12 |
<!-- Header --> |
9 | 13 |
<section style="padding-bottom: 0px"> |
... | ... | |
12 | 16 |
<div class="col-lg-12 centered"> |
13 | 17 |
<img ng-hide="facet" img class="img-responsive img-centered" style="max-width:400px" src="img/logo_big.png" alt=""> |
14 | 18 |
<div class="row"> |
15 |
<div class="form-group col-lg-10 floating-label-form-group controls">
|
|
19 |
<div class="form-group col-lg-12 ">
|
|
16 | 20 |
<form ng-submit="makeQuery()"> |
17 |
<label>Type your search!</label> |
|
18 |
<input class="form-control" placeholder="Type your search!" id="query" ng-autocomplete options="options" required data-validation-required-message="Please enter your query" ng-model="query"> |
|
19 |
|
|
21 |
<div class="row"> |
|
22 |
<div class="col-lg-10"> |
|
23 |
<input class="form-control" placeholder="Type your search!" id="query" ng-autocomplete options="options" required data-validation-required-message="Please enter your query" ng-model="query"> |
|
24 |
</div> |
|
25 |
<div class="col-lg-2" > |
|
26 |
<a ng-click="makeQuery()" class="btn btn-primary form-control"><span class="glyphicon glyphicon-search"></span> Search</a> |
|
27 |
</div> |
|
28 |
</div> |
|
20 | 29 |
</form> |
21 | 30 |
</div> |
22 |
<div class="form-group col-lg-2"> |
|
23 |
<a ng-click="makeQuery()" class="btn btn-primary"><span class="glyphicon glyphicon-search"></span> Search</a> |
|
24 |
</div> |
|
31 |
|
|
25 | 32 |
</div> |
26 |
</div> |
|
27 |
</div> |
|
28 |
</div> |
|
29 |
</section> |
|
30 | 33 |
|
31 |
<div class="row centered" ng-show="result_query.length"> |
|
32 |
<div class="text-center"> |
|
33 |
<ul class="pagination centered"> |
|
34 |
<li ><a href="#"><</a></li> |
|
35 |
<li class="active" ><a href="#">1</a></li> |
|
36 |
<li><a href="#">2</a></li> |
|
37 |
<li><a href="#">3</a></li> |
|
38 |
<li><a href="#">4</a></li> |
|
39 |
<li><a href="#">5</a></li> |
|
40 |
<li ><a href="#">></a></li> |
|
41 |
</ul> |
|
42 |
</div> |
|
43 |
</div> |
|
34 |
<div class="row" style="margin-top: 20px"> |
|
35 |
<div class="form-group col-lg-12 "> |
|
36 |
<form ng-submit="makeQuery()"> |
|
37 |
<div class="row"> |
|
38 |
<div class="col-lg-10"> |
|
39 |
<input class="form-control" placeholder="Search by persistent Identifier" id="query" ng-autocomplete options="options" required data-validation-required-message="Please enter your query" ng-model="queryPid"> |
|
40 |
</div> |
|
44 | 41 |
|
45 |
<div class="row container-fluid" ng-show="result_query.length"> |
|
46 |
<div class="col-md-3" id="leftCol"> |
|
47 |
<div class="row" ng-repeat="item in facet"> |
|
48 |
<div class="panel panel-primary"> |
|
49 |
<div class="panel-heading"><b>{{ item.facet }}</b></div> |
|
50 |
<div class="panel-body"> |
|
51 |
<ul class="list-group"> |
|
52 |
<li class="list-group-item" ng-repeat="value in item.values"> |
|
42 |
<div class="col-lg-2" > |
|
43 |
<a ng-click="makeQueryPid()" class="btn btn-primary form-control"><span class="glyphicon glyphicon-search"></span> Search PID</a> |
|
44 |
</div> |
|
45 |
</div> |
|
46 |
</form> |
|
47 |
</div> |
|
53 | 48 |
|
54 |
<span class="badge">{{ value.value }}</span> |
|
55 |
<a href="#">{{ value.key }}</a> |
|
56 |
</li> |
|
57 |
</ul> |
|
58 |
</div> |
|
59 |
</div> |
|
60 |
</div> |
|
61 |
</div> |
|
62 |
<div class="col-md-9 col-xs-12"> |
|
63 |
<div class="row" ng-repeat="result in result_query"> |
|
64 |
<div class="col-lg-12"> |
|
65 |
<a href="#/detail/{{ result.identifier }}"> |
|
66 |
<i ng-hide="result.objectType!= 'unknown' " |
|
67 |
style="padding: 10px" |
|
68 |
class="fa fa-question-circle fa-2x blue-text circle responsive-img"></i> |
|
69 |
<i ng-show="result.objectType=='dataset'" style="padding: 10px" |
|
70 |
class="fa fa-database fa-2x blue-text circle responsive-img"></i> |
|
71 |
<i style="padding: 10px" ng-show="result.objectType=='publication'" |
|
72 |
class="fa fa-book fa-2x blue-text circle responsive-img"></i> |
|
73 |
<b ng-show="result.title">{{result.title}}</b> |
|
74 |
<b ng-hide="result.title">Metadata non resolved for pid : {{result.pid}}</b> |
|
75 |
</a> |
|
76 |
</div> |
|
49 |
</div> |
|
77 | 50 |
|
78 |
<div class="col-lg-12"> |
|
79 |
<d style="font-size: small"></d> |
|
80 |
<auth style="font-size: small; color: #1565C0" |
|
81 |
ng-repeat="author in result.authors"> |
|
82 |
<f ng-hide="$index==0">,</f> |
|
83 |
{{author}} |
|
84 |
</auth> |
|
85 |
<d ng-show="result.date">- {{result.date}}</d> |
|
86 |
</d> |
|
51 |
|
|
52 |
</div> |
|
87 | 53 |
</div> |
88 |
<p> |
|
89 |
<div class="col-lg-2"> |
|
90 |
<auth style="font-size: small" class="orange-text"> <b>{{ countRelatedDatasets(result) |
|
91 |
}}</b> Related Datasets |
|
92 |
</auth> |
|
93 |
</div> |
|
94 |
<div class="col-lg-2"> |
|
95 |
<auth style="font-size: small" class="orange-text"><b> {{ |
|
96 |
countRelatedPublication(result) }}</b> Related Publications |
|
97 |
</auth> |
|
98 |
</div> |
|
99 |
<div class="col-lg-2"> |
|
100 |
<auth style="font-size: small" class="orange-text"> <b>{{ countOtherRelations(result) |
|
101 |
}}</b> Other Relations |
|
102 |
</auth> |
|
103 |
</div> |
|
104 |
<div class="col-lg-2"> |
|
105 |
<auth style="font-size: small" class="orange-text"><a |
|
106 |
href="{{ result.resolved_url }}" class="orange-text"> <i |
|
107 |
class="fa fa-link"></i> Original Object </a></auth> |
|
108 |
</div> |
|
109 |
<div class="col-lg-3"> |
|
110 |
[ |
|
111 |
<auth style="font-size: small" class="orange-text" |
|
112 |
ng-repeat="prov in result.provenance_record"> |
|
113 |
<f ng-hide="$index==0">,</f> |
|
114 |
{{prov.name}} |
|
115 |
</auth> |
|
116 |
<d style="font-size: small">]</d> |
|
117 |
</div> |
|
118 |
|
|
119 | 54 |
</div> |
120 |
</div> |
|
121 |
</div> |
|
55 |
</section> |
|
122 | 56 |
|
123 |
|
|
124 |
|
|
125 |
<section id="#stats" ng-hide="facet"> |
|
57 |
<section id="#stats"> |
|
126 | 58 |
<div class="container"> |
127 | 59 |
<div class="row text-center"> |
128 | 60 |
<div class="col-lg-12 col-xs-12"> |
modules/dli-service-portal/trunk/static/partials/api.html | ||
---|---|---|
12 | 12 |
understand systematically what data underpins literature and what literature references |
13 | 13 |
data. |
14 | 14 |
|
15 |
Scholix maintains an evolving set of <a href="www.scholix.org">Guidelines</a> consisting of: |
|
15 |
Scholix maintains an evolving set of <a href="http://www.scholix.org">Guidelines</a> consisting of:
|
|
16 | 16 |
(i) an information model (conceptual definition of what is a Scholix scholarly link), (ii) a |
17 | 17 |
link metadata schema (set of metadata fields representing a Scholix link), and (iii) |
18 | 18 |
a corresponding XML and JSON schema. |
... | ... | |
42 | 42 |
The APIs are available from <a |
43 | 43 |
href="https://api.scholexplorer.openaire.eu/v1/ui"> here</a>. The results of queries return lists of |
44 | 44 |
links encoded as JSON Scholix records. JSON (and XML) schema and example records for Scholix links are availabe on |
45 |
<a href="https://github.com/scholix/schema">GitHib</a>.
|
|
45 |
<a href="https://github.com/scholix/schema">GitHub</a>.
|
|
46 | 46 |
|
47 | 47 |
</div> |
48 | 48 |
</div> |
modules/dli-service-portal/trunk/static/partials/about.html | ||
---|---|---|
11 | 11 |
Scholexplorer populates and provides access to a graph of links between dataset |
12 | 12 |
and literature objects and dataset |
13 | 13 |
and dataset objects. Links (and objects) are provided by data sources managed by |
14 |
publishers (e.g. Elsevier, Thomson Reuters), data centers (e.g. PANGAEA, CCDC), or other
|
|
14 |
publishers, data centers, or other
|
|
15 | 15 |
organizations providing services to store and manage links between data sets and |
16 |
publications (e.g. CrossRef, DataCite, OpenAIRE). Scholexplorer aggregates link metadata |
|
17 |
harvested from |
|
18 |
the |
|
19 |
data sources and out of these builds and harmonised and de-duplicated graph of scholarly |
|
16 |
publications such as CrossRef, DataCite, and OpenAIRE. Scholexplorer aggregates link metadata |
|
17 |
harvested from the data sources and out of these builds and harmonised and de-duplicated graph of scholarly |
|
20 | 18 |
objects. The graph is openly accessible (CC-0) via <a |
21 | 19 |
href="api.scholexplorer.openaire.eu/v1/ui">search REST APIs </a> |
22 |
that return links in <a href="www.scholix.org"> Scholix format</a>. |
|
20 |
that return links in <a href="http://www.scholix.org"> Scholix format</a>.
|
|
23 | 21 |
|
24 | 22 |
|
25 | 23 |
</div> |
modules/dli-service-portal/trunk/static/partials/statistics.html | ||
---|---|---|
7 | 7 |
<li role="presentation" class="active"><a href="#tabstats" role="tab" id="profile-tab" |
8 | 8 |
data-toggle="tab" |
9 | 9 |
aria-controls="profile" aria-expanded="false"><h4> |
10 |
Graph Statistics</h4></a></li> |
|
11 |
<li role="presentation"><a href="#graphstats" id="home-tab" role="tab" data-toggle="tab" |
|
12 |
aria-controls="home" aria-expanded="true"><h4>Tabular Statistics</h4></a> |
|
13 |
</li> |
|
10 |
Statistics</h4></a></li> |
|
11 |
|
|
14 | 12 |
<li role="presentation"><a href="#historystats" role="tab" id="profile-tab" data-toggle="tab" |
15 |
aria-controls="profile" aria-expanded="false"><h4>History |
|
16 |
Statistics </h4></a></li> |
|
13 |
aria-controls="profile" aria-expanded="false"><h4>History</h4></a></li> |
|
17 | 14 |
|
18 | 15 |
</ul> |
19 | 16 |
|
20 | 17 |
<div id="myTabContent" class="tab-content"> |
21 | 18 |
|
22 | 19 |
|
23 |
<div role="tabpanel" class="tab-pane fade active in" id="tabstats" aria-labelledby="home-tab"> |
|
24 |
<div class="row"> |
|
25 |
<div class="col-lg-12"> |
|
26 | 20 |
|
27 |
<div> |
|
28 |
<div class="row center"> |
|
29 |
<div class="col-lg-4 col-lg-offset-2 col-sm-12"> |
|
30 |
<h4><b>Links</b></h4> |
|
31 |
</div> |
|
32 |
<div class="col l4 s12"> |
|
33 |
<h4><b>Objects</b></h4> |
|
34 |
</div> |
|
35 |
</div> |
|
36 |
<div class="row center"> |
|
37 |
<div class="col-lg-4 col-lg-offset-2 col-sm-12"> |
|
38 |
<div id="chart_links"></div> |
|
39 |
</div> |
|
40 | 21 |
|
41 |
<div class="col-lg-4 "> |
|
42 |
<div id="chart_objects"></div> |
|
43 |
</div> |
|
44 |
</div> |
|
45 |
|
|
46 |
|
|
47 |
<div class="row center"> |
|
48 |
<div class="col-lg-4 col-lg-offset-2 col-sm-12"> |
|
49 |
<h4><b>Literature</b></h4> |
|
50 |
</div> |
|
51 |
<div class="col-lg-4 col-lg-offset-2 col-sm-12"> |
|
52 |
<h4><b>Datasets</b></h4> |
|
53 |
</div> |
|
54 |
</div> |
|
55 |
<div class="row center"> |
|
56 |
<div class="col-lg-4 col-lg-offset-2 col-sm-12"> |
|
57 |
<div id="chart_publication"></div> |
|
58 |
</div> |
|
59 |
|
|
60 |
<div class="col-lg-4"> |
|
61 |
<div id="chart_dataset"></div> |
|
62 |
</div> |
|
63 |
</div> |
|
64 |
</div> |
|
65 |
</div> |
|
66 |
</div> |
|
67 |
</div> |
|
68 |
|
|
69 |
|
|
70 |
<div role="tabpanel" class="tab-pane fade " id="graphstats" aria-labelledby="dropdown1-tab"> |
|
22 |
<div role="tabpanel" class="tab-pane fade in active" id="tabstats" aria-labelledby="dropdown1-tab"> |
|
71 | 23 |
<div class="row"> |
72 | 24 |
<div class="col-lg-12"> |
73 | 25 |
|
... | ... | |
77 | 29 |
<div class="row"> |
78 | 30 |
|
79 | 31 |
<div class="col-lg-12"> |
80 |
<table class="table table-striped"> |
|
32 |
<table class="table "> |
|
33 |
|
|
34 |
<col> |
|
35 |
<colgroup span="3"></colgroup> |
|
36 |
<tr> |
|
37 |
<td rowspan="1" class="text-left"><b>Content Provider</b></td> |
|
38 |
<th rowspan="1" class="text-right">Links</th> |
|
39 |
<th colspan="4" scope="colgroup" class="text-center">Object</th> |
|
40 |
</tr> |
|
41 |
<tr> |
|
42 |
<th class="text-left"></th> |
|
43 |
<th class="text-right"></th> |
|
44 |
<th class="text-right" scope="col">Publication</th> |
|
45 |
<th class="text-right" scope="col">Dataset</th> |
|
46 |
<th class="text-right" scope="col">Unknown</th> |
|
47 |
<th class="text-right" scope="col">total</th> |
|
48 |
</tr> |
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
<!-- |
|
81 | 53 |
<tr class="orange-text"> |
82 | 54 |
|
83 | 55 |
<td class="text-left"><b>Content provider</b></td> |
... | ... | |
87 | 59 |
<td class="text-right"><b>Referred datasets</b></td> |
88 | 60 |
<td class="text-right"><b>Referred objects of unknown |
89 | 61 |
typology</b></td> |
62 |
</tr> |
|
63 |
--> |
|
90 | 64 |
|
91 |
<!--<td class="right-align">Contributed relationships</td> --> |
|
92 |
</tr> |
|
93 | 65 |
<tr ng-repeat="item in stats"> |
94 | 66 |
<td class="left-align"><a |
95 |
href='#/datasource/id/{{ item.acronym }}'>{{ item.datasource }} </a> |
|
67 |
href='#/datasource/id/{{ item.acronym }}'>{{ item.datasourceName }} </a>
|
|
96 | 68 |
</td> |
97 |
<td class="text-right"> {{ item.numberOfRelations }}</td>
|
|
98 |
<td class="text-right">{{ item.numberOfObjects }}</td>
|
|
99 |
<td class="text-right">{{ item.referredPublication }}</td>
|
|
100 |
<td class="text-right">{{ item.referredDataset }}</td>
|
|
101 |
<td class="text-right">{{ item.referredUnknown }}
|
|
69 |
<td class="text-right"> {{ item.links }}</td>
|
|
70 |
<td class="text-right">{{ item.publication }}</td>
|
|
71 |
<td class="text-right">{{ item.dataset }}</td>
|
|
72 |
<td class="text-right">{{ item.unknown }}</td>
|
|
73 |
<td class="text-right">{{ item.total }}
|
|
102 | 74 |
</td> |
103 | 75 |
|
104 | 76 |
</tr> |
modules/dli-service-portal/trunk/static/angular/mainPageController.js | ||
---|---|---|
96 | 96 |
$location.path("/query/q=" + $scope.query); |
97 | 97 |
}; |
98 | 98 |
|
99 |
$scope.makeQueryPid= function () { |
|
100 |
$location.path("/query/q=undefined").search({pid: $scope.queryPid}); |
|
101 |
}; |
|
102 |
|
|
99 | 103 |
$scope.$watch("query", function () { |
100 | 104 |
if($scope.query == null || $scope.query.length==0){ |
101 | 105 |
$scope.result_query=null; |
modules/dli-service-portal/trunk/static/angular/service_v10.js | ||
---|---|---|
16 | 16 |
return $http.post('/api/post/', $.param({'action': "query", 'query': query, 'start': (page - 1) * 10, 'filter':filter, 'value':value})); |
17 | 17 |
} |
18 | 18 |
}; |
19 |
|
|
20 |
factory.queryPid = function (pid) { |
|
21 |
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8"; |
|
22 |
console.log("Make query for PID "+pid) |
|
23 |
return $http.post('/api/queryPid/', $.param({ 'pid': pid})); |
|
24 |
}; |
|
25 |
|
|
19 | 26 |
factory.getStatsDetail = function () { |
20 | 27 |
//$http.defaults.headers.get["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8"; |
21 | 28 |
return $http.get('currentStats.json'); |
modules/dli-service-portal/trunk/static/angular/queryController.js | ||
---|---|---|
124 | 124 |
}; |
125 | 125 |
|
126 | 126 |
|
127 |
$scope.arguments = $location.$$search; |
|
128 |
|
|
129 |
$scope.pidQuery = null; |
|
130 |
|
|
131 |
if ('pid' in $scope.arguments) { |
|
132 |
$scope.pidQuery =$scope.arguments['pid'] |
|
133 |
} |
|
134 |
|
|
135 |
|
|
136 |
|
|
127 | 137 |
$scope.query = $routeParams['q']; |
138 |
$scope.searching = true; |
|
128 | 139 |
|
129 | 140 |
$scope.filterType = $routeParams['f']; |
130 | 141 |
$scope.filters = [] |
... | ... | |
188 | 199 |
return nArray; |
189 | 200 |
} |
190 | 201 |
|
191 |
queryService.query($scope.query, $scope.page, $scope.filter).success(function (data) { |
|
192 | 202 |
|
193 |
$scope.result_query = data['result']['hits']; |
|
194 |
$scope.facet = data['result']['facet']; |
|
195 |
$scope.total = data['result']['total']; |
|
203 |
if ($scope.pidQuery == null) { |
|
196 | 204 |
|
197 |
var totalPages = Math.round($scope.total / 10); |
|
205 |
queryService.query($scope.query, $scope.page, $scope.filter).success(function (data) { |
|
206 |
$scope.searching = false; |
|
198 | 207 |
|
199 |
if ($scope.total > 10 && $scope.total % 10) |
|
200 |
totalPages += 1; |
|
208 |
$scope.result_query = data['result']['hits']; |
|
209 |
$scope.facet = data['result']['facet']; |
|
210 |
$scope.total = data['result']['total']; |
|
201 | 211 |
|
202 |
$scope.totalPages = totalPages ;
|
|
212 |
var totalPages = Math.round($scope.total / 10);
|
|
203 | 213 |
|
204 |
$scope.lastPage = Math.min($scope.pageto, totalPages - 1); |
|
214 |
if ($scope.total > 10 && $scope.total % 10) |
|
215 |
totalPages += 1; |
|
205 | 216 |
|
217 |
$scope.totalPages = totalPages ; |
|
206 | 218 |
|
207 |
if ($scope.page != null) |
|
208 |
$scope.pageto = Math.max(Math.min($scope.pageFrom + 4, $scope.lastPage), $scope.page); |
|
209 |
else { |
|
210 |
$scope.page = 1; |
|
211 |
$scope.pageto = Math.max(Math.min($scope.pageFrom + 4, $scope.lastPage), 1); |
|
212 |
} |
|
213 |
$scope.pageRange = []; |
|
214 |
for (var i = $scope.pageFrom; i <= $scope.pageto; i++) { |
|
215 |
$scope.pageRange.push(i) |
|
216 |
} |
|
217 |
}).error(function (data) { |
|
219 |
$scope.lastPage = Math.min($scope.pageto, totalPages - 1); |
|
218 | 220 |
|
219 |
}) |
|
221 |
|
|
222 |
if ($scope.page != null) |
|
223 |
$scope.pageto = Math.max(Math.min($scope.pageFrom + 4, $scope.lastPage), $scope.page); |
|
224 |
else { |
|
225 |
$scope.page = 1; |
|
226 |
$scope.pageto = Math.max(Math.min($scope.pageFrom + 4, $scope.lastPage), 1); |
|
227 |
} |
|
228 |
$scope.pageRange = []; |
|
229 |
for (var i = $scope.pageFrom; i <= $scope.pageto; i++) { |
|
230 |
$scope.pageRange.push(i) |
|
231 |
} |
|
232 |
}).error(function (data) { |
|
233 |
|
|
234 |
}) |
|
235 |
|
|
236 |
} |
|
237 |
|
|
238 |
else { |
|
239 |
console.log("dovrei essere qui!") |
|
240 |
queryService.queryPid($scope.pidQuery).success(function (data) { |
|
241 |
$scope.searching = false; |
|
242 |
|
|
243 |
$scope.result_query = data['result']['hits']; |
|
244 |
$scope.facet = data['result']['facet']; |
|
245 |
$scope.total = data['result']['total']; |
|
246 |
|
|
247 |
var totalPages = Math.round($scope.total / 10); |
|
248 |
|
|
249 |
if ($scope.total > 10 && $scope.total % 10) |
|
250 |
totalPages += 1; |
|
251 |
|
|
252 |
$scope.totalPages = totalPages ; |
|
253 |
|
|
254 |
$scope.lastPage = Math.min($scope.pageto, totalPages - 1); |
|
255 |
|
|
256 |
|
|
257 |
if ($scope.page != null) |
|
258 |
$scope.pageto = Math.max(Math.min($scope.pageFrom + 4, $scope.lastPage), $scope.page); |
|
259 |
else { |
|
260 |
$scope.page = 1; |
|
261 |
$scope.pageto = Math.max(Math.min($scope.pageFrom + 4, $scope.lastPage), 1); |
|
262 |
} |
|
263 |
$scope.pageRange = []; |
|
264 |
for (var i = $scope.pageFrom; i <= $scope.pageto; i++) { |
|
265 |
$scope.pageRange.push(i) |
|
266 |
} |
|
267 |
}) |
|
268 |
} |
|
269 |
|
|
270 |
|
|
271 |
|
|
220 | 272 |
}]); |
modules/dli-service-portal/trunk/static/currentStats.json | ||
---|---|---|
1 | 1 |
{ |
2 |
"stats": [ |
|
3 |
{ |
|
4 |
"referredPublication": 18, |
|
5 |
"referredDataset": 18, |
|
6 |
"numberOfRelations": 36, |
|
7 |
"datasource": "", |
|
8 |
"numberOfDatasets": 18, |
|
9 |
"numberOfPublication": 15, |
|
10 |
"referredUnknown": 0, |
|
11 |
"numberOfUnknown": 0, |
|
12 |
"numberOfObjects": 33 |
|
13 |
}, |
|
14 |
{ |
|
15 |
"referredPublication": 14125, |
|
16 |
"referredDataset": 14642, |
|
17 |
"numberOfRelations": 29284, |
|
18 |
"datasource": "OpenAIRE", |
|
19 |
"numberOfDatasets": 4124, |
|
20 |
"numberOfPublication": 12939, |
|
21 |
"referredUnknown": 517, |
|
22 |
"numberOfUnknown": 472, |
|
23 |
"numberOfObjects": 17535 |
|
24 |
}, |
|
25 |
{ |
|
26 |
"referredPublication": 87713, |
|
27 |
"referredDataset": 87824, |
|
28 |
"numberOfRelations": 175648, |
|
29 |
"datasource": "RCSB", |
|
30 |
"numberOfDatasets": 88040, |
|
31 |
"numberOfPublication": 43667, |
|
32 |
"referredUnknown": 111, |
|
33 |
"numberOfUnknown": 79, |
|
34 |
"numberOfObjects": 131786 |
|
35 |
}, |
|
36 |
{ |
|
37 |
"referredPublication": 112847, |
|
38 |
"referredDataset": 525880, |
|
39 |
"numberOfRelations": 856181, |
|
40 |
"datasource": "Pangaea", |
|
41 |
"numberOfDatasets": 186248, |
|
42 |
"numberOfPublication": 14502, |
|
43 |
"referredUnknown": 217454, |
|
44 |
"numberOfUnknown": 37494, |
|
45 |
"numberOfObjects": 238244 |
|
46 |
}, |
|
47 |
{ |
|
48 |
"referredPublication": 886400, |
|
49 |
"referredDataset": 31408133, |
|
50 |
"numberOfRelations": 33762553, |
|
51 |
"datasource": "Datasets in Datacite", |
|
52 |
"numberOfDatasets": 1999034, |
|
53 |
"numberOfPublication": 350138, |
|
54 |
"referredUnknown": 1468020, |
|
55 |
"numberOfUnknown": 648922, |
|
56 |
"numberOfObjects": 2998094 |
|
57 |
}, |
|
58 |
{ |
|
59 |
"referredPublication": 634785, |
|
60 |
"referredDataset": 638885, |
|
61 |
"numberOfRelations": 1276152, |
|
62 |
"datasource": "Cambridge Crystallographic Data Centre", |
|
63 |
"numberOfDatasets": 629701, |
|
64 |
"numberOfPublication": 274969, |
|
65 |
"referredUnknown": 2482, |
|
66 |
"numberOfUnknown": 1331, |
|
67 |
"numberOfObjects": 906001 |
|
68 |
}, |
|
69 |
{ |
|
70 |
"referredPublication": 0, |
|
71 |
"referredDataset": 216, |
|
72 |
"numberOfRelations": 432, |
|
73 |
"datasource": "3TU.Datacentrum", |
|
74 |
"numberOfDatasets": 164, |
|
75 |
"numberOfPublication": 0, |
|
76 |
"referredUnknown": 216, |
|
77 |
"numberOfUnknown": 187, |
|
78 |
"numberOfObjects": 351 |
|
79 |
}, |
|
80 |
{ |
|
81 |
"referredPublication": 133402, |
|
82 |
"referredDataset": 133402, |
|
83 |
"numberOfRelations": 266804, |
|
84 |
"datasource": "ICPSR", |
|
85 |
"numberOfDatasets": 6721, |
|
86 |
"numberOfPublication": 63389, |
|
87 |
"referredUnknown": 0, |
|
88 |
"numberOfUnknown": 0, |
|
89 |
"numberOfObjects": 70110 |
|
90 |
}, |
|
91 |
{ |
|
92 |
"referredPublication": 603, |
|
93 |
"referredDataset": 794, |
|
94 |
"numberOfRelations": 1474, |
|
95 |
"datasource": "IEDA", |
|
96 |
"numberOfDatasets": 496, |
|
97 |
"numberOfPublication": 395, |
|
98 |
"referredUnknown": 77, |
|
99 |
"numberOfUnknown": 30, |
|
100 |
"numberOfObjects": 921 |
|
101 |
}, |
|
102 |
{ |
|
103 |
"referredPublication": 23714, |
|
104 |
"referredDataset": 24878, |
|
105 |
"numberOfRelations": 48592, |
|
106 |
"datasource": "Thomson Reuters", |
|
107 |
"numberOfDatasets": 24596, |
|
108 |
"numberOfPublication": 4271, |
|
109 |
"referredUnknown": 0, |
|
110 |
"numberOfUnknown": 0, |
|
111 |
"numberOfObjects": 28867 |
|
112 |
}, |
|
113 |
{ |
|
114 |
"referredPublication": 516408, |
|
115 |
"referredDataset": 516408, |
|
116 |
"numberOfRelations": 1032816, |
|
117 |
"datasource": "PubMed", |
|
118 |
"numberOfDatasets": 406308, |
|
119 |
"numberOfPublication": 102148, |
|
120 |
"referredUnknown": 0, |
|
121 |
"numberOfUnknown": 0, |
|
122 |
"numberOfObjects": 508456 |
|
123 |
}, |
|
124 |
{ |
|
125 |
"referredPublication": 28237, |
|
126 |
"referredDataset": 28255, |
|
127 |
"numberOfRelations": 56510, |
|
128 |
"datasource": "Springer Nature", |
|
129 |
"numberOfDatasets": 28201, |
|
130 |
"numberOfPublication": 7076, |
|
131 |
"referredUnknown": 18, |
|
132 |
"numberOfUnknown": 12, |
|
133 |
"numberOfObjects": 35289 |
|
134 |
}, |
|
135 |
{ |
|
136 |
"referredPublication": 69486, |
|
137 |
"referredDataset": 69486, |
|
138 |
"numberOfRelations": 138972, |
|
139 |
"datasource": "Elsevier", |
|
140 |
"numberOfDatasets": 65849, |
|
141 |
"numberOfPublication": 24158, |
|
142 |
"referredUnknown": 0, |
|
143 |
"numberOfUnknown": 0, |
|
144 |
"numberOfObjects": 90007 |
|
145 |
}, |
|
146 |
{ |
|
147 |
"referredPublication": 9775, |
|
148 |
"referredDataset": 9777, |
|
149 |
"numberOfRelations": 19552, |
|
150 |
"datasource": "Australian National Data Service", |
|
151 |
"numberOfDatasets": 9777, |
|
152 |
"numberOfPublication": 2634, |
|
153 |
"referredUnknown": 0, |
|
154 |
"numberOfUnknown": 0, |
|
155 |
"numberOfObjects": 12411 |
|
156 |
}, |
|
157 |
{ |
|
158 |
"referredPublication": 47, |
|
159 |
"referredDataset": 47, |
|
160 |
"numberOfRelations": 94, |
|
161 |
"datasource": "IEEE", |
|
162 |
"numberOfDatasets": 47, |
|
163 |
"numberOfPublication": 12, |
|
164 |
"referredUnknown": 0, |
|
165 |
"numberOfUnknown": 0, |
|
166 |
"numberOfObjects": 59 |
|
167 |
}, |
|
168 |
{ |
|
169 |
"referredPublication": 0, |
|
170 |
"referredDataset": 0, |
|
171 |
"numberOfRelations": 0, |
|
172 |
"datasource": "Crossref", |
|
173 |
"numberOfDatasets": 9687, |
|
174 |
"numberOfPublication": 383150, |
|
175 |
"referredUnknown": 0, |
|
176 |
"numberOfUnknown": 0, |
|
177 |
"numberOfObjects": 392837 |
|
178 |
} |
|
179 |
] |
|
2 |
"stats": [ |
|
3 |
{ |
|
4 |
"datasourceName": "OpenAIRE", |
|
5 |
"publication": 14139, |
|
6 |
"links": 29262, |
|
7 |
"unknown": 472, |
|
8 |
"dataset": 4124, |
|
9 |
"total": 18735 |
|
10 |
}, |
|
11 |
{ |
|
12 |
"datasourceName": "RCSB", |
|
13 |
"publication": 44859, |
|
14 |
"links": 175648, |
|
15 |
"unknown": 79, |
|
16 |
"dataset": 88687, |
|
17 |
"total": 133625 |
|
18 |
}, |
|
19 |
{ |
|
20 |
"datasourceName": "Pangaea", |
|
21 |
"publication": 14671, |
|
22 |
"links": 859076, |
|
23 |
"unknown": 37682, |
|
24 |
"dataset": 289395, |
|
25 |
"total": 341748 |
|
26 |
}, |
|
27 |
{ |
|
28 |
"datasourceName": "Datasets in Datacite", |
|
29 |
"publication": 381351, |
|
30 |
"links": 44121092, |
|
31 |
"unknown": 1017376, |
|
32 |
"dataset": 2646694, |
|
33 |
"total": 4045421 |
|
34 |
}, |
|
35 |
{ |
|
36 |
"datasourceName": "Cambridge Crystallographic Data Centre", |
|
37 |
"publication": 278005, |
|
38 |
"links": 1296158, |
|
39 |
"unknown": 2306, |
|
40 |
"dataset": 639698, |
|
41 |
"total": 920009 |
|
42 |
}, |
|
43 |
{ |
|
44 |
"datasourceName": "NCBI Nucleotide", |
|
45 |
"publication": 0, |
|
46 |
"links": 0, |
|
47 |
"unknown": 0, |
|
48 |
"dataset": 59200, |
|
49 |
"total": 59200 |
|
50 |
}, |
|
51 |
{ |
|
52 |
"datasourceName": "Thomson Reuters", |
|
53 |
"publication": 4271, |
|
54 |
"links": 48956, |
|
55 |
"unknown": 0, |
|
56 |
"dataset": 24596, |
|
57 |
"total": 28867 |
|
58 |
}, |
|
59 |
{ |
|
60 |
"datasourceName": "Australian National Data Service", |
|
61 |
"publication": 2634, |
|
62 |
"links": 18854, |
|
63 |
"unknown": 0, |
|
64 |
"dataset": 5293, |
|
65 |
"total": 7927 |
|
66 |
}, |
|
67 |
{ |
|
68 |
"datasourceName": "Mendeley Data", |
|
69 |
"publication": 15, |
|
70 |
"links": 36, |
|
71 |
"unknown": 0, |
|
72 |
"dataset": 18, |
|
73 |
"total": 33 |
|
74 |
}, |
|
75 |
{ |
|
76 |
"datasourceName": "IEDA", |
|
77 |
"publication": 395, |
|
78 |
"links": 1460, |
|
79 |
"unknown": 30, |
|
80 |
"dataset": 491, |
|
81 |
"total": 916 |
|
82 |
}, |
|
83 |
{ |
|
84 |
"datasourceName": "European Nucleotide Archive", |
|
85 |
"publication": 0, |
|
86 |
"links": 0, |
|
87 |
"unknown": 0, |
|
88 |
"dataset": 399737, |
|
89 |
"total": 399737 |
|
90 |
}, |
|
91 |
{ |
|
92 |
"datasourceName": "PubMed", |
|
93 |
"publication": 102148, |
|
94 |
"links": 1032816, |
|
95 |
"unknown": 0, |
|
96 |
"dataset": 406308, |
|
97 |
"total": 508456 |
|
98 |
}, |
|
99 |
{ |
|
100 |
"datasourceName": "3TU.Datacentrum", |
|
101 |
"publication": 0, |
|
102 |
"links": 432, |
|
103 |
"unknown": 187, |
|
104 |
"dataset": 164, |
|
105 |
"total": 351 |
|
106 |
}, |
|
107 |
{ |
|
108 |
"datasourceName": "Springer Nature", |
|
109 |
"publication": 7067, |
|
110 |
"links": 56510, |
|
111 |
"unknown": 12, |
|
112 |
"dataset": 28201, |
|
113 |
"total": 35280 |
|
114 |
}, |
|
115 |
{ |
|
116 |
"datasourceName": "Elsevier", |
|
117 |
"publication": 24352, |
|
118 |
"links": 138976, |
|
119 |
"unknown": 0, |
|
120 |
"dataset": 65849, |
|
121 |
"total": 90201 |
|
122 |
}, |
|
123 |
{ |
|
124 |
"datasourceName": "ICPSR", |
|
125 |
"publication": 64279, |
|
126 |
"links": 270314, |
|
127 |
"unknown": 0, |
|
128 |
"dataset": 6830, |
|
129 |
"total": 71109 |
|
130 |
}, |
|
131 |
{ |
|
132 |
"datasourceName": "IEEE", |
|
133 |
"publication": 12, |
|
134 |
"links": 94, |
|
135 |
"unknown": 0, |
|
136 |
"dataset": 47, |
|
137 |
"total": 59 |
|
138 |
}, |
|
139 |
{ |
|
140 |
"datasourceName": "Crossref", |
|
141 |
"publication": 458847, |
|
142 |
"links": 0, |
|
143 |
"unknown": 0, |
|
144 |
"dataset": 0, |
|
145 |
"total": 458847 |
|
146 |
} |
|
147 |
] |
|
180 | 148 |
} |
modules/dli-service-portal/trunk/eu/dnetlib/es_connector.py | ||
---|---|---|
1 | 1 |
from json import JSONEncoder |
2 | 2 |
|
3 | 3 |
import sys |
4 |
|
|
5 |
import re |
|
4 | 6 |
from elasticsearch import Elasticsearch |
5 | 7 |
from elasticsearch_dsl import * |
6 | 8 |
|
7 | 9 |
import os |
8 | 10 |
from os import path |
9 | 11 |
|
10 |
|
|
11 | 12 |
pid_resolver = { |
12 | 13 |
"pdb": "http://www.rcsb.org/pdb/explore/explore.do?structureId=%s", |
13 | 14 |
"ncbi-n": "http://www.ncbi.nlm.nih.gov/gquery/?term=%s", |
... | ... | |
35 | 36 |
|
36 | 37 |
|
37 | 38 |
def resolveIdentifier(pid, pid_type): |
38 |
if pid_type!= None: |
|
39 |
if pid_type.lower() in pid_resolver: |
|
39 |
|
|
40 |
|
|
41 |
if pid_type != None: |
|
42 |
regex = r"\b(10[.][0-9]{4,}(?:[.][0-9]+)*/(?:(?![\"&\'<>])\S)+)\b" |
|
43 |
if re.match(regex,pid): |
|
44 |
print "It should be doi" |
|
45 |
pid_type='doi' |
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
if pid_type.lower() in pid_resolver: |
|
40 | 50 |
return pid_resolver[pid_type.lower()] % pid |
41 | 51 |
else: |
42 | 52 |
if pid_type.lower() == 'openaire': |
43 |
return "https://www.openaire.eu/search/publication?articleId=%s"%pid.replace('oai:dnet:','')
|
|
53 |
return "https://www.openaire.eu/search/publication?articleId=%s" % pid.replace('oai:dnet:', '')
|
|
44 | 54 |
else: |
45 | 55 |
return "http://identifiers.org/%s:%s" % (pid_type, pid) |
46 | 56 |
return "" |
47 | 57 |
|
58 |
|
|
48 | 59 |
def get_property(): |
49 | 60 |
f = open(path.join(os.path.dirname(os.path.realpath(__file__)), '../../api.properties')) |
50 | 61 |
p = {} |
... | ... | |
63 | 74 |
return Q('nested', path='localIdentifier', query=Q('bool', must=[Q('match', **args)])) |
64 | 75 |
|
65 | 76 |
|
77 |
def create_pid_query(value): |
|
78 |
args = {'localIdentifier.id': value} |
|
79 |
return Q('nested', path='localIdentifier', query=Q('bool', must=[Q('match', **args)])) |
|
80 |
|
|
81 |
|
|
66 | 82 |
def create_publisher_filter(value): |
67 | 83 |
return Q('match', publisher=value) |
68 | 84 |
|
... | ... | |
93 | 109 |
self.client = Elasticsearch(hosts=self.index_host) |
94 | 110 |
self.index_name = props['api.index'] |
95 | 111 |
|
112 |
def query_by_id(self, id): |
|
113 |
s = Search(using=self.client, index=self.index_name).doc_type('object') |
|
114 |
s = s.query(create_pid_query(id)) |
|
115 |
s.aggs.bucket('typologies', 'terms', field='typology') |
|
116 |
s.aggs.bucket('all_datasources', 'nested', path='datasources').bucket('all_names', 'terms', |
|
117 |
field='datasources.datasourceName') |
|
118 |
s.aggs.bucket('all_publisher', 'terms', field='publisher') |
|
119 |
s.aggs.bucket('all_pids', 'nested', path='localIdentifier').bucket('all_types', 'terms', |
|
120 |
field='localIdentifier.type') |
|
121 |
response = s.execute() |
|
122 |
|
|
123 |
hits = [] |
|
124 |
|
|
125 |
for index_result in response.hits: |
|
126 |
input_source = index_result.__dict__['_d_'] |
|
127 |
fixed_titles = [] |
|
128 |
|
|
129 |
for ids in input_source.get('localIdentifier', []): |
|
130 |
ds = resolveIdentifier(ids['id'], ids['type']) |
|
131 |
ids['url'] = ds |
|
132 |
for t in input_source.get('title', []): |
|
133 |
if len(t) > 0 and t[0] == '"' and t[-1] == '"': |
|
134 |
fixed_titles.append(t[1:-1]) |
|
135 |
else: |
|
136 |
fixed_titles.append(t) |
|
137 |
input_source['title'] = fixed_titles |
|
138 |
hits.append(input_source) |
|
139 |
|
|
140 |
pid_types = [] |
|
141 |
for tag in response.aggs.all_pids.all_types.buckets: |
|
142 |
pid_types.append(dict(key=tag.key, count=tag.doc_count)) |
|
143 |
|
|
144 |
datasources = [] |
|
145 |
for tag in response.aggs.all_datasources.all_names.buckets: |
|
146 |
datasources.append(dict(key=tag.key, count=tag.doc_count)) |
|
147 |
|
|
148 |
typologies = [] |
|
149 |
for tag in response.aggs.typologies.buckets: |
|
150 |
typologies.append(dict(key=tag.key, count=tag.doc_count)) |
|
151 |
|
|
152 |
publishers = [] |
|
153 |
for tag in response.aggs.all_publisher.buckets: |
|
154 |
if len(tag.key) > 0: |
|
155 |
publishers.append(dict(key=tag.key, count=tag.doc_count)) |
|
156 |
|
|
157 |
return DLIESResponse(total=response.hits.total, |
|
158 |
facet=dict(pid=pid_types, typology=typologies, datasource=datasources, |
|
159 |
publishers=publishers), hits=hits) |
|
160 |
|
|
96 | 161 |
def simple_query(self, textual_query, start=None, end=None, user_filter=None): |
97 | 162 |
s = Search(using=self.client, index=self.index_name).doc_type('object') |
98 | 163 |
q = Q('match', _all=textual_query) |
... | ... | |
135 | 200 |
input_source = index_result.__dict__['_d_'] |
136 | 201 |
fixed_titles = [] |
137 | 202 |
|
138 |
for ids in input_source.get('localIdentifier',[]):
|
|
203 |
for ids in input_source.get('localIdentifier', []):
|
|
139 | 204 |
ds = resolveIdentifier(ids['id'], ids['type']) |
140 | 205 |
ids['url'] = ds |
141 |
for t in input_source.get('title',[]): |
|
206 |
for t in input_source.get('title', []):
|
|
142 | 207 |
if len(t) > 0 and t[0] == '"' and t[-1] == '"': |
143 | 208 |
fixed_titles.append(t[1:-1]) |
144 | 209 |
else: |
... | ... | |
180 | 245 |
hits = [] |
181 | 246 |
|
182 | 247 |
for index_hit in response.hits: |
183 |
hits.append(index_hit.__dict__['_d_']) |
|
248 |
current_item = index_hit.__dict__['_d_'] |
|
249 |
if 'target' in current_item: |
|
250 |
ids = [] |
|
251 |
for item in current_item['target']['identifier']: |
|
252 |
c_it = item |
|
253 |
c_it['url'] = resolveIdentifier(item['identifier'], item['schema']) |
|
254 |
ids .append(c_it) |
|
255 |
current_item['target']['identifier'] = ids |
|
256 |
hits.append(current_item) |
|
184 | 257 |
|
185 | 258 |
return hits |
186 | 259 |
|
... | ... | |
202 | 275 |
input_source = res['_source'] |
203 | 276 |
fixed_titles = [] |
204 | 277 |
for t in input_source.get('title'): |
205 |
if len(t) >0 and t[0]=='"' and t[-1]=='"':
|
|
278 |
if len(t) > 0 and t[0] == '"' and t[-1] == '"':
|
|
206 | 279 |
fixed_titles.append(t[1:-1]) |
207 | 280 |
else: |
208 | 281 |
fixed_titles.append(t) |
209 | 282 |
input_source['title'] = fixed_titles |
210 | 283 |
|
211 |
for ids in input_source.get('localIdentifier',[]):
|
|
284 |
for ids in input_source.get('localIdentifier', []):
|
|
212 | 285 |
ds = resolveIdentifier(ids['id'], ids['type']) |
213 | 286 |
ids['url'] = ds |
214 | 287 |
related_publications = [] |
... | ... | |
221 | 294 |
related_publications = self.related_type(id, 'publication', start) |
222 | 295 |
else: |
223 | 296 |
related_publications = self.related_type(id, 'publication') |
224 |
if len(related_publications) >0 :
|
|
297 |
if len(related_publications) > 0:
|
|
225 | 298 |
rel_source = related_publications[0] |
226 | 299 |
else: |
227 | 300 |
rel_source = {} |
... | ... | |
248 | 321 |
except Exception as e: |
249 | 322 |
print "Error on getting item " |
250 | 323 |
print e |
251 |
print "on line %i"% sys.exc_traceback.tb_lineno |
|
324 |
print "on line %i" % sys.exc_traceback.tb_lineno
|
|
252 | 325 |
return DLIESResponse() |
Also available in: Unified diff
made a new look