def triples(collection_id): """ --- get: summary: Linked data stream of the collection description: >- This will return a list of triples that describe each entity in the given collection. The format is `ntriples`. parameters: - in: path name: collection_id required: true schema: type: integer responses: '200': description: OK content: text/plain: schema: type: string tags: - Entity """ require(request.authz.can_stream()) log.debug("Stream triples [%r] begins... (coll: %s)", request.authz, collection_id) collection = get_db_collection(collection_id, request.authz.READ) return Response(export_collection(collection), mimetype='text/plain')
def rdf(foreign_id): """Generate a RDF triples for the given collection.""" collection = get_collection(foreign_id) for line in export_collection(collection): line = line.strip().decode('utf-8') if len(line): print(line)
def dump_rdf(foreign_id, outfile): """Export RDF triples for the given collection.""" collection = get_collection(foreign_id) for line in export_collection(collection): outfile.write(line)