blob: fcfb92d626e2b26b6efa752f6e787504d537b3d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# Convert all definitions to RDF-XML.
# RDF-XML isn't a very nice format, but it is widely understood by tools.
import parse
all_data = parse.load_all_morphologies(path='..')
def serialize_to_rdf_xml(rdflib_graph):
# FIXME: there must be a way to make it use nice prefixes for the
# namespaces in the output instead of 'ns1', 'ns2' etc.
# FIXME: would be nice if it would output in a stable (sorted) order too. I
# think this requires a patch to the 'rdflib.plugins.serializers.rdfxml'
# module.
return rdflib_graph.serialize(format='application/rdf+xml')
with open('definitions.rdfxml', 'w') as f:
f.write(serialize_to_rdf_xml(all_data))
|