2015-10-19 72 views
2

我刚开始学习使用Callimachus。它的文档在某些部分有些碎片化(不幸的是,不同版本之间会有所不同),我无法弄清楚问题所在 - 我无法将变量传递到模板中。如何将变量传递到Callimachus中的模板中?

测试RDF图:

@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" . 

测试模板:

<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> 

类是正确关联,我可以看到两个项目检查类的资源时,但模板没有显示身体。根据我已经试过的文件:

<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. 

没有什么帮助。模板仍然是空的。

回答

1

我明白了。问题是我只将模板分配给“查看”,而不是“编辑”和“创建”。由于我将相同的模板分配给所有模式,因此一切正常。