Examples of ObjectEntity


Examples of unbbayes.prs.mebn.entity.ObjectEntity

      return;
    }
   
    DataBase db = DataBase.getInstance();
   
    ObjectEntity entity;
    String shipName;
    String ship2Name;
    String personName;
    String organizationName;
    ResidentNode residentNode;
View Full Code Here

Examples of unbbayes.prs.mebn.entity.ObjectEntity

  private void loadEntityInstances() throws DuplicatedNameException,
      ReservedWordException, EntityInstanceAlreadyExistsException,
      InvalidOperationException {
    mebnUtil.removeAllEntityInstances();

    ObjectEntity entity = mebn.getObjectEntityContainer()
        .getObjectEntityByName("Ship");
    mebnUtil.createEntityIntance(entity, "ship1");
    mebnUtil.createEntityIntance(entity, "ship2");
    mebnUtil.createEntityIntance(entity, "ship3");
View Full Code Here

Examples of unbbayes.prs.mebn.entity.ObjectEntity

    if (continuousResidentNode.getMFrag() == null || continuousResidentNode.getMFrag().getMultiEntityBayesianNetwork() == null) {
      throw new IllegalArgumentException(continuousResidentNode + " is inconsistent: it is not associated with any MTheory");
    }
   
    // extract the "Number" entity from the continuousResidentNode. The possible values of continuous resident nodes are assumed to be individuals of entity "Number"
    ObjectEntity numberType = null;
    try {
      numberType = this.getMultiEntityBayesianNetwork().getObjectEntityContainer().getObjectEntityByName(continuousResidentNode.NUMBER_ENTITY_NAME);
    } catch (Exception e) {
      throw new IllegalArgumentException("The type of " + continuousResidentNode +" is not a " + continuousResidentNode.NUMBER_ENTITY_NAME +", and also could not extract the type from its MTheory.", e);
    }
   
    if (numberType == null) {
      // let's assure we never have numberType == null
      throw new IllegalArgumentException("The type of " + continuousResidentNode +" is not a " + continuousResidentNode.NUMBER_ENTITY_NAME +", and also could not extract the type from its MTheory.");
    }
   
    // check whether the value is already recorded as a possible value of numberType. If so, reuse it
    ObjectEntityInstance state = numberType.getInstanceByName(String.valueOf(value));
    if (state == null) {
      // this is a new value. Insert it
      try {
        state = numberType.addInstance(String.valueOf(value));
        continuousResidentNode.getMFrag().getMultiEntityBayesianNetwork().getObjectEntityContainer().addEntityInstance(state);
      } catch (TypeException e) {
        throw new IllegalArgumentException("Cannnot use " + value + " as a possible value of " + continuousResidentNode,e);
      } catch (EntityInstanceAlreadyExistsException e) {
        e.printStackTrace();
View Full Code Here

Examples of unbbayes.prs.mebn.entity.ObjectEntity

       
        MebnUtil mebnUtil = new MebnUtil(mebn);
       
        mebnUtil.removeAllEntityInstances();
       
        ObjectEntity entity = mebn.getObjectEntityContainer().getObjectEntityByName("Ship");
        mebnUtil.createEntityIntance(entity, "ship1");
        mebnUtil.createEntityIntance(entity, "ship2");
        mebnUtil.createEntityIntance(entity, "ship3");
       
        entity = mebn.getObjectEntityContainer().getObjectEntityByName("Person");
View Full Code Here

Examples of unbbayes.prs.mebn.entity.ObjectEntity

     
      argument[i] = new JComboBox(list);
      argument[i].addItemListener(new ComboListener(i));
      argument[i].setSelectedIndex(0);
     
      ObjectEntity oe = mebn.
                           getObjectEntityContainer().getObjectEntityByType(ov.getValueType());
     
      if(oe.isOrdereable()){
        argument[i].setEditable(false);
      }else{
        argument[i].setEditable(true);
      }
     
View Full Code Here

Examples of unbbayes.prs.mebn.entity.ObjectEntity

             argumentVector[i] = (ObjectEntityInstance)argument[i].getSelectedItem();
        }else{
          if(argument[i].getSelectedItem() instanceof String){
            if(isNameValid((String)argument[i].getSelectedItem())){
             String nameInstance = (String)argument[i].getSelectedItem();
             ObjectEntity objectEntity = mebn.getObjectEntityContainer().getObjectEntityByType(node.getOrdinaryVariableList().get(i).getValueType());
             argumentVector[i] = new ObjectEntityInstance(nameInstance, objectEntity);
            }else{
              throw new ParcialStateException();
            }
          }
View Full Code Here

Examples of unbbayes.prs.mebn.entity.ObjectEntity

    }
   
    OrdinaryVariable ovOrdereable = ovOrdereableList.get(0); //Have only one element...
   
    //2) FIND THE PREVIOUS ELEMENT.
    ObjectEntity objectEntityOrdereable = residentNode.getMFrag().
                        getMultiEntityBayesianNetwork().getObjectEntityContainer().
                        getObjectEntityByType(ovOrdereable.getValueType());
 
    LiteralEntityInstance ovOrdereableActualValue = node.getEntityForOv(ovOrdereable);
    OVInstance ovInstanceOrdereable = OVInstance.getInstance(ovOrdereable, ovOrdereableActualValue);
   
    if(ovInstanceOrdereable == null){
      throw new SSBNNodeGeneralException();
    }
   
    String nameEntity = ovInstanceOrdereable.getEntity().getInstanceName();
   
    ObjectEntityInstanceOrdereable objectEntityInstanceOrdereable =
      (ObjectEntityInstanceOrdereable)objectEntityOrdereable.getInstanceByName(nameEntity);
   
    if(objectEntityInstanceOrdereable == null){
      throw new SSBNNodeGeneralException();
    }
   
View Full Code Here

Examples of unbbayes.prs.mebn.entity.ObjectEntity

   * numeric values. It creates a new object entity "Number" if such entity is not
   * present.
   */
  protected void forceTypeToBeANumber() {
    if (this.getMFrag() != null) {
      ObjectEntity number = this.getMFrag().getMultiEntityBayesianNetwork().getObjectEntityContainer().getObjectEntityByName(NUMBER_ENTITY_NAME);
      if (number == null) {
        try {
          number = this.getMFrag().getMultiEntityBayesianNetwork().getObjectEntityContainer().createObjectEntity(NUMBER_ENTITY_NAME);
        } catch (TypeException e) {
          e.printStackTrace();
        }
      }
      if (number != null) {
        // if necessary, replace the routine which checks whether an instance name is valid or not.
        // initial assertion (it may not be always necessary)
        if (number.getInstanceNameCheckChainOfResponsibility() == null) {
          number.setInstanceNameCheckChainOfResponsibility(new ArrayList<Entity.INameChecker>());
        }
        if (!number.getInstanceNameCheckChainOfResponsibility().contains(DEFAULT_NAME_CHECK)) {
          // clear previous one
          number.getInstanceNameCheckChainOfResponsibility().clear();
          // add a name check which return true when a name can be converted to a float/double
          number.getInstanceNameCheckChainOfResponsibility().add(DEFAULT_NAME_CHECK);
        }
        this.addPossibleValueLink(number);
      }
    }
  }
View Full Code Here

Examples of unbbayes.prs.mebn.entity.ObjectEntity

    } else {
      expected("Identifier");
   
    // check entityName consistency: entityName must be an object entity
    // extract entity from mebn
    ObjectEntity entity = null;
    try {
      entity = this.getNode().getMFrag().getMultiEntityBayesianNetwork().getObjectEntityContainer().getObjectEntityByName(entityName);
    } catch (Exception e) {
      throw new TableFunctionMalformedException(e);
    }
View Full Code Here

Examples of unbbayes.prs.mebn.entity.ObjectEntity

    return Collections.singletonList(result);
  }

  private void loadEvidence(List<EvidenceInfo> evidenceList) throws Exception {
    ResidentNode residentNode;
    ObjectEntity entity;
    ObjectEntityInstance[] arguments;
    Entity state;
    CategoricalStateEntity categoricalState;
   
    // TODO - Fix this somehow to add what has changed instead of reseting
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.