1:-use_module(library(trill)).    2
    3:- trill. % or :- trillp. or :- tornado.
    4
    5/*
    6This knowledge base is inpired by the people+pets ontology from
    7Patel-Schneider, P, F., Horrocks, I., and Bechhofer, S. 2003. Tutorial on OWL.
    8The knowledge base indicates that the individuals that own an animal which is a pet are nature lovers, from
    9Zese, R.: Reasoning with Probabilistic Logics. ArXiv e-prints 1405.0915v3. 
   10Doctoral Consortium of the 30th International Conference on Logic Programming (ICLP 2014), July 19-22, Vienna, Austria.
   11*/

?- prob_instanceOf('natureLover','Kevin',Prob). ?- instanceOf('natureLover','Kevin',ListExpl).

*/

   20owl_rdf('<?xml version="1.0"?>
   21
   22<!DOCTYPE rdf:RDF [
   23    <!ENTITY owl "http://www.w3.org/2002/07/owl#" >
   24    <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
   25    <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
   26    <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
   27    <!ENTITY disponte "https://sites.google.com/a/unife.it/ml/disponte#" >
   28]>
   29
   30
   31<rdf:RDF xmlns="http://cohse.semanticweb.org/ontologies/people#"
   32     xml:base="http://cohse.semanticweb.org/ontologies/people"
   33     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
   34     xmlns:owl="http://www.w3.org/2002/07/owl#"
   35     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
   36     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   37     xmlns:disponte="https://sites.google.com/a/unife.it/ml/disponte#">
   38    <owl:Ontology rdf:about="http://cohse.semanticweb.org/ontologies/people"/>
   39    
   40
   41
   42    <!-- 
   43    ///////////////////////////////////////////////////////////////////////////////////////
   44    //
   45    // Annotation properties
   46    //
   47    ///////////////////////////////////////////////////////////////////////////////////////
   48     -->
   49
   50    
   51
   52
   53    <!-- https://sites.google.com/a/unife.it/ml/disponte#probability -->
   54
   55    <owl:AnnotationProperty rdf:about="&disponte;probability"/>
   56    
   57
   58
   59    <!-- 
   60    ///////////////////////////////////////////////////////////////////////////////////////
   61    //
   62    // Object Properties
   63    //
   64    ///////////////////////////////////////////////////////////////////////////////////////
   65     -->
   66
   67    
   68
   69
   70    <!-- http://cohse.semanticweb.org/ontologies/people#has_animal -->
   71
   72    <owl:ObjectProperty rdf:about="http://cohse.semanticweb.org/ontologies/people#has_animal">
   73        <rdfs:label>has_animal</rdfs:label>
   74        <rdfs:comment></rdfs:comment>
   75    </owl:ObjectProperty>
   76    
   77
   78
   79    <!-- 
   80    ///////////////////////////////////////////////////////////////////////////////////////
   81    //
   82    // Classes
   83    //
   84    ///////////////////////////////////////////////////////////////////////////////////////
   85     -->
   86
   87    
   88
   89
   90    <!-- http://cohse.semanticweb.org/ontologies/people#cat -->
   91
   92    <!--owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#cat">
   93        <rdfs:label>cat</rdfs:label>
   94        <rdfs:subClassOf rdf:resource="http://cohse.semanticweb.org/ontologies/people#pet"/>
   95        <rdfs:comment></rdfs:comment>
   96    </owl:Class>
   97    <owl:Axiom>
   98        <disponte:probability rdf:datatype="&xsd;decimal">0.6</disponte:probability>
   99        <owl:annotatedSource rdf:resource="http://cohse.semanticweb.org/ontologies/people#cat"/>
  100        <owl:annotatedTarget rdf:resource="http://cohse.semanticweb.org/ontologies/people#pet"/>
  101        <owl:annotatedProperty rdf:resource="&rdfs;subClassOf"/>
  102    </owl:Axiom-->
  103    
  104
  105
  106    <!-- http://cohse.semanticweb.org/ontologies/people#natureLover -->
  107
  108    <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#natureLover"/>
  109    
  110
  111
  112    <!-- http://cohse.semanticweb.org/ontologies/people#pet -->
  113
  114    <owl:Class rdf:about="http://cohse.semanticweb.org/ontologies/people#pet"/>
  115    
  116
  117
  118    <!-- 
  119    ///////////////////////////////////////////////////////////////////////////////////////
  120    //
  121    // Individuals
  122    //
  123    ///////////////////////////////////////////////////////////////////////////////////////
  124     -->
  125
  126    
  127
  128
  129    <!-- http://cohse.semanticweb.org/ontologies/people#Fluffy -->
  130
  131    <owl:NamedIndividual rdf:about="http://cohse.semanticweb.org/ontologies/people#Fluffy">
  132        <rdf:type rdf:resource="http://cohse.semanticweb.org/ontologies/people#cat"/>
  133        <rdfs:label>Fuffy</rdfs:label>
  134        <rdfs:comment></rdfs:comment>
  135    </owl:NamedIndividual>
  136    <owl:Axiom>
  137        <disponte:probability>0.4</disponte:probability>
  138        <owl:annotatedSource rdf:resource="http://cohse.semanticweb.org/ontologies/people#Fluffy"/>
  139        <owl:annotatedTarget rdf:resource="http://cohse.semanticweb.org/ontologies/people#cat"/>
  140        <owl:annotatedProperty rdf:resource="&rdf;type"/>
  141    </owl:Axiom>
  142    
  143
  144
  145    <!-- http://cohse.semanticweb.org/ontologies/people#Kevin -->
  146
  147    <owl:NamedIndividual rdf:about="http://cohse.semanticweb.org/ontologies/people#Kevin">
  148        <rdfs:label>Kevin</rdfs:label>
  149        <rdfs:comment></rdfs:comment>
  150        <has_animal rdf:resource="http://cohse.semanticweb.org/ontologies/people#Fluffy"/>
  151        <has_animal rdf:resource="http://cohse.semanticweb.org/ontologies/people#Tom"/>
  152    </owl:NamedIndividual>
  153    
  154
  155
  156    <!-- http://cohse.semanticweb.org/ontologies/people#Tom -->
  157
  158    <owl:NamedIndividual rdf:about="http://cohse.semanticweb.org/ontologies/people#Tom">
  159        <rdf:type rdf:resource="http://cohse.semanticweb.org/ontologies/people#cat"/>
  160        <rdfs:label>Tom</rdfs:label>
  161        <rdfs:comment></rdfs:comment>
  162    </owl:NamedIndividual>
  163    <owl:Axiom>
  164        <disponte:probability>0.3</disponte:probability>
  165        <owl:annotatedSource rdf:resource="http://cohse.semanticweb.org/ontologies/people#Tom"/>
  166        <owl:annotatedTarget rdf:resource="http://cohse.semanticweb.org/ontologies/people#cat"/>
  167        <owl:annotatedProperty rdf:resource="&rdf;type"/>
  168    </owl:Axiom>
  169    
  170
  171
  172    <!-- 
  173    ///////////////////////////////////////////////////////////////////////////////////////
  174    //
  175    // General axioms
  176    //
  177    ///////////////////////////////////////////////////////////////////////////////////////
  178     -->
  179
  180    <owl:Axiom>
  181        <owl:annotatedTarget rdf:resource="http://cohse.semanticweb.org/ontologies/people#natureLover"/>
  182        <owl:annotatedProperty rdf:resource="&rdfs;subClassOf"/>
  183        <owl:annotatedSource>
  184            <owl:Restriction>
  185                <rdfs:subClassOf rdf:resource="http://cohse.semanticweb.org/ontologies/people#natureLover"/>
  186                <owl:onProperty rdf:resource="http://cohse.semanticweb.org/ontologies/people#has_animal"/>
  187                <owl:someValuesFrom rdf:resource="http://cohse.semanticweb.org/ontologies/people#pet"/>
  188            </owl:Restriction>
  189        </owl:annotatedSource>
  190    </owl:Axiom>
  191</rdf:RDF>').
  192
  193subClassOf('cat','pet').
  194annotationAssertion('disponte:probability',subClassOf('cat','pet'),literal('0.6'))