Concept:Bigstock/Java

From BITPlan Wiki
Revision as of 08:10, 24 September 2019 by Wf (talk | contribs) (created by WikiTask 2019-09-24T07:10:57Z)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

java code

@// This is a rythm template
@// the args are the standard wikiTask arguments
@import org.sidif.triple.TripleQuery
@import org.sidif.triple.Triple
@import com.alibaba.fastjson.JSON
@args() {
  String title 
  String logo
  org.sidif.wiki.WikiTask wikiTask
  org.sidif.triple.TripleStore tripleStore
}


@def static {

  /**
   * Base class
   */
  static abstract class TopicBase {
    // each Topic has a pageid - for non subobject thats the pagename
    public String pageid;

    /**
     * get a WikiSon version of the given name value
     * 
     * @param name
     * @param value
     * @return - the string representation
     */
    public String toWikiSon(String name, String value) {
      String result = "<!-- " + name + " is null-->\n";
      if (value != null)
        result = "|" + name + "=" + value + "\n";
      return result;
    }

    /**
     * get the SiDIF representation of the given property
     * 
     * @param name - the name of the property
     * @param value - the value of the property
     * @param type - the type of the property
     * @return - the SiDIF Sting representation of the property
     */
    public static String propertySiDIF(String name, String value, String type) {
      // default is a comment line which can be filled by uncommenting
      String result = String.format("# is is %s of it\n",name);;
      // if the value is not empty
      if ((value != null) && (!("".equals(value.trim())))) {
        // do we need to quote the result?
        String quote = "";
        // this depends on the Type
        if ("Text".equals(type)) {
          quote = "\"";
        }
        // create a SIDIF Property line like
        // "John" is lastname of it
        // convert double quotes to single quotes - FIXME - should we escape instead?
        value=value.replace("\"","'");
        result = String.format("%s%s%s is %s of it\n",quote,value,quote,name);
      }
      // return the SiDIF property line
      return result;
    }

    /**
     * get me as a String
     * 
     * @param name
     * @param value
     * @return
     */
    public static String propertySiDIF(String name, String value) {
      String result = propertySiDIF(name, value, "Text");
      return result;
    }

    /**
     * check if the given boolean String value is true
     * 
     * @param value
     * @return true if the value is not null and has true/TRUE as it's string
     *         content
     */
    public boolean isTrue(String value) {
      boolean result = false;
      if (value != null && value.toLowerCase().equals("true")) {
        result = true;
      }
      return result;
    }

    /**
     * initialize
     */
    public void init(TripleQuery query) {
    }
  } // TopicBase
 /**
  * Presentation
  * Slide Presentation
  */
  public static class Presentation extends TopicBase {
  
    public String title;
    public String author;
    public String startDate;
    public String file;
    public String lang;

    public String getTitle() { return title; }
    public void setTitle(String pTitle) { title=pTitle; }
    public String getAuthor() { return author; }
    public void setAuthor(String pAuthor) { author=pAuthor; }
    public String getStartDate() { return startDate; }
    public void setStartDate(String pStartDate) { startDate=pStartDate; }
    public String getFile() { return file; }
    public void setFile(String pFile) { file=pFile; }
    public String getLang() { return lang; }
    public void setLang(String pLang) { lang=pLang; }
    /**
     * convert this Presentation to a JSON string
     */
    public String toJson() { return JSON.toJSONString(this); }

    /**
     * convert this Presentation to a WikiSon string
     * @return the WikiSon representation of this Presentation
     */
    public String toWikiSon() {
      String wikison= "{{Presentation\n";
      wikison+=toWikiSon("title",title);
      wikison+=toWikiSon("author",author);
      wikison+=toWikiSon("startDate",startDate);
      wikison+=toWikiSon("file",file);
      wikison+=toWikiSon("lang",lang);
      wikison+="}}\n";
      return wikison;
    }

    /**
     * convert this Presentation to a SiDIF string
     * @return the SiDIF representation of this Presentation
     */
    public String toSiDIF() {
      String siDIF = String.format("%s isA Presentation\n",this.pageid);
      siDIF+=propertySiDIF("title",title,"Text");
      siDIF+=propertySiDIF("author",author,"Text");
      siDIF+=propertySiDIF("startDate",startDate,"Date");
      siDIF+=propertySiDIF("file",file,"Page");
      siDIF+=propertySiDIF("lang",lang,"Text");
      return siDIF;
    }
 
    /**  
     * get the pageid for this topic
     */
    public String getPageid() { return pageid; };

    /**
     * default constructor for Presentation
     */
    public Presentation() {}

    /**
     * construct a Presentation from the given Triple
     * @param query - the TripleQuery to get the triples from
     * @param pPresentationTriple - the triple to construct me from
     */
    public Presentation(TripleQuery query,Triple pPresentationTriple) {
      this(query,pPresentationTriple.getSubject().toString());
    } // constructor

    /**
     * construct a Presentation from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public Presentation(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple titleTriple=query.selectSingle(pageid,"title",null);
      if (titleTriple==null)
        titleTriple=query.selectSingle(pageid,"Property:Presentation_title",null);
      if (titleTriple!=null) 
        title=titleTriple.getObject().toString();
      Triple authorTriple=query.selectSingle(pageid,"author",null);
      if (authorTriple==null)
        authorTriple=query.selectSingle(pageid,"Property:Presentation_author",null);
      if (authorTriple!=null) 
        author=authorTriple.getObject().toString();
      Triple startDateTriple=query.selectSingle(pageid,"startDate",null);
      if (startDateTriple==null)
        startDateTriple=query.selectSingle(pageid,"Property:Presentation_startDate",null);
      if (startDateTriple!=null) 
        startDate=startDateTriple.getObject().toString();
      Triple fileTriple=query.selectSingle(pageid,"file",null);
      if (fileTriple==null)
        fileTriple=query.selectSingle(pageid,"Property:Presentation_file",null);
      if (fileTriple!=null) 
        file=fileTriple.getObject().toString();
      Triple langTriple=query.selectSingle(pageid,"lang",null);
      if (langTriple==null)
        langTriple=query.selectSingle(pageid,"Property:Presentation_lang",null);
      if (langTriple!=null) 
        lang=langTriple.getObject().toString();
      init(query);
    } // constructor for Presentation
    
    // >>>{user defined topic code}{Presentation}{Presentation}
    // <<<{user defined topic code}{Presentation}{Presentation}
  } // class Presentation
  /**
   * Manager for Presentation
   */
  public static class PresentationManager extends TopicBase {
 
    public String topicName="Presentation";
    public transient List<Presentation> mPresentations=new ArrayList<Presentation>();
    public transient Map<String,Presentation> mPresentationMap=new LinkedHashMap<String,Presentation>();

    /**
     * get my Presentations
     */
    public List<Presentation> getPresentations() {
      List<Presentation> result=this.mPresentations;
      return result;
    }

    /**
     *  add a new Presentation 
     */
    public Presentation add(Presentation pPresentation) {
      mPresentations.add(pPresentation);
      mPresentationMap.put(pPresentation.getPageid(),pPresentation);
      return pPresentation;
    }

    /**
     *  add a new Presentation from the given triple
     */
    public Presentation add(TripleQuery query,Triple pPresentationTriple) {
      Presentation lPresentation=new Presentation(query,pPresentationTriple);
      add(lPresentation);
      return lPresentation;
    }

    // reinitialize my mPresentation map
    public void reinit() {
      mPresentationMap.clear();
      for (Presentation lPresentation:mPresentations) {
        mPresentationMap.put(lPresentation.getPageid(),lPresentation);
      }
    }

    // convert this manager to json format 
    public String toJson() { return JSON.toJSONString(this); }
    
    // get a new manager from the given json string
    public static PresentationManager fromJson(String json) {
      PresentationManager result=JSON.parseObject(json, PresentationManager.class);
      result.reinit();
      return result;
    }

    // default constructor for Presentation Manager
    public PresentationManager() {}

    // add Presentations from the given query
    public void addPresentations(TripleQuery pPresentationQuery,TripleQuery query) {
      if (pPresentationQuery!=null) {
        for (Triple lPresentationTriple:pPresentationQuery.getTriples()) {
          add(query,lPresentationTriple);
        }
      }
    }

    // construct me from the given triple Query query
    public PresentationManager(TripleQuery query) {
      // first query the SiDIF bases triplestore
      TripleQuery lPresentationQuery=query.query(null,"isA","Presentation");
      addPresentations(lPresentationQuery,query);
      // then the SMW triplestore
      lPresentationQuery=query.query(null,"Property:IsA","Presentation");
      addPresentations(lPresentationQuery,query);
      init(query);
    } // constructor for Presentation Manager
    
    // >>>{user defined topicmanager code}{Presentation}{Presentation}
    // <<<{user defined topicmanager code}{Presentation}{Presentation}
  } // class Presentation Manager
 /**
  * Flipchart
  * Representation of the content of a flip chart.
  */
  public static class Flipchart extends TopicBase {
  
    public String title;
    public String text;
    public String size;
    public String picture;
    public String imagelink;
    public String topic;

    public String getTitle() { return title; }
    public void setTitle(String pTitle) { title=pTitle; }
    public String getText() { return text; }
    public void setText(String pText) { text=pText; }
    public String getSize() { return size; }
    public void setSize(String pSize) { size=pSize; }
    public String getPicture() { return picture; }
    public void setPicture(String pPicture) { picture=pPicture; }
    public String getImagelink() { return imagelink; }
    public void setImagelink(String pImagelink) { imagelink=pImagelink; }
    public String getTopic() { return topic; }
    public void setTopic(String pTopic) { topic=pTopic; }
    /**
     * convert this Flipchart to a JSON string
     */
    public String toJson() { return JSON.toJSONString(this); }

    /**
     * convert this Flipchart to a WikiSon string
     * @return the WikiSon representation of this Flipchart
     */
    public String toWikiSon() {
      String wikison= "{{Flipchart\n";
      wikison+=toWikiSon("title",title);
      wikison+=toWikiSon("text",text);
      wikison+=toWikiSon("size",size);
      wikison+=toWikiSon("picture",picture);
      wikison+=toWikiSon("imagelink",imagelink);
      wikison+=toWikiSon("topic",topic);
      wikison+="}}\n";
      return wikison;
    }

    /**
     * convert this Flipchart to a SiDIF string
     * @return the SiDIF representation of this Flipchart
     */
    public String toSiDIF() {
      String siDIF = String.format("%s isA Flipchart\n",this.pageid);
      siDIF+=propertySiDIF("title",title,"Text");
      siDIF+=propertySiDIF("text",text,"Text");
      siDIF+=propertySiDIF("size",size,"Text");
      siDIF+=propertySiDIF("picture",picture,"Text");
      siDIF+=propertySiDIF("imagelink",imagelink,"Text");
      siDIF+=propertySiDIF("topic",topic,"Text");
      return siDIF;
    }
 
    /**  
     * get the pageid for this topic
     */
    public String getPageid() { return pageid; };

    /**
     * default constructor for Flipchart
     */
    public Flipchart() {}

    /**
     * construct a Flipchart from the given Triple
     * @param query - the TripleQuery to get the triples from
     * @param pFlipchartTriple - the triple to construct me from
     */
    public Flipchart(TripleQuery query,Triple pFlipchartTriple) {
      this(query,pFlipchartTriple.getSubject().toString());
    } // constructor

    /**
     * construct a Flipchart from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public Flipchart(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple titleTriple=query.selectSingle(pageid,"title",null);
      if (titleTriple==null)
        titleTriple=query.selectSingle(pageid,"Property:Flipchart_title",null);
      if (titleTriple!=null) 
        title=titleTriple.getObject().toString();
      Triple textTriple=query.selectSingle(pageid,"text",null);
      if (textTriple==null)
        textTriple=query.selectSingle(pageid,"Property:Flipchart_text",null);
      if (textTriple!=null) 
        text=textTriple.getObject().toString();
      Triple sizeTriple=query.selectSingle(pageid,"size",null);
      if (sizeTriple==null)
        sizeTriple=query.selectSingle(pageid,"Property:Flipchart_size",null);
      if (sizeTriple!=null) 
        size=sizeTriple.getObject().toString();
      Triple pictureTriple=query.selectSingle(pageid,"picture",null);
      if (pictureTriple==null)
        pictureTriple=query.selectSingle(pageid,"Property:Flipchart_picture",null);
      if (pictureTriple!=null) 
        picture=pictureTriple.getObject().toString();
      Triple imagelinkTriple=query.selectSingle(pageid,"imagelink",null);
      if (imagelinkTriple==null)
        imagelinkTriple=query.selectSingle(pageid,"Property:Flipchart_imagelink",null);
      if (imagelinkTriple!=null) 
        imagelink=imagelinkTriple.getObject().toString();
      Triple topicTriple=query.selectSingle(pageid,"topic",null);
      if (topicTriple==null)
        topicTriple=query.selectSingle(pageid,"Property:Flipchart_topic",null);
      if (topicTriple!=null) 
        topic=topicTriple.getObject().toString();
      init(query);
    } // constructor for Flipchart
    
    // >>>{user defined topic code}{Flipchart}{Flipchart}
    // <<<{user defined topic code}{Flipchart}{Flipchart}
  } // class Flipchart
  /**
   * Manager for Flipchart
   */
  public static class FlipchartManager extends TopicBase {
 
    public String topicName="Flipchart";
    public transient List<Flipchart> mFlipcharts=new ArrayList<Flipchart>();
    public transient Map<String,Flipchart> mFlipchartMap=new LinkedHashMap<String,Flipchart>();

    /**
     * get my Flipcharts
     */
    public List<Flipchart> getFlipcharts() {
      List<Flipchart> result=this.mFlipcharts;
      return result;
    }

    /**
     *  add a new Flipchart 
     */
    public Flipchart add(Flipchart pFlipchart) {
      mFlipcharts.add(pFlipchart);
      mFlipchartMap.put(pFlipchart.getPageid(),pFlipchart);
      return pFlipchart;
    }

    /**
     *  add a new Flipchart from the given triple
     */
    public Flipchart add(TripleQuery query,Triple pFlipchartTriple) {
      Flipchart lFlipchart=new Flipchart(query,pFlipchartTriple);
      add(lFlipchart);
      return lFlipchart;
    }

    // reinitialize my mFlipchart map
    public void reinit() {
      mFlipchartMap.clear();
      for (Flipchart lFlipchart:mFlipcharts) {
        mFlipchartMap.put(lFlipchart.getPageid(),lFlipchart);
      }
    }

    // convert this manager to json format 
    public String toJson() { return JSON.toJSONString(this); }
    
    // get a new manager from the given json string
    public static FlipchartManager fromJson(String json) {
      FlipchartManager result=JSON.parseObject(json, FlipchartManager.class);
      result.reinit();
      return result;
    }

    // default constructor for Flipchart Manager
    public FlipchartManager() {}

    // add Flipcharts from the given query
    public void addFlipcharts(TripleQuery pFlipchartQuery,TripleQuery query) {
      if (pFlipchartQuery!=null) {
        for (Triple lFlipchartTriple:pFlipchartQuery.getTriples()) {
          add(query,lFlipchartTriple);
        }
      }
    }

    // construct me from the given triple Query query
    public FlipchartManager(TripleQuery query) {
      // first query the SiDIF bases triplestore
      TripleQuery lFlipchartQuery=query.query(null,"isA","Flipchart");
      addFlipcharts(lFlipchartQuery,query);
      // then the SMW triplestore
      lFlipchartQuery=query.query(null,"Property:IsA","Flipchart");
      addFlipcharts(lFlipchartQuery,query);
      init(query);
    } // constructor for Flipchart Manager
    
    // >>>{user defined topicmanager code}{Flipchart}{Flipchart}
    // <<<{user defined topicmanager code}{Flipchart}{Flipchart}
  } // class Flipchart Manager
 /**
  * Bigstock
  * A photo from http://www.bigstockphoto.com/de/
  */
  public static class Bigstock extends TopicBase {
  
    public String id;
    public String file;

    public String getId() { return id; }
    public void setId(String pId) { id=pId; }
    public String getFile() { return file; }
    public void setFile(String pFile) { file=pFile; }
    /**
     * convert this Bigstock to a JSON string
     */
    public String toJson() { return JSON.toJSONString(this); }

    /**
     * convert this Bigstock to a WikiSon string
     * @return the WikiSon representation of this Bigstock
     */
    public String toWikiSon() {
      String wikison= "{{Bigstock\n";
      wikison+=toWikiSon("id",id);
      wikison+=toWikiSon("file",file);
      wikison+="}}\n";
      return wikison;
    }

    /**
     * convert this Bigstock to a SiDIF string
     * @return the SiDIF representation of this Bigstock
     */
    public String toSiDIF() {
      String siDIF = String.format("%s isA Bigstock\n",this.pageid);
      siDIF+=propertySiDIF("id",id,"Text");
      siDIF+=propertySiDIF("file",file,"Page");
      return siDIF;
    }
 
    /**  
     * get the pageid for this topic
     */
    public String getPageid() { return pageid; };

    /**
     * default constructor for Bigstock
     */
    public Bigstock() {}

    /**
     * construct a Bigstock from the given Triple
     * @param query - the TripleQuery to get the triples from
     * @param pBigstockTriple - the triple to construct me from
     */
    public Bigstock(TripleQuery query,Triple pBigstockTriple) {
      this(query,pBigstockTriple.getSubject().toString());
    } // constructor

    /**
     * construct a Bigstock from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public Bigstock(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple idTriple=query.selectSingle(pageid,"id",null);
      if (idTriple==null)
        idTriple=query.selectSingle(pageid,"Property:Bigstock_id",null);
      if (idTriple!=null) 
        id=idTriple.getObject().toString();
      Triple fileTriple=query.selectSingle(pageid,"file",null);
      if (fileTriple==null)
        fileTriple=query.selectSingle(pageid,"Property:Bigstock_file",null);
      if (fileTriple!=null) 
        file=fileTriple.getObject().toString();
      init(query);
    } // constructor for Bigstock
    
    // >>>{user defined topic code}{Bigstock}{Bigstock}
    // <<<{user defined topic code}{Bigstock}{Bigstock}
  } // class Bigstock
  /**
   * Manager for Bigstock
   */
  public static class BigstockManager extends TopicBase {
 
    public String topicName="Bigstock";
    public transient List<Bigstock> mBigstocks=new ArrayList<Bigstock>();
    public transient Map<String,Bigstock> mBigstockMap=new LinkedHashMap<String,Bigstock>();

    /**
     * get my BigstockPhotos
     */
    public List<Bigstock> getBigstockPhotos() {
      List<Bigstock> result=this.mBigstocks;
      return result;
    }

    /**
     *  add a new Bigstock 
     */
    public Bigstock add(Bigstock pBigstock) {
      mBigstocks.add(pBigstock);
      mBigstockMap.put(pBigstock.getPageid(),pBigstock);
      return pBigstock;
    }

    /**
     *  add a new Bigstock from the given triple
     */
    public Bigstock add(TripleQuery query,Triple pBigstockTriple) {
      Bigstock lBigstock=new Bigstock(query,pBigstockTriple);
      add(lBigstock);
      return lBigstock;
    }

    // reinitialize my mBigstock map
    public void reinit() {
      mBigstockMap.clear();
      for (Bigstock lBigstock:mBigstocks) {
        mBigstockMap.put(lBigstock.getPageid(),lBigstock);
      }
    }

    // convert this manager to json format 
    public String toJson() { return JSON.toJSONString(this); }
    
    // get a new manager from the given json string
    public static BigstockManager fromJson(String json) {
      BigstockManager result=JSON.parseObject(json, BigstockManager.class);
      result.reinit();
      return result;
    }

    // default constructor for Bigstock Manager
    public BigstockManager() {}

    // add BigstockPhotos from the given query
    public void addBigstockPhotos(TripleQuery pBigstockQuery,TripleQuery query) {
      if (pBigstockQuery!=null) {
        for (Triple lBigstockTriple:pBigstockQuery.getTriples()) {
          add(query,lBigstockTriple);
        }
      }
    }

    // construct me from the given triple Query query
    public BigstockManager(TripleQuery query) {
      // first query the SiDIF bases triplestore
      TripleQuery lBigstockQuery=query.query(null,"isA","Bigstock");
      addBigstockPhotos(lBigstockQuery,query);
      // then the SMW triplestore
      lBigstockQuery=query.query(null,"Property:IsA","Bigstock");
      addBigstockPhotos(lBigstockQuery,query);
      init(query);
    } // constructor for Bigstock Manager
    
    // >>>{user defined topicmanager code}{Bigstock}{Bigstock}
    // <<<{user defined topicmanager code}{Bigstock}{Bigstock}
  } // class Bigstock Manager
 /**
  * Icon
  * An icon is a pictogram that is a symbol for some Topic
  */
  public static class Icon extends TopicBase {
  
    public String name;
    public String style;
    public String size;

    public String getName() { return name; }
    public void setName(String pName) { name=pName; }
    public String getStyle() { return style; }
    public void setStyle(String pStyle) { style=pStyle; }
    public String getSize() { return size; }
    public void setSize(String pSize) { size=pSize; }
    /**
     * convert this Icon to a JSON string
     */
    public String toJson() { return JSON.toJSONString(this); }

    /**
     * convert this Icon to a WikiSon string
     * @return the WikiSon representation of this Icon
     */
    public String toWikiSon() {
      String wikison= "{{Icon\n";
      wikison+=toWikiSon("name",name);
      wikison+=toWikiSon("style",style);
      wikison+=toWikiSon("size",size);
      wikison+="}}\n";
      return wikison;
    }

    /**
     * convert this Icon to a SiDIF string
     * @return the SiDIF representation of this Icon
     */
    public String toSiDIF() {
      String siDIF = String.format("%s isA Icon\n",this.pageid);
      siDIF+=propertySiDIF("name",name,"Text");
      siDIF+=propertySiDIF("style",style,"Text");
      siDIF+=propertySiDIF("size",size,"Number");
      return siDIF;
    }
 
    /**  
     * get the pageid for this topic
     */
    public String getPageid() { return pageid; };

    /**
     * default constructor for Icon
     */
    public Icon() {}

    /**
     * construct a Icon from the given Triple
     * @param query - the TripleQuery to get the triples from
     * @param pIconTriple - the triple to construct me from
     */
    public Icon(TripleQuery query,Triple pIconTriple) {
      this(query,pIconTriple.getSubject().toString());
    } // constructor

    /**
     * construct a Icon from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public Icon(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple nameTriple=query.selectSingle(pageid,"name",null);
      if (nameTriple==null)
        nameTriple=query.selectSingle(pageid,"Property:Icon_name",null);
      if (nameTriple!=null) 
        name=nameTriple.getObject().toString();
      Triple styleTriple=query.selectSingle(pageid,"style",null);
      if (styleTriple==null)
        styleTriple=query.selectSingle(pageid,"Property:Icon_style",null);
      if (styleTriple!=null) 
        style=styleTriple.getObject().toString();
      Triple sizeTriple=query.selectSingle(pageid,"size",null);
      if (sizeTriple==null)
        sizeTriple=query.selectSingle(pageid,"Property:Icon_size",null);
      if (sizeTriple!=null) 
        size=sizeTriple.getObject().toString();
      init(query);
    } // constructor for Icon
    
    // >>>{user defined topic code}{Icon}{Icon}
    // <<<{user defined topic code}{Icon}{Icon}
  } // class Icon
  /**
   * Manager for Icon
   */
  public static class IconManager extends TopicBase {
 
    public String topicName="Icon";
    public transient List<Icon> mIcons=new ArrayList<Icon>();
    public transient Map<String,Icon> mIconMap=new LinkedHashMap<String,Icon>();

    /**
     * get my Icons
     */
    public List<Icon> getIcons() {
      List<Icon> result=this.mIcons;
      return result;
    }

    /**
     *  add a new Icon 
     */
    public Icon add(Icon pIcon) {
      mIcons.add(pIcon);
      mIconMap.put(pIcon.getPageid(),pIcon);
      return pIcon;
    }

    /**
     *  add a new Icon from the given triple
     */
    public Icon add(TripleQuery query,Triple pIconTriple) {
      Icon lIcon=new Icon(query,pIconTriple);
      add(lIcon);
      return lIcon;
    }

    // reinitialize my mIcon map
    public void reinit() {
      mIconMap.clear();
      for (Icon lIcon:mIcons) {
        mIconMap.put(lIcon.getPageid(),lIcon);
      }
    }

    // convert this manager to json format 
    public String toJson() { return JSON.toJSONString(this); }
    
    // get a new manager from the given json string
    public static IconManager fromJson(String json) {
      IconManager result=JSON.parseObject(json, IconManager.class);
      result.reinit();
      return result;
    }

    // default constructor for Icon Manager
    public IconManager() {}

    // add Icons from the given query
    public void addIcons(TripleQuery pIconQuery,TripleQuery query) {
      if (pIconQuery!=null) {
        for (Triple lIconTriple:pIconQuery.getTriples()) {
          add(query,lIconTriple);
        }
      }
    }

    // construct me from the given triple Query query
    public IconManager(TripleQuery query) {
      // first query the SiDIF bases triplestore
      TripleQuery lIconQuery=query.query(null,"isA","Icon");
      addIcons(lIconQuery,query);
      // then the SMW triplestore
      lIconQuery=query.query(null,"Property:IsA","Icon");
      addIcons(lIconQuery,query);
      init(query);
    } // constructor for Icon Manager
    
    // >>>{user defined topicmanager code}{Icon}{Icon}
    // <<<{user defined topicmanager code}{Icon}{Icon}
  } // class Icon Manager
 /**
  * Image
  * I am an image
  */
  public static class Image extends TopicBase {
  
    public String name;
    public String title;
    public String topic;

    public String getName() { return name; }
    public void setName(String pName) { name=pName; }
    public String getTitle() { return title; }
    public void setTitle(String pTitle) { title=pTitle; }
    public String getTopic() { return topic; }
    public void setTopic(String pTopic) { topic=pTopic; }
    /**
     * convert this Image to a JSON string
     */
    public String toJson() { return JSON.toJSONString(this); }

    /**
     * convert this Image to a WikiSon string
     * @return the WikiSon representation of this Image
     */
    public String toWikiSon() {
      String wikison= "{{Image\n";
      wikison+=toWikiSon("name",name);
      wikison+=toWikiSon("title",title);
      wikison+=toWikiSon("topic",topic);
      wikison+="}}\n";
      return wikison;
    }

    /**
     * convert this Image to a SiDIF string
     * @return the SiDIF representation of this Image
     */
    public String toSiDIF() {
      String siDIF = String.format("%s isA Image\n",this.pageid);
      siDIF+=propertySiDIF("name",name,"Text");
      siDIF+=propertySiDIF("title",title,"Text");
      siDIF+=propertySiDIF("topic",topic,"Text");
      return siDIF;
    }
 
    /**  
     * get the pageid for this topic
     */
    public String getPageid() { return pageid; };

    /**
     * default constructor for Image
     */
    public Image() {}

    /**
     * construct a Image from the given Triple
     * @param query - the TripleQuery to get the triples from
     * @param pImageTriple - the triple to construct me from
     */
    public Image(TripleQuery query,Triple pImageTriple) {
      this(query,pImageTriple.getSubject().toString());
    } // constructor

    /**
     * construct a Image from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public Image(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple nameTriple=query.selectSingle(pageid,"name",null);
      if (nameTriple==null)
        nameTriple=query.selectSingle(pageid,"Property:Image_name",null);
      if (nameTriple!=null) 
        name=nameTriple.getObject().toString();
      Triple titleTriple=query.selectSingle(pageid,"title",null);
      if (titleTriple==null)
        titleTriple=query.selectSingle(pageid,"Property:Image_title",null);
      if (titleTriple!=null) 
        title=titleTriple.getObject().toString();
      Triple topicTriple=query.selectSingle(pageid,"topic",null);
      if (topicTriple==null)
        topicTriple=query.selectSingle(pageid,"Property:Image_topic",null);
      if (topicTriple!=null) 
        topic=topicTriple.getObject().toString();
      init(query);
    } // constructor for Image
    
    // >>>{user defined topic code}{Image}{Image}
    // <<<{user defined topic code}{Image}{Image}
  } // class Image
  /**
   * Manager for Image
   */
  public static class ImageManager extends TopicBase {
 
    public String topicName="Image";
    public transient List<Image> mImages=new ArrayList<Image>();
    public transient Map<String,Image> mImageMap=new LinkedHashMap<String,Image>();

    /**
     * get my Images
     */
    public List<Image> getImages() {
      List<Image> result=this.mImages;
      return result;
    }

    /**
     *  add a new Image 
     */
    public Image add(Image pImage) {
      mImages.add(pImage);
      mImageMap.put(pImage.getPageid(),pImage);
      return pImage;
    }

    /**
     *  add a new Image from the given triple
     */
    public Image add(TripleQuery query,Triple pImageTriple) {
      Image lImage=new Image(query,pImageTriple);
      add(lImage);
      return lImage;
    }

    // reinitialize my mImage map
    public void reinit() {
      mImageMap.clear();
      for (Image lImage:mImages) {
        mImageMap.put(lImage.getPageid(),lImage);
      }
    }

    // convert this manager to json format 
    public String toJson() { return JSON.toJSONString(this); }
    
    // get a new manager from the given json string
    public static ImageManager fromJson(String json) {
      ImageManager result=JSON.parseObject(json, ImageManager.class);
      result.reinit();
      return result;
    }

    // default constructor for Image Manager
    public ImageManager() {}

    // add Images from the given query
    public void addImages(TripleQuery pImageQuery,TripleQuery query) {
      if (pImageQuery!=null) {
        for (Triple lImageTriple:pImageQuery.getTriples()) {
          add(query,lImageTriple);
        }
      }
    }

    // construct me from the given triple Query query
    public ImageManager(TripleQuery query) {
      // first query the SiDIF bases triplestore
      TripleQuery lImageQuery=query.query(null,"isA","Image");
      addImages(lImageQuery,query);
      // then the SMW triplestore
      lImageQuery=query.query(null,"Property:IsA","Image");
      addImages(lImageQuery,query);
      init(query);
    } // constructor for Image Manager
    
    // >>>{user defined topicmanager code}{Image}{Image}
    // <<<{user defined topicmanager code}{Image}{Image}
  } // class Image Manager
 /**
  * PageOrder
  * A list of pages that have the order as per form editing
  */
  public static class PageOrder extends TopicBase {
  
    public String page;

    public String getPage() { return page; }
    public void setPage(String pPage) { page=pPage; }
    /**
     * convert this PageOrder to a JSON string
     */
    public String toJson() { return JSON.toJSONString(this); }

    /**
     * convert this PageOrder to a WikiSon string
     * @return the WikiSon representation of this PageOrder
     */
    public String toWikiSon() {
      String wikison= "{{PageOrder\n";
      wikison+=toWikiSon("page",page);
      wikison+="}}\n";
      return wikison;
    }

    /**
     * convert this PageOrder to a SiDIF string
     * @return the SiDIF representation of this PageOrder
     */
    public String toSiDIF() {
      String siDIF = String.format("%s isA PageOrder\n",this.pageid);
      siDIF+=propertySiDIF("page",page,"Page");
      return siDIF;
    }
 
    /**  
     * get the pageid for this topic
     */
    public String getPageid() { return pageid; };

    /**
     * default constructor for PageOrder
     */
    public PageOrder() {}

    /**
     * construct a PageOrder from the given Triple
     * @param query - the TripleQuery to get the triples from
     * @param pPageOrderTriple - the triple to construct me from
     */
    public PageOrder(TripleQuery query,Triple pPageOrderTriple) {
      this(query,pPageOrderTriple.getSubject().toString());
    } // constructor

    /**
     * construct a PageOrder from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public PageOrder(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple pageTriple=query.selectSingle(pageid,"page",null);
      if (pageTriple==null)
        pageTriple=query.selectSingle(pageid,"Property:PageOrder_page",null);
      if (pageTriple!=null) 
        page=pageTriple.getObject().toString();
      init(query);
    } // constructor for PageOrder
    
    // >>>{user defined topic code}{PageOrder}{PageOrder}
    // <<<{user defined topic code}{PageOrder}{PageOrder}
  } // class PageOrder
  /**
   * Manager for PageOrder
   */
  public static class PageOrderManager extends TopicBase {
 
    public String topicName="PageOrder";
    public transient List<PageOrder> mPageOrders=new ArrayList<PageOrder>();
    public transient Map<String,PageOrder> mPageOrderMap=new LinkedHashMap<String,PageOrder>();

    /**
     * get my PageOrders
     */
    public List<PageOrder> getPageOrders() {
      List<PageOrder> result=this.mPageOrders;
      return result;
    }

    /**
     *  add a new PageOrder 
     */
    public PageOrder add(PageOrder pPageOrder) {
      mPageOrders.add(pPageOrder);
      mPageOrderMap.put(pPageOrder.getPageid(),pPageOrder);
      return pPageOrder;
    }

    /**
     *  add a new PageOrder from the given triple
     */
    public PageOrder add(TripleQuery query,Triple pPageOrderTriple) {
      PageOrder lPageOrder=new PageOrder(query,pPageOrderTriple);
      add(lPageOrder);
      return lPageOrder;
    }

    // reinitialize my mPageOrder map
    public void reinit() {
      mPageOrderMap.clear();
      for (PageOrder lPageOrder:mPageOrders) {
        mPageOrderMap.put(lPageOrder.getPageid(),lPageOrder);
      }
    }

    // convert this manager to json format 
    public String toJson() { return JSON.toJSONString(this); }
    
    // get a new manager from the given json string
    public static PageOrderManager fromJson(String json) {
      PageOrderManager result=JSON.parseObject(json, PageOrderManager.class);
      result.reinit();
      return result;
    }

    // default constructor for PageOrder Manager
    public PageOrderManager() {}

    // add PageOrders from the given query
    public void addPageOrders(TripleQuery pPageOrderQuery,TripleQuery query) {
      if (pPageOrderQuery!=null) {
        for (Triple lPageOrderTriple:pPageOrderQuery.getTriples()) {
          add(query,lPageOrderTriple);
        }
      }
    }

    // construct me from the given triple Query query
    public PageOrderManager(TripleQuery query) {
      // first query the SiDIF bases triplestore
      TripleQuery lPageOrderQuery=query.query(null,"isA","PageOrder");
      addPageOrders(lPageOrderQuery,query);
      // then the SMW triplestore
      lPageOrderQuery=query.query(null,"Property:IsA","PageOrder");
      addPageOrders(lPageOrderQuery,query);
      init(query);
    } // constructor for PageOrder Manager
    
    // >>>{user defined topicmanager code}{PageOrder}{PageOrder}
    // <<<{user defined topicmanager code}{PageOrder}{PageOrder}
  } // class PageOrder Manager
 /**
  * PageSequence
  * A Sequence of pages that might belong to the same category and might have an icon
  */
  public static class PageSequence extends TopicBase {
  
    public String prev;
    public String next;
    public String categoryIcon;
    public String category;

    public String getPrev() { return prev; }
    public void setPrev(String pPrev) { prev=pPrev; }
    public String getNext() { return next; }
    public void setNext(String pNext) { next=pNext; }
    public String getCategoryIcon() { return categoryIcon; }
    public void setCategoryIcon(String pCategoryIcon) { categoryIcon=pCategoryIcon; }
    public String getCategory() { return category; }
    public void setCategory(String pCategory) { category=pCategory; }
    /**
     * convert this PageSequence to a JSON string
     */
    public String toJson() { return JSON.toJSONString(this); }

    /**
     * convert this PageSequence to a WikiSon string
     * @return the WikiSon representation of this PageSequence
     */
    public String toWikiSon() {
      String wikison= "{{PageSequence\n";
      wikison+=toWikiSon("prev",prev);
      wikison+=toWikiSon("next",next);
      wikison+=toWikiSon("categoryIcon",categoryIcon);
      wikison+=toWikiSon("category",category);
      wikison+="}}\n";
      return wikison;
    }

    /**
     * convert this PageSequence to a SiDIF string
     * @return the SiDIF representation of this PageSequence
     */
    public String toSiDIF() {
      String siDIF = String.format("%s isA PageSequence\n",this.pageid);
      siDIF+=propertySiDIF("prev",prev,"Page");
      siDIF+=propertySiDIF("next",next,"Page");
      siDIF+=propertySiDIF("categoryIcon",categoryIcon,"Text");
      siDIF+=propertySiDIF("category",category,"Page");
      return siDIF;
    }
 
    /**  
     * get the pageid for this topic
     */
    public String getPageid() { return pageid; };

    /**
     * default constructor for PageSequence
     */
    public PageSequence() {}

    /**
     * construct a PageSequence from the given Triple
     * @param query - the TripleQuery to get the triples from
     * @param pPageSequenceTriple - the triple to construct me from
     */
    public PageSequence(TripleQuery query,Triple pPageSequenceTriple) {
      this(query,pPageSequenceTriple.getSubject().toString());
    } // constructor

    /**
     * construct a PageSequence from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public PageSequence(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple prevTriple=query.selectSingle(pageid,"prev",null);
      if (prevTriple==null)
        prevTriple=query.selectSingle(pageid,"Property:PageSequence_prev",null);
      if (prevTriple!=null) 
        prev=prevTriple.getObject().toString();
      Triple nextTriple=query.selectSingle(pageid,"next",null);
      if (nextTriple==null)
        nextTriple=query.selectSingle(pageid,"Property:PageSequence_next",null);
      if (nextTriple!=null) 
        next=nextTriple.getObject().toString();
      Triple categoryIconTriple=query.selectSingle(pageid,"categoryIcon",null);
      if (categoryIconTriple==null)
        categoryIconTriple=query.selectSingle(pageid,"Property:PageSequence_categoryIcon",null);
      if (categoryIconTriple!=null) 
        categoryIcon=categoryIconTriple.getObject().toString();
      Triple categoryTriple=query.selectSingle(pageid,"category",null);
      if (categoryTriple==null)
        categoryTriple=query.selectSingle(pageid,"Property:PageSequence_category",null);
      if (categoryTriple!=null) 
        category=categoryTriple.getObject().toString();
      init(query);
    } // constructor for PageSequence
    
    // >>>{user defined topic code}{PageSequence}{PageSequence}
    // <<<{user defined topic code}{PageSequence}{PageSequence}
  } // class PageSequence
  /**
   * Manager for PageSequence
   */
  public static class PageSequenceManager extends TopicBase {
 
    public String topicName="PageSequence";
    public transient List<PageSequence> mPageSequences=new ArrayList<PageSequence>();
    public transient Map<String,PageSequence> mPageSequenceMap=new LinkedHashMap<String,PageSequence>();

    /**
     * get my PageSequences
     */
    public List<PageSequence> getPageSequences() {
      List<PageSequence> result=this.mPageSequences;
      return result;
    }

    /**
     *  add a new PageSequence 
     */
    public PageSequence add(PageSequence pPageSequence) {
      mPageSequences.add(pPageSequence);
      mPageSequenceMap.put(pPageSequence.getPageid(),pPageSequence);
      return pPageSequence;
    }

    /**
     *  add a new PageSequence from the given triple
     */
    public PageSequence add(TripleQuery query,Triple pPageSequenceTriple) {
      PageSequence lPageSequence=new PageSequence(query,pPageSequenceTriple);
      add(lPageSequence);
      return lPageSequence;
    }

    // reinitialize my mPageSequence map
    public void reinit() {
      mPageSequenceMap.clear();
      for (PageSequence lPageSequence:mPageSequences) {
        mPageSequenceMap.put(lPageSequence.getPageid(),lPageSequence);
      }
    }

    // convert this manager to json format 
    public String toJson() { return JSON.toJSONString(this); }
    
    // get a new manager from the given json string
    public static PageSequenceManager fromJson(String json) {
      PageSequenceManager result=JSON.parseObject(json, PageSequenceManager.class);
      result.reinit();
      return result;
    }

    // default constructor for PageSequence Manager
    public PageSequenceManager() {}

    // add PageSequences from the given query
    public void addPageSequences(TripleQuery pPageSequenceQuery,TripleQuery query) {
      if (pPageSequenceQuery!=null) {
        for (Triple lPageSequenceTriple:pPageSequenceQuery.getTriples()) {
          add(query,lPageSequenceTriple);
        }
      }
    }

    // construct me from the given triple Query query
    public PageSequenceManager(TripleQuery query) {
      // first query the SiDIF bases triplestore
      TripleQuery lPageSequenceQuery=query.query(null,"isA","PageSequence");
      addPageSequences(lPageSequenceQuery,query);
      // then the SMW triplestore
      lPageSequenceQuery=query.query(null,"Property:IsA","PageSequence");
      addPageSequences(lPageSequenceQuery,query);
      init(query);
    } // constructor for PageSequence Manager
    
    // >>>{user defined topicmanager code}{PageSequence}{PageSequence}
    // <<<{user defined topicmanager code}{PageSequence}{PageSequence}
  } // class PageSequence Manager
 /**
  * Slide
  * I am a presentation slide
  */
  public static class Slide extends TopicBase {
  
    public String title;
    public String pageno;
    public String based on;
    public String pages;
    public String prev;
    public String next;
    public String leftContent;
    public String rightContent;
    public String text;
    public String notes;
    public String print;
    public String template;
    public String state;
    public String comment;
    public String presentation;

    public String getTitle() { return title; }
    public void setTitle(String pTitle) { title=pTitle; }
    public String getPageno() { return pageno; }
    public void setPageno(String pPageno) { pageno=pPageno; }
    public String getBased on() { return based on; }
    public void setBased on(String pBased on) { based on=pBased on; }
    public String getPages() { return pages; }
    public void setPages(String pPages) { pages=pPages; }
    public String getPrev() { return prev; }
    public void setPrev(String pPrev) { prev=pPrev; }
    public String getNext() { return next; }
    public void setNext(String pNext) { next=pNext; }
    public String getLeftContent() { return leftContent; }
    public void setLeftContent(String pLeftContent) { leftContent=pLeftContent; }
    public String getRightContent() { return rightContent; }
    public void setRightContent(String pRightContent) { rightContent=pRightContent; }
    public String getText() { return text; }
    public void setText(String pText) { text=pText; }
    public String getNotes() { return notes; }
    public void setNotes(String pNotes) { notes=pNotes; }
    public String getPrint() { return print; }
    public void setPrint(String pPrint) { print=pPrint; }
    public String getTemplate() { return template; }
    public void setTemplate(String pTemplate) { template=pTemplate; }
    public String getState() { return state; }
    public void setState(String pState) { state=pState; }
    public String getComment() { return comment; }
    public void setComment(String pComment) { comment=pComment; }
    public String getPresentation() { return presentation; }
    public void setPresentation(String pPresentation) { presentation=pPresentation; }
    /**
     * convert this Slide to a JSON string
     */
    public String toJson() { return JSON.toJSONString(this); }

    /**
     * convert this Slide to a WikiSon string
     * @return the WikiSon representation of this Slide
     */
    public String toWikiSon() {
      String wikison= "{{Slide\n";
      wikison+=toWikiSon("title",title);
      wikison+=toWikiSon("pageno",pageno);
      wikison+=toWikiSon("based on",based on);
      wikison+=toWikiSon("pages",pages);
      wikison+=toWikiSon("prev",prev);
      wikison+=toWikiSon("next",next);
      wikison+=toWikiSon("leftContent",leftContent);
      wikison+=toWikiSon("rightContent",rightContent);
      wikison+=toWikiSon("text",text);
      wikison+=toWikiSon("notes",notes);
      wikison+=toWikiSon("print",print);
      wikison+=toWikiSon("template",template);
      wikison+=toWikiSon("state",state);
      wikison+=toWikiSon("comment",comment);
      wikison+=toWikiSon("presentation",presentation);
      wikison+="}}\n";
      return wikison;
    }

    /**
     * convert this Slide to a SiDIF string
     * @return the SiDIF representation of this Slide
     */
    public String toSiDIF() {
      String siDIF = String.format("%s isA Slide\n",this.pageid);
      siDIF+=propertySiDIF("title",title,"Text");
      siDIF+=propertySiDIF("pageno",pageno,"Text");
      siDIF+=propertySiDIF("based on",based on,"Page");
      siDIF+=propertySiDIF("pages",pages,"Text");
      siDIF+=propertySiDIF("prev",prev,"Page");
      siDIF+=propertySiDIF("next",next,"Page");
      siDIF+=propertySiDIF("leftContent",leftContent,"Text");
      siDIF+=propertySiDIF("rightContent",rightContent,"Text");
      siDIF+=propertySiDIF("text",text,"Text");
      siDIF+=propertySiDIF("notes",notes,"Text");
      siDIF+=propertySiDIF("print",print,"Text");
      siDIF+=propertySiDIF("template",template,"Text");
      siDIF+=propertySiDIF("state",state,"Text");
      siDIF+=propertySiDIF("comment",comment,"Text");
      siDIF+=propertySiDIF("presentation",presentation,"Page");
      return siDIF;
    }
 
    /**  
     * get the pageid for this topic
     */
    public String getPageid() { return pageid; };

    /**
     * default constructor for Slide
     */
    public Slide() {}

    /**
     * construct a Slide from the given Triple
     * @param query - the TripleQuery to get the triples from
     * @param pSlideTriple - the triple to construct me from
     */
    public Slide(TripleQuery query,Triple pSlideTriple) {
      this(query,pSlideTriple.getSubject().toString());
    } // constructor

    /**
     * construct a Slide from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public Slide(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple titleTriple=query.selectSingle(pageid,"title",null);
      if (titleTriple==null)
        titleTriple=query.selectSingle(pageid,"Property:Slide_title",null);
      if (titleTriple!=null) 
        title=titleTriple.getObject().toString();
      Triple pagenoTriple=query.selectSingle(pageid,"pageno",null);
      if (pagenoTriple==null)
        pagenoTriple=query.selectSingle(pageid,"Property:Slide_pageno",null);
      if (pagenoTriple!=null) 
        pageno=pagenoTriple.getObject().toString();
      Triple based onTriple=query.selectSingle(pageid,"based on",null);
      if (based onTriple==null)
        based onTriple=query.selectSingle(pageid,"Property:Slide_based on",null);
      if (based onTriple!=null) 
        based on=based onTriple.getObject().toString();
      Triple pagesTriple=query.selectSingle(pageid,"pages",null);
      if (pagesTriple==null)
        pagesTriple=query.selectSingle(pageid,"Property:Slide_pages",null);
      if (pagesTriple!=null) 
        pages=pagesTriple.getObject().toString();
      Triple prevTriple=query.selectSingle(pageid,"prev",null);
      if (prevTriple==null)
        prevTriple=query.selectSingle(pageid,"Property:Slide_prev",null);
      if (prevTriple!=null) 
        prev=prevTriple.getObject().toString();
      Triple nextTriple=query.selectSingle(pageid,"next",null);
      if (nextTriple==null)
        nextTriple=query.selectSingle(pageid,"Property:Slide_next",null);
      if (nextTriple!=null) 
        next=nextTriple.getObject().toString();
      Triple leftContentTriple=query.selectSingle(pageid,"leftContent",null);
      if (leftContentTriple==null)
        leftContentTriple=query.selectSingle(pageid,"Property:Slide_leftContent",null);
      if (leftContentTriple!=null) 
        leftContent=leftContentTriple.getObject().toString();
      Triple rightContentTriple=query.selectSingle(pageid,"rightContent",null);
      if (rightContentTriple==null)
        rightContentTriple=query.selectSingle(pageid,"Property:Slide_rightContent",null);
      if (rightContentTriple!=null) 
        rightContent=rightContentTriple.getObject().toString();
      Triple textTriple=query.selectSingle(pageid,"text",null);
      if (textTriple==null)
        textTriple=query.selectSingle(pageid,"Property:Slide_text",null);
      if (textTriple!=null) 
        text=textTriple.getObject().toString();
      Triple notesTriple=query.selectSingle(pageid,"notes",null);
      if (notesTriple==null)
        notesTriple=query.selectSingle(pageid,"Property:Slide_notes",null);
      if (notesTriple!=null) 
        notes=notesTriple.getObject().toString();
      Triple printTriple=query.selectSingle(pageid,"print",null);
      if (printTriple==null)
        printTriple=query.selectSingle(pageid,"Property:Slide_print",null);
      if (printTriple!=null) 
        print=printTriple.getObject().toString();
      Triple templateTriple=query.selectSingle(pageid,"template",null);
      if (templateTriple==null)
        templateTriple=query.selectSingle(pageid,"Property:Slide_template",null);
      if (templateTriple!=null) 
        template=templateTriple.getObject().toString();
      Triple stateTriple=query.selectSingle(pageid,"state",null);
      if (stateTriple==null)
        stateTriple=query.selectSingle(pageid,"Property:Slide_state",null);
      if (stateTriple!=null) 
        state=stateTriple.getObject().toString();
      Triple commentTriple=query.selectSingle(pageid,"comment",null);
      if (commentTriple==null)
        commentTriple=query.selectSingle(pageid,"Property:Slide_comment",null);
      if (commentTriple!=null) 
        comment=commentTriple.getObject().toString();
      Triple presentationTriple=query.selectSingle(pageid,"presentation",null);
      if (presentationTriple==null)
        presentationTriple=query.selectSingle(pageid,"Property:Slide_presentation",null);
      if (presentationTriple!=null) 
        presentation=presentationTriple.getObject().toString();
      init(query);
    } // constructor for Slide
    
    // >>>{user defined topic code}{Slide}{Slide}
    // <<<{user defined topic code}{Slide}{Slide}
  } // class Slide
  /**
   * Manager for Slide
   */
  public static class SlideManager extends TopicBase {
 
    public String topicName="Slide";
    public transient List<Slide> mSlides=new ArrayList<Slide>();
    public transient Map<String,Slide> mSlideMap=new LinkedHashMap<String,Slide>();

    /**
     * get my Slides
     */
    public List<Slide> getSlides() {
      List<Slide> result=this.mSlides;
      return result;
    }

    /**
     *  add a new Slide 
     */
    public Slide add(Slide pSlide) {
      mSlides.add(pSlide);
      mSlideMap.put(pSlide.getPageid(),pSlide);
      return pSlide;
    }

    /**
     *  add a new Slide from the given triple
     */
    public Slide add(TripleQuery query,Triple pSlideTriple) {
      Slide lSlide=new Slide(query,pSlideTriple);
      add(lSlide);
      return lSlide;
    }

    // reinitialize my mSlide map
    public void reinit() {
      mSlideMap.clear();
      for (Slide lSlide:mSlides) {
        mSlideMap.put(lSlide.getPageid(),lSlide);
      }
    }

    // convert this manager to json format 
    public String toJson() { return JSON.toJSONString(this); }
    
    // get a new manager from the given json string
    public static SlideManager fromJson(String json) {
      SlideManager result=JSON.parseObject(json, SlideManager.class);
      result.reinit();
      return result;
    }

    // default constructor for Slide Manager
    public SlideManager() {}

    // add Slides from the given query
    public void addSlides(TripleQuery pSlideQuery,TripleQuery query) {
      if (pSlideQuery!=null) {
        for (Triple lSlideTriple:pSlideQuery.getTriples()) {
          add(query,lSlideTriple);
        }
      }
    }

    // construct me from the given triple Query query
    public SlideManager(TripleQuery query) {
      // first query the SiDIF bases triplestore
      TripleQuery lSlideQuery=query.query(null,"isA","Slide");
      addSlides(lSlideQuery,query);
      // then the SMW triplestore
      lSlideQuery=query.query(null,"Property:IsA","Slide");
      addSlides(lSlideQuery,query);
      init(query);
    } // constructor for Slide Manager
    
    // >>>{user defined topicmanager code}{Slide}{Slide}
    // <<<{user defined topicmanager code}{Slide}{Slide}
  } // class Slide Manager

}
Showing below 0 pages.

Retrieved from "https://wiki.bitplan.com/index.php?title=Concept:Bigstock/Java&oldid=9914#smw-result"