Creating components in LODSPeaKr
Clone this wiki locally
- Modules are used to control which Component is used to handle a URI request.
What we'll cover
This page describes how to create the three kinds of components: Service, Type, and URI.
lodspk.sh can be used to create the appropriate directory structures for a new model and view.
Service components (1/3)
$utils/lodspk.sh create service <myservice>
That will create the whole structure including
components/services/myservice/ |-> queries/ | |-> main.query |-> html.template
You can add an argument (e.g.
json) that will create queries and templates for all the options available (html rdf ttl nt json). This is not necessary, since LODSPeaKr can convert the query serving html requests to other formats. Use specific values only if you know what you are doing
$ utils/ldspk.sh delete service <myservice> will delete the html model query and view template from the myservice service. Using additional values
rdf will delete specific content type from myservice (html rdf ttl nt json).
Type components (2/3)
It is also possible to create model queries and view templates for URIs of a certain type or specific URIs (see more in Modules)
$utils/lodspk.sh create type foaf:Person
That will create the whole structure that will be used when a URI of type
foaf:Person is requested.
components/types/foaf:Person/ |-> queries/ | |-> sp.query | |-> po.query |-> html.template
URI components (3/3)
$utils/lodspk.sh create uri local:Alvaro
That will create the whole structure that will be used when the URI
local:Alvaro is requested.
components/uris/local:Alvaro/ |-> queries/ | |-> sp.query | |-> po.query |-> html.template
Similarly, we can do
$utils/lodspk.sh delete service myservice
$utils/lodspk.sh delete type foaf:Person
$utils/lodspk.sh delete uri local:Alvaro
You can delete model queries and views for specific content types by adding a
json, etc. argument at the end, although it is discouraged.
- Components are made up of Models and Views, so after creating a Component you need to set them up.
- Models is the first step in handling a lodspeakr request.
- Views is the second step in handling a lodspeakr request.
- Default-Values-in-Template Useful value that are available to use in templates.
- You can look at CommonErrors when writing models and views.
- Debugging components