Search code examples
rdfrdfa

How to pass a variable into the template in Callimachus?


I have just started to learn to work with Callimachus. Its documentation is in some parts a bit fragmented (and unfortunately differs between releases) and I can’t figure out where could be the problem—I can’t pass a variable into the template.

Testing RDF graph:

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix owl:<http://www.w3.org/2002/07/owl#>.
@prefix te:<http://46.28.111.241:8080/test/> .

foaf:Person a owl:Class
   ; rdfs:label "Person" .

te:Humanoid_A a foaf:Person
   ; foaf:name "Mr Humanoid A" .

te:Humanoid_B a foaf:Person
   ; foaf:name "Mr Humanoid B" .

Testing template:

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:foaf="http://www.xmlns.com/foaf/1.0/"
xmlns:owl="http://www.w3.org/2002/07/owl#">

  <head>
    <title>Titulek</title>
  </head>
  <body resource="?this">
    <div class="container">
      <p property="foaf:name">{?name}</p>
    </div>
  </body>
</html>

The Class is properly associated, I can see two items when checking the class’s resources but the template does not show the body. According the the documentation I have tried as well:

<p>{foaf:name}</p>
<p resource="?this">{foaf:name}</p>
<p property="foaf:name" content="{?name}" /> # but this is marked as error in the editor’s window, despite it should use XHTML5, the header of the result is marked as HTML5 no matter if I used the <?xml... spec.

Nothing helps. The template is still empty.


Solution

  • I got it. The problem was I assigned the template only to “viewing”, not to “editing” and “creating”. Since I assigned the same template to all of the modes, everything works.