Package unbbayes.prs.mebn

Examples of unbbayes.prs.mebn.ContextNode


        if(simpleContextNodeList.size() > 1){
          throw new ImplementationRestrictionException(
              ImplementationRestrictionException.MORE_THAN_ONE_CTXT_NODE_SEARCH);
        }else{
          //We have only one context node father
          ContextNode contextNode = simpleContextNodeList.get(0).getContextNode();
          ContextFatherSSBNNode contextFather = mapContextNode.get(contextNode);
          if(contextFather == null){
            contextFather = new ContextFatherSSBNNode(pn, contextNode);
           
            List<LiteralEntityInstance> possibleValueList = new ArrayList<LiteralEntityInstance>();
View Full Code Here


     */
    protected void loadDomainMFrag() throws IOMebnException {

      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);
          getMapMultiEntityNode().put(individualTwo.getBrowserText(),
              generativeInputNode);
          Debug.println("-> " + individualOne.getBrowserText() + ": "
              + objectProperty.getBrowserText() + " = "
              + individualTwo.getBrowserText());
        }

        /* -> hasContextNode */
        objectProperty = (OWLObjectProperty) getOwlModel()
            .getOWLObjectProperty("hasContextNode");
        instances = individualOne.getPropertyValues(objectProperty);
        for (Iterator itIn = instances.iterator(); itIn.hasNext();) {
          individualTwo = (RDFIndividual) itIn.next();
          contextNode = new ContextNode(individualTwo.getBrowserText(),
              domainMFrag);
          getMebn().getNamesUsed().add(individualTwo.getBrowserText());
          domainMFrag.addContextNode(contextNode);
          getMapContextNode().put(individualTwo.getBrowserText(), contextNode);
          getMapMultiEntityNode().put(individualTwo.getBrowserText(),
View Full Code Here

TOP

Related Classes of unbbayes.prs.mebn.ContextNode

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.