def _build(self): log.debug('Building a response to request number {}'.format(self._request_id)) graph = CGraph() resp_node = BNode('#response') graph.add((resp_node, RDF.type, CURATOR.EnrichmentResponse)) graph.add((resp_node, CURATOR.messageId, Literal(str(uuid.uuid4()), datatype=TYPES.UUID))) graph.add((resp_node, CURATOR.responseTo, Literal(self.sink.message_id, datatype=TYPES.UUID))) graph.add((resp_node, CURATOR.responseNumber, Literal("1", datatype=XSD.unsignedLong))) graph.add((resp_node, CURATOR.targetResource, self.sink.enrichment_data.target)) graph.add((resp_node, CURATOR.submittedOn, Literal(datetime.now()))) curator_node = BNode('#curator') graph.add((resp_node, CURATOR.submittedBy, curator_node)) graph.add((curator_node, RDF.type, FOAF.Agent)) graph.add((curator_node, CURATOR.agentId, CURATOR_UUID)) addition_node = BNode('#addition') graph.add((resp_node, CURATOR.additionTarget, addition_node)) graph.add((addition_node, RDF.type, CURATOR.Variable)) for link, v in self.sink.enrichment_data.links: trs = self.graph().triples((self.sink.enrichment_data.target, link, None)) for (_, _, o) in trs: graph.add((addition_node, link, o)) yield graph.serialize(format='turtle'), {}