RDFLib / pyLODE

An OWL ontology documentation tool using Python and templating, based on LODE
BSD 3-Clause "New" or "Revised" License
169 stars 70 forks source link

Using OWL:equivalentClass to create Enum lists #214

Open ashleysommer opened 7 months ago

ashleysommer commented 7 months ago

The recommended way to create an Enum in an owl ontology is to use owl:equivalentClass with a bnode containing an owl:oneOf list like this:

cn:CausalEffectIncrease
    a owl:NamedIndividual , cn:CausalEffect ;
    rdfs:comment "The link has the effect of Increasing."@en ;
    rdfs:label "Increase"@en ;
    .

cn:CausalEffectDecrease
    a owl:NamedIndividual , cn:CausalEffect ;
    rdfs:comment "The link has the effect of Decreasing."@en ;
    rdfs:label "Decrease"@en ;

cn:CausalEffects
    a rdfs:Class, owl:Class ;
    rdfs:subClassOf cn:CausalEffect ;
    owl:equivalentClass [
        owl:oneOf ( cn:CausalEffectIncrease cn:CausalEffectDecrease ) ;
                        ] ;
    rdfs:comment "Enum of possible Casual Effects. Can be \"Increase\" or \"Decrease\"."@en ;
    .

When rendering this in pyLode I get this output:

image Notice the owl:equivalentClass

I would expect this to render a list of the named individuals like this: