Difference between revisions of "Resource Registry Service - Query & Access"

From Gcube Wiki
Jump to: navigation, search
Line 63: Line 63:
  
 
<pre>GET /resource-registry/access/instances/EService?polymorphic=true&reference=4d28077b-566d-4132-b073-f4edaf61dcb9&direction=(in|out|both)</pre>
 
<pre>GET /resource-registry/access/instances/EService?polymorphic=true&reference=4d28077b-566d-4132-b073-f4edaf61dcb9&direction=(in|out|both)</pre>
 +
 +
 +
 +
=== Get Filtered Resource Instances ===
 +
 +
<pre>GET /resource-registry/access/resourceInstances/{ResourceType}/{ConsistsOfType}/{FacetType}?[polymorphic=(true|false)]&key1=value1&key2=value2&...</pre>
 +
 +
Default:
 +
* polymorphic : false
 +
 +
 +
<pre>GET /resource-registry/access/resourceInstances/EService/IsIdentifiedBy/SoftwareFacet?polymorphic=true&group=DataAccess&name=HomeLibraryWebapp</pre>
 +
 +
 +
<pre>public <R extends Resource> List<R> getFilteredResources(Class<R> resourceClass, Class<? extends ConsistsOf> consistsOfClass, Class<? extends Facet> facetClass,boolean polymorphic, Map<String, Object> map) throws ResourceRegistryException</pre>
 +
 +
 +
<pre>
 +
Map<String, Object> map = new HashMap<>();
 +
map.put("group", "DataAccess");
 +
map.put("name", "HomeLibraryWebapp");
 +
 +
List<EService> eServices = resourceRegistryClient.getFilteredResources(EService.class, IsIdentifiedBy.class, SoftwareFacet.class, true, map);
 +
</pre>
 +
 +
 +
<pre>public List<Resource> getFilteredResources(String resourceType, String consistsOfType, String facetType, boolean polymorphic, Map<String, Object> map) throws ResourceRegistryException;</pre>
  
  

Revision as of 11:06, 9 November 2017

This sections provide information regarding how to interact with Resource Registry Service for Query and Access. REST and JAVA API are presented for each functionality.

Please note that the provided examples can intentionally hide some details in the response to avoid unneeded complexity.

Apart the REST API this port type can be used also by using Resource Registry Client java client.

Resource Registry Client has the following maven coordinates

<dependency>
	<groupId>org.gcube.information-system</groupId>
	<artifactId>resource-registry-client</artifactId>
	<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>

To use the client you need first get a ResourceRegistryClient instance.

By using ResourceRegistryClientFactory.create() method the library discover the correct endpoint to interact with the Resource Registry for the current context.

SecurityTokenProvider.instance.set("Your-NextNext-Token-Here"); //If not already set
ResourceRegistryClient resourceRegistryClient = ResourceRegistryClientFactory.create();

Exists

HEAD /resource-registry/access/instance/{ER-Type}/{INSTANCE UUID}

Example

HEAD /resource-registry/access/instance/ContactFacet/4d28077b-566d-4132-b073-f4edaf61dcb9


Get Instance

GET /resource-registry/access/instance/{ER-Type}/{INSTANCE UUID}

Example

GET /resource-registry/access/instance/ContactFacet/4d28077b-566d-4132-b073-f4edaf61dcb9


Get All Instances of a Specific Type

GET /resource-registry/access/instances/{ER-Type}?[polymorphic=(true|false)][&reference={INSTANCE UUID}][&direction=(in|out|both)]

Default:

* polymorphic : false
* direction : both

direction has sense only if reference UUID is provided, is ignored otherwise.


GET /resource-registry/access/instances/EService?polymorphic=true
GET /resource-registry/access/instances/EService?polymorphic=true&reference=4d28077b-566d-4132-b073-f4edaf61dcb9&direction=(in|out|both)


Get Filtered Resource Instances

GET /resource-registry/access/resourceInstances/{ResourceType}/{ConsistsOfType}/{FacetType}?[polymorphic=(true|false)]&key1=value1&key2=value2&...

Default:

* polymorphic : false


GET /resource-registry/access/resourceInstances/EService/IsIdentifiedBy/SoftwareFacet?polymorphic=true&group=DataAccess&name=HomeLibraryWebapp


public <R extends Resource> List<R> getFilteredResources(Class<R> resourceClass, Class<? extends ConsistsOf> consistsOfClass, Class<? extends Facet> facetClass,boolean polymorphic, Map<String, Object> map) throws ResourceRegistryException


Map<String, Object> map = new HashMap<>();
map.put("group", "DataAccess");
map.put("name", "HomeLibraryWebapp");
		
List<EService> eServices = resourceRegistryClient.getFilteredResources(EService.class, IsIdentifiedBy.class, SoftwareFacet.class, true, map);


public List<Resource> getFilteredResources(String resourceType, String consistsOfType, String facetType, boolean polymorphic, Map<String, Object> map) throws ResourceRegistryException;


Raw Query

GET /resource-registry/access?query=SELECT FROM Facet