Search code examples
rdfsemantic-webowlprotege

OWL DL Query on Symmetric property


I'm trying to put together a small ontology (class HP, class HEWLETT_PACKARD linked together by a symmetric property). The Owl is below. What I want to do is query in Protege "equal_symmetric only hp" or "equal_symmetric only hewlett_packard" and get the opposing company. Essentially I want to get synonyms for each company's name.

    <owl:ObjectProperty rdf:about="ontologies/2014/1/untitled-ontology-2#equal_symmetric">
        <rdf:type rdf:resource="&owl;SymmetricProperty"/>
    </owl:ObjectProperty>

    <owl:Class rdf:about="ontologies/2014/1/untitled-ontology-2#hewlett_packard">
        <owl:equivalentClass>
            <owl:Restriction>
                <owl:onProperty rdf:resource="ontologies/2014/1/untitled-ontology-2#equal_symmetric"/>
                <owl:allValuesFrom rdf:resource="ontologies/2014/1/untitled-ontology-2#hp"/>
            </owl:Restriction>
        </owl:equivalentClass>        
    </owl:Class>

    <owl:Class rdf:about="ontologies/2014/1/untitled-ontology-2#hp">
        <rdfs:subClassOf rdf:resource="ontologies/2014/1/untitled-ontology-2#brand"/>
    </owl:Class>

Solution

  • If you have two classes and you're trying to say that they're the same, you should probably just use an equivalent class axiom. In Protégé and RDF/XML it would look like this:

    enter image description here

    <rdf:RDF
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns="http://stackoverflow.com/q/22047101/1281433/ontology#"
        xmlns:owl="http://www.w3.org/2002/07/owl#"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
        xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
      <owl:Ontology rdf:about="http://stackoverflow.com/q/22047101/1281433/ontology"/>
      <owl:Class rdf:about="http://stackoverflow.com/q/22047101/1281433/ontology#HEWLETT_PACKARD">
        <owl:equivalentClass>
          <owl:Class rdf:about="http://stackoverflow.com/q/22047101/1281433/ontology#HP"/>
        </owl:equivalentClass>
      </owl:Class>
    </rdf:RDF>
    

    If you use the DL query, you can see the equivalent classes:

    enter image description here

    enter image description here