On Wednesday, June 06, 2012 03:07:23 AM DHOMAS HATTA FUDHOLI wrote:
> The code that I tried to write like the following :
> -----
> .......
> OntModel m = ModelFactory.createOntologyModel();
> m.read(input_filename);
>
> DatatypeProperty dp = m.getDatatypeProperty(URI+"usd");
>
> ExtendedIterator<Restriction> i = m.listRestrictions();
> while (i.hasNext()){
> Restriction r = i.next();
> if (r.onProperty(dp) && r.isMaxCardinalityRestriction()){
> com.hp.hpl.jena.rdf.model.Property opt = r.getOnProperty();
> r.removeOnProperty(opt);
> }
> }
You're updating a model that you're iterating over. That's not allowed
("ConcurrentModificationException"). It's a Java thing.
Work out what you want to remove first, then do the removes afterwards.
Chris
--
"It does not need to take events in their correct order." /Hexwood/
Epimorphics Ltd, http://www.epimorphics.com
Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20 6PT
Epimorphics Ltd. is a limited company registered in England (number 7016688)