-
Notifications
You must be signed in to change notification settings - Fork 15
Example: how to pass uris as arguments
timrdf edited this page Mar 15, 2012
·
3 revisions
Example: How to set up a service
Sometimes it is necessary to pass random URIs (not CURIEs) to a service. To do that it is possible to use Urifier and Deurifier, which translates a URI to/from a more suitable form for services.
Consider the following template
<ul>
{% for row in models.main %}
<li><a href="{{lodspk.baseUrl}}thing/{{ row.resource.value|urifier }}">{{row.resource.value|urifier}}</a></li>
{% endfor %}
</ul>
This will produce
<ul>
<li><a href="http://localhost/thing/http/xmlns.com/foaf/0.1/Person">http/xmlns.com/foaf/0.1/Person</a></li>
<li><a href="http://localhost/thing/http/aquarius.tw.rpi.edu/www2012/ns/swc/ontology__hash__TalkEvent">http/localhost/ns/swc/ontology__hash__TalkEvent</a></li>
<li><a href="http://localhost/thing/http/swrc.ontoware.org/ontology__hash__InProceedings">http/swrc.ontoware.org/ontology__hash__InProceedings</a></li>
</ul>
Remember that {{lodspk.args.all}}
will return a string with all the segments after the service name. Thus for example
http://localhost/thing/http/swrc.ontoware.org/ontology__hash__InProceedings
can be parse as
{{lodspk.args.all|deurifier}}
which will return
http://swrc.ontoware.org/ontology#InProceedings