Ejemplo n.º 1
0
  public String vizGenerateOntosaurusHandle(StandardObject renamed_Object) {
    {
      VizInfo self = this;

      {
        OutputStringStream url = OutputStringStream.newOutputStringStream();

        OntosaurusUtil.htmlWriteUrl(url.nativeStream, "show", renamed_Object);
        return (url.theStringReader());
      }
    }
  }
Ejemplo n.º 2
0
  public void vizAddConceptRulesToDotNode(LogicObject concept, Module module) {
    {
      VizInfo self = this;

      {
        OutputStream stream = self.stream;
        boolean firstP = true;

        {
          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())));
            {
              Object old$PrettyprintlogicalformsP$000 = Logic.$PRETTYPRINTLOGICALFORMSp$.get();

              try {
                Native.setBooleanSpecial(Logic.$PRETTYPRINTLOGICALFORMSp$, true);
                {
                  Proposition rule = null;
                  edu.isi.powerloom.PlIterator iter000 =
                      edu.isi.powerloom.PLI.getRules(concept, module, null);

                  while (iter000.nextP()) {
                    rule = ((Proposition) (iter000.value));
                    if (!Proposition.simpleSubrelationPropositionP(rule)) {
                      if (!(firstP)) {
                        stream.nativeStream.print("\\l");
                      }
                      firstP = false;
                      stream.nativeStream.print(
                          OntosaurusUtil.vizDotString(Native.stringify(rule)));
                    }
                  }
                }

              } finally {
                Logic.$PRETTYPRINTLOGICALFORMSp$.set(old$PrettyprintlogicalformsP$000);
              }
            }

          } finally {
            Stella.$CONTEXT$.set(old$Context$000);
            Stella.$MODULE$.set(old$Module$000);
          }
        }
      }
    }
  }
Ejemplo n.º 3
0
  public void vizAddConceptAttributesToDotNode(LogicObject concept, Module module) {
    {
      VizInfo self = this;

      {
        OutputStream stream = self.stream;
        LogicObject range = null;

        {
          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 iter000 = self.vizGetBinaryRelationsOf(concept);

              for (; !(iter000 == Stella.NIL); iter000 = iter000.rest) {
                relation = ((LogicObject) (iter000.value));
                range = edu.isi.powerloom.PLI.getRange(relation);
                stream.nativeStream.print(
                    OntosaurusUtil.vizDotObjectName(relation)
                        + ": "
                        + OntosaurusUtil.vizDotObjectName(range)
                        + "\\l");
              }
            }

          } finally {
            Stella.$CONTEXT$.set(old$Context$000);
            Stella.$MODULE$.set(old$Module$000);
          }
        }
      }
    }
  }
Ejemplo n.º 4
0
  public void vizConceptToDotNode(LogicObject concept, Module module) {
    {
      VizInfo self = this;

      {
        OutputStream stream = self.stream;
        String conceptname = OntosaurusUtil.vizDotObjectName(concept);
        String conceptcolor = self.nodeColor;
        String concepturl = self.vizGenerateOntosaurusHandle(concept);

        if (self.showAttributesP || self.showRulesP) {
          stream.nativeStream.print(
              "  \""
                  + conceptname
                  + "\" [shape=record, style=filled, fillcolor="
                  + conceptcolor
                  + ", URL=\"");
          stream.nativeStream.print(concepturl);
          stream.nativeStream.print("\", label=\"{" + conceptname + "|");
          if (self.showAttributesP) {
            self.vizAddConceptAttributesToDotNode(concept, module);
          }
          if (self.showRulesP) {
            if (self.showAttributesP) {
              stream.nativeStream.print("|");
            }
            self.vizAddConceptRulesToDotNode(concept, module);
          }
          stream.nativeStream.println("}\"]");
        } else {
          stream.nativeStream.print(
              "  \""
                  + conceptname
                  + "\" [shape=box, style=filled, fillcolor="
                  + conceptcolor
                  + ", URL=\""
                  + concepturl
                  + "\"]");
        }
      }
    }
  }
Ejemplo n.º 5
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);
              }
            }
          }
        }
      }
    }
  }