RE: Inferring Properties based on Types

Hi again, Evren!

Evren Sirin wrote on October 01, 2007 10:00 PM:

>On 10/1/07 12:16 PM, Michael Schneider wrote:
>> Hi, Evren and Dmitry!
>>
>> @Dmitry: Yes, what you say below was also the first thing 
>which came to my
>> mind, when I read Evren's answer. Of course, I wanted to 
>express that the
>> property 'manman' is somehow "equivalent" to a given, 
>*arbitrary* class
>> 'Man'. The axiom set should of course not only allow models 
>in which 'Man'
>> is an equivalent class of 'owl:Thing'. :)
>>   
>Ah, of course :)
>> But, Evren, many thanks for your reply! Great discussion, 
>great points! I
>> was completely unaware of this "Nonstructural Restrictions" 
>issue, and I
>> will look at it, as soon as I find time.
>>   
>When you read through that section you will actually see that those 
>nonstructural restrictions do not apply to the set of axioms 
>you had in 
>the beginning :) It is ok to use the same property in (local 
>or global) 
>reflexivity restrictions and cardinality restrictions at the 
>same time. 
>The nonstructural restrictions only limit the usage of composite 
>properties (the only composite property in your set of axioms is 
>brother) so it wasn't a problem to begin with.

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


============ Ontology "timsrule.owl" ===================

<?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="">
    <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>
      <owl11:SelfRestriction>
        <owl:onProperty>
          <owl:FunctionalProperty rdf:ID="manman"/>
        </owl:onProperty>
      </owl11:SelfRestriction>
    </rdfs:subClassOf>
    <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
  </owl:Class>
  <owl:Class rdf:ID="ExistsManman">
    <rdfs:subClassOf rdf:resource="#Man"/>
    <owl:equivalentClass>
      <owl:Restriction>
        <owl11:onClass rdf:resource="#Man"/>
        <owl:minCardinality
rdf:datatype="http://www.w3.org/2001/XMLSchema#int"
        >1</owl:minCardinality>
        <owl:onProperty>
          <owl:FunctionalProperty rdf:about="#manman"/>
        </owl:onProperty>
      </owl:Restriction>
    </owl:equivalentClass>
    <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
  </owl:Class>
  <owl:ObjectProperty rdf:ID="sibling"/>
  <owl:ObjectProperty rdf:ID="brother"/>
  <owl:FunctionalProperty rdf:about="#manman">
    <rdfs:domain rdf:resource="#Man"/>
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
  </owl:FunctionalProperty>
  <rdf:List rdf:ID="subRoleChain">
    <rdfs:subPropertyOf rdf:resource="#brother"/>
    <rdf:rest rdf:parseType="Collection">
      <owl:FunctionalProperty rdf:about="#manman"/>
    </rdf:rest>
    <rdf:first rdf:resource="#sibling"/>
  </rdf:List>
  <owl:Thing rdf:ID="alice">
    <sibling>
      <Man rdf:ID="bob"/>
    </sibling>
  </owl:Thing>
</rdf:RDF>

<!-- Created with TopBraid Composer -->

============ TimsRuleDemo.java ==============

// Note: Needs 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;

/**
 * sibling(x,y) AND Man(x) ==> 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 Monday, 1 October 2007 21:29:17 UTC