Resource Lookup Interface
This interface is used by Resource Users and other components (e.g. the SQR) to find Resource Descriptions based on resource ID or other information contained in the Resource Description. In the current version of the Sensei Framework, the only service that responds to RLI Requests is the Resource Directory (and its advanced resource component).
Resource Directory
There are several URL options for the RLI. Search query can contain multiple tags, a single identifier, name and description, that are passed as URL parameters in a HTTP GET request.
Service | URL | What it does | Required parameters |
RD | /rli | Search by Tag | tag= |
RD | /rli | Search by Resource-ID | identifier= |
RD | /rli | Search by Name | name= |
RD | /rli | Search by Description of RAI-Description | description= |
RD | /rli | paging offset (default 0) | o= |
RD | /rli | paging limit (default 10, max. 100) | l= |
Here is a small code example on how to use an RLI query to get resources:
public ArrayList<ResourceDescription> searchByIdentifier(String identifier) throws DAOException { ... String myURL = url + "/rli"; myURL = URLUtils.addParameter(myURL, "identifier", identifier); logger.log(Level.FINER, "Commiting data to {0}. ", myURL.toString()); org.restlet.data.Reference itemRef = new org.restlet.data.Reference(myURL); ArrayList<ResourceDescription> result = null; Response response = handle(new Request(Method.GET, itemRef)); ...
Please also see how to run the Resource Directory.
All other interfaces work the same, just combine the code from here and Connecting a Resource User page.
Semantic Query Resolver
Another RLI-like interface is provided by the SQR Service. You can get Sensing and Actuation information (result is a resource description), or you can choose to get the sensor data or actuate directly. The following urls are available:
Service | URL | What it does | Required parameters |
SQR | /sqr/lookupagent?querytype=entityattributequery&iopetype=any | Get Entity with following attributes | eoi1=&attribute1= |
SQR | /sqr/lookupagent?querytype=getcontext&iopetype=any | Get Sensor Value of entity with following attributes | eoi1=&attribute1= |
SQR | /sqr/lookupagent?querytype=Actuate&iopetype=any | Actuate the sensor with following attributes | eoi1=&attribute1=&value1= |
Examples:
- http://sensei-dev1.grid.pub.ro:8186/sqr/lookupagent?eoi1=&attribute1=&iopetype=any&querytype=entityattributequery
- http://sensei-dev1.grid.pub.ro:8186/sqr/lookupagent?eoi1=&attribute1=&iopetype=any&querytype=getcontext
- http://sensei-dev1.grid.pub.ro:8186/sqr/lookupagent?eoi1=&attribute1=&value1=&iopetype=any&querytype=Actuate
The SQR also lets you do direct ARD Sparql queries and ARD-based Resource Lookup. Example Sparql query:
<requestResource> <resourceSpecification> <tag>tag13</tag> </resourceSpecification> <AdvancedSpecification> <![CDATA[PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX ard: <http://www.ict-sensei.org/AdvancedResourceDescription#> PREFIX loc: <http://www.ict-sensei.org/LocationOntology#> PREFIX sensor: <http://www.ict-sensei.org/Sensor#> PREFIX mo: <http://www.ict-sensei.org/MeasurementAndObservation#> SELECT ?description ?operation ?output ?infoType WHERE { ?description ard:hasSemanticOperationDescription ?operation . ?operation ard:hasOutput ?output . ?output ard:hasInformationType ?infoType . ?infoType rdfs:subClassOf sensor:Temperature . }]]> </AdvancedSpecification> </requestResource>