def post(self): postType = self.getFormat(self.request.headers["Content-Type"])[1] graph = self.processGraph(content, postType) acceptType = self.getFormat(self.request.headers["Accept"]) response.headers.add_header("Content-Type",acceptType[0]) if acceptType[1] == 'json': return to_json(modelGraph) else: return graph.serialize(format=acceptType[1])
def serialize(self, format='xml', direct=False): """ Return a serialized version of the internal graph represenatation of the resource, the format is the same as expected by rdflib's graph serialize method supported formats: - **n3** - **xml** - **json** (internal serializer) - **nt** - **turtle** """ graph = self.graph(direct=direct) if format == 'json': return to_json(graph) return graph.serialize(format=format)
def serialize(self, format = 'xml', direct = False): """ Return a serialized version of the internal graph represenatation of the resource, the format is the same as expected by rdflib's graph serialize method supported formats: - **n3** - **xml** - **json** (internal serializer) - **nt** - **turtle** """ graph = self.graph(direct = direct) if format == 'json': return to_json(graph) return graph.serialize(format = format)
def serialize(self, graph): return to_json(modelGraph)
def serialize(self,graph): return to_json(modelGraph)