Revision 62447
Added by Katerina Iatropoulou about 2 years ago
modules/uoa-search/trunk/src/main/java/eu/dnetlib/data/search/web/api/CSVResponseFormat.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
public static final String organization = "Name,Projects,Country\n"; |
12 | 12 |
public static final String datasource = "Name,Type,Compatibility,OAI-PMH,website\n"; |
13 |
public static final String service = "Name,website\n"; |
|
13 | 14 |
public static final String person = "Fullname\n"; |
14 | 15 |
public static final String project = "Title,Funder,Start Date,End Date,Participants\n"; |
15 | 16 |
public static final String result = "Type,Title,Authors,Publication Year,DOI,Download from,Type,Journal,Funder|Project Name (GA Number),Access\n"; |
... | ... | |
29 | 30 |
} else if (entity.equals(RequestResponseHandler.Entity.DATASOURCE)) { |
30 | 31 |
return datasource; |
31 | 32 |
|
32 |
}/* else if (entity.equals(RequestResponseHandler.Entity.PERSON)) { |
|
33 |
} else if (entity.equals(RequestResponseHandler.Entity.SERVICE)) { |
|
34 |
return service; |
|
35 |
} |
|
36 |
/* else if (entity.equals(RequestResponseHandler.Entity.PERSON)) { |
|
33 | 37 |
return person; |
34 | 38 |
|
35 | 39 |
}*/ else if (entity.equals(RequestResponseHandler.Entity.PROJECT)) { |
modules/uoa-search/trunk/src/main/java/eu/dnetlib/data/search/web/api/SearchApiService.java | ||
---|---|---|
540 | 540 |
return getResponseByEntityId(request, RequestResponseHandler.Entity.DATASOURCE, datasourceid, format, fieldQueries); |
541 | 541 |
} |
542 | 542 |
|
543 |
@GET |
|
544 |
@Path("/api/services/{serviceid}") |
|
545 |
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) |
|
546 |
@Timed(value = "http.server.request.duration", extraTags = {"referer", "portal", "uri", "/rest/v2/api/services/{serviceid}"}, longTask = false) |
|
547 |
public Response fetchServices(@PathParam("serviceid") String datasourceid, |
|
548 |
@QueryParam("format") final String format, |
|
549 |
@QueryParam("fq") final List<String> fieldQueries, |
|
550 |
@Context final HttpServletRequest request) { |
|
551 |
return getResponseByEntityId(request, RequestResponseHandler.Entity.SERVICE, datasourceid, format, fieldQueries); |
|
552 |
} |
|
543 | 553 |
|
554 |
|
|
544 | 555 |
@GET |
545 | 556 |
@Path("/api/organizations") |
546 | 557 |
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) |
... | ... | |
1434 | 1445 |
} else if (type.equalsIgnoreCase(RequestResponseHandler.Entity.DATASOURCE.getPlural())) { |
1435 | 1446 |
return RequestResponseHandler.Entity.DATASOURCE; |
1436 | 1447 |
|
1448 |
} else if (type.equalsIgnoreCase(RequestResponseHandler.Entity.SERVICE.getPlural())) { |
|
1449 |
return RequestResponseHandler.Entity.SERVICE; |
|
1450 |
|
|
1437 | 1451 |
/*} else if (type.equalsIgnoreCase(RequestResponseHandler.Entity.PERSON.getPlural())) { |
1438 | 1452 |
return RequestResponseHandler.Entity.PERSON; |
1439 | 1453 |
*/ |
... | ... | |
1531 | 1545 |
return false; |
1532 | 1546 |
} |
1533 | 1547 |
} |
1534 |
|
|
1535 | 1548 |
return true; |
1536 | 1549 |
} |
1537 | 1550 |
|
... | ... | |
1552 | 1565 |
} else if (type.equals(RequestResponseHandler.Entity.DATASOURCE.getPlural())) { |
1553 | 1566 |
return RequestResponseHandler.Entity.DATASOURCE; |
1554 | 1567 |
|
1568 |
} else if (type.equals(RequestResponseHandler.Entity.SERVICE.getPlural())) { |
|
1569 |
return RequestResponseHandler.Entity.SERVICE; |
|
1570 |
|
|
1555 | 1571 |
} else if (type.equals(RequestResponseHandler.Entity.ORGANIZATION.getPlural())) { |
1556 | 1572 |
return RequestResponseHandler.Entity.ORGANIZATION; |
1557 | 1573 |
} |
modules/uoa-search/trunk/src/main/java/eu/dnetlib/data/search/web/utils/RequestResponseHandler.java | ||
---|---|---|
14 | 14 |
DATASET("dataset"), |
15 | 15 |
PROJECT("project"), |
16 | 16 |
DATASOURCE("datasource"), |
17 |
SERVICE("service"), |
|
17 | 18 |
ORGANIZATION("organization"), |
18 | 19 |
//PERSON("person"), |
19 | 20 |
SOFTWARE("software"), |
... | ... | |
27 | 28 |
private final List<String> OTHER_FIELD_QUERIES = Arrays.asList("oaftype exact result", "resulttypeid exact other"); |
28 | 29 |
private final List<String> PROJECT_FIELD_QUERIES = Arrays.asList("oaftype exact project"); |
29 | 30 |
private final List<String> DATASOURCE_FIELD_QUERIES = Arrays.asList("oaftype exact datasource", "(eosctype exact \"Data Source\")"); |
31 |
private final List<String> SERVICE_FIELD_QUERIES = Arrays.asList("(oaftype exact \"datasource\")"); |
|
30 | 32 |
private final List<String> ORGANIZATION_FIELD_QUERIES = Arrays.asList("oaftype exact organization"); |
33 |
|
|
31 | 34 |
/*private final List<String> ORGANIZATION_FIELD_QUERIES = Arrays.asList("oaftype exact organization", |
32 | 35 |
"reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or " + |
33 | 36 |
"reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or " + |
... | ... | |
77 | 80 |
case DATASOURCE: |
78 | 81 |
return DATASOURCE_PREFIX; |
79 | 82 |
|
83 |
case SERVICE: |
|
84 |
return SERVICE_PREFIX; |
|
85 |
|
|
80 | 86 |
case ORGANIZATION: |
81 | 87 |
return ORGANIZATION_PREFIX; |
82 | 88 |
|
... | ... | |
115 | 121 |
case DATASOURCE: |
116 | 122 |
return "datasources"; |
117 | 123 |
|
124 |
case SERVICE: |
|
125 |
return "services"; |
|
126 |
|
|
118 | 127 |
case ORGANIZATION: |
119 | 128 |
return "organizations"; |
120 | 129 |
|
... | ... | |
152 | 161 |
case DATASOURCE: |
153 | 162 |
return DATASOURCE_FIELD_QUERIES; |
154 | 163 |
|
164 |
case SERVICE: |
|
165 |
return SERVICE_FIELD_QUERIES; |
|
166 |
|
|
155 | 167 |
case ORGANIZATION: |
156 | 168 |
return ORGANIZATION_FIELD_QUERIES; |
157 | 169 |
|
... | ... | |
193 | 205 |
public final static String OTHER_PREFIX = "(oaftype exact result) and (resulttypeid exact other)"; |
194 | 206 |
public final static String PROJECT_PREFIX = "(oaftype exact project)"; |
195 | 207 |
public final static String DATASOURCE_PREFIX = "(oaftype exact datasource) and (eosctype exact \"Data Source\")"; |
208 |
public final static String SERVICE_PREFIX = "(oaftype exact datasource)"; |
|
196 | 209 |
public final static String ORGANIZATION_PREFIX = "(oaftype exact organization and " + |
197 | 210 |
"(reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or " + |
198 | 211 |
"reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or " + |
199 | 212 |
"reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy " + |
200 | 213 |
"or relproject=*)"; |
214 |
|
|
201 | 215 |
//public final static String PERSON_PREFIX = "(oaftype exact person)"; |
202 |
|
|
203 |
|
|
204 |
|
|
205 | 216 |
} |
modules/uoa-search/trunk/src/main/resources/configuration.xml | ||
---|---|---|
99 | 99 |
<transformation xslt="csv_datasource.xsl" /> |
100 | 100 |
</transformer> |
101 | 101 |
|
102 |
<transformer name="csv_service"> |
|
103 |
<transformation xslt="csv_service.xsl" /> |
|
104 |
</transformer> |
|
105 |
|
|
102 | 106 |
<transformer name="csv_project"> |
103 | 107 |
<transformation xslt="csv_project.xsl" /> |
104 | 108 |
</transformer> |
modules/uoa-search/trunk/src/main/resources/csv_service.xsl | ||
---|---|---|
1 |
|
|
2 |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|
3 |
xmlns:dri="http://www.driver-repository.eu/namespace/dri" |
|
4 |
xmlns:oaf="http://namespace.openaire.eu/oaf" |
|
5 |
xmlns:dc="http://purl.org/dc/elements/1.1/"> |
|
6 |
|
|
7 |
<!-- Turn off auto-insertion of <?xml> tag and set indenting on --> |
|
8 |
<xsl:output method="text" encoding="utf-8" omit-xml-declaration="yes" media-type="text/csv" /> |
|
9 |
|
|
10 |
<!-- strip whitespace from whitespace-only nodes --> |
|
11 |
<xsl:strip-space elements="*"/> |
|
12 |
|
|
13 |
<xsl:template match = "/"> |
|
14 |
<xsl:apply-templates select="//oaf:datasource"/> |
|
15 |
</xsl:template> |
|
16 |
|
|
17 |
<!-- Name, Type, Compatibility, OAI-PMH, website --> |
|
18 |
<xsl:template match="oaf:datasource"> |
|
19 |
|
|
20 |
<!-- Name --> |
|
21 |
<xsl:text>"</xsl:text> |
|
22 |
<xsl:value-of select="officialname"/> |
|
23 |
<xsl:text>",</xsl:text> |
|
24 |
|
|
25 |
<!-- Type |
|
26 |
<xsl:value-of select="datasourcetype/@classname"/> |
|
27 |
<xsl:text>,</xsl:text> |
|
28 |
--> |
|
29 |
<!-- Compatibility |
|
30 |
<xsl:value-of select="openairecompatibility/@classname"/> |
|
31 |
<xsl:text>,</xsl:text> |
|
32 |
--> |
|
33 |
|
|
34 |
<!-- OAI-PMH |
|
35 |
<xsl:value-of select="accessinfopackage"/> |
|
36 |
<xsl:text>,</xsl:text> |
|
37 |
--> |
|
38 |
|
|
39 |
<!-- website --> |
|
40 |
<xsl:value-of select="websiteurl"/> |
|
41 |
<xsl:text>
</xsl:text> |
|
42 |
|
|
43 |
</xsl:template> |
|
44 |
|
|
45 |
</xsl:stylesheet> |
Also available in: Unified diff
merge eosc branch -r62230:62446