コード例 #1
0
  public IProperty retrieveProperty(SemanticType t) {

    IProperty ret = null;
    IOntology o = knowledgeRepository.retrieveOntology(t.getConceptSpace());
    if (o != null) ret = o.getProperty(t.getLocalName());
    return ret;
  }
コード例 #2
0
  /* (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;
  }
コード例 #3
0
  public IConcept retrieveConcept(SemanticType t) {

    IConcept ret = null;
    IOntology o = knowledgeRepository.retrieveOntology(t.getConceptSpace());
    if (o != null) ret = o.getConcept(t.getLocalName());
    if (ret == null && t.toString().equals(rootTypeID.toString())) {
      ret = getRootConcept();
    }
    return ret;
  }
コード例 #4
0
  /* (non-Javadoc)
   * @see org.integratedmodelling.thinklab.IKnowledgeBase#getPropertyFromURI(java.lang.String)
   */
  public IProperty getPropertyFromURI(String uri) {

    IProperty ret = null;

    String[] ss = uri.split("#");
    if (ss.length != 2) return ret;

    IOntology o = null;
    try {
      String csp = getConceptSpaceFromURI(ss[0] + "#");
      if (csp == null) return ret;
      o = knowledgeRepository.retrieveOntology(csp);
      if (o != null) ret = o.getProperty(ss[1]);
    } catch (ThinklabResourceNotFoundException e) {
    }
    return ret;
  }
コード例 #5
0
 public IInstance retrieveInstance(SemanticType t) {
   IInstance ret = null;
   IOntology o = knowledgeRepository.retrieveOntology(t.getConceptSpace());
   if (o != null) ret = o.getInstance(t.getLocalName());
   return ret;
 }