Defining cross products in OWL-1.1

[CC'ed Peter Patel-Schneider, because I cite him in this mail] 

Hi list!

I have started to stroll around a little through the OWL-1.1 issues list
this week, and I found this interesting one (issue 30) yesterday evening:

  "Need a role descrption based on the "cross product" of two concepts"
  http://code.google.com/p/owl1-1/issues/detail?id=30

  (Sorry, I cannot find out who the original author "kashyap.vipul" was.)

After reading this I was not really sure if this issue is about specifying
cross products in general, or just about realizing a specific scenario, with
or without the use of a cross product. But IMHO it /is/ certainly a
noteworthy question if cross products can be specified in OWL or not. I can
see that Peter Patel-Schneider has just commented on this issue: 

  "You are asking for the ability to define roles.

  A similar definition would be
     brother = sibling INTERSECTION range(Male)
  using range(x) as a shorthand for crossProduct(owl:Thing,x)

  This expands expressive power (I'm pretty sure).  
  I don't know whether there is a reasoning algorithm 
  for this construct."

I'm not quite clear if Peter means by "this construct" either the problem of
specifying a cross product in OWL-1.1, or something else? Assuming the first
of these options has motivated me to try out if I am able to specify a cross
product in OWL-1.1. It really seems to work - with some restrictions
discussed below.


Task: For given classes A and B give an OWL-1.1 axiom set, by which a
property pAXB is specified to be equivalent to the cross product A X B.

Solution:

  (A0) ClassAssertion(w owl:Thing)
  (A1) SubClassOf(A ObjectHasValue(pA w))
  (A2) SubClassOf(B ObjectHasValue(pB w))
  (A3) SubObjectPropertyOf(
         SubObjectPropertyChain(pA InverseObjectProperty(pB))
         pAXB )
  (A4) ObjectPropertyDomain(pAXB A)
  (A5) ObjectPropertyRange(pAXB B)

Axiom (A0) demands the existence of /some/ arbitrary individual w. I will
use this as a "glue instance" to connect two roles in a sub property chain.

Axioms (A1) and (A2) introduce roles 'pA' and 'pB', which are intended to
represent the classes A and B, respectively. The domain of role pA covers
class A (i.e. class A is a sub class of domain(pA)). The right hand side of
a role instance of pA is /always/ the "glue instance" w. Analog for role
'pB'.

Axiom (A3) makes role pAXB into a /super/ role of the cross product A X B:
Let x and y be two instances for which A(x) and B(y) both hold. According to
axioms (A1) and (A2), pA(x,w) and pB(y,w) both hold. Thus, the inverse role
instance pB^-1(w,y) is true, too. Hence, by applying axiom (A3), pAXB(x,y)
holds.

Axioms (A4) and (A5) obviously make role pAXB into a /sub/ role of the cross
product A X B = domain(pAXB) X range(pAXB).

So we finally receive pAXB = A X B.


There are a several points which need some further discussion here:

First: Is the above set of axioms allowed at all? I have checked the
"non-structural restrictions" given in [1]. Role pAXB is certainly a
"non-simple" role, as it appears as a super role of a sub role chain. So
certain axioms, in which pAXB occurs, will not be allowed. But the global
'domain' and 'range' restrictions, as given by axioms (A4) and (A5), are not
listed as forbidden restrictions in [1]. So this seems to be ok! (?) 

Second: About the "glue instance" w. The only real requirement was that
there is /some/ instance in the universe (denoted by owl:Thing), because
this alone suffices to use such an instance for glueing pA and pB^-1
together in the above sub role chain. Even the two 'ObjectHasValue' axioms
do not seem to put a dangerous restriction on 'w'. So it seems to be
possible for instance that I can reuse w for specifing the "glue instance"
of a second role rCXD for other classes C and D without any problem. Also,
if w occurs in other axioms of the ontology, this shouldn't be a big
problem, because it does not affect the fact that such a w /exists/. Of
course, it must not happen that in the ontology's remaining axioms one of
the "helper roles" 'pA' and 'pB' appears, but this can always be avoided in
practice AFAICS. So the only thing which might be considered to be at least
a /theoretical/ problem is that it will not be possible anymore to interpret
such an OWL ontology over the /empty/ universe. But in practice, no one will
really care about this lacking, and I am not even certain if doing so is
allowed at all in OWL. 

Third: What are the ramifications for using role 'pAXB'? Being a non-simple
role according to [1], pAXB suffers from not being allowed to appear in
certain kinds of axioms. This is generally a problem, because it means that
I cannot freely "play around" with pAXB, I always have to check first. On
the other hand, from a pragmatical point of view, I do not see immediate
applications for specifying cardinality restrictions on this cross product
role. Also, making a cross product into a functional or inverse functional
role will perhaps not happen too often, because it would have strong
implicit consequenses on the pair of original classes A and B. Same for
irreflexivity and asymmetry axioms. So the axiom set above might really be
of value for a large set of application scenarios.


You can find below an example ontology "crossproduct.owl" together with some
Jena/Pellet demo code. The ontology contains the axioms above, together with
the following assertions:

  * A(a1)
  * A(a2)
  * B(b1)
  * B(b2)

Also, I have made A a subclass of another class AA, and B a subclass of
another class BB, and included the following additional assertions:

  * AA(aNOT)
  * BB(bNOT)

The demo code checks if all possible combinations of instances of A and B
exist with property pAXB, while no tuple containing aNOT or bNOT as one of
its components must exist with property pAXB. The result of running the demo
is:

  *** allowed tuples MUST occur in pAXB ***
  Exists tuple (a1,b1)? true
  Exists tuple (a1,b2)? true
  Exists tuple (a2,b1)? true
  Exists tuple (a2,b2)? true
  *** un-allowed tuples must NOT occur in pAXB ***
  Exists tuple (aNOT,b1)? false
  Exists tuple (aNOT,b2)? false
  Exists tuple (a1,bNOT)? false
  Exists tuple (a2,bNOT)? false
  Exists tuple (aNOT,bNOT)? false


Cheers,
Michael

[1] http://www.webont.org/owl/1.1/owl_specification.html#7


===== ontology "crossproduct.owl" =====

<?xml version="1.0"?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns="http://example.org/crossproduct.owl#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:daml="http://www.daml.org/2001/03/daml+oil#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
  xml:base="http://example.org/crossproduct.owl">
  <owl:Ontology rdf:about="">
    <owl:versionInfo rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >Created with TopBraid Composer</owl:versionInfo>
  </owl:Ontology>
  <owl:Class rdf:ID="A">
    <rdfs:subClassOf>
      <owl:Restriction>
        <owl:hasValue>
          <owl:Thing rdf:ID="w"/>
        </owl:hasValue>
        <owl:onProperty>
          <owl:ObjectProperty rdf:ID="pA"/>
        </owl:onProperty>
      </owl:Restriction>
    </rdfs:subClassOf>
    <rdfs:subClassOf>
      <owl:Class rdf:ID="AA"/>
    </rdfs:subClassOf>
  </owl:Class>
  <owl:Class rdf:about="#AA">
    <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
  </owl:Class>
  <owl:Class rdf:ID="B">
    <rdfs:subClassOf>
      <owl:Restriction>
        <owl:hasValue rdf:resource="#w"/>
        <owl:onProperty>
          <owl:ObjectProperty rdf:ID="pB"/>
        </owl:onProperty>
      </owl:Restriction>
    </rdfs:subClassOf>
    <rdfs:subClassOf>
      <owl:Class rdf:ID="BB"/>
    </rdfs:subClassOf>
  </owl:Class>
  <owl:Class rdf:about="#BB">
    <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
  </owl:Class>
  <owl:ObjectProperty rdf:ID="pAXB">
    <rdfs:range rdf:resource="#B"/>
    <rdfs:domain rdf:resource="#A"/>
  </owl:ObjectProperty>
  <owl:ObjectProperty rdf:ID="inv_pB">
    <owl:inverseOf rdf:resource="#pB"/>
  </owl:ObjectProperty>
  <BB rdf:ID="bNOT"/>
  <A rdf:ID="a2"/>
  <A rdf:ID="a1"/>
  <B rdf:ID="b1"/>
  <AA rdf:ID="aNOT"/>
  <rdf:List>
    <rdfs:subPropertyOf rdf:resource="#pAXB"/>
    <rdf:rest rdf:parseType="Collection">
      <owl:ObjectProperty rdf:about="#inv_pB"/>
    </rdf:rest>
    <rdf:first rdf:resource="#pA"/>
  </rdf:List>
  <B rdf:ID="b2"/>
</rdf:RDF>

<!-- Created with TopBraid Composer -->


===== Demo code in Java, using Jena and Pellet (>=1.5) ===============

import org.mindswap.pellet.jena.PelletReasonerFactory;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.ResourceFactory;
import com.hp.hpl.jena.vocabulary.OWL;
import com.hp.hpl.jena.vocabulary.RDF;

import java.io.FileInputStream;

/**
 * Demo code for the "crossproduct" ontology: checks if pAXB = A X B.
 * @author Michael Schneider (m_schnei@gmx.de)
 */
public class Owl11CrossProductDemo {
    public static void main(String[] args) {
        String ONT_FILENAME = "crossproduct.owl"; // put in project-toplevel
        String BASE_URI = "http://example.org/crossproduct.owl";
        try {
            OntModel ontModel =
ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC);
            ontModel.read(new FileInputStream(ONT_FILENAME), BASE_URI);
            
            // check that all allowed tuples ARE in pAXB
            {
                String[][] allowedTuples = {
                        {"a1", "b1"},
                        {"a1", "b2"},
                        {"a2", "b1"},
                        {"a2", "b2"},
                };
                System.out.println("*** allowed tuples MUST occur in pAXB
***");
                for (String[] tuple : allowedTuples) {
                    System.out.println("Exists tuple
("+tuple[0]+","+tuple[1]+")? " +
                            ontModel.contains(
 
ResourceFactory.createResource(BASE_URI+"#"+tuple[0]), 
                                    ResourceFactory.createProperty(BASE_URI,
"#pAXB"), 
 
ResourceFactory.createResource(BASE_URI+"#"+tuple[1])
                            )
                    );                 
                }
            }
            
            // check that unallowed triples are NOT in pAXB
            {
                String[][] unAllowedTuples = {
                        {"aNOT", "b1"},
                        {"aNOT", "b2"},
                        {"a1", "bNOT"},
                        {"a2", "bNOT"},
                        {"aNOT", "bNOT"},
                };
                System.out.println("*** un-allowed tuples must NOT occur in
pAXB ***");
                for (String[] tuple : unAllowedTuples) {
                    System.out.println("Exists tuple
("+tuple[0]+","+tuple[1]+")? " +
                            ontModel.contains(
 
ResourceFactory.createResource(BASE_URI+"#"+tuple[0]), 
                                    ResourceFactory.createProperty(BASE_URI,
"#pAXB"), 
 
ResourceFactory.createResource(BASE_URI+"#"+tuple[1])
                            )
                    );                 
                }
            }          
            
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
}

=======================================

--
Dipl.-Inform. Michael Schneider
FZI Forschungszentrum Informatik Karlsruhe
Abtl. Information Process Engineering (IPE)
Tel  : +49-721-9654-726
Fax  : +49-721-9654-727
Email: Michael.Schneider@fzi.de
Web  : http://www.fzi.de/ipe/eng/mitarbeiter.php?id=555

FZI Forschungszentrum Informatik an der Universität Karlsruhe
Haid-und-Neu-Str. 10-14, D-76131 Karlsruhe
Tel.: +49-721-9654-0, Fax: +49-721-9654-959
Stiftung des bürgerlichen Rechts
Az: 14-0563.1 Regierungspräsidium Karlsruhe
Vorstand: Rüdiger Dillmann, Michael Flor, Jivka Ovtcharova, Rudi Studer
Vorsitzender des Kuratoriums: Ministerialdirigent Günther Leßnerkraus

Received on Friday, 12 October 2007 11:14:57 UTC