Package unbbayes.prs.mebn

Examples of unbbayes.prs.mebn.InputNode


      for (TempTableHeaderParent leaf : parentsList) {
        if (!leaf.isKnownValue()) {
          // if leaf is not set to be a constant value, then we should set it to
          // evaluate a combination of entities
          if (leaf.parent instanceof InputNode) {
            InputNode inputNode = (InputNode) leaf.parent;
            leaf.setEvaluationList(valuesOnCPTColumn.get(inputNode.getResidentNodePointer().getResidentNode().getName()));
          } else {
            leaf.setEvaluationList(valuesOnCPTColumn.get(leaf.parent.getName()));
          }
        }
      }
View Full Code Here


    super.addParent(parent);
    if (parent instanceof ResidentNode) {
      ResidentNode residentNode = (ResidentNode) parent;
      residentNode.addResidentNodeChild(this); // this will automatically add parent to this.getResidentNodeFatherList()
    } else if (parent instanceof InputNode) {
      InputNode inputNode = (InputNode) parent;
      inputNode.addResidentNodeChild(this);
    } else {
      try {
        Debug.println(getClass(), parent + " is not a " + ResidentNode.class.getName() + " or " + InputNode.class.getName());
      } catch (Throwable t) {
        t.printStackTrace();
View Full Code Here

     */
    protected void loadDomainResidentNode() throws IOMebnException {

      MFrag domainMFrag;
      ResidentNode domainResidentNode;
      InputNode generativeInputNode;
      Argument argument;
      MultiEntityNode multiEntityNode;

      RDFIndividual individualOne;
      RDFIndividual individualTwo;
      OWLObjectProperty objectProperty;

      OWLNamedClass domainResidentNodePr = this.getOwlModel().getOWLNamedClass(DOMAIN_RESIDENT);
      Collection instances = domainResidentNodePr.getInstances(true);
      MFrag mFragOfNode = null;

      for (Iterator it = instances.iterator(); it.hasNext();) {

        individualOne = (RDFIndividual) it.next();
        domainResidentNode = getMapDomainResidentNode().get(individualOne
            .getBrowserText());
        if (domainResidentNode == null) {
          throw new IOMebnException(
              getResource().getString("DomainResidentNotExistsInMTheory"),
              individualOne.getBrowserText());
        }

        Debug.println("Domain Resident loaded: "
            + individualOne.getBrowserText());

        domainResidentNode.setDescription(getDescription(individualOne));

        /* -> isResidentNodeIn */
        objectProperty = (OWLObjectProperty) getOwlModel()
            .getOWLObjectProperty("isResidentNodeIn");
        instances = individualOne.getPropertyValues(objectProperty);
        Iterator itAux = instances.iterator();
        individualTwo = (RDFIndividual) itAux.next();
        domainMFrag = getMapDomainMFrag().get(individualTwo.getBrowserText());
        if (domainMFrag.containsDomainResidentNode(domainResidentNode) == false) {
          throw new IOMebnException(
              getResource().getString("DomainResidentNotExistsInDomainMFrag"));
        }
        mFragOfNode = domainMFrag;
        Debug.println("-> " + individualOne.getBrowserText() + ": "
            + objectProperty.getBrowserText() + " = "
            + individualTwo.getBrowserText());

        /* -> hasArgument */
        objectProperty = (OWLObjectProperty) getOwlModel()
            .getOWLObjectProperty("hasArgument");
        instances = individualOne.getPropertyValues(objectProperty);
        for (Iterator itIn = instances.iterator(); itIn.hasNext();) {
          individualTwo = (RDFIndividual) itIn.next();
          argument = new Argument(individualTwo.getBrowserText(),
              domainResidentNode);
          domainResidentNode.addArgument(argument);
          getMapArgument().put(individualTwo.getBrowserText(), argument);
          Debug.println("-> " + individualOne.getBrowserText() + ": "
              + objectProperty.getBrowserText() + " = "
              + individualTwo.getBrowserText());
        }

        /* -> hasParent */
        objectProperty = (OWLObjectProperty) getOwlModel()
            .getOWLObjectProperty("hasParent");
        instances = individualOne.getPropertyValues(objectProperty);
        for (Iterator itIn = instances.iterator(); itIn.hasNext();) {
          individualTwo = (RDFIndividual) itIn.next();
          if (getMapDomainResidentNode().containsKey(individualTwo
              .getBrowserText())) {
            ResidentNode aux = getMapDomainResidentNode().get(individualTwo
                .getBrowserText());

            Edge auxEdge = new Edge(aux, domainResidentNode);
            try {
              mFragOfNode.addEdge(auxEdge);
            } catch (Exception e) {
              Debug.println("Erro: arco invalido!!!");
            }
          } else {
            if (getMapGenerativeInputNode().containsKey(individualTwo
                .getBrowserText())) {
              InputNode aux = getMapGenerativeInputNode()
                  .get(individualTwo.getBrowserText());

              Edge auxEdge = new Edge(aux, domainResidentNode);
              try {
                mFragOfNode.addEdge(auxEdge);
View Full Code Here

      MFrag domainMFrag;
      OrdinaryVariable oVariable;
      ContextNode contextNode;
      ResidentNode domainResidentNode;
      InputNode generativeInputNode;
      BuiltInRV builtInRV;

      RDFIndividual individualOne;
      RDFIndividual individualTwo;
      OWLNamedClass owlNamedClass;
      OWLObjectProperty objectProperty;

      owlNamedClass = getOwlModel().getOWLNamedClass(DOMAIN_MFRAG);
      Collection instances = owlNamedClass.getInstances(false);

      for (Iterator it = instances.iterator(); it.hasNext();) {
        individualOne = (RDFIndividual) it.next();
        domainMFrag = getMapDomainMFrag().get(individualOne.getBrowserText());
        if (domainMFrag == null) {
          throw new IOMebnException(
              getResource().getString("DomainMFragNotExistsInMTheory"),
              individualOne.getBrowserText());
        }

        Debug.println("DomainMFrag loaded: "
            + individualOne.getBrowserText());

        domainMFrag.setDescription(getDescription(individualOne));

        /* -> hasResidentNode */
        objectProperty = (OWLObjectProperty) getOwlModel()
            .getOWLObjectProperty("hasResidentNode");
        instances = individualOne.getPropertyValues(objectProperty);
        for (Iterator itIn = instances.iterator(); itIn.hasNext();) {
          Object itInNext = itIn.next();
          if (!(itInNext instanceof RDFIndividual)) {
            try {
              System.err.println(itInNext + " != RDFIndividual");
            } catch (Throwable t) {
              t.printStackTrace();
            }
            continue;
          }
          individualTwo = (RDFIndividual) itInNext;

          // remove prefixes from the name
          String name = individualTwo.getBrowserText();
          if (name.startsWith(SaverPrOwlIO.RESIDENT_NAME_PREFIX)) {
            try {
              name = name.substring(SaverPrOwlIO.RESIDENT_NAME_PREFIX
                  .length());
            } catch (Exception e) {
              // ignore, because we can still try the original name
              e.printStackTrace();
            }
          }

          // instanciate a continuous resident node instead of resident node, if individual is assignable to a continuous node
          if (individualTwo.hasRDFType(getOwlModel().getOWLNamedClass(CONTINUOUS_RESIDENT_NODE), true)) {
            domainResidentNode = new ContinuousResidentNode(name, domainMFrag);
//            try {
//              ((ContinuousResidentNode)domainResidentNode).onAddToMFrag(domainMFrag);
//            } catch (MFragDoesNotExistException e) {
//              e.printStackTrace();
//            }
          } else {
            domainResidentNode = new ResidentNode(name, domainMFrag);
          }
          getMebn().getNamesUsed().add(name);

          domainMFrag.addResidentNode(domainResidentNode);

          // the mappings uses the original names (no prefix removal)
          getMapDomainResidentNode().put(individualTwo.getBrowserText(),
              domainResidentNode);
          getMapMultiEntityNode().put(individualTwo.getBrowserText(),
              domainResidentNode);
          Debug.println("-> " + individualOne.getBrowserText() + ": "
              + objectProperty.getBrowserText() + " = "
              + individualTwo.getBrowserText());
        }

        /* -> hasInputNode */
        objectProperty = (OWLObjectProperty) getOwlModel()
            .getOWLObjectProperty("hasInputNode");
        instances = individualOne.getPropertyValues(objectProperty);
        for (Iterator itIn = instances.iterator(); itIn.hasNext();) {
          individualTwo = (RDFIndividual) itIn.next();
          generativeInputNode = new InputNode(
              individualTwo.getBrowserText(), domainMFrag);
          getMebn().getNamesUsed().add(individualTwo.getBrowserText());
          domainMFrag.addInputNode(generativeInputNode);
          getMapGenerativeInputNode().put(individualTwo.getBrowserText(),
              generativeInputNode);
View Full Code Here

        }
        continue;
      }
      String parentName = null;
      if (parent instanceof InputNode) {
        InputNode inputNode = (InputNode) parent;
        if (inputNode.getResidentNodePointer() != null && inputNode.getResidentNodePointer().getResidentNode() != null) {
          parentName = inputNode.getResidentNodePointer().getResidentNode().getName();
        } else {
          try {
            Debug.println(getClass(), inputNode + " is not pointing to a resident node...");
          } catch (Throwable t) {
            t.printStackTrace();
View Full Code Here

    // check nodeName consistency: nodeName must be a parent
    boolean found = false;
    for (INode node : getNode().getParentNodes()) {
      try {
        if (node instanceof InputNode) {
          InputNode inputNode = (InputNode) node;
          if (inputNode.getResidentNodePointer().getResidentNode().getName().equals(nodeName)) {
            found = true;
            break;
          }
        }
        if (node.getName().equals(nodeName)) {
View Full Code Here

TOP

Related Classes of unbbayes.prs.mebn.InputNode

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.