Package edu.stanford.smi.protegex.owl.model

Examples of edu.stanford.smi.protegex.owl.model.OWLIndividual


    if(obj instanceof RDFSClass) {
      RDFSClass cls = (RDFSClass) obj;
      return cls.getBrowserText();
    }
    else if(obj instanceof OWLIndividual) {
      OWLIndividual owlInstance = (OWLIndividual) obj;
      return owlInstance.getBrowserText();
    }
    return "";
  }
View Full Code Here


     */
    protected void saveMTheory(){

        OWLNamedClass mTheoryClass = getOwlModel().getOWLNamedClass(MTHEORY);
        // check if individual exists
        OWLIndividual mTheoryIndividual = getOwlModel().getOWLIndividual(getMebn().getName());
        if (mTheoryIndividual == null) {
          // if this individual is new, create it
          mTheoryIndividual = mTheoryClass.createOWLIndividual(getMebn().getName());
        }
        Debug.println("MTheory = " + getMebn().getName());
       
        if(getMebn().getDescription() != null){
          mTheoryIndividual.addComment(getMebn().getDescription());
        }
       
        /* hasMFrag */
       
        OWLObjectProperty hasMFragProperty = (OWLObjectProperty)getOwlModel().getOWLObjectProperty("hasMFrag");  
        List<MFrag> listDomainMFrag = getMebn().getDomainMFragList();
       
        for(MFrag domainMFrag: listDomainMFrag){
          OWLNamedClass domainMFragClass = getOwlModel().getOWLNamedClass(DOMAIN_MFRAG);
          Debug.println("Domain_MFrag = " + domainMFrag.getName());
          // check if individual exists.
          OWLIndividual domainMFragIndividual = getOwlModel().getOWLIndividual(this.MFRAG_NAME_PREFIX + domainMFrag.getName());
          if (domainMFragIndividual == null) {
            // if new, create it
            domainMFragIndividual = domainMFragClass.createOWLIndividual(this.MFRAG_NAME_PREFIX + domainMFrag.getName());
          }
          getMapMFrag().put(domainMFrag, domainMFragIndividual);
          mTheoryIndividual.addPropertyValue(hasMFragProperty, domainMFragIndividual);
         
          if(domainMFrag.getDescription()!=null){
            domainMFragIndividual.addComment(domainMFrag.getDescription());
          }
         
          /* hasResidentNode */
          OWLObjectProperty hasResidentNodeProperty = (OWLObjectProperty)getOwlModel().getOWLObjectProperty("hasResidentNode");  
         
          for(Node node: domainMFrag.getNodeList()){
            if (node instanceof ResidentNode) {
              ResidentNode residentNode = (ResidentNode) node;
             
              Debug.println("Domain_Res = " + residentNode.getName())
              // check if individual exists
              OWLIndividual domainResIndividual = getOwlModel().getOWLIndividual(this.RESIDENT_NAME_PREFIX + residentNode.getName());
              if (domainResIndividual == null) {
                // if new, create it
                OWLNamedClass domainResClass = null;
                if (residentNode instanceof ContinuousResidentNode) {
                  // get owl class for continuous nodes
                  domainResClass = getOwlModel().getOWLNamedClass(CONTINUOUS_RESIDENT_NODE);
                  if (domainResClass == null) {
                    // if CONTINUOUS_RESIDENT_NODE does not exist, create it
                    domainResClass = getOwlModel().createOWLNamedSubclass(CONTINUOUS_RESIDENT_NODE, getOwlModel().getOWLNamedClass(DOMAIN_RESIDENT));
                  }
                } else {
                  // get owl class for resident nodes
                  domainResClass = getOwlModel().getOWLNamedClass(DOMAIN_RESIDENT);
                }
               
                domainResIndividual = domainResClass.createOWLIndividual(this.RESIDENT_NAME_PREFIX + residentNode.getName());
              }
              domainMFragIndividual.addPropertyValue(hasResidentNodeProperty, domainResIndividual);  
              getMapDomainResident().put(residentNode, domainResIndividual);
            }
           
          } 
         
          /* hasInputNode */
          OWLObjectProperty hasInputNodeProperty = (OWLObjectProperty)getOwlModel().getOWLObjectProperty("hasInputNode");  
          OWLNamedClass generativeInputClass = getOwlModel().getOWLNamedClass(GENERATIVE_INPUT);
          for(InputNode inputNode: domainMFrag.getInputNodeList()){
            Debug.println("Generative_input = " + inputNode.getName());
            // check if individuals exists
            OWLIndividual generativeInputIndividual = getOwlModel().getOWLIndividual(inputNode.getName());
            if (generativeInputIndividual == null) {
              // if new, create it
              generativeInputIndividual = generativeInputClass.createOWLIndividual(inputNode.getName());
            }
            domainMFragIndividual.addPropertyValue(hasInputNodeProperty, generativeInputIndividual);    
            getMapGenerativeInput().put(inputNode, generativeInputIndividual);    
          }       
         
          /* hasContextNode */
          OWLObjectProperty hasContextNodeProperty = (OWLObjectProperty)getOwlModel().getOWLObjectProperty("hasContextNode");  
          OWLNamedClass contextClass = getOwlModel().getOWLNamedClass(CONTEXT_NODE);
          for(ContextNode contextNode: domainMFrag.getContextNodeList()){
            // check if individuals exist
            OWLIndividual contextIndividual = getOwlModel().getOWLIndividual(contextNode.getName());
            if (contextIndividual == null) {
              // if new, create it
              contextIndividual = contextClass.createOWLIndividual(contextNode.getName());
            }
            domainMFragIndividual.addPropertyValue(hasContextNodeProperty, contextIndividual);                  
            getMapContext().put(contextNode, contextIndividual);  
          }       
         
          /* hasOVariable */
          OWLObjectProperty hasOVariableProperty = (OWLObjectProperty)getOwlModel().getOWLObjectProperty("hasOVariable");  
            OWLNamedClass oVariableClass = getOwlModel().getOWLNamedClass(ORDINARY_VARIABLE);
          OWLObjectProperty isSubsByProperty = (OWLObjectProperty)getOwlModel().getOWLObjectProperty("isSubsBy");  
         
          for(OrdinaryVariable oVariable: domainMFrag.getOrdinaryVariableList()){
            // Set variable name as "MFragName.OVName"
            OWLIndividual oVariableIndividual = getOwlModel().getOWLIndividual(
                  oVariable.getMFrag().getName() + SCOPE_SEPARATOR
                  + oVariable.getName() );
            if (oVariableIndividual == null) {
              oVariableIndividual = oVariableClass.createOWLIndividual(
                      oVariable.getMFrag().getName() + SCOPE_SEPARATOR
                    + oVariable.getName() );
            }
            domainMFragIndividual.addPropertyValue(hasOVariableProperty, oVariableIndividual);    
           
            if (oVariable.getValueType() != null){
              oVariableIndividual.addPropertyValue(isSubsByProperty, getMapMetaEntity().get(oVariable.getValueType().getName()));
            }
           
            if(oVariable.getDescription() != null){
              oVariableIndividual.addComment(oVariable.getDescription());  
            }
           
            getMapOrdinaryVariable().put(oVariable, oVariableIndividual);        
          }       
        }     
View Full Code Here

   * @param name
   * @return
   */
  public IInstance getInstance(String name){
    checkModel();
    OWLIndividual c = model.getOWLIndividual(getResourceName(name));
    return (c != null)?new PInstance(c,this):null;
  }
View Full Code Here

   * @param name
   * @return
   */
  public IInstance getInstance(String name){
    checkModel();
    OWLIndividual c = model.getOWLIndividual(getResourceName(name));
    return (c != null)?new PInstance(c,this):null;
  }
View Full Code Here

      OWLObjectProperty propertyIs_same_as = individual.getOWLModel().getOWLObjectProperty(this.xclOntologyLocation+"#is_same_as");
      try {
        //using the reasoner for resolving the symmetric individual relations
        Iterator<OWLIndividual> it = this.getReasoner().getRelatedIndividuals(convertRDFIndividual(individual), propertyIs_same_as).iterator();
        while(it.hasNext()){
          OWLIndividual sameAsIndividual = it.next();
          lis_same_asIndividuals.add(sameAsIndividual);
        }
      } catch (ProtegeReasonerException e) {
        // TODO Auto-generated catch block
        log.debug("Problems resolving is_same_as relationship with the pellet reasoner",e);
View Full Code Here

TOP

Related Classes of edu.stanford.smi.protegex.owl.model.OWLIndividual

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.