/* (non-Javadoc) * @see org.integratedmodelling.thinklab.IKnowledgeBase#getInstanceFromURI(java.lang.String, org.integratedmodelling.thinklab.interfaces.ISession) */ public IInstance getInstanceFromURI(String uri, ISession session) throws ThinklabException { IInstance ret = null; String[] ss = uri.split("#"); if (ss.length != 2) return ret; IOntology o = null; String csp = getConceptSpaceFromURI(ss[0] + "#"); if (csp != null) { o = knowledgeRepository.retrieveOntology(csp); if (o != null) { ret = o.getInstance(ss[1]); if (ret != null) { ret = session.createObject(ret); } } } /* not an ontology, so must be a kbox */ if (ret == null) { IKBox kbox = session.retrieveKBox(ss[0]); if (kbox != null) { ret = kbox.getObjectFromID(ss[1], session); } } return ret; }
public IInstance retrieveInstance(SemanticType t) { IInstance ret = null; IOntology o = knowledgeRepository.retrieveOntology(t.getConceptSpace()); if (o != null) ret = o.getInstance(t.getLocalName()); return ret; }