@prefix : <http://example.org/test#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

<http://example.org/test> a owl:Ontology .

:A a owl:Class .
:B a owl:Class .
:C a owl:Class .
:hasPart a owl:ObjectProperty .

:A rdfs:subClassOf :B .
:C rdfs:subClassOf [
    a owl:Restriction ;
    owl:onProperty :hasPart ;
    owl:someValuesFrom :B
] .
