djangordf.ontology

Generate an OWL ontology from the declared RDFModel classes. Also provides the dump_ontology Django management command as a thin CLI wrapper.

Generate an OWL ontology from declared RDFModel classes.

Walks the model registry, asks each class for its declared properties, and emits the OWL triples that describe the schema: owl:Class declarations, rdfs:subClassOf relationships, rdfs:label/rdfs:comment annotations, per-property owl:DatatypeProperty/owl:ObjectProperty declarations (for custom predicates only — external SKOS/FOAF/etc. predicates are not re-declared), rdfs:domain/rdfs:range, and blank-node owl:Restriction resources for cardinality.

djangordf.ontology.generate_ontology(models=None, graph=None)[source]

Build an OWL ontology graph from the given RDFModel classes.

Defaults to every class in the process-wide model registry. The resulting graph carries the prefix bindings of the namespace registry so Turtle serialisation comes out pretty.

Return type:

Graph

Parameters: