Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return self.g.serialize(format='trig')
def write_np(s, npid, formt):
filename = filename = "np{0}.{1}".format(npid, formt)
with open(os.path.join(out_dir, filename), 'wb') as f:
f.write(s)
with open(csv_path) as csvfile:
creader = csv.reader(csvfile)
for i, analysis in enumerate(creader):
if i == 0:
csv_headers = analysis
else:
npid = analysis[csv_headers.index("id")]
n = Nanopub(analysis, npid)
if args.format == "trix":
s = n.trix()
elif args.format == "trig":
s = n.trig()
elif args.format == "nq":
s = n.nquads()
elif args.format == "jsonld":
s = n.jsonld()
else:
args.format = "trig"
s = n.trig()
write_np(s, npid, args.format)
register('json-ld', Serializer, 'rdflib_jsonld.serializer', 'JsonLDSerializer')