def setUp(self): self.format = FormatSelector()
import json import sys from django.http import HttpRequest, HttpResponse from django.views.generic.base import View from flask_rdf.format import FormatSelector from pyld import jsonld from rdflib import Graph, URIRef from rdflib.plugin import register from rdflib.store import Store FORMAT = FormatSelector() FORMAT.add_format("application/ld+json", "json-ld") FORMAT.default_mimetype = "application/ld+json" FORMAT.wildcard_mimetype = "application/ld+json" register("Hyperdjango", Store, "hyperdjango.store", "HyperdjangoStore") class HyperView(View): models = sys.modules[__name__] def get(self, request, *args, **kwargs): base_url = "http://" + request.get_host() graph = Graph("Hyperdjango", identifier=URIRef(base_url)) graph.open(configuration=self.models.__name__) r = graph.query(