RE: Inferring Properties based on Types

Hi, again!

I wrote on October 01, 2007:

>Many thanks again, Evren, for re-investigating!
>
>So I attach below a demo ontology, which exactly consists of 
>the five axioms
>I gave in the beginning. Additionally, it contains the 
>following assertions:
>
>    * :alice a owl:Thing .
>    * :bob a :Man .
>    * :alice :sibling :bob .
>
>Also, I attach below some working Jena/Pellet code, which builds an
>inference model from this ontology, and then checks, if this 
>inference model
>'contains()' the triple
>
>    :alice :brother :bob .
>
>The result is:
>
>    "Exists inferred triple [alice brother bob]? true"
>
>And you say that I can believe in this result? 
>
>Hey, Tim, good news, it seems to work! You get your rule in 
>OWL-1.1! :-)
>
>So, end of day now!
>
>Cheers,
>Michael

A few corrections/enhancements.

I now checked Evren's observation that I can remove the axiom (A2), which
was specified in my original mail by: 

  (A2) SubClassOf( ObjectMinCardinality(1 manman owl:Thing) Man )

You are wright, Evren! So the set of axioms is now:

  (R4) SubObjectPropertyOf(SubObjectPropertyChain(sibling manman) brother)
  (A1) SubClassOf( Man ObjectExistsSelf(manman) )
  (A3) ObjectPropertyDomain( manman Man )
  (A4) FunctionalObjectProperty( manman )

The "Deduction of (S1b')" in my original mail, where 

  (S1b') FORALL x: ( EXISTS y: manman(x,y) ) ==> Man(x)

has then to be changed the following way:

  * Deduction of (S1b'): Given an instance x, and an instance y, for which
manman(x,y) holds. Then x is in the domain of 'manman'. And from axiom (A3)
we can conclude Man(x). 

The original "Deduction of (A2)" gets then removed, of course. 

Btw, in my previous post, I had the axiom (A2) wrong in the demo ontology.
Because in that ontology, I had accidentally made the minCardinality
restriction a QCR restricted to class Man, instead of owl:Thing. Not a
dangerous bug, but now the complete axiom has vanished, anyway. :-)

There was also a confusing typo in the javadoc of the demo code, where the
string for the rule contained the predicate "Man" with variable "x" instead
of "y".

I attach the corrected/enhanced versions of the ontology and the demo code
below.

Cheers,
Michael

===== Ontology "timsrule.owl" (no axiom (A2) anymore) =============

<?xml version="1.0"?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns="http://example.org/timsrule.owl#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:owl11="http://www.w3.org/2006/12/owl11#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
  xml:base="http://example.org/timsrule.owl">
  <owl:Ontology rdf:about="">
    <rdfs:comment>Encoding of the rule
[sibling(x,y)^Man(y)-&gt;brother(x,y)] in OWL-1.1</rdfs:comment>
    <owl:versionInfo rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >Created with TopBraid Composer</owl:versionInfo>
  </owl:Ontology>
  <owl:Class rdf:ID="Man">
    <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
    <rdfs:subClassOf>
      <owl11:SelfRestriction>
        <owl:onProperty>
          <owl:ObjectProperty rdf:ID="manman"/>
        </owl:onProperty>
      </owl11:SelfRestriction>
    </rdfs:subClassOf>
  </owl:Class>
  <owl:ObjectProperty rdf:about="#manman">
    <rdfs:domain rdf:resource="#Man"/>
    <rdf:type
rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/>
  </owl:ObjectProperty>
  <owl:ObjectProperty rdf:ID="sibling"/>
  <owl:ObjectProperty rdf:ID="brother"/>
  <rdf:List rdf:ID="subRoleChain">
    <rdf:first rdf:resource="#sibling"/>
    <rdf:rest rdf:parseType="Collection">
      <owl:ObjectProperty rdf:about="#manman"/>
    </rdf:rest>
    <rdfs:subPropertyOf rdf:resource="#brother"/>
  </rdf:List>
  <owl:Thing rdf:ID="alice">
    <sibling>
      <Man rdf:ID="bob"/>
    </sibling>
  </owl:Thing>
</rdf:RDF>

<!-- Created with TopBraid Composer -->

===== Democode (corrected typo in class docu) =====================

// Note: need a current version of 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 java.io.FileInputStream;

/**
 * Rule [sibling(x,y) AND Man(y) ==> brother(x,y)] in OWL-1.1
 * @author Michael Schneider (m_schnei@gmx.de)
 */
public class TimsRuleDemo {
    public static void main(String[] args) {
        String ONT_FILENAME = "timsrule.owl"; // put in project-toplevel
        String BASE_URI = "http://example.org/timsrule.owl";
        try {
            OntModel ontModel =
ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC);
            ontModel.read(new FileInputStream(ONT_FILENAME), BASE_URI);
            System.out.println("Exists inferred triple [alice brother bob]?
" +
                    ontModel.contains(
 
ResourceFactory.createResource(BASE_URI+"#alice"), 
                            ResourceFactory.createProperty(BASE_URI,
"#brother"), 
                            ResourceFactory.createResource(BASE_URI+"#bob")
                    )
            ); 
        } 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 Tuesday, 2 October 2007 07:52:58 UTC