Codegen (experimental)
triplemodel-codegen generates stub TripleModel classes from OWL/RDFS ontologies.
Limitations
Only
owl:DatatypePropertyandowl:ObjectPropertyare emitted (plainrdf:Propertyis ignored).All properties are typed as
str;rdfs:rangeis not read.Every class gets
id_field = "slug"and aslug: strfield.Duplicate local field names (different predicate IRIs) keep the first property only (a
UserWarningis emitted).Multiple
rdfs:subClassOfparents: last parent wins in the emitted hierarchy.
Missing ontology files raise FileNotFoundError when the path has a known suffix (.ttl, .owl, etc.).
Experimental OWL/RDFS → TripleModel stub codegen.
- triplemodel.codegen.generate_models_from_graph(graph)[source]
Return Python source for stub
TripleModelsubclasses.- Return type:
- Parameters:
graph (RdfGraph)
- triplemodel.codegen.ontology_graph(source, *, format=None)[source]
Load an ontology file into a graph.
CLI entry point for OWL/RDFS stub codegen.