Howto Create owl:Ontology From Python Classes and Convert Data To RDF
Create owl:Ontology from python classes and convert data to rdf turtle file
Repository: nietzsche-python
In one step:
$ python3 py2ttl/convert.py <MANUSCRIPT.xml>
<MANUSCRIPT.xml> is a manuscript xml file.
Script will save ontology to a file 'PROJECT_PREFIX-ontology_autogenerated.ttl'.
Script will convert xml data to rdf triples and write them to a file 'MANUSCRIPT_DATA.ttl'.
In two steps:
1. Create ontology file:
$ python3 py2ttl/py2ttl_ontology.py
Script will save ontology to a file 'PROJECT_PREFIX-ontology_autogenerated.ttl'. It will also create a mapping dictionary file that
contains a mapping for each python class to the URIRef of the ontology. This file will be named 'mapping_file4DATATYPEPACKAGE2ONTOLOGYFILE.xml',
where DATATYPEPACKAGE refers to the package of the datatypes (e.g. 'svgscripts.datatypes') and ONTOLOGYFILE refers to the autogenerated ontology file.
Use option --target=target_ontology_file to change output file name for the ontology.
2. Convert data to rdf triples and store as turtle file:
$ python3 py2ttl/py2ttl_data.py <MANUSCRIPT.xml>
<MANUSCRIPT.xml> is a manuscript xml file.
Script will convert xml data to rdf triples and write them to a file 'MANUSCRIPTTITLE_DATA.ttl'.
Use option --mapping=mapping_dict.xml to specify your mapping dictionary xml file.
- Last Author
- steinech
- Last Edited
- Apr 15 2020, 18:11