-
Notifications
You must be signed in to change notification settings - Fork 15
Creating services with slashes
Sometimes it is useful to have services that reflect a certain hierarchy. For example, imagine you have URIs describing information about a university with the following pattern:
http://example.org/id/SCHOOL/DEPARTMENT/RESEARCHGROUP
Thus, you may have
http://example.org/id/science/physics/highenergy
http://example.org/id/science/chemistry/polymers
http://example.org/id/science/chemistry/aminoacids
http://example.org/id/humanities/literature/medieval
http://example.org/id/humanities/cognitivescience/perceptionlab
http://example.org/id/humanities/cognitivescience/inference
An elegant mechanism to browse these URIs is providing a list of services like
-
http://example.org/id
list all the schools -
http://example.org/id/SCHOOL
list all the departments related to this particular SCHOOL -
http://example.org/id/SCHOOL/DEPARTMENT
list all the research groups related to this particular SCHOOL and DEPARTMENT
In simple cases, this can be done easily by passing arguments to services, but when things start increasing in complexity and variety, it may be necessary to separate each listing into different services. Since version 20130206
, it is possible to create services containing slashes /
. This is done as usual by executing
utils/lodspk.sh create service id/science
This will create the folder components/services/id%27science
(/
is encoded). Under this folder the files and directories for queries and templates are the same as always.
Since, it is possible to have a id
and id/science
service, LODSPeaKr will try to match first with the service with the longest name. Thus, when id/science/physics
is requested, LODSPeaKr will ask:
- Is
id/science/physics
a service? iffalse
then - Is
id/science
a service? iffalse
then - Is
id/
a service? iffalse
then returnfalse
for the service module
This is the priority for the service
module. See Modules and Changing priorities of modules for more information about how module priority works and how it can be changed.
As you would expect, if there is a service id/science
and an agent requests id/science/abc/123
, the service will be able to use abc
and 123
as arguments. See Passing arguments to services for more information.