You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Rodrigo Antonialli <rc...@gmail.com> on 2014/02/24 14:46:45 UTC

Cardinality Restriction with onDataRange

Hi!

I have a doubt about Jena OWL2 support and the
method createCardinalityQRestriction.

What I'm building now is something like that:

ns:sample
      a       owl:Class ;
      rdfs:subClassOf
              [ a       owl:Restriction ;
                owl:cardinality "1"^^xsd:int ;
                owl:onProperty ns:longitude
              ] ;

ns:longitude
      a       owl:DatatypeProperty ;
      rdfs:range xsd:string .


What I'd like to do is to add a owl:onDataRange to the owl:Restriction and
come up with this:

ns:sample
      a       owl:Class ;
      rdfs:subClassOf
              [ a       owl:Restriction ;
                owl:cardinality "1"^^xsd:int ;
                owl:onProperty ns:longitude
               * owl:onDataRange xsd:string*
              ] ;

ns:longitude
      a       owl:DatatypeProperty ;
      rdfs:range xsd:string .


Is it possible? As far as I read the docs, the method
createCardinalityQRestriction could me help with that, but when I try to
use it, the following exception is thrown:

Exception in thread "main" com.hp.hpl.jena.ontology.ProfileException:
Attempted to use language construct CARDINALITY_Q that is not supported in
the current language profile: OWL DL

Is this about Jena OWL2 support? (I think that owl:onDataRange is OWL2
vocabulary, right?)

I tried with other language profile but no success.

Is there any other way I could do that declaration?!

Thanks,

Rodrigo C. Antonialli
======================================
Rio Claro - SP - Brasil
LinkedIn: http://www.linkedin.com/in/rcantonialli
Contato:  (19) 98136-2347
              rcantonialli@gmail.com
              Skype: rc_antonialli

Re: Cardinality Restriction with onDataRange

Posted by Rodrigo Antonialli <rc...@gmail.com>.
Oh yes! My example showed only what I was able to do...

Some datatype properties has a range specified in their definition but
others don't, so owl:onDataRange gives this assertion in class restriction.


Rodrigo C. Antonialli
======================================
Rio Claro - SP - Brasil
LinkedIn: http://www.linkedin.com/in/rcantonialli
Contato:  (19) 98136-2347
              rcantonialli@gmail.com
              Skype: rc_antonialli


On Mon, Feb 24, 2014 at 3:05 PM, Joshua TAYLOR <jo...@gmail.com>wrote:

> Oh, I'd missed at first that you were working with datatype
> properties.  You should note, of course, that adding the onDataRange
> here doesn't actually add anything for you.  If you've already
> declared that the range of the property is xsd:string, then the class
> expression (p min 1 xsd:string) doesn't say anything that (p min 1)
> didn't already, since _every_ object of p already has to be an
> xsd:string.
>
>
> On Mon, Feb 24, 2014 at 12:55 PM, Rodrigo Antonialli
> <rc...@gmail.com> wrote:
> > Hi Joshua,
> >
> > Thanks!
> >
> > I did this:
> >
> > DatatypeProperty dataproperty =  this.ontmodel.createDatatypeProperty(NS
> +
> > propname);
> >
> > Restriction rest = this.ontmodel.createRestriction(dataproperty);
> >
> > MinCardinalityRestriction minCardRestriction;
> >
> > minCardRestriction = rest.convertToMinCardinalityRestriction(1);
> >
> > minCardRestriction.addSubClass(myClass);
> > minCardRestriction.addProperty(this.ontmodel.getProperty("
> http://www.w3.org/2002/07/owl#onDataRange"),
> > dataproperty.getRange());
> >
> > []s
> >
> > Rodrigo C. Antonialli
> > ======================================
> > Rio Claro - SP - Brasil
> > LinkedIn: http://www.linkedin.com/in/rcantonialli
> > Contato:  (19) 98136-2347
> >               rcantonialli@gmail.com
> >               Skype: rc_antonialli
> >
> >
> > On Mon, Feb 24, 2014 at 2:12 PM, Joshua TAYLOR <jo...@gmail.com>
> > wrote:
> >>
> >> On Mon, Feb 24, 2014 at 9:54 AM, Rodrigo Antonialli
> >> <rc...@gmail.com> wrote:
> >> > Sorry, I know jena does not support OWL2, the intention was to know
> some
> >> > work in progress about it. I should have asked directly...
> >> >
> >> > Thanks for your help! I'll try to create the RDF statements!
> >>
> >> There's an example of creating such restrictions on Stack Overflow,
> >> How to add qualified cardinality in JENA [1].
> >>
> >> [1] http://stackoverflow.com/q/20562107/1281433
> >>
> >> --
> >> Joshua Taylor, http://www.cs.rpi.edu/~tayloj/
> >
> >
>
>
>
> --
> Joshua Taylor, http://www.cs.rpi.edu/~tayloj/
>

Re: Cardinality Restriction with onDataRange

Posted by Joshua TAYLOR <jo...@gmail.com>.
Oh, I'd missed at first that you were working with datatype
properties.  You should note, of course, that adding the onDataRange
here doesn't actually add anything for you.  If you've already
declared that the range of the property is xsd:string, then the class
expression (p min 1 xsd:string) doesn't say anything that (p min 1)
didn't already, since _every_ object of p already has to be an
xsd:string.


On Mon, Feb 24, 2014 at 12:55 PM, Rodrigo Antonialli
<rc...@gmail.com> wrote:
> Hi Joshua,
>
> Thanks!
>
> I did this:
>
> DatatypeProperty dataproperty =  this.ontmodel.createDatatypeProperty(NS +
> propname);
>
> Restriction rest = this.ontmodel.createRestriction(dataproperty);
>
> MinCardinalityRestriction minCardRestriction;
>
> minCardRestriction = rest.convertToMinCardinalityRestriction(1);
>
> minCardRestriction.addSubClass(myClass);
> minCardRestriction.addProperty(this.ontmodel.getProperty("http://www.w3.org/2002/07/owl#onDataRange"),
> dataproperty.getRange());
>
> []s
>
> Rodrigo C. Antonialli
> ======================================
> Rio Claro - SP - Brasil
> LinkedIn: http://www.linkedin.com/in/rcantonialli
> Contato:  (19) 98136-2347
>               rcantonialli@gmail.com
>               Skype: rc_antonialli
>
>
> On Mon, Feb 24, 2014 at 2:12 PM, Joshua TAYLOR <jo...@gmail.com>
> wrote:
>>
>> On Mon, Feb 24, 2014 at 9:54 AM, Rodrigo Antonialli
>> <rc...@gmail.com> wrote:
>> > Sorry, I know jena does not support OWL2, the intention was to know some
>> > work in progress about it. I should have asked directly...
>> >
>> > Thanks for your help! I'll try to create the RDF statements!
>>
>> There's an example of creating such restrictions on Stack Overflow,
>> How to add qualified cardinality in JENA [1].
>>
>> [1] http://stackoverflow.com/q/20562107/1281433
>>
>> --
>> Joshua Taylor, http://www.cs.rpi.edu/~tayloj/
>
>



-- 
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/

Re: Cardinality Restriction with onDataRange

Posted by Rodrigo Antonialli <rc...@gmail.com>.
Hi Joshua,

Thanks!

I did this:

DatatypeProperty dataproperty =  this.ontmodel.createDatatypeProperty(NS +
propname);

Restriction rest = this.ontmodel.createRestriction(dataproperty);

MinCardinalityRestriction minCardRestriction;

minCardRestriction = rest.convertToMinCardinalityRestriction(1);

minCardRestriction.addSubClass(myClass);
minCardRestriction.addProperty(this.ontmodel.getProperty("
http://www.w3.org/2002/07/owl#onDataRange"), dataproperty.getRange());

[]s

Rodrigo C. Antonialli
======================================
Rio Claro - SP - Brasil
LinkedIn: http://www.linkedin.com/in/rcantonialli
Contato:  (19) 98136-2347
              rcantonialli@gmail.com
              Skype: rc_antonialli


On Mon, Feb 24, 2014 at 2:12 PM, Joshua TAYLOR <jo...@gmail.com>wrote:

> On Mon, Feb 24, 2014 at 9:54 AM, Rodrigo Antonialli
> <rc...@gmail.com> wrote:
> > Sorry, I know jena does not support OWL2, the intention was to know some
> > work in progress about it. I should have asked directly...
> >
> > Thanks for your help! I'll try to create the RDF statements!
>
> There's an example of creating such restrictions on Stack Overflow,
> How to add qualified cardinality in JENA [1].
>
> [1] http://stackoverflow.com/q/20562107/1281433
>
> --
> Joshua Taylor, http://www.cs.rpi.edu/~tayloj/
>

Re: Cardinality Restriction with onDataRange

Posted by Joshua TAYLOR <jo...@gmail.com>.
On Mon, Feb 24, 2014 at 9:54 AM, Rodrigo Antonialli
<rc...@gmail.com> wrote:
> Sorry, I know jena does not support OWL2, the intention was to know some
> work in progress about it. I should have asked directly...
>
> Thanks for your help! I'll try to create the RDF statements!

There's an example of creating such restrictions on Stack Overflow,
How to add qualified cardinality in JENA [1].

[1] http://stackoverflow.com/q/20562107/1281433

-- 
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/

Re: Cardinality Restriction with onDataRange

Posted by Rodrigo Antonialli <rc...@gmail.com>.
Hi Dave,

Sorry, I know jena does not support OWL2, the intention was to know some
work in progress about it. I should have asked directly...

Thanks for your help! I'll try to create the RDF statements!


Rodrigo C. Antonialli
======================================
Rio Claro - SP - Brasil
LinkedIn: http://www.linkedin.com/in/rcantonialli
Contato:  (19) 98136-2347
              rcantonialli@gmail.com
              Skype: rc_antonialli


On Mon, Feb 24, 2014 at 11:07 AM, Dave Reynolds
<da...@gmail.com>wrote:

> On 24/02/14 13:46, Rodrigo Antonialli wrote:
>
>> Hi!
>>
>> I have a doubt about Jena OWL2 support and the
>> method createCardinalityQRestriction.
>>
>
> Jena does not support OWL2.
>
> I suspect that the createCardinalityQRestriction is a hang over from the
> now-defunct DAML support and not available in the current OWL profiles.
>
> You can create OWL2 restrictions by asserting the RDF statements directly
> but there's no convenience support for OWL2 at the present time.
>
> Dave
>
>
>  What I'm building now is something like that:
>>
>> ns:sample
>>        a       owl:Class ;
>>        rdfs:subClassOf
>>                [ a       owl:Restriction ;
>>                  owl:cardinality "1"^^xsd:int ;
>>                  owl:onProperty ns:longitude
>>                ] ;
>>
>> ns:longitude
>>        a       owl:DatatypeProperty ;
>>        rdfs:range xsd:string .
>>
>>
>> What I'd like to do is to add a owl:onDataRange to the owl:Restriction and
>> come up with this:
>>
>> ns:sample
>>        a       owl:Class ;
>>        rdfs:subClassOf
>>                [ a       owl:Restriction ;
>>                  owl:cardinality "1"^^xsd:int ;
>>                  owl:onProperty ns:longitude
>>                 * owl:onDataRange xsd:string*
>>
>>                ] ;
>>
>> ns:longitude
>>        a       owl:DatatypeProperty ;
>>        rdfs:range xsd:string .
>>
>>
>> Is it possible? As far as I read the docs, the method
>> createCardinalityQRestriction could me help with that, but when I try to
>> use it, the following exception is thrown:
>>
>> Exception in thread "main" com.hp.hpl.jena.ontology.ProfileException:
>> Attempted to use language construct CARDINALITY_Q that is not supported in
>> the current language profile: OWL DL
>>
>> Is this about Jena OWL2 support? (I think that owl:onDataRange is OWL2
>> vocabulary, right?)
>>
>> I tried with other language profile but no success.
>>
>> Is there any other way I could do that declaration?!
>>
>> Thanks,
>>
>> Rodrigo C. Antonialli
>> ======================================
>> Rio Claro - SP - Brasil
>> LinkedIn: http://www.linkedin.com/in/rcantonialli
>> Contato:  (19) 98136-2347
>>                rcantonialli@gmail.com
>>                Skype: rc_antonialli
>>
>>
>

Re: Cardinality Restriction with onDataRange

Posted by Dave Reynolds <da...@gmail.com>.
On 24/02/14 13:46, Rodrigo Antonialli wrote:
> Hi!
>
> I have a doubt about Jena OWL2 support and the
> method createCardinalityQRestriction.

Jena does not support OWL2.

I suspect that the createCardinalityQRestriction is a hang over from the 
now-defunct DAML support and not available in the current OWL profiles.

You can create OWL2 restrictions by asserting the RDF statements 
directly but there's no convenience support for OWL2 at the present time.

Dave


> What I'm building now is something like that:
>
> ns:sample
>        a       owl:Class ;
>        rdfs:subClassOf
>                [ a       owl:Restriction ;
>                  owl:cardinality "1"^^xsd:int ;
>                  owl:onProperty ns:longitude
>                ] ;
>
> ns:longitude
>        a       owl:DatatypeProperty ;
>        rdfs:range xsd:string .
>
>
> What I'd like to do is to add a owl:onDataRange to the owl:Restriction and
> come up with this:
>
> ns:sample
>        a       owl:Class ;
>        rdfs:subClassOf
>                [ a       owl:Restriction ;
>                  owl:cardinality "1"^^xsd:int ;
>                  owl:onProperty ns:longitude
>                 * owl:onDataRange xsd:string*
>                ] ;
>
> ns:longitude
>        a       owl:DatatypeProperty ;
>        rdfs:range xsd:string .
>
>
> Is it possible? As far as I read the docs, the method
> createCardinalityQRestriction could me help with that, but when I try to
> use it, the following exception is thrown:
>
> Exception in thread "main" com.hp.hpl.jena.ontology.ProfileException:
> Attempted to use language construct CARDINALITY_Q that is not supported in
> the current language profile: OWL DL
>
> Is this about Jena OWL2 support? (I think that owl:onDataRange is OWL2
> vocabulary, right?)
>
> I tried with other language profile but no success.
>
> Is there any other way I could do that declaration?!
>
> Thanks,
>
> Rodrigo C. Antonialli
> ======================================
> Rio Claro - SP - Brasil
> LinkedIn: http://www.linkedin.com/in/rcantonialli
> Contato:  (19) 98136-2347
>                rcantonialli@gmail.com
>                Skype: rc_antonialli
>