Thanks for all responses,

listDomain sugested by Dave Reynolds solved my problem.


2013/9/4 Chris Dollin <[email protected]>

> On Wednesday, September 04, 2013 10:00:51 AM Luis Eufrasio Teixeira Neto
> wrote:
>
> Non-date remarks:
>
> >         ExtendedIterator<OntClass> i = ontModel.listClasses();
> >         while (i.hasNext()) {
> >             OntClass ontClass = (OntClass) i.next();
> >             String prefix =
> > ontModel.getNsURIPrefix(ontClass.getNameSpace());
> >             String name = ontClass.getLocalName();
> >
> >             if (classes.get(name + prefix) == null) {
> >                 Class_ c = new Class_(prefix, name);
> >                 classes.put(prefix + name, c);
> >                 mapPrefixes.put(prefix, ontClass.getNameSpace());
>
> (a) Rather than using mapPrefixes, just use the PrefixMapping of
>     the model, or even the model itself.
>
> (b) If you want a short name for the class, you can use Model.shortForm,
>     which applies any available prefix from the model.
>
> >                 OntClass superClass = ontClass.getSuperClass();
>
> (c) Note that a class can have multiple distinct superclasses. Assuming
>    that there's only one will trip you up.
>
> >                 if (superClass != null) {
> >                     String superName = superClass.getLocalName();
> >                     String superPrefix =
> > ontModel.getNsURIPrefix(superClass.getNameSpace());
> >                     Class_ superC = classes.get(superPrefix + superName);
> >
> >                     if (superC == null) {
> >                         superC = new Class_(superPrefix, superName);
> >                         classes.put(superPrefix + superName, superC);
> >                         mapPrefixes.put(superPrefix,
> > superClass.getNameSpace());
> >                     }
> >
> >                     c.setSuperClass(superC);
> >                 }
> >             }
> >         }
>
> Exactly why are you extracting all this information from the model
> when the model holds it quite nicely already?
>
> Chris
>
> --
> "I know it was late, but Mountjoy never bothers,                /Archer's
> Goon/
>  so long as it's the full two thousand words."
>
> 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)
>
>


-- 
Um abraço,
Luís Eufrasio T. Neto
MSN: [email protected]

"Ser LIVRE é ser capaz de AMAR sem exigir nada em troca."

Reply via email to