def rdf(request):
uri = request.GET['uri']
g = Graph()
annotations = Annotation.objects.filter(uri=uri)
for annotation in annotations:
if annotation.title:
g.add( ( URIRef(annotation.uri), URIRef("http://localhost/metawiki/index.php/Special:URIResolver/Property-3ATitle"), Literal(annotation.title) ) )
if annotation.notes:
g.add( ( URIRef(annotation.uri), URIRef("http://localhost/metawiki/index.php/Special:URIResolver/Property-3ANotes"), Literal(annotation.notes) ) )
for tag in annotation.tags.all():
g.add( ( URIRef(annotation.uri), URIRef("http://localhost/metawiki/index.php/Special:URIResolver/Property-3ATag"), Literal(tag.prefLabel) ) )
status = HttpResponse(g.serialize( format='xml' ) )
status["Content-Type"] = "application/rdf+xml"
return status
views.py 文件源码
python
阅读 20
收藏 0
点赞 0
评论 0
评论列表
文章目录