Bogenturnier/Java


Wolfgang Fahl

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
 /**
  * Bogensportverein
  * Ein Verein für Bogensport
  */
  public static class Bogensportverein extends TopicBase {
  
    public String name;
    public String lat;
    public String url;
    public String lon;

    public String getName() { return name; }
    public void setName(String pName) { name=pName; }
    public String getLat() { return lat; }
    public void setLat(String pLat) { lat=pLat; }
    public String getUrl() { return url; }
    public void setUrl(String pUrl) { url=pUrl; }
    public String getLon() { return lon; }
    public void setLon(String pLon) { lon=pLon; }
    /**
     * convert this Bogensportverein to a JSON string
     */
    public String toJson() { return JSON.toJSONString(this); }

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

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

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

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

    /**
     * construct a Bogensportverein from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public Bogensportverein(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple nameTriple=query.selectSingle(pageid,"name",null);
      if (nameTriple==null)
        nameTriple=query.selectSingle(pageid,"Property:Bogensportverein_name",null);
      if (nameTriple!=null) 
        name=nameTriple.getObject().toString();
      Triple latTriple=query.selectSingle(pageid,"lat",null);
      if (latTriple==null)
        latTriple=query.selectSingle(pageid,"Property:Bogensportverein_lat",null);
      if (latTriple!=null) 
        lat=latTriple.getObject().toString();
      Triple urlTriple=query.selectSingle(pageid,"url",null);
      if (urlTriple==null)
        urlTriple=query.selectSingle(pageid,"Property:Bogensportverein_url",null);
      if (urlTriple!=null) 
        url=urlTriple.getObject().toString();
      Triple lonTriple=query.selectSingle(pageid,"lon",null);
      if (lonTriple==null)
        lonTriple=query.selectSingle(pageid,"Property:Bogensportverein_lon",null);
      if (lonTriple!=null) 
        lon=lonTriple.getObject().toString();
      init(query);
    } // constructor for Bogensportverein
    
    // >>>{user defined topic code}{Bogensportverein}{Bogensportverein}
    // <<<{user defined topic code}{Bogensportverein}{Bogensportverein}
  } // class Bogensportverein
  /**
   * Manager for Bogensportverein
   */
  public static class BogensportvereinManager extends TopicBase {
 
    public String topicName="Bogensportverein";
    public transient List<Bogensportverein> mBogensportvereins=new ArrayList<Bogensportverein>();
    public transient Map<String,Bogensportverein> mBogensportvereinMap=new LinkedHashMap<String,Bogensportverein>();

    /**
     * get my Bogensportvereine
     */
    public List<Bogensportverein> getBogensportvereine() {
      List<Bogensportverein> result=this.mBogensportvereins;
      return result;
    }

    /**
     *  add a new Bogensportverein 
     */
    public Bogensportverein add(Bogensportverein pBogensportverein) {
      mBogensportvereins.add(pBogensportverein);
      mBogensportvereinMap.put(pBogensportverein.getPageid(),pBogensportverein);
      return pBogensportverein;
    }

    /**
     *  add a new Bogensportverein from the given triple
     */
    public Bogensportverein add(TripleQuery query,Triple pBogensportvereinTriple) {
      Bogensportverein lBogensportverein=new Bogensportverein(query,pBogensportvereinTriple);
      add(lBogensportverein);
      return lBogensportverein;
    }

    // reinitialize my mBogensportverein map
    public void reinit() {
      mBogensportvereinMap.clear();
      for (Bogensportverein lBogensportverein:mBogensportvereins) {
        mBogensportvereinMap.put(lBogensportverein.getPageid(),lBogensportverein);
      }
    }

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

    // default constructor for Bogensportverein Manager
    public BogensportvereinManager() {}

    // add Bogensportvereine from the given query
    public void addBogensportvereine(TripleQuery pBogensportvereinQuery,TripleQuery query) {
      if (pBogensportvereinQuery!=null) {
        for (Triple lBogensportvereinTriple:pBogensportvereinQuery.getTriples()) {
          add(query,lBogensportvereinTriple);
        }
      }
    }

    // construct me from the given triple Query query
    public BogensportvereinManager(TripleQuery query) {
      // first query the SiDIF bases triplestore
      TripleQuery lBogensportvereinQuery=query.query(null,"isA","Bogensportverein");
      addBogensportvereine(lBogensportvereinQuery,query);
      // then the SMW triplestore
      lBogensportvereinQuery=query.query(null,"Property:IsA","Bogensportverein");
      addBogensportvereine(lBogensportvereinQuery,query);
      init(query);
    } // constructor for Bogensportverein Manager
    
    // >>>{user defined topicmanager code}{Bogensportverein}{Bogensportverein}
    // <<<{user defined topicmanager code}{Bogensportverein}{Bogensportverein}
  } // class Bogensportverein Manager
 /**
  * Bogenturnier
  * Ein Bogensport Turnier
  */
  public static class Bogenturnier extends TopicBase {
  
    public String name;
    public String date;
    public String url;
    public String veranstalter;

    public String getName() { return name; }
    public void setName(String pName) { name=pName; }
    public String getDate() { return date; }
    public void setDate(String pDate) { date=pDate; }
    public String getUrl() { return url; }
    public void setUrl(String pUrl) { url=pUrl; }
    public String getVeranstalter() { return veranstalter; }
    public void setVeranstalter(String pVeranstalter) { veranstalter=pVeranstalter; }
    /**
     * convert this Bogenturnier to a JSON string
     */
    public String toJson() { return JSON.toJSONString(this); }

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

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

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

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

    /**
     * construct a Bogenturnier from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public Bogenturnier(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple nameTriple=query.selectSingle(pageid,"name",null);
      if (nameTriple==null)
        nameTriple=query.selectSingle(pageid,"Property:Bogenturnier_name",null);
      if (nameTriple!=null) 
        name=nameTriple.getObject().toString();
      Triple dateTriple=query.selectSingle(pageid,"date",null);
      if (dateTriple==null)
        dateTriple=query.selectSingle(pageid,"Property:Bogenturnier_date",null);
      if (dateTriple!=null) 
        date=dateTriple.getObject().toString();
      Triple urlTriple=query.selectSingle(pageid,"url",null);
      if (urlTriple==null)
        urlTriple=query.selectSingle(pageid,"Property:Bogenturnier_url",null);
      if (urlTriple!=null) 
        url=urlTriple.getObject().toString();
      Triple veranstalterTriple=query.selectSingle(pageid,"veranstalter",null);
      if (veranstalterTriple==null)
        veranstalterTriple=query.selectSingle(pageid,"Property:Bogenturnier_veranstalter",null);
      if (veranstalterTriple!=null) 
        veranstalter=veranstalterTriple.getObject().toString();
      init(query);
    } // constructor for Bogenturnier
    
    // >>>{user defined topic code}{Bogenturnier}{Bogenturnier}
    // <<<{user defined topic code}{Bogenturnier}{Bogenturnier}
  } // class Bogenturnier
  /**
   * Manager for Bogenturnier
   */
  public static class BogenturnierManager extends TopicBase {
 
    public String topicName="Bogenturnier";
    public transient List<Bogenturnier> mBogenturniers=new ArrayList<Bogenturnier>();
    public transient Map<String,Bogenturnier> mBogenturnierMap=new LinkedHashMap<String,Bogenturnier>();

    /**
     * get my Bogenturnier
     */
    public List<Bogenturnier> getBogenturnier() {
      List<Bogenturnier> result=this.mBogenturniers;
      return result;
    }

    /**
     *  add a new Bogenturnier 
     */
    public Bogenturnier add(Bogenturnier pBogenturnier) {
      mBogenturniers.add(pBogenturnier);
      mBogenturnierMap.put(pBogenturnier.getPageid(),pBogenturnier);
      return pBogenturnier;
    }

    /**
     *  add a new Bogenturnier from the given triple
     */
    public Bogenturnier add(TripleQuery query,Triple pBogenturnierTriple) {
      Bogenturnier lBogenturnier=new Bogenturnier(query,pBogenturnierTriple);
      add(lBogenturnier);
      return lBogenturnier;
    }

    // reinitialize my mBogenturnier map
    public void reinit() {
      mBogenturnierMap.clear();
      for (Bogenturnier lBogenturnier:mBogenturniers) {
        mBogenturnierMap.put(lBogenturnier.getPageid(),lBogenturnier);
      }
    }

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

    // default constructor for Bogenturnier Manager
    public BogenturnierManager() {}

    // add Bogenturnier from the given query
    public void addBogenturnier(TripleQuery pBogenturnierQuery,TripleQuery query) {
      if (pBogenturnierQuery!=null) {
        for (Triple lBogenturnierTriple:pBogenturnierQuery.getTriples()) {
          add(query,lBogenturnierTriple);
        }
      }
    }

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

}
Showing below 0 pages.

java code[edit]

@// 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
 /**
  * Bogensportverein
  * Ein Verein für Bogensport
  */
  public static class Bogensportverein extends TopicBase {
  
    public String name;
    public String lat;
    public String url;
    public String lon;

    public String getName() { return name; }
    public void setName(String pName) { name=pName; }
    public String getLat() { return lat; }
    public void setLat(String pLat) { lat=pLat; }
    public String getUrl() { return url; }
    public void setUrl(String pUrl) { url=pUrl; }
    public String getLon() { return lon; }
    public void setLon(String pLon) { lon=pLon; }
    /**
     * convert this Bogensportverein to a JSON string
     */
    public String toJson() { return JSON.toJSONString(this); }

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

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

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

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

    /**
     * construct a Bogensportverein from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public Bogensportverein(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple nameTriple=query.selectSingle(pageid,"name",null);
      if (nameTriple==null)
        nameTriple=query.selectSingle(pageid,"Property:Bogensportverein_name",null);
      if (nameTriple!=null) 
        name=nameTriple.getObject().toString();
      Triple latTriple=query.selectSingle(pageid,"lat",null);
      if (latTriple==null)
        latTriple=query.selectSingle(pageid,"Property:Bogensportverein_lat",null);
      if (latTriple!=null) 
        lat=latTriple.getObject().toString();
      Triple urlTriple=query.selectSingle(pageid,"url",null);
      if (urlTriple==null)
        urlTriple=query.selectSingle(pageid,"Property:Bogensportverein_url",null);
      if (urlTriple!=null) 
        url=urlTriple.getObject().toString();
      Triple lonTriple=query.selectSingle(pageid,"lon",null);
      if (lonTriple==null)
        lonTriple=query.selectSingle(pageid,"Property:Bogensportverein_lon",null);
      if (lonTriple!=null) 
        lon=lonTriple.getObject().toString();
      init(query);
    } // constructor for Bogensportverein
    
    // >>>{user defined topic code}{Bogensportverein}{Bogensportverein}
    // <<<{user defined topic code}{Bogensportverein}{Bogensportverein}
  } // class Bogensportverein
  /**
   * Manager for Bogensportverein
   */
  public static class BogensportvereinManager extends TopicBase {
 
    public String topicName="Bogensportverein";
    public transient List<Bogensportverein> mBogensportvereins=new ArrayList<Bogensportverein>();
    public transient Map<String,Bogensportverein> mBogensportvereinMap=new LinkedHashMap<String,Bogensportverein>();

    /**
     * get my Bogensportvereine
     */
    public List<Bogensportverein> getBogensportvereine() {
      List<Bogensportverein> result=this.mBogensportvereins;
      return result;
    }

    /**
     *  add a new Bogensportverein 
     */
    public Bogensportverein add(Bogensportverein pBogensportverein) {
      mBogensportvereins.add(pBogensportverein);
      mBogensportvereinMap.put(pBogensportverein.getPageid(),pBogensportverein);
      return pBogensportverein;
    }

    /**
     *  add a new Bogensportverein from the given triple
     */
    public Bogensportverein add(TripleQuery query,Triple pBogensportvereinTriple) {
      Bogensportverein lBogensportverein=new Bogensportverein(query,pBogensportvereinTriple);
      add(lBogensportverein);
      return lBogensportverein;
    }

    // reinitialize my mBogensportverein map
    public void reinit() {
      mBogensportvereinMap.clear();
      for (Bogensportverein lBogensportverein:mBogensportvereins) {
        mBogensportvereinMap.put(lBogensportverein.getPageid(),lBogensportverein);
      }
    }

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

    // default constructor for Bogensportverein Manager
    public BogensportvereinManager() {}

    // add Bogensportvereine from the given query
    public void addBogensportvereine(TripleQuery pBogensportvereinQuery,TripleQuery query) {
      if (pBogensportvereinQuery!=null) {
        for (Triple lBogensportvereinTriple:pBogensportvereinQuery.getTriples()) {
          add(query,lBogensportvereinTriple);
        }
      }
    }

    // construct me from the given triple Query query
    public BogensportvereinManager(TripleQuery query) {
      // first query the SiDIF bases triplestore
      TripleQuery lBogensportvereinQuery=query.query(null,"isA","Bogensportverein");
      addBogensportvereine(lBogensportvereinQuery,query);
      // then the SMW triplestore
      lBogensportvereinQuery=query.query(null,"Property:IsA","Bogensportverein");
      addBogensportvereine(lBogensportvereinQuery,query);
      init(query);
    } // constructor for Bogensportverein Manager
    
    // >>>{user defined topicmanager code}{Bogensportverein}{Bogensportverein}
    // <<<{user defined topicmanager code}{Bogensportverein}{Bogensportverein}
  } // class Bogensportverein Manager
 /**
  * Bogenturnier
  * Ein Bogensport Turnier
  */
  public static class Bogenturnier extends TopicBase {
  
    public String name;
    public String date;
    public String url;
    public String veranstalter;

    public String getName() { return name; }
    public void setName(String pName) { name=pName; }
    public String getDate() { return date; }
    public void setDate(String pDate) { date=pDate; }
    public String getUrl() { return url; }
    public void setUrl(String pUrl) { url=pUrl; }
    public String getVeranstalter() { return veranstalter; }
    public void setVeranstalter(String pVeranstalter) { veranstalter=pVeranstalter; }
    /**
     * convert this Bogenturnier to a JSON string
     */
    public String toJson() { return JSON.toJSONString(this); }

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

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

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

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

    /**
     * construct a Bogenturnier from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public Bogenturnier(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple nameTriple=query.selectSingle(pageid,"name",null);
      if (nameTriple==null)
        nameTriple=query.selectSingle(pageid,"Property:Bogenturnier_name",null);
      if (nameTriple!=null) 
        name=nameTriple.getObject().toString();
      Triple dateTriple=query.selectSingle(pageid,"date",null);
      if (dateTriple==null)
        dateTriple=query.selectSingle(pageid,"Property:Bogenturnier_date",null);
      if (dateTriple!=null) 
        date=dateTriple.getObject().toString();
      Triple urlTriple=query.selectSingle(pageid,"url",null);
      if (urlTriple==null)
        urlTriple=query.selectSingle(pageid,"Property:Bogenturnier_url",null);
      if (urlTriple!=null) 
        url=urlTriple.getObject().toString();
      Triple veranstalterTriple=query.selectSingle(pageid,"veranstalter",null);
      if (veranstalterTriple==null)
        veranstalterTriple=query.selectSingle(pageid,"Property:Bogenturnier_veranstalter",null);
      if (veranstalterTriple!=null) 
        veranstalter=veranstalterTriple.getObject().toString();
      init(query);
    } // constructor for Bogenturnier
    
    // >>>{user defined topic code}{Bogenturnier}{Bogenturnier}
    // <<<{user defined topic code}{Bogenturnier}{Bogenturnier}
  } // class Bogenturnier
  /**
   * Manager for Bogenturnier
   */
  public static class BogenturnierManager extends TopicBase {
 
    public String topicName="Bogenturnier";
    public transient List<Bogenturnier> mBogenturniers=new ArrayList<Bogenturnier>();
    public transient Map<String,Bogenturnier> mBogenturnierMap=new LinkedHashMap<String,Bogenturnier>();

    /**
     * get my Bogenturnier
     */
    public List<Bogenturnier> getBogenturnier() {
      List<Bogenturnier> result=this.mBogenturniers;
      return result;
    }

    /**
     *  add a new Bogenturnier 
     */
    public Bogenturnier add(Bogenturnier pBogenturnier) {
      mBogenturniers.add(pBogenturnier);
      mBogenturnierMap.put(pBogenturnier.getPageid(),pBogenturnier);
      return pBogenturnier;
    }

    /**
     *  add a new Bogenturnier from the given triple
     */
    public Bogenturnier add(TripleQuery query,Triple pBogenturnierTriple) {
      Bogenturnier lBogenturnier=new Bogenturnier(query,pBogenturnierTriple);
      add(lBogenturnier);
      return lBogenturnier;
    }

    // reinitialize my mBogenturnier map
    public void reinit() {
      mBogenturnierMap.clear();
      for (Bogenturnier lBogenturnier:mBogenturniers) {
        mBogenturnierMap.put(lBogenturnier.getPageid(),lBogenturnier);
      }
    }

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

    // default constructor for Bogenturnier Manager
    public BogenturnierManager() {}

    // add Bogenturnier from the given query
    public void addBogenturnier(TripleQuery pBogenturnierQuery,TripleQuery query) {
      if (pBogenturnierQuery!=null) {
        for (Triple lBogenturnierTriple:pBogenturnierQuery.getTriples()) {
          add(query,lBogenturnierTriple);
        }
      }
    }

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

}
🖨 🚪