Search code examples
containersrdfsemantic-webrdfsturtle-rdf

How to express "all members of containers of class C must be of class M" in rdfs?


I have these triples (expressed in turtle):

:C rdf:subClassOf rdfs:Container.
:M a rdfs:Class.

How do i specify that only instances of :M can be members of :C? I looked through this, but couldn't find the answer.


Solution

  • You can't express this with an RDFS ontology (that is, as an RDF graph interpreted according to the RDFS entailment regime). You can't express this with an OWL DL ontology (that is, an OWL ontology interpreted according to the OWL direct semantics). However, it can be expressed with OWL Full (that is, as an RDF graph interpreted according to the OWL RDF-based semantics). In Turtle:

    [
      a  owl:Restriction;
      owl:onProperty  rdfs:member;
      owl:someValuesFrom  :C
    ]
    rdfs:subClassOf  :M .
    

    If you wan't to make it compatible with OWL DL, you must not use RDF containers but you can make your own class of containers:

    :Container  a  owl:Class .
    :C  rdfs:subClassOf  :Container .
    :M  a  owl:Class .
    :member  a  owl:ObjectProperty .
    [
      a  owl:Restriction;
      owl:onProperty  :member;
      owl:someValuesFrom  :C
    ]
    rdfs:subClassOf  :M .