protected Concept transformToModel(Object obj) {
        if(obj instanceof NamedConcept) {
            return (NamedConcept) obj;
        } else if(obj instanceof String) {
            return new NamedConcept((String) obj);
        } else if(obj instanceof au.csiro.snorocket.core.model.Conjunction) {
            au.csiro.snorocket.core.model.Conjunction conj = (au.csiro.snorocket.core.model.Conjunction) obj;
            List<Concept> conjs = new ArrayList<>();
            for(AbstractConcept ac : conj.getConcepts()) {
                conjs.add(transformToModel(ac));
            }
            return new Conjunction(conjs.toArray(new Concept[conjs.size()]));
        } else if(obj instanceof au.csiro.snorocket.core.model.Existential) {
            au.csiro.snorocket.core.model.Existential ex = (au.csiro.snorocket.core.model.Existential) obj;
            String roleId = (String) factory.lookupRoleId(ex.getRole());
            Concept con = transformToModel(ex.getConcept());
            return new Existential(new NamedRole(roleId), con);
        } else if(obj instanceof au.csiro.snorocket.core.model.Datatype) {
            au.csiro.snorocket.core.model.Datatype dt = (au.csiro.snorocket.core.model.Datatype) obj;
            String featureId = factory.lookupFeatureId(dt.getFeature());
            Literal l = transformLiteralToModel(dt.getLiteral());
            return new Datatype(new NamedFeature(featureId), dt.getOperator(), l);
        } else if(obj instanceof au.csiro.snorocket.core.model.Concept) {
            au.csiro.snorocket.core.model.Concept c = (au.csiro.snorocket.core.model.Concept) obj;
            Object id = factory.lookupConceptId(c.hashCode());
            if(id instanceof String) {
                return new NamedConcept((String) id);
            } else if(id instanceof NamedConcept) {
                // If TOP or BOTTOM
                return (NamedConcept) id;
            } else {
                return transformToModel(id);
            }
        } else {
            throw new RuntimeException("Unexpected abstract concept " + obj.getClass());
        }
    }
protected Concept transformToModel ( Object obj ) { if ( obj instanceof NamedConcept ) { return ( NamedConcept ) obj ; } else if ( obj instanceof String ) { return new NamedConcept ( ( String ) obj ) ; } else if ( obj instanceof au . csiro . snorocket . core . model . Conjunction ) { au . csiro . snorocket . core . model . Conjunction conj = ( au . csiro . snorocket . core . model . Conjunction ) obj ; List < Concept > conjs = new ArrayList < > ( ) ; for ( AbstractConcept ac : conj . getConcepts ( ) ) { conjs . add ( transformToModel ( ac ) ) ; } return new Conjunction ( conjs . toArray ( new Concept [ conjs . size ( ) ] ) ) ; } else if ( obj instanceof au . csiro . snorocket . core . model . Existential ) { au . csiro . snorocket . core . model . Existential ex = ( au . csiro . snorocket . core . model . Existential ) obj ; String roleId = ( String ) factory . lookupRoleId ( ex . getRole ( ) ) ; Concept con = transformToModel ( ex . getConcept ( ) ) ; return new Existential ( new NamedRole ( roleId ) , con ) ; } else if ( obj instanceof au . csiro . snorocket . core . model . Datatype ) { au . csiro . snorocket . core . model . Datatype dt = ( au . csiro . snorocket . core . model . Datatype ) obj ; String featureId = factory . lookupFeatureId ( dt . getFeature ( ) ) ; Literal l = transformLiteralToModel ( dt . getLiteral ( ) ) ; return new Datatype ( new NamedFeature ( featureId ) , dt . getOperator ( ) , l ) ; } else if ( obj instanceof au . csiro . snorocket . core . model . Concept ) { au . csiro . snorocket . core . model . Concept c = ( au . csiro . snorocket . core . model . Concept ) obj ; Object id = factory . lookupConceptId ( c . hashCode ( ) ) ; if ( id instanceof String ) { return new NamedConcept ( ( String ) id ) ; } else if ( id instanceof NamedConcept ) { return ( NamedConcept ) id ; } else { return transformToModel ( id ) ; } } else { throw new RuntimeException ( "Unexpected abstract concept " + obj . getClass ( ) ) ; } }
The {@link CoreFactory} can currently hold very different types of objects. These include:

<ul>
<li>NamedConcept: for TOP and BOTTOM</li>
<li>Strings: for named concepts</li>
<li>au.csiro.snorocket.core.model.Conjunction</li>
<li>au.csiro.snorocket.core.model.Datatype</li>
<li>au.csiro.snorocket.core.model.Existential</li>
</ul>

@param obj
@return