Hi Dave
The bindSchema is used in the examples from the book "Semantic Web
Programming" Hebeler at all and although I didn't succeed in reproducing
these examples, I suppose somebody got it working.

I will check with the pellet folks.

mycircuit


On 27 June 2013 10:48, Dave Reynolds <[email protected]> wrote:

> Looks like a Pellet issue.
>
> If I run your code using the OWLMicro reasoner I see:
>
> All Mary related statements :
>
>  - (http://localhost/boc#Mary rdf:type owl:NamedIndividual)
>  - (http://localhost/boc#Mary rdf:type http://localhost/boc#Mother)
>  - (http://localhost/boc#Mary rdf:type owl:Thing)
>  - (http://localhost/boc#Mary rdf:type http://localhost/boc#Woman)
>
> Perhaps Pellet does not support the bindSchema mode. You'll need to check
> with the Pellet folks.
>
> Dave
>
>
> On 27/06/13 09:32, mycircuit wrote:
>
>> Sorry, about my last mail, hit the send key inadvertently.
>> Here is the problem:
>>
>> Hi, I am struggling to understand the usage of this idiom:
>>
>>     reasoner = reasoner.bindSchema(schema);
>>     InfModel infModel = ModelFactory.createInfModel( reasoner, data );
>>
>> when using separate models for tbox ( schema ) and abox ( data ).
>>
>> I am posting the data and the code, sorry if this is a bit long, but I
>> think it is required to understand the question.
>>
>> This is schema.owl:
>>
>> @prefix : <http://localhost/boc#> .
>> @prefix owl: 
>> <http://www.w3.org/2002/07/**owl#<http://www.w3.org/2002/07/owl#>>
>> .
>> @prefix rdf: 
>> <http://www.w3.org/1999/02/22-**rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns#>>
>> .
>> @prefix xml: 
>> <http://www.w3.org/XML/1998/**namespace<http://www.w3.org/XML/1998/namespace>>
>> .
>> @prefix xsd: 
>> <http://www.w3.org/2001/**XMLSchema#<http://www.w3.org/2001/XMLSchema#>>
>> .
>> @prefix rdfs: 
>> <http://www.w3.org/2000/01/**rdf-schema#<http://www.w3.org/2000/01/rdf-schema#>>
>> .
>> @base <http://localhost/boc> .
>> <http://localhost/boc> rdf:type owl:Ontology .
>>
>> ##############################**##############################**#####
>> #
>> #    Classes
>> #
>> ##############################**##############################**#####
>>
>> ###  http://localhost/boc#Mother
>>
>> :Mother rdf:type owl:Class ;
>>
>>          rdfs:subClassOf :Woman .
>>
>> ###  http://localhost/boc#Woman
>>
>> :Woman rdf:type owl:Class .
>>
>> ###  Generated by the OWL API (version
>> 3.4.4.owlapi-parent-3.4.4-3-**g757b63c) http://owlapi.sourceforge.net
>>
>>
>> and this is data.owl:
>>
>> @prefix : <http://localhost/boc#> .
>> @prefix owl: 
>> <http://www.w3.org/2002/07/**owl#<http://www.w3.org/2002/07/owl#>>
>> .
>> @prefix rdf: 
>> <http://www.w3.org/1999/02/22-**rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns#>>
>> .
>> @prefix xml: 
>> <http://www.w3.org/XML/1998/**namespace<http://www.w3.org/XML/1998/namespace>>
>> .
>> @prefix xsd: 
>> <http://www.w3.org/2001/**XMLSchema#<http://www.w3.org/2001/XMLSchema#>>
>> .
>> @prefix rdfs: 
>> <http://www.w3.org/2000/01/**rdf-schema#<http://www.w3.org/2000/01/rdf-schema#>>
>> .
>> @base <http://localhost/boc> .
>> <http://localhost/boc> rdf:type owl:Ontology .
>>
>> ##############################**##############################**#####
>> #
>> #    Classes
>> #
>> ##############################**##############################**#####
>>
>> ###  http://localhost/boc#Mother
>>
>> :Mother rdf:type owl:Class .
>>
>> ##############################**##############################**#####
>> #
>> #    Individuals
>> #
>> ##############################**##############################**#####
>>
>>
>> ###  http://localhost/boc#Mary
>>
>> :Mary rdf:type :Mother ,
>>                 owl:NamedIndividual .
>>
>>
>> ###  Generated by the OWL API (version
>> 3.4.4.owlapi-parent-3.4.4-3-**g757b63c) http://owlapi.sourceforge.net
>>
>>
>>  From these models, a reasoner can infer that the Individual Mary is a
>> Woman.
>>
>> When I use the bindSchema method on the reasoner ( as explained on the
>> Jena
>> website ), the program runs and the model is
>> validated, but there is no inference ( ie. Mary is not listed as a Woman
>> ):
>>
>>      String base = "http://localhost/boc";;
>>          com.hp.hpl.jena.reasoner.**Reasoner reasoner =
>>
>> org.mindswap.pellet.jena.**PelletReasonerFactory.**
>> theInstance().create();
>>
>>
>>
>>          OntModel data = ModelFactory.**createOntologyModel(
>> OntModelSpec.OWL_DL_MEM);
>>          InputStream is = FileManager.get().open("data.**owl");
>>          data.read( is, base, "TURTLE" );
>>
>>          OntModel schema = ModelFactory.**createOntologyModel(
>> OntModelSpec.OWL_DL_MEM );
>>           is = FileManager.get().open("**schema.owl");
>>          schema.read( is, base, "TURTLE" );
>>
>>         // this is the thing that does not trigger inference as expected
>>          reasoner = reasoner.bindSchema(schema);
>>          InfModel infModel = ModelFactory.createInfModel( reasoner, data
>> );
>>
>>          ValidityReport report = infModel.validate();
>>          assert ( report.isClean() );
>>
>>          System.out.println("All Mary related statements :");
>>
>>          Resource mary = infModel.createResource(base+"**#Mary");
>>          printStatements(infModel, mary, null, null);
>>      }
>>
>>
>>      public void printStatements(InfModel m, Resource s, Property p,
>> Resource o) {
>>          for (StmtIterator i = m.listStatements(s,p,o); i.hasNext(); ) {
>>              Statement stmt = i.nextStatement();
>>              System.out.println(" - " + PrintUtil.print(stmt));
>>          }
>>      }
>>
>>
>> This prints:
>>
>> Realizing:  33% complete in 00:00
>> Realizing:  66% complete in 00:00
>> Realizing:  100% complete in 00:00
>> Realizing finished in 00:00
>>   - (http://localhost/boc#Mary rdf:type owl:Thing)
>>   - (http://localhost/boc#Mary rdf:type http://localhost/boc#Mother)
>>   - (http://localhost/boc#Mary owl:sameAs http://localhost/boc#Mary)
>>   - (http://localhost/boc#Mary rdf:type owl:NamedIndividual)
>>
>> =>  - (http://localhost/boc#Mary rdf:type http://localhost/boc#Woman )
>>  is
>> missing
>>
>>
>> What am I missing ?
>>
>> Thanks for your time.
>> mycircuit
>>
>>
>>
>> On 27 June 2013 10:12, mycircuit <[email protected]> wrote:
>>
>>  Hi, I am struggling to understand the usage of this idiom:
>>>
>>> reasoner = reasoner.bindSchema(schema);
>>> InfModel infModel = ModelFactory.createInfModel( reasoner, data );
>>>
>>>
>>>
>>
>

Reply via email to