Пример #1
0
  public void setBasePartialMatchTruth(Proposition prop, Keyword truth) {
    {
      PartialMatchFrame self = this;

      prop = prop;
      if (truth == Logic.KWD_TRUE) {
        KeyValueList.setDynamicSlotValue(
            ((QueryIterator) (Logic.$QUERYITERATOR$.get())).dynamicSlots,
            Logic.SYM_LOGIC_LATEST_POSITIVE_SCORE,
            FloatWrapper.wrapFloat(1.0),
            Stella.NULL_FLOAT_WRAPPER);
      } else if (truth == Logic.KWD_FAIL) {
        KeyValueList.setDynamicSlotValue(
            ((QueryIterator) (Logic.$QUERYITERATOR$.get())).dynamicSlots,
            Logic.SYM_LOGIC_LATEST_POSITIVE_SCORE,
            FloatWrapper.wrapFloat(0.0),
            Stella.NULL_FLOAT_WRAPPER);
      } else {
        {
          OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

          stream000.nativeStream.print("`" + truth + "' is not a valid case option");
          throw ((StellaException)
              (StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
        }
      }
    }
  }
Пример #2
0
  public String vizGenerateOntosaurusHandle(StandardObject renamed_Object) {
    {
      VizInfo self = this;

      {
        OutputStringStream url = OutputStringStream.newOutputStringStream();

        OntosaurusUtil.htmlWriteUrl(url.nativeStream, "show", renamed_Object);
        return (url.theStringReader());
      }
    }
  }
Пример #3
0
  public void stopHttpServerImpl() {
    {
      HttpServer server = this;

      {
        OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

        stream000.nativeStream.print("stop-http-server-impl: not implemented on `" + server + "'");
        throw ((StellaException)
            (StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
      }
    }
  }
Пример #4
0
  public String getRequestUriImpl(HttpExchange xchg) {
    {
      HttpServer server = this;

      xchg = xchg;
      {
        OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

        stream000.nativeStream.print("get-request-uri-impl: not implemented on `" + server + "'");
        throw ((StellaException)
            (StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
      }
    }
  }
Пример #5
0
  public double computePartialTruth(QueryIterator query) {
    {
      PartialMatchFrame self = this;

      query = query;
      {
        OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

        stream000.nativeStream.print("Don't know how to compute partial truth for `" + self + "'");
        throw ((StellaException)
            (StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
      }
    }
  }
Пример #6
0
  public PropertyList getHandlerOptionsImpl(HttpExchange xchg) {
    {
      HttpServer server = this;

      xchg = xchg;
      {
        OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

        stream000.nativeStream.print(
            "get-handler-options-impl: not implemented on `" + server + "'");
        throw ((StellaException)
            (StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
      }
    }
  }
Пример #7
0
  public QueryIterator retrievePartialSolutions(QueryIterator query) {
    {
      PartialMatchFrame self = this;

      query = query;
      {
        OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

        stream000.nativeStream.print(
            "Don't know how to retrieve partial solutions for `" + self + "'");
        throw ((StellaException)
            (StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
      }
    }
  }
Пример #8
0
  public String getHeaderValueImpl(HttpExchange xchg, Keyword key) {
    {
      HttpServer server = this;

      {
        xchg = xchg;
        key = key;
      }
      {
        OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

        stream000.nativeStream.print("get-header-value-impl: not implemented on `" + server + "'");
        throw ((StellaException)
            (StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
      }
    }
  }
Пример #9
0
  public void setResponseCodeImpl(HttpExchange xchg, Keyword code) {
    {
      HttpServer server = this;

      {
        xchg = xchg;
        code = code;
      }
      {
        OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

        stream000.nativeStream.print("set-response-code-impl: not implemented on `" + server + "'");
        throw ((StellaException)
            (StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
      }
    }
  }
Пример #10
0
  public void publishDirectoryImpl(String path, String directory, PropertyList options) {
    {
      HttpServer server = this;

      {
        path = path;
        directory = directory;
        options = options;
      }
      {
        OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

        stream000.nativeStream.print("publish-directory-impl: not implemented on `" + server + "'");
        throw ((StellaException)
            (StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
      }
    }
  }
Пример #11
0
  public void publishHandlerImpl(
      String path, java.lang.reflect.Method handler, PropertyList options) {
    {
      HttpServer server = this;

      {
        path = path;
        handler = handler;
        options = options;
      }
      {
        OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

        stream000.nativeStream.print("publish-handler-impl: not implemented on `" + server + "'");
        throw ((StellaException)
            (StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
      }
    }
  }
Пример #12
0
  public PartialMatchFrame createPartialMatchFrame(ControlFrame frame, Keyword kind) {
    {
      PartialMatchFrame self = this;

      {
        frame = frame;
        kind = kind;
      }
      {
        OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

        {
          stream000.nativeStream.println(
              "Missing concrete method named 'create-partial-match-frame' on the");
          stream000.nativeStream.print("   class `" + self.primaryType() + "'");
        }
        ;
        throw ((StellaException)
            (StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
      }
    }
  }
Пример #13
0
  public void vizExportConcepts(Module module) {
    {
      VizInfo self = this;

      {
        Stella_Object concept = null;
        edu.isi.powerloom.PlIterator iter000 =
            edu.isi.powerloom.PLI.getConceptInstances(
                ((LogicObject) (Logic.getInstance(OntosaurusUtil.SGT_PL_KERNEL_KB_CONCEPT))),
                module,
                null);

        while (iter000.nextP()) {
          concept = iter000.value;
          if (Surrogate.subtypeOfP(
              Stella_Object.safePrimaryType(concept), OntosaurusUtil.SGT_LOGIC_LOGIC_OBJECT)) {
            {
              LogicObject concept000 = ((LogicObject) (concept));

              if ((concept000.homeModule() == module) && self.vizAllowedObjectP(concept000)) {
                self.vizExportConcept(concept000, module);
              }
            }
          } else {
            {
              OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

              stream000.nativeStream.print(
                  "viz-export-concepts: concept not handled: `" + concept + "'");
              throw ((StellaException)
                  (StellaException.newStellaException(stream000.theStringReader())
                      .fillInStackTrace()));
            }
          }
        }
      }
    }
  }
Пример #14
0
  public static Stella_Object accessVizInfoSlotValue(
      VizInfo self, Symbol slotname, Stella_Object value, boolean setvalueP) {
    if (slotname == OntosaurusUtil.SYM_STELLA_STREAM) {
      if (setvalueP) {
        self.stream = ((OutputStream) (value));
      } else {
        value = self.stream;
      }
    } else if (slotname == OntosaurusUtil.SYM_ONTOSAURUS_ALLOWED_OBJECTS) {
      if (setvalueP) {
        self.allowedObjects = ((HashSet) (value));
      } else {
        value = self.allowedObjects;
      }
    } else if (slotname == OntosaurusUtil.SYM_ONTOSAURUS_SHOW_RELATIONSp) {
      if (setvalueP) {
        self.showRelationsP =
            BooleanWrapper.coerceWrappedBooleanToBoolean(((BooleanWrapper) (value)));
      } else {
        value = (self.showRelationsP ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER);
      }
    } else if (slotname == OntosaurusUtil.SYM_ONTOSAURUS_SHOW_ATTRIBUTESp) {
      if (setvalueP) {
        self.showAttributesP =
            BooleanWrapper.coerceWrappedBooleanToBoolean(((BooleanWrapper) (value)));
      } else {
        value = (self.showAttributesP ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER);
      }
    } else if (slotname == OntosaurusUtil.SYM_ONTOSAURUS_SHOW_RULESp) {
      if (setvalueP) {
        self.showRulesP = BooleanWrapper.coerceWrappedBooleanToBoolean(((BooleanWrapper) (value)));
      } else {
        value = (self.showRulesP ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER);
      }
    } else if (slotname == OntosaurusUtil.SYM_ONTOSAURUS_ADD_TOPp) {
      if (setvalueP) {
        self.addTopP = BooleanWrapper.coerceWrappedBooleanToBoolean(((BooleanWrapper) (value)));
      } else {
        value = (self.addTopP ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER);
      }
    } else if (slotname == OntosaurusUtil.SYM_ONTOSAURUS_NODE_COLOR) {
      if (setvalueP) {
        self.nodeColor = ((StringWrapper) (value)).wrapperValue;
      } else {
        value = StringWrapper.wrapString(self.nodeColor);
      }
    } else if (slotname == OntosaurusUtil.SYM_ONTOSAURUS_RELATION_COLOR) {
      if (setvalueP) {
        self.relationColor = ((StringWrapper) (value)).wrapperValue;
      } else {
        value = StringWrapper.wrapString(self.relationColor);
      }
    } else if (slotname == OntosaurusUtil.SYM_ONTOSAURUS_RELATION_STYLE) {
      if (setvalueP) {
        self.relationStyle = ((StringWrapper) (value)).wrapperValue;
      } else {
        value = StringWrapper.wrapString(self.relationStyle);
      }
    } else if (slotname == OntosaurusUtil.SYM_ONTOSAURUS_FONT_SIZE) {
      if (setvalueP) {
        self.fontSize = ((IntegerWrapper) (value)).wrapperValue;
      } else {
        value = IntegerWrapper.wrapInteger(self.fontSize);
      }
    } else {
      {
        OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

        stream000.nativeStream.print("`" + slotname + "' is not a valid case option");
        throw ((StellaException)
            (StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
      }
    }
    return (value);
  }
Пример #15
0
  public void vizConceptLinksToDotEdges(LogicObject concept, Module module) {
    {
      VizInfo self = this;

      {
        OutputStream stream = self.stream;
        int count = 0;

        {
          LogicObject renamed_Super = null;
          edu.isi.powerloom.PlIterator iter000 =
              edu.isi.powerloom.PLI.getDirectSuperrelations(concept, module, null);

          while (iter000.nextP()) {
            renamed_Super = ((LogicObject) (iter000.value));
            if (Surrogate.subtypeOfP(
                Stella_Object.safePrimaryType(renamed_Super),
                OntosaurusUtil.SGT_LOGIC_NAMED_DESCRIPTION)) {
              {
                NamedDescription super000 = ((NamedDescription) (renamed_Super));

                if (self.vizAllowedObjectP(super000)) {
                  stream.nativeStream.println(
                      "  \""
                          + OntosaurusUtil.vizDotObjectName(super000)
                          + "\" -> \""
                          + OntosaurusUtil.vizDotObjectName(concept)
                          + "\" [dir=back]");
                  count = count + 1;
                } else {
                  stream.nativeStream.print(
                      "  \""
                          + OntosaurusUtil.vizDotObjectName(super000)
                          + "\" [shape=box, style=filled, fillcolor=grey,URL=\""
                          + self.vizGenerateOntosaurusHandle(super000)
                          + "\"]");
                  stream.nativeStream.println(
                      "  \""
                          + OntosaurusUtil.vizDotObjectName(super000)
                          + "\" -> \""
                          + OntosaurusUtil.vizDotObjectName(concept)
                          + "\" [dir=back]");
                  count = count + 1;
                }
              }
            } else {
              {
                OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

                stream000.nativeStream.print(
                    "viz-concept-links-to-dot-edges: unhandled super concept: `"
                        + renamed_Super
                        + "'");
                throw ((StellaException)
                    (StellaException.newStellaException(stream000.theStringReader())
                        .fillInStackTrace()));
              }
            }
          }
        }
        if ((count == 0) && self.addTopP) {
          stream.nativeStream.println(
              "  \""
                  + OntosaurusUtil.VIZ_TOP
                  + "\" -> \""
                  + OntosaurusUtil.vizDotObjectName(concept)
                  + "\" [dir=back]");
        }
        if (self.showRelationsP) {
          {
            LogicObject range = null;
            String relcolor = self.relationColor;
            String relstyle = self.relationStyle;

            {
              Object old$Module$000 = Stella.$MODULE$.get();
              Object old$Context$000 = Stella.$CONTEXT$.get();

              try {
                Native.setSpecial(Stella.$MODULE$, module);
                Native.setSpecial(Stella.$CONTEXT$, ((Module) (Stella.$MODULE$.get())));
                {
                  LogicObject relation = null;
                  Cons iter001 = self.vizGetBinaryRelationsOf(concept);

                  for (; !(iter001 == Stella.NIL); iter001 = iter001.rest) {
                    relation = ((LogicObject) (iter001.value));
                    range = edu.isi.powerloom.PLI.getRange(relation);
                    if (self.vizAllowedObjectP(relation)) {
                      stream.nativeStream.println(
                          "  \""
                              + OntosaurusUtil.vizDotObjectName(concept)
                              + "\" -> \""
                              + OntosaurusUtil.vizDotObjectName(range)
                              + "\" [label=\""
                              + OntosaurusUtil.vizDotObjectName(relation)
                              + "\", color="
                              + relcolor
                              + ", style="
                              + relstyle
                              + "]");
                    }
                  }
                }

              } finally {
                Stella.$CONTEXT$.set(old$Context$000);
                Stella.$MODULE$.set(old$Module$000);
              }
            }
          }
        }
      }
    }
  }
Пример #16
0
  public void vizExportConceptTree(LogicObject concept, Module module) {
    {
      VizInfo self = this;

      self.nodeColor = "palegreen";
      self.vizExportConcept(concept, module);
      self.nodeColor = "yellow";
      self.vizAllowObject(concept);
      {
        LogicObject renamed_Super = null;
        edu.isi.powerloom.PlIterator iter000 =
            edu.isi.powerloom.PLI.getProperSuperrelations(concept, module, null);

        while (iter000.nextP()) {
          renamed_Super = ((LogicObject) (iter000.value));
          self.vizAllowObject(renamed_Super);
        }
      }
      {
        LogicObject sub = null;
        edu.isi.powerloom.PlIterator iter001 =
            edu.isi.powerloom.PLI.getProperSubrelations(concept, module, null);

        while (iter001.nextP()) {
          sub = ((LogicObject) (iter001.value));
          self.vizAllowObject(sub);
        }
      }
      {
        LogicObject renamed_Super = null;
        edu.isi.powerloom.PlIterator iter002 =
            edu.isi.powerloom.PLI.getProperSuperrelations(concept, module, null);

        while (iter002.nextP()) {
          renamed_Super = ((LogicObject) (iter002.value));
          if (Surrogate.subtypeOfP(
              Stella_Object.safePrimaryType(renamed_Super),
              OntosaurusUtil.SGT_LOGIC_LOGIC_OBJECT)) {
            {
              LogicObject super000 = ((LogicObject) (renamed_Super));

              self.vizExportConcept(super000, module);
            }
          } else {
            {
              OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

              stream000.nativeStream.print(
                  "viz-export-concept-tree: concept not handled: `" + renamed_Super + "'");
              throw ((StellaException)
                  (StellaException.newStellaException(stream000.theStringReader())
                      .fillInStackTrace()));
            }
          }
        }
      }
      {
        LogicObject sub = null;
        edu.isi.powerloom.PlIterator iter003 =
            edu.isi.powerloom.PLI.getProperSubrelations(concept, module, null);

        while (iter003.nextP()) {
          sub = ((LogicObject) (iter003.value));
          if (Surrogate.subtypeOfP(
              Stella_Object.safePrimaryType(sub), OntosaurusUtil.SGT_LOGIC_LOGIC_OBJECT)) {
            {
              LogicObject sub000 = ((LogicObject) (sub));

              self.vizExportConcept(sub000, module);
            }
          } else {
            {
              OutputStringStream stream001 = OutputStringStream.newOutputStringStream();

              stream001.nativeStream.print(
                  "viz-export-concept-tree: concept not handled: `" + sub + "'");
              throw ((StellaException)
                  (StellaException.newStellaException(stream001.theStringReader())
                      .fillInStackTrace()));
            }
          }
        }
      }
    }
  }
Пример #17
0
  public static Stella_Object accessPartialMatchFrameSlotValue(
      PartialMatchFrame self, Symbol slotname, Stella_Object value, boolean setvalueP) {
    if (slotname == Logic.SYM_LOGIC_KIND) {
      if (setvalueP) {
        self.kind = ((Keyword) (value));
      } else {
        value = self.kind;
      }
    } else if (slotname == Logic.SYM_LOGIC_CONTROL_FRAME) {
      if (setvalueP) {
        self.controlFrame = ((ControlFrame) (value));
      } else {
        value = self.controlFrame;
      }
    } else if (slotname == Logic.SYM_LOGIC_PARENT) {
      if (setvalueP) {
        self.parent = ((PartialMatchFrame) (value));
      } else {
        value = self.parent;
      }
    } else if (slotname == Logic.SYM_LOGIC_CHILD) {
      if (setvalueP) {
        self.child = ((PartialMatchFrame) (value));
      } else {
        value = self.child;
      }
    } else if (slotname == Logic.SYM_LOGIC_POSITIVE_SCORE) {
      if (setvalueP) {
        self.positiveScore = ((FloatWrapper) (value)).wrapperValue;
      } else {
        value = FloatWrapper.wrapFloat(self.positiveScore);
      }
    } else if (slotname == Logic.SYM_LOGIC_NEGATIVE_SCORE) {
      if (setvalueP) {
        self.negativeScore = ((FloatWrapper) (value)).wrapperValue;
      } else {
        value = FloatWrapper.wrapFloat(self.negativeScore);
      }
    } else if (slotname == Logic.SYM_LOGIC_DYNAMIC_CUTOFF) {
      if (setvalueP) {
        self.dynamicCutoff = ((FloatWrapper) (value)).wrapperValue;
      } else {
        value = FloatWrapper.wrapFloat(self.dynamicCutoff);
      }
    } else if (slotname == Logic.SYM_LOGIC_ARGUMENT_SCORES) {
      if (setvalueP) {
        self.argumentScores = ((Cons) (value));
      } else {
        value = self.argumentScores;
      }
    } else if (slotname == Logic.SYM_LOGIC_ARGUMENT_WEIGHTS) {
      if (setvalueP) {
        self.argumentWeights = ((Cons) (value));
      } else {
        value = self.argumentWeights;
      }
    } else if (slotname == Logic.SYM_LOGIC_UNBOUND_VARS) {
      if (setvalueP) {
        self.unboundVars = ((Cons) (value));
      } else {
        value = self.unboundVars;
      }
    } else if (slotname == Logic.SYM_LOGIC_SUCCESSp) {
      if (setvalueP) {
        self.successP = BooleanWrapper.coerceWrappedBooleanToBoolean(((BooleanWrapper) (value)));
      } else {
        value = (self.successP ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER);
      }
    } else {
      {
        OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

        stream000.nativeStream.print("`" + slotname + "' is not a valid case option");
        throw ((StellaException)
            (StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
      }
    }
    return (value);
  }