You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by sourajit basak <je...@yahoo.com> on 2011/08/18 15:14:47 UTC

basic inference capabilities in Jena

Suppose I have two class definition like -


<owl:Class rdf:about="&v1;Customer">
    <!-- property restrictions -->

 </owl:Class>

 <owl:Class rdf:about="&v1;PotentialCustomer">
        <rdfs:subClassOf rdf:resource="&v1;Customer"/>
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="&v1;proposedScheme"/>
                <owl:allValuesFrom rdf:resource="&v1;Scheme"/>
            </owl:Restriction>
        </rdfs:subClassOf>
  </owl:Class>

At runtime, I create an instance of Customer and explicitly assert the type. However, for PotentialCustomer, I don't explicitly assert a type but only set the 'proposedSchema' property. If I query for PotentialCustomers, will Jena list correctly. This inferring of triples is a feature handled by reasoners but I am trying to avoid using reasoners when my system is online.

thanks,
Sourajit

Re: basic inference capabilities in Jena

Posted by sourajit basak <je...@yahoo.com>.

I forgot to mention that I also have a ObjectProperty definition for 'proposedSchema' 


    <owl:ObjectProperty rdf:about="&v1;proposedScheme">
        <rdfs:domain rdf:resource="&v1;PotentialCustomer"/>
        <rdfs:range rdf:resource="&v1;Scheme"/>
    </owl:ObjectProperty>

thanks,
Sourajit


________________________________
From: sourajit basak <je...@yahoo.com>
To: "jena-users@incubator.apache.org" <je...@incubator.apache.org>
Sent: Thursday, 18 August 2011 6:44 PM
Subject: basic inference capabilities in Jena

Suppose I have two class definition like -


<owl:Class rdf:about="&v1;Customer">
    <!-- property restrictions -->

 </owl:Class>

 <owl:Class rdf:about="&v1;PotentialCustomer">
        <rdfs:subClassOf rdf:resource="&v1;Customer"/>
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="&v1;proposedScheme"/>
                <owl:allValuesFrom rdf:resource="&v1;Scheme"/>
            </owl:Restriction>
        </rdfs:subClassOf>
  </owl:Class>

At runtime, I create an instance of Customer and explicitly assert the type. However, for PotentialCustomer, I don't explicitly assert a type but only set the 'proposedSchema' property. If I query for PotentialCustomers, will Jena list correctly. This inferring of triples is a feature handled by reasoners but I am trying to avoid using reasoners when my system is online.

thanks,
Sourajit

Re: basic inference capabilities in Jena

Posted by Dave Reynolds <da...@gmail.com>.
On Fri, 2011-08-19 at 04:37 -0700, sourajit basak wrote: 
> A closed world checker would find that issue but not a general reasoner. - example implementation ? Pellet ?

Of a closed world checker?

Eyeball - I believe it has a cardinality checker, though not one that
will also check the allValuesFrom.

C&P do have a closed world checker. I don't know if it ships as part of
Pellet or as a separate product.

Dave

> 
> thanks,
> Sourajit
> 
> 
> 
> ________________________________
> From: Dave Reynolds <da...@gmail.com>
> To: sourajit basak <je...@yahoo.com>
> Cc: "jena-users@incubator.apache.org" <je...@incubator.apache.org>
> Sent: Friday, 19 August 2011 3:58 PM
> Subject: Re: basic inference capabilities in Jena
> 
> Hi,
> 
> On Fri, 2011-08-19 at 01:42 -0700, sourajit basak wrote: 
> > Thanks Dave.
> > 
> > I think I have run into the reasoner OWA principles which have been perpetually confusing to me.
> 
> You are not alone. The OWA principles are important but they are a
> different way of thinking about data and many find them confusing at
> first.
> 
> > According to the specs,
> > The owl:allValuesFrom restriction requires that for every instance of
> > the class that has instances of the specified property, the 
> > values of the property are all members of the class indicated by the owl:allValuesFrom clause. 
> > 
> > 
> > Which means if I add a min cardinality, it means that PotentialCustomers have one proposedScheme pointing to individuals from 'Scheme'. Is this correct ?
> 
> Yes. It doesn't let you infer a PotentialCustomer but it does mean that
> anything explicitly typed as a PtentialCustomer logically has at least
> one proposedScheme pointing to a Scheme.
> 
> > 
> >     <owl:Class rdf:about="&v1;PotentialCustomer">
> >         <rdfs:subClassOf rdf:resource="&v1;Customer"/>
> >         <rdfs:subClassOf>
> >             <owl:Restriction>
> >                 <owl:onProperty rdf:resource="&v1;proposedScheme"/>
> >                 <owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:minCardinality>
> >             </owl:Restriction>
> >         </rdfs:subClassOf>
> >         <rdfs:subClassOf>
> >             <owl:Restriction>
> >                 <owl:onProperty rdf:resource="&v1;proposedScheme"/>
> >                 <owl:allValuesFrom rdf:resource="&v1;Scheme"/>
> >             </owl:Restriction>
> >         </rdfs:subClassOf>
> >     </owl:Class>
> > 
> > Lets assume there is no reasoner and I explicitly created a typed PotentialCustomer and try to add a 'proposedScheme' value a) which isn't an instance of Scheme and b) not add the 'proposedScheme' at all.
> > 
> > 
> > Will Jena throw a validation error ? 
> 
> No.
> 
> Firstly there is no runtime validation like this at all in Jena. To
> validate a model you call a reasoner and ask it to validate, so with no
> reasoner no errors like that are detected. As a piece of RDF it is fine
> either way.
> 
> For (b) that wouldn't even be an error for a reasoner - OWA again.  Your
> minCardinality means that there is logically at least one proposedScheme
> value. Just because your instance doesn't have one yet just means to
> don't a complete view of the data so there is no inconsistency. A closed
> world checker would find that issue but not a general reasoner.
> 
> Dave




Re: basic inference capabilities in Jena

Posted by sourajit basak <je...@yahoo.com>.
A closed world checker would find that issue but not a general reasoner. - example implementation ? Pellet ?

thanks,
Sourajit



________________________________
From: Dave Reynolds <da...@gmail.com>
To: sourajit basak <je...@yahoo.com>
Cc: "jena-users@incubator.apache.org" <je...@incubator.apache.org>
Sent: Friday, 19 August 2011 3:58 PM
Subject: Re: basic inference capabilities in Jena

Hi,

On Fri, 2011-08-19 at 01:42 -0700, sourajit basak wrote: 
> Thanks Dave.
> 
> I think I have run into the reasoner OWA principles which have been perpetually confusing to me.

You are not alone. The OWA principles are important but they are a
different way of thinking about data and many find them confusing at
first.

> According to the specs,
> The owl:allValuesFrom restriction requires that for every instance of
> the class that has instances of the specified property, the 
> values of the property are all members of the class indicated by the owl:allValuesFrom clause. 
> 
> 
> Which means if I add a min cardinality, it means that PotentialCustomers have one proposedScheme pointing to individuals from 'Scheme'. Is this correct ?

Yes. It doesn't let you infer a PotentialCustomer but it does mean that
anything explicitly typed as a PtentialCustomer logically has at least
one proposedScheme pointing to a Scheme.

> 
>     <owl:Class rdf:about="&v1;PotentialCustomer">
>         <rdfs:subClassOf rdf:resource="&v1;Customer"/>
>         <rdfs:subClassOf>
>             <owl:Restriction>
>                 <owl:onProperty rdf:resource="&v1;proposedScheme"/>
>                 <owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:minCardinality>
>             </owl:Restriction>
>         </rdfs:subClassOf>
>         <rdfs:subClassOf>
>             <owl:Restriction>
>                 <owl:onProperty rdf:resource="&v1;proposedScheme"/>
>                 <owl:allValuesFrom rdf:resource="&v1;Scheme"/>
>             </owl:Restriction>
>         </rdfs:subClassOf>
>     </owl:Class>
> 
> Lets assume there is no reasoner and I explicitly created a typed PotentialCustomer and try to add a 'proposedScheme' value a) which isn't an instance of Scheme and b) not add the 'proposedScheme' at all.
> 
> 
> Will Jena throw a validation error ? 

No.

Firstly there is no runtime validation like this at all in Jena. To
validate a model you call a reasoner and ask it to validate, so with no
reasoner no errors like that are detected. As a piece of RDF it is fine
either way.

For (b) that wouldn't even be an error for a reasoner - OWA again.  Your
minCardinality means that there is logically at least one proposedScheme
value. Just because your instance doesn't have one yet just means to
don't a complete view of the data so there is no inconsistency. A closed
world checker would find that issue but not a general reasoner.

Dave

Re: basic inference capabilities in Jena

Posted by Dave Reynolds <da...@gmail.com>.
Hi,

On Fri, 2011-08-19 at 01:42 -0700, sourajit basak wrote: 
> Thanks Dave.
> 
> I think I have run into the reasoner OWA principles which have been perpetually confusing to me.

You are not alone. The OWA principles are important but they are a
different way of thinking about data and many find them confusing at
first.

> According to the specs,
> The owl:allValuesFrom restriction requires that for every instance of
> the class that has instances of the specified property, the 
> values of the property are all members of the class indicated by the owl:allValuesFrom clause. 
> 
> 
> Which means if I add a min cardinality, it means that PotentialCustomers have one proposedScheme pointing to individuals from 'Scheme'. Is this correct ?

Yes. It doesn't let you infer a PotentialCustomer but it does mean that
anything explicitly typed as a PtentialCustomer logically has at least
one proposedScheme pointing to a Scheme.

> 
>     <owl:Class rdf:about="&v1;PotentialCustomer">
>         <rdfs:subClassOf rdf:resource="&v1;Customer"/>
>         <rdfs:subClassOf>
>             <owl:Restriction>
>                 <owl:onProperty rdf:resource="&v1;proposedScheme"/>
>                 <owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:minCardinality>
>             </owl:Restriction>
>         </rdfs:subClassOf>
>         <rdfs:subClassOf>
>             <owl:Restriction>
>                 <owl:onProperty rdf:resource="&v1;proposedScheme"/>
>                 <owl:allValuesFrom rdf:resource="&v1;Scheme"/>
>             </owl:Restriction>
>         </rdfs:subClassOf>
>     </owl:Class>
> 
> Lets assume there is no reasoner and I explicitly created a typed PotentialCustomer and try to add a 'proposedScheme' value a) which isn't an instance of Scheme and b) not add the 'proposedScheme' at all.
> 
> 
> Will Jena throw a validation error ? 

No.

Firstly there is no runtime validation like this at all in Jena. To
validate a model you call a reasoner and ask it to validate, so with no
reasoner no errors like that are detected. As a piece of RDF it is fine
either way.

For (b) that wouldn't even be an error for a reasoner - OWA again.  Your
minCardinality means that there is logically at least one proposedScheme
value. Just because your instance doesn't have one yet just means to
don't a complete view of the data so there is no inconsistency. A closed
world checker would find that issue but not a general reasoner.

Dave



Re: basic inference capabilities in Jena

Posted by sourajit basak <je...@yahoo.com>.
Thanks Dave.

I think I have run into the reasoner OWA principles which have been perpetually confusing to me.


According to the specs,
The owl:allValuesFrom restriction requires that for every instance of
the class that has instances of the specified property, the 
values of the property are all members of the class indicated by the owl:allValuesFrom clause. 


Which means if I add a min cardinality, it means that PotentialCustomers have one proposedScheme pointing to individuals from 'Scheme'. Is this correct ?


    <owl:Class rdf:about="&v1;PotentialCustomer">
        <rdfs:subClassOf rdf:resource="&v1;Customer"/>
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="&v1;proposedScheme"/>
                <owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:minCardinality>
            </owl:Restriction>
        </rdfs:subClassOf>
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="&v1;proposedScheme"/>
                <owl:allValuesFrom rdf:resource="&v1;Scheme"/>
            </owl:Restriction>
        </rdfs:subClassOf>
    </owl:Class>

Lets assume there is no reasoner and I explicitly created a typed PotentialCustomer and try to add a 'proposedScheme' value a) which isn't an instance of Scheme and b) not add the 'proposedScheme' at all.


Will Jena throw a validation error ? 


thanks,
Sourajit


________________________________
From: Dave Reynolds <da...@gmail.com>
To: sourajit basak <je...@yahoo.com>
Cc: "jena-users@incubator.apache.org" <je...@incubator.apache.org>
Sent: Thursday, 18 August 2011 7:43 PM
Subject: Re: basic inference capabilities in Jena

Hi,

On Thu, 2011-08-18 at 06:14 -0700, sourajit basak wrote: 
> Suppose I have two class definition like -
> 
> 
> <owl:Class rdf:about="&v1;Customer">
>     <!-- property restrictions -->
> 
>  </owl:Class>
> 
>  <owl:Class rdf:about="&v1;PotentialCustomer">
>         <rdfs:subClassOf rdf:resource="&v1;Customer"/>
>         <rdfs:subClassOf>
>             <owl:Restriction>
>                 <owl:onProperty rdf:resource="&v1;proposedScheme"/>
>                 <owl:allValuesFrom rdf:resource="&v1;Scheme"/>
>             </owl:Restriction>
>         </rdfs:subClassOf>
>   </owl:Class>
> 
> At runtime, I create an instance of Customer and explicitly assert the type. However, for PotentialCustomer, I don't explicitly assert a type but only set the 'proposedSchema' property. If I query for PotentialCustomers, will Jena list correctly. This inferring of triples is a feature handled by reasoners but I am trying to avoid using reasoners when my system is online.

The short answer is "no" but for two different reasons :)

First, unless there is a reasoner running then jena won't see any
inferred types, it is not baked into the API itself somehow - no
inference engine then no inferences. 

So you'll need to either assert the type explicitly, run a reasoner or
run some custom special-purpose reasoner-lite code which asserts the
type based on your assertion of proposedScheme.

Second, note that the open-world assumption means that even a complete
reasoner can't deduce something is a PotentialCustomer just because it
is a Customer and has a proposedScheme value pointing to some Scheme.
That's because there could be other proposedScheme values which aren't
schemes so the reasoner can't be certain the "allValuesFrom" is
satisfied. You might mean that a PotentialCustomer is anyone who has
some proposedScheme in which case use someValuesFrom (or cardinality).

Dave

Re: basic inference capabilities in Jena

Posted by Dave Reynolds <da...@gmail.com>.
Hi,

On Thu, 2011-08-18 at 06:14 -0700, sourajit basak wrote: 
> Suppose I have two class definition like -
> 
> 
> <owl:Class rdf:about="&v1;Customer">
>     <!-- property restrictions -->
> 
>  </owl:Class>
> 
>  <owl:Class rdf:about="&v1;PotentialCustomer">
>         <rdfs:subClassOf rdf:resource="&v1;Customer"/>
>         <rdfs:subClassOf>
>             <owl:Restriction>
>                 <owl:onProperty rdf:resource="&v1;proposedScheme"/>
>                 <owl:allValuesFrom rdf:resource="&v1;Scheme"/>
>             </owl:Restriction>
>         </rdfs:subClassOf>
>   </owl:Class>
> 
> At runtime, I create an instance of Customer and explicitly assert the type. However, for PotentialCustomer, I don't explicitly assert a type but only set the 'proposedSchema' property. If I query for PotentialCustomers, will Jena list correctly. This inferring of triples is a feature handled by reasoners but I am trying to avoid using reasoners when my system is online.

The short answer is "no" but for two different reasons :)

First, unless there is a reasoner running then jena won't see any
inferred types, it is not baked into the API itself somehow - no
inference engine then no inferences. 

So you'll need to either assert the type explicitly, run a reasoner or
run some custom special-purpose reasoner-lite code which asserts the
type based on your assertion of proposedScheme.

Second, note that the open-world assumption means that even a complete
reasoner can't deduce something is a PotentialCustomer just because it
is a Customer and has a proposedScheme value pointing to some Scheme.
That's because there could be other proposedScheme values which aren't
schemes so the reasoner can't be certain the "allValuesFrom" is
satisfied. You might mean that a PotentialCustomer is anyone who has
some proposedScheme in which case use someValuesFrom (or cardinality).

Dave