Concept:Tour/Java

From BITPlan E-Bike Wiki
Revision as of 20:09, 28 June 2018 by Wf (talk | contribs) (created by WikiTask 2018-06-28T18:09:31Z)
(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
 /**
  * Tour
  * A tour is point of a trip
  */
  public static class Tour extends TopicBase {
  
    public String date;
    public String target;
    public String weather;
    public String location;
    public String coordinates;
    public String trip;
    public String track;
    public String stay;
    public String shop;
    public String distance;
    public String comment;

    public String getDate() { return date; }
    public void setDate(String pDate) { date=pDate; }
    public String getTarget() { return target; }
    public void setTarget(String pTarget) { target=pTarget; }
    public String getWeather() { return weather; }
    public void setWeather(String pWeather) { weather=pWeather; }
    public String getLocation() { return location; }
    public void setLocation(String pLocation) { location=pLocation; }
    public String getCoordinates() { return coordinates; }
    public void setCoordinates(String pCoordinates) { coordinates=pCoordinates; }
    public String getTrip() { return trip; }
    public void setTrip(String pTrip) { trip=pTrip; }
    public String getTrack() { return track; }
    public void setTrack(String pTrack) { track=pTrack; }
    public String getStay() { return stay; }
    public void setStay(String pStay) { stay=pStay; }
    public String getShop() { return shop; }
    public void setShop(String pShop) { shop=pShop; }
    public String getDistance() { return distance; }
    public void setDistance(String pDistance) { distance=pDistance; }
    public String getComment() { return comment; }
    public void setComment(String pComment) { comment=pComment; }
    /**
     * convert this Tour to a JSON string
     */
    public String toJson() { return JSON.toJSONString(this); }

    /**
     * convert this Tour to a WikiSon string
     * @return the WikiSon representation of this Tour
     */
    public String toWikiSon() {
      String wikison= "{{Tour\n";
      wikison+=toWikiSon("date",date);
      wikison+=toWikiSon("target",target);
      wikison+=toWikiSon("weather",weather);
      wikison+=toWikiSon("location",location);
      wikison+=toWikiSon("coordinates",coordinates);
      wikison+=toWikiSon("trip",trip);
      wikison+=toWikiSon("track",track);
      wikison+=toWikiSon("stay",stay);
      wikison+=toWikiSon("shop",shop);
      wikison+=toWikiSon("distance",distance);
      wikison+=toWikiSon("comment",comment);
      wikison+="}}\n";
      return wikison;
    }

    /**
     * convert this Tour to a SiDIF string
     * @return the SiDIF representation of this Tour
     */
    public String toSiDIF() {
      String siDIF = String.format("%s isA Tour\n",this.pageid);
      siDIF+=propertySiDIF("date",date,"Date");
      siDIF+=propertySiDIF("target",target,"Page");
      siDIF+=propertySiDIF("weather",weather,"Text");
      siDIF+=propertySiDIF("location",location,"Text");
      siDIF+=propertySiDIF("coordinates",coordinates,"Text");
      siDIF+=propertySiDIF("trip",trip,"Page");
      siDIF+=propertySiDIF("track",track,"Text");
      siDIF+=propertySiDIF("stay",stay,"Text");
      siDIF+=propertySiDIF("shop",shop,"Text");
      siDIF+=propertySiDIF("distance",distance,"Text");
      siDIF+=propertySiDIF("comment",comment,"Text");
      return siDIF;
    }
 
    /**  
     * get the pageid for this topic
     */
    public String getPageid() { return pageid; };

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

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

    /**
     * construct a Tour from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public Tour(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple dateTriple=query.selectSingle(pageid,"date",null);
      if (dateTriple==null)
        dateTriple=query.selectSingle(pageid,"Property:Tour_date",null);
      if (dateTriple!=null) 
        date=dateTriple.getObject().toString();
      Triple targetTriple=query.selectSingle(pageid,"target",null);
      if (targetTriple==null)
        targetTriple=query.selectSingle(pageid,"Property:Tour_target",null);
      if (targetTriple!=null) 
        target=targetTriple.getObject().toString();
      Triple weatherTriple=query.selectSingle(pageid,"weather",null);
      if (weatherTriple==null)
        weatherTriple=query.selectSingle(pageid,"Property:Tour_weather",null);
      if (weatherTriple!=null) 
        weather=weatherTriple.getObject().toString();
      Triple locationTriple=query.selectSingle(pageid,"location",null);
      if (locationTriple==null)
        locationTriple=query.selectSingle(pageid,"Property:Tour_location",null);
      if (locationTriple!=null) 
        location=locationTriple.getObject().toString();
      Triple coordinatesTriple=query.selectSingle(pageid,"coordinates",null);
      if (coordinatesTriple==null)
        coordinatesTriple=query.selectSingle(pageid,"Property:Tour_coordinates",null);
      if (coordinatesTriple!=null) 
        coordinates=coordinatesTriple.getObject().toString();
      Triple tripTriple=query.selectSingle(pageid,"trip",null);
      if (tripTriple==null)
        tripTriple=query.selectSingle(pageid,"Property:Tour_trip",null);
      if (tripTriple!=null) 
        trip=tripTriple.getObject().toString();
      Triple trackTriple=query.selectSingle(pageid,"track",null);
      if (trackTriple==null)
        trackTriple=query.selectSingle(pageid,"Property:Tour_track",null);
      if (trackTriple!=null) 
        track=trackTriple.getObject().toString();
      Triple stayTriple=query.selectSingle(pageid,"stay",null);
      if (stayTriple==null)
        stayTriple=query.selectSingle(pageid,"Property:Tour_stay",null);
      if (stayTriple!=null) 
        stay=stayTriple.getObject().toString();
      Triple shopTriple=query.selectSingle(pageid,"shop",null);
      if (shopTriple==null)
        shopTriple=query.selectSingle(pageid,"Property:Tour_shop",null);
      if (shopTriple!=null) 
        shop=shopTriple.getObject().toString();
      Triple distanceTriple=query.selectSingle(pageid,"distance",null);
      if (distanceTriple==null)
        distanceTriple=query.selectSingle(pageid,"Property:Tour_distance",null);
      if (distanceTriple!=null) 
        distance=distanceTriple.getObject().toString();
      Triple commentTriple=query.selectSingle(pageid,"comment",null);
      if (commentTriple==null)
        commentTriple=query.selectSingle(pageid,"Property:Tour_comment",null);
      if (commentTriple!=null) 
        comment=commentTriple.getObject().toString();
      init(query);
    } // constructor for Tour
    
    // >>>{user defined topic code}{Tour}{Tour}
    // <<<{user defined topic code}{Tour}{Tour}
  } // class Tour
  /**
   * Manager for Tour
   */
  public static class TourManager extends TopicBase {
 
    public String topicName="Tour";
    public transient List<Tour> mTours=new ArrayList<Tour>();
    public transient Map<String,Tour> mTourMap=new LinkedHashMap<String,Tour>();

    /**
     * get my Tours
     */
    public List<Tour> getTours() {
      List<Tour> result=this.mTours;
      return result;
    }

    /**
     *  add a new Tour 
     */
    public Tour add(Tour pTour) {
      mTours.add(pTour);
      mTourMap.put(pTour.getPageid(),pTour);
      return pTour;
    }

    /**
     *  add a new Tour from the given triple
     */
    public Tour add(TripleQuery query,Triple pTourTriple) {
      Tour lTour=new Tour(query,pTourTriple);
      add(lTour);
      return lTour;
    }

    // reinitialize my mTour map
    public void reinit() {
      mTourMap.clear();
      for (Tour lTour:mTours) {
        mTourMap.put(lTour.getPageid(),lTour);
      }
    }

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

    // default constructor for Tour Manager
    public TourManager() {}

    // add Tours from the given query
    public void addTours(TripleQuery pTourQuery,TripleQuery query) {
      if (pTourQuery!=null) {
        for (Triple lTourTriple:pTourQuery.getTriples()) {
          add(query,lTourTriple);
        }
      }
    }

    // construct me from the given triple Query query
    public TourManager(TripleQuery query) {
      // first query the SiDIF bases triplestore
      TripleQuery lTourQuery=query.query(null,"isA","Tour");
      addTours(lTourQuery,query);
      // then the SMW triplestore
      lTourQuery=query.query(null,"Property:IsA","Tour");
      addTours(lTourQuery,query);
      init(query);
    } // constructor for Tour Manager
    
    // >>>{user defined topicmanager code}{Tour}{Tour}
    // <<<{user defined topicmanager code}{Tour}{Tour}
  } // class Tour Manager
 /**
  * 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
 /**
  * Sender
  * Ein Fernsehsender
  */
  public static class Sender extends TopicBase {
  
    public String nummer;
    public String name;
    public String logo;
    public String vollname;
    public String beschreibung;

    public String getNummer() { return nummer; }
    public void setNummer(String pNummer) { nummer=pNummer; }
    public String getName() { return name; }
    public void setName(String pName) { name=pName; }
    public String getLogo() { return logo; }
    public void setLogo(String pLogo) { logo=pLogo; }
    public String getVollname() { return vollname; }
    public void setVollname(String pVollname) { vollname=pVollname; }
    public String getBeschreibung() { return beschreibung; }
    public void setBeschreibung(String pBeschreibung) { beschreibung=pBeschreibung; }
    /**
     * convert this Sender to a JSON string
     */
    public String toJson() { return JSON.toJSONString(this); }

    /**
     * convert this Sender to a WikiSon string
     * @return the WikiSon representation of this Sender
     */
    public String toWikiSon() {
      String wikison= "{{Sender\n";
      wikison+=toWikiSon("nummer",nummer);
      wikison+=toWikiSon("name",name);
      wikison+=toWikiSon("logo",logo);
      wikison+=toWikiSon("vollname",vollname);
      wikison+=toWikiSon("beschreibung",beschreibung);
      wikison+="}}\n";
      return wikison;
    }

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

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

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

    /**
     * construct a Sender from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public Sender(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple nummerTriple=query.selectSingle(pageid,"nummer",null);
      if (nummerTriple==null)
        nummerTriple=query.selectSingle(pageid,"Property:Sender_nummer",null);
      if (nummerTriple!=null) 
        nummer=nummerTriple.getObject().toString();
      Triple nameTriple=query.selectSingle(pageid,"name",null);
      if (nameTriple==null)
        nameTriple=query.selectSingle(pageid,"Property:Sender_name",null);
      if (nameTriple!=null) 
        name=nameTriple.getObject().toString();
      Triple logoTriple=query.selectSingle(pageid,"logo",null);
      if (logoTriple==null)
        logoTriple=query.selectSingle(pageid,"Property:Sender_logo",null);
      if (logoTriple!=null) 
        logo=logoTriple.getObject().toString();
      Triple vollnameTriple=query.selectSingle(pageid,"vollname",null);
      if (vollnameTriple==null)
        vollnameTriple=query.selectSingle(pageid,"Property:Sender_vollname",null);
      if (vollnameTriple!=null) 
        vollname=vollnameTriple.getObject().toString();
      Triple beschreibungTriple=query.selectSingle(pageid,"beschreibung",null);
      if (beschreibungTriple==null)
        beschreibungTriple=query.selectSingle(pageid,"Property:Sender_beschreibung",null);
      if (beschreibungTriple!=null) 
        beschreibung=beschreibungTriple.getObject().toString();
      init(query);
    } // constructor for Sender
    
    // >>>{user defined topic code}{Sender}{Sender}
    // <<<{user defined topic code}{Sender}{Sender}
  } // class Sender
  /**
   * Manager for Sender
   */
  public static class SenderManager extends TopicBase {
 
    public String topicName="Sender";
    public transient List<Sender> mSenders=new ArrayList<Sender>();
    public transient Map<String,Sender> mSenderMap=new LinkedHashMap<String,Sender>();

    /**
     * get my Sender
     */
    public List<Sender> getSender() {
      List<Sender> result=this.mSenders;
      return result;
    }

    /**
     *  add a new Sender 
     */
    public Sender add(Sender pSender) {
      mSenders.add(pSender);
      mSenderMap.put(pSender.getPageid(),pSender);
      return pSender;
    }

    /**
     *  add a new Sender from the given triple
     */
    public Sender add(TripleQuery query,Triple pSenderTriple) {
      Sender lSender=new Sender(query,pSenderTriple);
      add(lSender);
      return lSender;
    }

    // reinitialize my mSender map
    public void reinit() {
      mSenderMap.clear();
      for (Sender lSender:mSenders) {
        mSenderMap.put(lSender.getPageid(),lSender);
      }
    }

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

    // default constructor for Sender Manager
    public SenderManager() {}

    // add Sender from the given query
    public void addSender(TripleQuery pSenderQuery,TripleQuery query) {
      if (pSenderQuery!=null) {
        for (Triple lSenderTriple:pSenderQuery.getTriples()) {
          add(query,lSenderTriple);
        }
      }
    }

    // construct me from the given triple Query query
    public SenderManager(TripleQuery query) {
      // first query the SiDIF bases triplestore
      TripleQuery lSenderQuery=query.query(null,"isA","Sender");
      addSender(lSenderQuery,query);
      // then the SMW triplestore
      lSenderQuery=query.query(null,"Property:IsA","Sender");
      addSender(lSenderQuery,query);
      init(query);
    } // constructor for Sender Manager
    
    // >>>{user defined topicmanager code}{Sender}{Sender}
    // <<<{user defined topicmanager code}{Sender}{Sender}
  } // class Sender Manager
 /**
  * VideoRecording
  * a Video Recording
  */
  public static class VideoRecording extends TopicBase {
  
    public String name;
    public String date;
    public String time;
    public String duration;
    public String description;
    public String cover;
    public String file;

    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 getTime() { return time; }
    public void setTime(String pTime) { time=pTime; }
    public String getDuration() { return duration; }
    public void setDuration(String pDuration) { duration=pDuration; }
    public String getDescription() { return description; }
    public void setDescription(String pDescription) { description=pDescription; }
    public String getCover() { return cover; }
    public void setCover(String pCover) { cover=pCover; }
    public String getFile() { return file; }
    public void setFile(String pFile) { file=pFile; }
    /**
     * convert this VideoRecording to a JSON string
     */
    public String toJson() { return JSON.toJSONString(this); }

    /**
     * convert this VideoRecording to a WikiSon string
     * @return the WikiSon representation of this VideoRecording
     */
    public String toWikiSon() {
      String wikison= "{{VideoRecording\n";
      wikison+=toWikiSon("name",name);
      wikison+=toWikiSon("date",date);
      wikison+=toWikiSon("time",time);
      wikison+=toWikiSon("duration",duration);
      wikison+=toWikiSon("description",description);
      wikison+=toWikiSon("cover",cover);
      wikison+=toWikiSon("file",file);
      wikison+="}}\n";
      return wikison;
    }

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

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

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

    /**
     * construct a VideoRecording from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public VideoRecording(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple nameTriple=query.selectSingle(pageid,"name",null);
      if (nameTriple==null)
        nameTriple=query.selectSingle(pageid,"Property:VideoRecording_name",null);
      if (nameTriple!=null) 
        name=nameTriple.getObject().toString();
      Triple dateTriple=query.selectSingle(pageid,"date",null);
      if (dateTriple==null)
        dateTriple=query.selectSingle(pageid,"Property:VideoRecording_date",null);
      if (dateTriple!=null) 
        date=dateTriple.getObject().toString();
      Triple timeTriple=query.selectSingle(pageid,"time",null);
      if (timeTriple==null)
        timeTriple=query.selectSingle(pageid,"Property:VideoRecording_time",null);
      if (timeTriple!=null) 
        time=timeTriple.getObject().toString();
      Triple durationTriple=query.selectSingle(pageid,"duration",null);
      if (durationTriple==null)
        durationTriple=query.selectSingle(pageid,"Property:VideoRecording_duration",null);
      if (durationTriple!=null) 
        duration=durationTriple.getObject().toString();
      Triple descriptionTriple=query.selectSingle(pageid,"description",null);
      if (descriptionTriple==null)
        descriptionTriple=query.selectSingle(pageid,"Property:VideoRecording_description",null);
      if (descriptionTriple!=null) 
        description=descriptionTriple.getObject().toString();
      Triple coverTriple=query.selectSingle(pageid,"cover",null);
      if (coverTriple==null)
        coverTriple=query.selectSingle(pageid,"Property:VideoRecording_cover",null);
      if (coverTriple!=null) 
        cover=coverTriple.getObject().toString();
      Triple fileTriple=query.selectSingle(pageid,"file",null);
      if (fileTriple==null)
        fileTriple=query.selectSingle(pageid,"Property:VideoRecording_file",null);
      if (fileTriple!=null) 
        file=fileTriple.getObject().toString();
      init(query);
    } // constructor for VideoRecording
    
    // >>>{user defined topic code}{VideoRecording}{VideoRecording}
    // <<<{user defined topic code}{VideoRecording}{VideoRecording}
  } // class VideoRecording
  /**
   * Manager for VideoRecording
   */
  public static class VideoRecordingManager extends TopicBase {
 
    public String topicName="VideoRecording";
    public transient List<VideoRecording> mVideoRecordings=new ArrayList<VideoRecording>();
    public transient Map<String,VideoRecording> mVideoRecordingMap=new LinkedHashMap<String,VideoRecording>();

    /**
     * get my VideoRecordings
     */
    public List<VideoRecording> getVideoRecordings() {
      List<VideoRecording> result=this.mVideoRecordings;
      return result;
    }

    /**
     *  add a new VideoRecording 
     */
    public VideoRecording add(VideoRecording pVideoRecording) {
      mVideoRecordings.add(pVideoRecording);
      mVideoRecordingMap.put(pVideoRecording.getPageid(),pVideoRecording);
      return pVideoRecording;
    }

    /**
     *  add a new VideoRecording from the given triple
     */
    public VideoRecording add(TripleQuery query,Triple pVideoRecordingTriple) {
      VideoRecording lVideoRecording=new VideoRecording(query,pVideoRecordingTriple);
      add(lVideoRecording);
      return lVideoRecording;
    }

    // reinitialize my mVideoRecording map
    public void reinit() {
      mVideoRecordingMap.clear();
      for (VideoRecording lVideoRecording:mVideoRecordings) {
        mVideoRecordingMap.put(lVideoRecording.getPageid(),lVideoRecording);
      }
    }

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

    // default constructor for VideoRecording Manager
    public VideoRecordingManager() {}

    // add VideoRecordings from the given query
    public void addVideoRecordings(TripleQuery pVideoRecordingQuery,TripleQuery query) {
      if (pVideoRecordingQuery!=null) {
        for (Triple lVideoRecordingTriple:pVideoRecordingQuery.getTriples()) {
          add(query,lVideoRecordingTriple);
        }
      }
    }

    // construct me from the given triple Query query
    public VideoRecordingManager(TripleQuery query) {
      // first query the SiDIF bases triplestore
      TripleQuery lVideoRecordingQuery=query.query(null,"isA","VideoRecording");
      addVideoRecordings(lVideoRecordingQuery,query);
      // then the SMW triplestore
      lVideoRecordingQuery=query.query(null,"Property:IsA","VideoRecording");
      addVideoRecordings(lVideoRecordingQuery,query);
      init(query);
    } // constructor for VideoRecording Manager
    
    // >>>{user defined topicmanager code}{VideoRecording}{VideoRecording}
    // <<<{user defined topicmanager code}{VideoRecording}{VideoRecording}
  } // class VideoRecording Manager
 /**
  * Abfalltermin
  * Ein Abfalltermin is der Termin zu dem das Entsorgungsunternehmen die entsprechenden Abfalltonnen Blaue Tonne, Gelbe Tonne, Graue Tonne oder Grünbündel abholt
  */
  public static class Abfalltermin extends TopicBase {
  
    public String termin;
    public String name;
    public String tonne;

    public String getTermin() { return termin; }
    public void setTermin(String pTermin) { termin=pTermin; }
    public String getName() { return name; }
    public void setName(String pName) { name=pName; }
    public String getTonne() { return tonne; }
    public void setTonne(String pTonne) { tonne=pTonne; }
    /**
     * convert this Abfalltermin to a JSON string
     */
    public String toJson() { return JSON.toJSONString(this); }

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

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

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

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

    /**
     * construct a Abfalltermin from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public Abfalltermin(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple terminTriple=query.selectSingle(pageid,"termin",null);
      if (terminTriple==null)
        terminTriple=query.selectSingle(pageid,"Property:Abfalltermin_termin",null);
      if (terminTriple!=null) 
        termin=terminTriple.getObject().toString();
      Triple nameTriple=query.selectSingle(pageid,"name",null);
      if (nameTriple==null)
        nameTriple=query.selectSingle(pageid,"Property:Abfalltermin_name",null);
      if (nameTriple!=null) 
        name=nameTriple.getObject().toString();
      Triple tonneTriple=query.selectSingle(pageid,"tonne",null);
      if (tonneTriple==null)
        tonneTriple=query.selectSingle(pageid,"Property:Abfalltermin_tonne",null);
      if (tonneTriple!=null) 
        tonne=tonneTriple.getObject().toString();
      init(query);
    } // constructor for Abfalltermin
    
    // >>>{user defined topic code}{Abfalltermin}{Abfalltermin}
    // <<<{user defined topic code}{Abfalltermin}{Abfalltermin}
  } // class Abfalltermin
  /**
   * Manager for Abfalltermin
   */
  public static class AbfallterminManager extends TopicBase {
 
    public String topicName="Abfalltermin";
    public transient List<Abfalltermin> mAbfalltermins=new ArrayList<Abfalltermin>();
    public transient Map<String,Abfalltermin> mAbfallterminMap=new LinkedHashMap<String,Abfalltermin>();

    /**
     * get my Abfalltermine
     */
    public List<Abfalltermin> getAbfalltermine() {
      List<Abfalltermin> result=this.mAbfalltermins;
      return result;
    }

    /**
     *  add a new Abfalltermin 
     */
    public Abfalltermin add(Abfalltermin pAbfalltermin) {
      mAbfalltermins.add(pAbfalltermin);
      mAbfallterminMap.put(pAbfalltermin.getPageid(),pAbfalltermin);
      return pAbfalltermin;
    }

    /**
     *  add a new Abfalltermin from the given triple
     */
    public Abfalltermin add(TripleQuery query,Triple pAbfallterminTriple) {
      Abfalltermin lAbfalltermin=new Abfalltermin(query,pAbfallterminTriple);
      add(lAbfalltermin);
      return lAbfalltermin;
    }

    // reinitialize my mAbfalltermin map
    public void reinit() {
      mAbfallterminMap.clear();
      for (Abfalltermin lAbfalltermin:mAbfalltermins) {
        mAbfallterminMap.put(lAbfalltermin.getPageid(),lAbfalltermin);
      }
    }

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

    // default constructor for Abfalltermin Manager
    public AbfallterminManager() {}

    // add Abfalltermine from the given query
    public void addAbfalltermine(TripleQuery pAbfallterminQuery,TripleQuery query) {
      if (pAbfallterminQuery!=null) {
        for (Triple lAbfallterminTriple:pAbfallterminQuery.getTriples()) {
          add(query,lAbfallterminTriple);
        }
      }
    }

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

}
Showing below 0 pages.

Retrieved from "http://ebike.bitplan.com/index.php?title=Concept:Tour/Java&oldid=253#smw-result"