Hi,
What I did is just deleting the restriction with the following script :

DatatypeProperty dp = m.getDatatypeProperty(URI+element);
                List<Restriction> restrictionsToRemove = new 
ArrayList<Restriction>();
                ExtendedIterator<Restriction>  i = m.listRestrictions();
                while (i.hasNext()){
                    Restriction r = i.next();
                    if (r.onProperty(dp)){
                        restrictionsToRemove.add(r);
                    }
                }

                for (Restriction r: restrictionsToRemove) {
                    r.remove();
                }                
                dp.remove();

but, it resulting an empty IntersectionClass since it only remove the 
restriction. I havn't tried any ways to remove the empty IntersectionClass. 
Maybe any of you have an idea how to remove it.

Cheers,

Dhomas Hatta Fudholi
Student, Department of Computer Science and Computer Engineering
La Trobe University, Victoria 3086, Australia

________________________________________
From: Ian Dickinson [[email protected]]
Sent: Wednesday, August 01, 2012 8:30 PM
To: [email protected]
Subject: Re: (ask) how to remove empty intersection class?

On 01/08/12 06:03, DHOMAS HATTA FUDHOLI wrote:
> Hi All,
>
> I tried to remove cardinality restriction in owl using Jena. I did
> that, but the intersection class is still there, in the owl file, but
> it becomes empty. The script below shows the empty intersection class
> :
>
> <owl:Class> <owl:intersectionOf rdf:parseType="Resource"> <rdf:rest
> rdf:parseType="Resource"> <rdf:rest
> rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
> </rdf:rest> </owl:intersectionOf> </owl:Class>
>
> If I open in Protege, there will be a warning "<empty class
> edu.stanford.smi.protegex.owl.model.impl.DefaultOWLIntersectionClass>"
> in the restriction window.
>
> How can I remove this empty intersection class completely using Jena
> API?
What have you tried so far? It's easier to help you debug your code if
you actually show us the code!

Ian

Reply via email to