(SOLVED) How to read\get data range of dataproperty with OWL API

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

(SOLVED) How to read\get data range of dataproperty with OWL API

Denis Smirnov
Hey Matthew,
thanks for your help. Thats how it works for me. I don’t know if it’s the
best/fastest way, but it works:

OWLDataFactory factory = manager.getOWLDataFactory();
               
OWLNamedIndividual indi =
factory.getOWLNamedIndividual(IRI.create(fullIndividualName));
OWLDataProperty prop =
factory.getOWLDataProperty(IRI.create(fullDatapropertyName));
       
for(OWLAxiom a: onto.getAxioms(AxiomType.DATA_PROPERTY_RANGE)){
       
if(prop.getDataPropertiesInSignature().equals(a.getDataPropertiesInSignature
())){
                for(OWLDatatype d: a.getDatatypesInSignature()){
                        if(d.isInteger()){
                                OWLDataPropertyAssertionAxiom
dataPropertyAssertion = factory.getOWLDataPropertyAssertionAxiom(prop, indi,
Integer.parseInt(datapropertyValue));
                                manager.addAxiom(onto,
dataPropertyAssertion);
                        }else if(d.isString()){
                                OWLDataPropertyAssertionAxiom
dataPropertyAssertion = factory.getOWLDataPropertyAssertionAxiom(prop, indi,
datapropertyValue);
                                manager.addAxiom(onto,
dataPropertyAssertion);
                        }
                }
        }
}

@ Adila Alfa Krisnadhi: There is no getRanges() on a OWLDataProperty.

Beste regards
Denis

M. Sc. Denis Smirnov
Universität der Bundeswehr München (UniBwM)


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: (SOLVED) How to read\get data range of dataproperty with OWL API

Adila Alfa Krisnadhi

On Wed, Mar 25, 2015 at 2:44 AM, Denis Smirnov <[hidden email]> wrote:


@ Adila Alfa Krisnadhi: There is no getRanges() on a OWLDataProperty.


Really? 
According to the documentation here http://owlapi.sourceforge.net/javadoc/org/semanticweb/owlapi/model/OWLDataProperty.html, getRanges() is a method inherited from the interface OWLPropertyExpression

--adila

 

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: (SOLVED) How to read\get data range of dataproperty with OWL API

Matthew Horridge-2
Administrator
In reply to this post by Denis Smirnov
Hi Dennis,

Great.  Glad it worked for you!

Cheers,

Matthew

> On 25 Mar 2015, at 02:44, Denis Smirnov <[hidden email]> wrote:
>
> Hey Matthew,
> thanks for your help. Thats how it works for me. I don’t know if it’s the
> best/fastest way, but it works:
>
> OWLDataFactory factory = manager.getOWLDataFactory();
>
> OWLNamedIndividual indi =
> factory.getOWLNamedIndividual(IRI.create(fullIndividualName));
> OWLDataProperty prop =
> factory.getOWLDataProperty(IRI.create(fullDatapropertyName));
>
> for(OWLAxiom a: onto.getAxioms(AxiomType.DATA_PROPERTY_RANGE)){
>
> if(prop.getDataPropertiesInSignature().equals(a.getDataPropertiesInSignature
> ())){
> for(OWLDatatype d: a.getDatatypesInSignature()){
> if(d.isInteger()){
> OWLDataPropertyAssertionAxiom
> dataPropertyAssertion = factory.getOWLDataPropertyAssertionAxiom(prop, indi,
> Integer.parseInt(datapropertyValue));
> manager.addAxiom(onto,
> dataPropertyAssertion);
> }else if(d.isString()){
> OWLDataPropertyAssertionAxiom
> dataPropertyAssertion = factory.getOWLDataPropertyAssertionAxiom(prop, indi,
> datapropertyValue);
> manager.addAxiom(onto,
> dataPropertyAssertion);
> }
> }
> }
> }
>
> @ Adila Alfa Krisnadhi: There is no getRanges() on a OWLDataProperty.
>
> Beste regards
> Denis
>
> M. Sc. Denis Smirnov
> Universität der Bundeswehr München (UniBwM)
>
>
> _______________________________________________
> protege-user mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-user


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: (SOLVED) How to read\get data range of dataproperty with OWL API

Matthew Horridge-2
Administrator
In reply to this post by Adila Alfa Krisnadhi
Hi Adila,

I think this method was removed in version 4.0.0.

Cheers,

Matthew

On 25 Mar 2015, at 05:48, Adila Alfa Krisnadhi <[hidden email]> wrote:


On Wed, Mar 25, 2015 at 2:44 AM, Denis Smirnov <[hidden email]> wrote:


@ Adila Alfa Krisnadhi: There is no getRanges() on a OWLDataProperty.


Really? 
According to the documentation here http://owlapi.sourceforge.net/javadoc/org/semanticweb/owlapi/model/OWLDataProperty.html, getRanges() is a method inherited from the interface OWLPropertyExpression

--adila

 
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: (SOLVED) How to read\get data range of dataproperty with OWL API

Adila Alfa Krisnadhi
Ah I see. Didn't know that this is changed in the latest version of OWL API.
Thanks!

--adila

On Mon, Mar 30, 2015 at 3:26 PM, Matthew Horridge <[hidden email]> wrote:
Hi Adila,

I think this method was removed in version 4.0.0.

Cheers,

Matthew

On 25 Mar 2015, at 05:48, Adila Alfa Krisnadhi <[hidden email]> wrote:


On Wed, Mar 25, 2015 at 2:44 AM, Denis Smirnov <[hidden email]> wrote:


@ Adila Alfa Krisnadhi: There is no getRanges() on a OWLDataProperty.


Really? 
According to the documentation here http://owlapi.sourceforge.net/javadoc/org/semanticweb/owlapi/model/OWLDataProperty.html, getRanges() is a method inherited from the interface OWLPropertyExpression

--adila

 
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user



_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: (SOLVED) How to read\get data range of dataproperty with OWL API

Lorenz Buehmann
If you're using OWL API V4.x , why are you not using one of the utility classes?

EntitySearcher::getRanges(OWLDataProperty dp, OWLOntology ont)

Cheers,
Lorenz


Ah I see. Didn't know that this is changed in the latest version of OWL API.
Thanks!

--adila

On Mon, Mar 30, 2015 at 3:26 PM, Matthew Horridge <[hidden email]> wrote:
Hi Adila,

I think this method was removed in version 4.0.0.

Cheers,

Matthew

On 25 Mar 2015, at 05:48, Adila Alfa Krisnadhi <[hidden email]> wrote:


On Wed, Mar 25, 2015 at 2:44 AM, Denis Smirnov <[hidden email]> wrote:


@ Adila Alfa Krisnadhi: There is no getRanges() on a OWLDataProperty.


Really? 
According to the documentation here http://owlapi.sourceforge.net/javadoc/org/semanticweb/owlapi/model/OWLDataProperty.html, getRanges() is a method inherited from the interface OWLPropertyExpression

--adila

 
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user




_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
-- 
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user