Djangonic way to handle rdf?

I was looking for an RDF project for django and I can not find any active ones.

This seems to be a good http://code.google.com/p/django-rdf , but the last commit was in 2008 (4 years ago). The group seems to be left in google groups. The last non-spam post was in 2008. Therefore, it does not support new versions of django.

Is there any library or some ready-made open source application to easily expose rdf data?

It may be easy to decide, for example, to write a view and return something using https://github.com/RDFLib/rdflib in one or two lines of code, but I can "I don’t understand how to do this ...

An idea using RDFlib would be to take a django object or collection of objects and somehow convert it to rdf, possibly using the rdf parser.

I thought I could give html answers if the client request is "accept: text / html" and RDF, if the user requested the same page using the html accept header with rdf + xml or rdf + turtle (and it may exist an application that handles this for me)

+6
source share
2 answers

From what I read a little about RDF, you probably have to do the manual work to get meaningful RDF instructions from Django models, since this is not a simple data presentation format like JSON, it tries to encode a semantic value.

However, look at django-rdflib:
https://github.com/odeoncg/django-rdflib

It seems that there is no documentation (and it seems that it was created for a specific application), but the author published the manage.py syncvb command here, which generates an RDF graph from existing Django models:
https://groups.google.com/d/msg/django-rdf/14WVK7t88PE/ktAKJo-aCfUJ

Not sure which particular django-rdflib views provide, but if it can make an RDFlib chart for you, then you can probably use the serialization plugins provided by RDFlib to output rdf + xml or any other from your own view.

+4
source

http://code.google.com/p/djubby/

SURF is useful as a means of displaying RDF-> objects (or RDFAlchemy)

Putting rdfa into your templates should work (if you want to avoid tripters)

you can also provide your database as a sparql endpoint with a tool like http://d2rq.org/

+1
source

Source: https://habr.com/ru/post/919869/


All Articles