Difference between revisions of "Concept:Event/Java"

From BITPlan cr Wiki
Jump to navigation Jump to search
m (created by WikiTask 2020-07-23T10:51:50Z)
m (created by WikiTask 2020-10-06T06:34:45Z)
 
(3 intermediate revisions by the same user not shown)
Line 98: Line 98:
 
     }
 
     }
 
   } // TopicBase
 
   } // TopicBase
 +
/**
 +
  * EventSeries
 +
  * a series of Events
 +
  */
 +
  public static class EventSeries extends TopicBase {
 +
 
 +
    public String acronym;
 +
    public String homepage;
 +
 +
    public String getAcronym() { return acronym; }
 +
    public void setAcronym(String pAcronym) { acronym=pAcronym; }
 +
    public String getHomepage() { return homepage; }
 +
    public void setHomepage(String pHomepage) { homepage=pHomepage; }
 +
    /**
 +
    * convert this EventSeries to a JSON string
 +
    * @return the JSON representation
 +
    */
 +
    public String toJson() { return JSON.toJSONString(this); }
 +
 +
    /**
 +
    * convert this EventSeries to a WikiSon string
 +
    * @return the WikiSon representation of this EventSeries
 +
    */
 +
    public String toWikiSon() {
 +
      String wikison= "{{EventSeries\n";
 +
      wikison+=toWikiSon("acronym",acronym);
 +
      wikison+=toWikiSon("homepage",homepage);
 +
      wikison+="}}\n";
 +
      return wikison;
 +
    }
 +
 +
    /**
 +
    * convert this EventSeries to a SiDIF string
 +
    * @return the SiDIF representation of this EventSeries
 +
    */
 +
    public String toSiDIF() {
 +
      String siDIF = String.format("%s isA EventSeries\n",this.pageid);
 +
      siDIF+=propertySiDIF("acronym",acronym,"text");
 +
      siDIF+=propertySiDIF("homepage",homepage,"url");
 +
      return siDIF;
 +
    }
 +
 +
    /** 
 +
    * get the pageid for this topic
 +
    */
 +
    public String getPageid() { return pageid; };
 +
 +
    /**
 +
    * default constructor for EventSeries
 +
    */
 +
    public EventSeries() {}
 +
 +
    /**
 +
    * construct a EventSeries from the given Triple
 +
    * @param query - the TripleQuery to get the triples from
 +
    * @param pEventSeriesTriple - the triple to construct me from
 +
    */
 +
    public EventSeries(TripleQuery query,Triple pEventSeriesTriple) {
 +
      this(query,pEventSeriesTriple.getSubject().toString());
 +
    } // constructor
 +
 +
    /**
 +
    * construct a EventSeries from the given pageId
 +
    * @param query - the TripleQuery to get the triples from
 +
    * @param pageid - pageid
 +
    */
 +
    public EventSeries(TripleQuery query,String pageid) {
 +
      this.pageid=pageid;
 +
      Triple acronymTriple=query.selectSingle(pageid,"acronym",null);
 +
      if (acronymTriple==null)
 +
        acronymTriple=query.selectSingle(pageid,"Property:EventSeries_acronym",null);
 +
      if (acronymTriple!=null)
 +
        acronym=acronymTriple.getObject().toString();
 +
      Triple homepageTriple=query.selectSingle(pageid,"homepage",null);
 +
      if (homepageTriple==null)
 +
        homepageTriple=query.selectSingle(pageid,"Property:EventSeries_homepage",null);
 +
      if (homepageTriple!=null)
 +
        homepage=homepageTriple.getObject().toString();
 +
      init(query);
 +
    } // constructor for EventSeries
 +
   
 +
    // >>>{user defined topic code}{EventSeries}{EventSeries}
 +
    // <<<{user defined topic code}{EventSeries}{EventSeries}
 +
  } // class EventSeries
 +
  /**
 +
  * Manager for EventSeries
 +
  */
 +
  public static class EventSeriesManager extends TopicBase {
 +
 +
    public String topicName="EventSeries";
 +
    public transient List<EventSeries> mEventSeriess=new ArrayList<EventSeries>();
 +
    public transient Map<String,EventSeries> mEventSeriesMap=new LinkedHashMap<String,EventSeries>();
 +
 +
    /**
 +
    * get my EventSeries
 +
    */
 +
    public List<EventSeries> getEventSeries() {
 +
      List<EventSeries> result=this.mEventSeriess;
 +
      return result;
 +
    }
 +
 +
    /**
 +
    *  add a new EventSeries
 +
    */
 +
    public EventSeries add(EventSeries pEventSeries) {
 +
      mEventSeriess.add(pEventSeries);
 +
      mEventSeriesMap.put(pEventSeries.getPageid(),pEventSeries);
 +
      return pEventSeries;
 +
    }
 +
 +
    /**
 +
    *  add a new EventSeries from the given triple
 +
    */
 +
    public EventSeries add(TripleQuery query,Triple pEventSeriesTriple) {
 +
      EventSeries lEventSeries=new EventSeries(query,pEventSeriesTriple);
 +
      add(lEventSeries);
 +
      return lEventSeries;
 +
    }
 +
 +
    // reinitialize my mEventSeries map
 +
    public void reinit() {
 +
      mEventSeriesMap.clear();
 +
      for (EventSeries lEventSeries:mEventSeriess) {
 +
        mEventSeriesMap.put(lEventSeries.getPageid(),lEventSeries);
 +
      }
 +
    }
 +
 +
    // convert this manager to json format
 +
    public String toJson() { return JSON.toJSONString(this); }
 +
   
 +
    // get a new manager from the given json string
 +
    public static EventSeriesManager fromJson(String json) {
 +
      EventSeriesManager result=JSON.parseObject(json, EventSeriesManager.class);
 +
      result.reinit();
 +
      return result;
 +
    }
 +
 +
    // default constructor for EventSeries Manager
 +
    public EventSeriesManager() {}
 +
 +
    // add EventSeries from the given query
 +
    public void addEventSeries(TripleQuery pEventSeriesQuery,TripleQuery query) {
 +
      if (pEventSeriesQuery!=null) {
 +
        for (Triple lEventSeriesTriple:pEventSeriesQuery.getTriples()) {
 +
          add(query,lEventSeriesTriple);
 +
        }
 +
      }
 +
    }
 +
 +
    // construct me from the given triple Query query
 +
    public EventSeriesManager(TripleQuery query) {
 +
      // first query the SiDIF bases triplestore
 +
      TripleQuery lEventSeriesQuery=query.query(null,"isA","EventSeries");
 +
      addEventSeries(lEventSeriesQuery,query);
 +
      // then the SMW triplestore
 +
      lEventSeriesQuery=query.query(null,"Property:IsA","EventSeries");
 +
      addEventSeries(lEventSeriesQuery,query);
 +
      init(query);
 +
    } // constructor for EventSeries Manager
 +
   
 +
    // >>>{user defined topicmanager code}{EventSeries}{EventSeries}
 +
    // <<<{user defined topicmanager code}{EventSeries}{EventSeries}
 +
  } // class EventSeries Manager
 
  /**
 
  /**
 
   * Event
 
   * Event
Line 105: Line 268:
 
    
 
    
 
     public String acronym;
 
     public String acronym;
 +
    public String homepage;
 +
    public String wikidataid;
 +
    public String series;
 
     public String city;
 
     public String city;
     public String state;
+
     public String region;
 
     public String country;
 
     public String country;
  
 
     public String getAcronym() { return acronym; }
 
     public String getAcronym() { return acronym; }
 
     public void setAcronym(String pAcronym) { acronym=pAcronym; }
 
     public void setAcronym(String pAcronym) { acronym=pAcronym; }
 +
    public String getHomepage() { return homepage; }
 +
    public void setHomepage(String pHomepage) { homepage=pHomepage; }
 +
    public String getWikidataid() { return wikidataid; }
 +
    public void setWikidataid(String pWikidataid) { wikidataid=pWikidataid; }
 +
    public String getSeries() { return series; }
 +
    public void setSeries(String pSeries) { series=pSeries; }
 
     public String getCity() { return city; }
 
     public String getCity() { return city; }
 
     public void setCity(String pCity) { city=pCity; }
 
     public void setCity(String pCity) { city=pCity; }
     public String getState() { return state; }
+
     public String getRegion() { return region; }
     public void setState(String pState) { state=pState; }
+
     public void setRegion(String pRegion) { region=pRegion; }
 
     public String getCountry() { return country; }
 
     public String getCountry() { return country; }
 
     public void setCountry(String pCountry) { country=pCountry; }
 
     public void setCountry(String pCountry) { country=pCountry; }
Line 130: Line 302:
 
       String wikison= "{{Event\n";
 
       String wikison= "{{Event\n";
 
       wikison+=toWikiSon("acronym",acronym);
 
       wikison+=toWikiSon("acronym",acronym);
 +
      wikison+=toWikiSon("homepage",homepage);
 +
      wikison+=toWikiSon("wikidataid",wikidataid);
 +
      wikison+=toWikiSon("series",series);
 
       wikison+=toWikiSon("city",city);
 
       wikison+=toWikiSon("city",city);
       wikison+=toWikiSon("state",state);
+
       wikison+=toWikiSon("region",region);
 
       wikison+=toWikiSon("country",country);
 
       wikison+=toWikiSon("country",country);
 
       wikison+="}}\n";
 
       wikison+="}}\n";
Line 144: Line 319:
 
       String siDIF = String.format("%s isA Event\n",this.pageid);
 
       String siDIF = String.format("%s isA Event\n",this.pageid);
 
       siDIF+=propertySiDIF("acronym",acronym,"text");
 
       siDIF+=propertySiDIF("acronym",acronym,"text");
 +
      siDIF+=propertySiDIF("homepage",homepage,"url");
 +
      siDIF+=propertySiDIF("wikidataid",wikidataid,"text");
 +
      siDIF+=propertySiDIF("series",series,"Page");
 
       siDIF+=propertySiDIF("city",city,"Page");
 
       siDIF+=propertySiDIF("city",city,"Page");
       siDIF+=propertySiDIF("state",state,"Page");
+
       siDIF+=propertySiDIF("region",region,"Page");
 
       siDIF+=propertySiDIF("country",country,"Page");
 
       siDIF+=propertySiDIF("country",country,"Page");
 
       return siDIF;
 
       return siDIF;
Line 181: Line 359:
 
       if (acronymTriple!=null)  
 
       if (acronymTriple!=null)  
 
         acronym=acronymTriple.getObject().toString();
 
         acronym=acronymTriple.getObject().toString();
 +
      Triple homepageTriple=query.selectSingle(pageid,"homepage",null);
 +
      if (homepageTriple==null)
 +
        homepageTriple=query.selectSingle(pageid,"Property:Event_homepage",null);
 +
      if (homepageTriple!=null)
 +
        homepage=homepageTriple.getObject().toString();
 +
      Triple wikidataidTriple=query.selectSingle(pageid,"wikidataid",null);
 +
      if (wikidataidTriple==null)
 +
        wikidataidTriple=query.selectSingle(pageid,"Property:Event_wikidataid",null);
 +
      if (wikidataidTriple!=null)
 +
        wikidataid=wikidataidTriple.getObject().toString();
 +
      Triple seriesTriple=query.selectSingle(pageid,"series",null);
 +
      if (seriesTriple==null)
 +
        seriesTriple=query.selectSingle(pageid,"Property:Event_series",null);
 +
      if (seriesTriple!=null)
 +
        series=seriesTriple.getObject().toString();
 
       Triple cityTriple=query.selectSingle(pageid,"city",null);
 
       Triple cityTriple=query.selectSingle(pageid,"city",null);
 
       if (cityTriple==null)
 
       if (cityTriple==null)
Line 186: Line 379:
 
       if (cityTriple!=null)  
 
       if (cityTriple!=null)  
 
         city=cityTriple.getObject().toString();
 
         city=cityTriple.getObject().toString();
       Triple stateTriple=query.selectSingle(pageid,"state",null);
+
       Triple regionTriple=query.selectSingle(pageid,"region",null);
       if (stateTriple==null)
+
       if (regionTriple==null)
         stateTriple=query.selectSingle(pageid,"Property:Event_state",null);
+
         regionTriple=query.selectSingle(pageid,"Property:Event_region",null);
       if (stateTriple!=null)  
+
       if (regionTriple!=null)  
         state=stateTriple.getObject().toString();
+
         region=regionTriple.getObject().toString();
 
       Triple countryTriple=query.selectSingle(pageid,"country",null);
 
       Triple countryTriple=query.selectSingle(pageid,"country",null);
 
       if (countryTriple==null)
 
       if (countryTriple==null)
Line 608: Line 801:
 
   } // class Country Manager
 
   } // class Country Manager
 
  /**
 
  /**
   * State
+
   * Region
   * territorial and constitutional community forming part of a federal union
+
   * first-level administrative country subdivision e.g. Region/province
 
   */
 
   */
   public static class State extends TopicBase {
+
   public static class Region extends TopicBase {
 
    
 
    
 
     public String name;
 
     public String name;
Line 621: Line 814:
 
     public void setWikidataid(String pWikidataid) { wikidataid=pWikidataid; }
 
     public void setWikidataid(String pWikidataid) { wikidataid=pWikidataid; }
 
     /**
 
     /**
     * convert this State to a JSON string
+
     * convert this Region to a JSON string
 
     * @return the JSON representation
 
     * @return the JSON representation
 
     */
 
     */
Line 627: Line 820:
  
 
     /**
 
     /**
     * convert this State to a WikiSon string
+
     * convert this Region to a WikiSon string
     * @return the WikiSon representation of this State
+
     * @return the WikiSon representation of this Region
 
     */
 
     */
 
     public String toWikiSon() {
 
     public String toWikiSon() {
       String wikison= "{{State\n";
+
       String wikison= "{{Region\n";
 
       wikison+=toWikiSon("name",name);
 
       wikison+=toWikiSon("name",name);
 
       wikison+=toWikiSon("wikidataid",wikidataid);
 
       wikison+=toWikiSon("wikidataid",wikidataid);
Line 639: Line 832:
  
 
     /**
 
     /**
     * convert this State to a SiDIF string
+
     * convert this Region to a SiDIF string
     * @return the SiDIF representation of this State
+
     * @return the SiDIF representation of this Region
 
     */
 
     */
 
     public String toSiDIF() {
 
     public String toSiDIF() {
       String siDIF = String.format("%s isA State\n",this.pageid);
+
       String siDIF = String.format("%s isA Region\n",this.pageid);
 
       siDIF+=propertySiDIF("name",name,"text");
 
       siDIF+=propertySiDIF("name",name,"text");
 
       siDIF+=propertySiDIF("wikidataid",wikidataid,"text");
 
       siDIF+=propertySiDIF("wikidataid",wikidataid,"text");
Line 655: Line 848:
  
 
     /**
 
     /**
     * default constructor for State
+
     * default constructor for Region
 
     */
 
     */
     public State() {}
+
     public Region() {}
  
 
     /**
 
     /**
     * construct a State from the given Triple
+
     * construct a Region from the given Triple
 
     * @param query - the TripleQuery to get the triples from
 
     * @param query - the TripleQuery to get the triples from
     * @param pStateTriple - the triple to construct me from
+
     * @param pRegionTriple - the triple to construct me from
 
     */
 
     */
     public State(TripleQuery query,Triple pStateTriple) {
+
     public Region(TripleQuery query,Triple pRegionTriple) {
       this(query,pStateTriple.getSubject().toString());
+
       this(query,pRegionTriple.getSubject().toString());
 
     } // constructor
 
     } // constructor
  
 
     /**
 
     /**
     * construct a State from the given pageId
+
     * construct a Region from the given pageId
 
     * @param query - the TripleQuery to get the triples from
 
     * @param query - the TripleQuery to get the triples from
 
     * @param pageid - pageid
 
     * @param pageid - pageid
 
     */
 
     */
     public State(TripleQuery query,String pageid) {
+
     public Region(TripleQuery query,String pageid) {
 
       this.pageid=pageid;
 
       this.pageid=pageid;
 
       Triple nameTriple=query.selectSingle(pageid,"name",null);
 
       Triple nameTriple=query.selectSingle(pageid,"name",null);
 
       if (nameTriple==null)
 
       if (nameTriple==null)
         nameTriple=query.selectSingle(pageid,"Property:State_name",null);
+
         nameTriple=query.selectSingle(pageid,"Property:Region_name",null);
 
       if (nameTriple!=null)  
 
       if (nameTriple!=null)  
 
         name=nameTriple.getObject().toString();
 
         name=nameTriple.getObject().toString();
 
       Triple wikidataidTriple=query.selectSingle(pageid,"wikidataid",null);
 
       Triple wikidataidTriple=query.selectSingle(pageid,"wikidataid",null);
 
       if (wikidataidTriple==null)
 
       if (wikidataidTriple==null)
         wikidataidTriple=query.selectSingle(pageid,"Property:State_wikidataid",null);
+
         wikidataidTriple=query.selectSingle(pageid,"Property:Region_wikidataid",null);
 
       if (wikidataidTriple!=null)  
 
       if (wikidataidTriple!=null)  
 
         wikidataid=wikidataidTriple.getObject().toString();
 
         wikidataid=wikidataidTriple.getObject().toString();
 
       init(query);
 
       init(query);
     } // constructor for State
+
     } // constructor for Region
 
      
 
      
     // >>>{user defined topic code}{State}{State}
+
     // >>>{user defined topic code}{Region}{Region}
     // <<<{user defined topic code}{State}{State}
+
     // <<<{user defined topic code}{Region}{Region}
   } // class State
+
   } // class Region
 
   /**
 
   /**
   * Manager for State
+
   * Manager for Region
 
   */
 
   */
   public static class StateManager extends TopicBase {
+
   public static class RegionManager extends TopicBase {
 
   
 
   
     public String topicName="State";
+
     public String topicName="Region";
     public transient List<State> mStates=new ArrayList<State>();
+
     public transient List<Region> mRegions=new ArrayList<Region>();
     public transient Map<String,State> mStateMap=new LinkedHashMap<String,State>();
+
     public transient Map<String,Region> mRegionMap=new LinkedHashMap<String,Region>();
  
 
     /**
 
     /**
     * get my States
+
     * get my Regions
 
     */
 
     */
     public List<State> getStates() {
+
     public List<Region> getRegions() {
       List<State> result=this.mStates;
+
       List<Region> result=this.mRegions;
 
       return result;
 
       return result;
 
     }
 
     }
  
 
     /**
 
     /**
     *  add a new State
+
     *  add a new Region
 
     */
 
     */
     public State add(State pState) {
+
     public Region add(Region pRegion) {
       mStates.add(pState);
+
       mRegions.add(pRegion);
       mStateMap.put(pState.getPageid(),pState);
+
       mRegionMap.put(pRegion.getPageid(),pRegion);
       return pState;
+
       return pRegion;
 
     }
 
     }
  
 
     /**
 
     /**
     *  add a new State from the given triple
+
     *  add a new Region from the given triple
 
     */
 
     */
     public State add(TripleQuery query,Triple pStateTriple) {
+
     public Region add(TripleQuery query,Triple pRegionTriple) {
       State lState=new State(query,pStateTriple);
+
       Region lRegion=new Region(query,pRegionTriple);
       add(lState);
+
       add(lRegion);
       return lState;
+
       return lRegion;
 
     }
 
     }
  
     // reinitialize my mState map
+
     // reinitialize my mRegion map
 
     public void reinit() {
 
     public void reinit() {
       mStateMap.clear();
+
       mRegionMap.clear();
       for (State lState:mStates) {
+
       for (Region lRegion:mRegions) {
         mStateMap.put(lState.getPageid(),lState);
+
         mRegionMap.put(lRegion.getPageid(),lRegion);
 
       }
 
       }
 
     }
 
     }
Line 738: Line 931:
 
      
 
      
 
     // get a new manager from the given json string
 
     // get a new manager from the given json string
     public static StateManager fromJson(String json) {
+
     public static RegionManager fromJson(String json) {
       StateManager result=JSON.parseObject(json, StateManager.class);
+
       RegionManager result=JSON.parseObject(json, RegionManager.class);
 
       result.reinit();
 
       result.reinit();
 
       return result;
 
       return result;
 
     }
 
     }
  
     // default constructor for State Manager
+
     // default constructor for Region Manager
     public StateManager() {}
+
     public RegionManager() {}
  
     // add States from the given query
+
     // add Regions from the given query
     public void addStates(TripleQuery pStateQuery,TripleQuery query) {
+
     public void addRegions(TripleQuery pRegionQuery,TripleQuery query) {
       if (pStateQuery!=null) {
+
       if (pRegionQuery!=null) {
         for (Triple lStateTriple:pStateQuery.getTriples()) {
+
         for (Triple lRegionTriple:pRegionQuery.getTriples()) {
           add(query,lStateTriple);
+
           add(query,lRegionTriple);
 
         }
 
         }
 
       }
 
       }
Line 757: Line 950:
  
 
     // construct me from the given triple Query query
 
     // construct me from the given triple Query query
     public StateManager(TripleQuery query) {
+
     public RegionManager(TripleQuery query) {
 
       // first query the SiDIF bases triplestore
 
       // first query the SiDIF bases triplestore
       TripleQuery lStateQuery=query.query(null,"isA","State");
+
       TripleQuery lRegionQuery=query.query(null,"isA","Region");
       addStates(lStateQuery,query);
+
       addRegions(lRegionQuery,query);
 
       // then the SMW triplestore
 
       // then the SMW triplestore
       lStateQuery=query.query(null,"Property:IsA","State");
+
       lRegionQuery=query.query(null,"Property:IsA","Region");
       addStates(lStateQuery,query);
+
       addRegions(lRegionQuery,query);
 
       init(query);
 
       init(query);
     } // constructor for State Manager
+
     } // constructor for Region Manager
 
      
 
      
     // >>>{user defined topicmanager code}{State}{State}
+
     // >>>{user defined topicmanager code}{Region}{Region}
     // <<<{user defined topicmanager code}{State}{State}
+
     // <<<{user defined topicmanager code}{Region}{Region}
   } // class State Manager
+
   } // class Region Manager
  
 
}
 
}
 
</source>
 
</source>

Latest revision as of 07:34, 6 October 2020

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 my SiDIF representation
     */
    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
 /**
  * EventSeries
  * a series of Events
  */
  public static class EventSeries extends TopicBase {
  
    public String acronym;
    public String homepage;

    public String getAcronym() { return acronym; }
    public void setAcronym(String pAcronym) { acronym=pAcronym; }
    public String getHomepage() { return homepage; }
    public void setHomepage(String pHomepage) { homepage=pHomepage; }
    /**
     * convert this EventSeries to a JSON string
     * @return the JSON representation
     */
    public String toJson() { return JSON.toJSONString(this); }

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

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

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

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

    /**
     * construct a EventSeries from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public EventSeries(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple acronymTriple=query.selectSingle(pageid,"acronym",null);
      if (acronymTriple==null)
        acronymTriple=query.selectSingle(pageid,"Property:EventSeries_acronym",null);
      if (acronymTriple!=null) 
        acronym=acronymTriple.getObject().toString();
      Triple homepageTriple=query.selectSingle(pageid,"homepage",null);
      if (homepageTriple==null)
        homepageTriple=query.selectSingle(pageid,"Property:EventSeries_homepage",null);
      if (homepageTriple!=null) 
        homepage=homepageTriple.getObject().toString();
      init(query);
    } // constructor for EventSeries
    
    // >>>{user defined topic code}{EventSeries}{EventSeries}
    // <<<{user defined topic code}{EventSeries}{EventSeries}
  } // class EventSeries
  /**
   * Manager for EventSeries
   */
  public static class EventSeriesManager extends TopicBase {
 
    public String topicName="EventSeries";
    public transient List<EventSeries> mEventSeriess=new ArrayList<EventSeries>();
    public transient Map<String,EventSeries> mEventSeriesMap=new LinkedHashMap<String,EventSeries>();

    /**
     * get my EventSeries
     */
    public List<EventSeries> getEventSeries() {
      List<EventSeries> result=this.mEventSeriess;
      return result;
    }

    /**
     *  add a new EventSeries 
     */
    public EventSeries add(EventSeries pEventSeries) {
      mEventSeriess.add(pEventSeries);
      mEventSeriesMap.put(pEventSeries.getPageid(),pEventSeries);
      return pEventSeries;
    }

    /**
     *  add a new EventSeries from the given triple
     */
    public EventSeries add(TripleQuery query,Triple pEventSeriesTriple) {
      EventSeries lEventSeries=new EventSeries(query,pEventSeriesTriple);
      add(lEventSeries);
      return lEventSeries;
    }

    // reinitialize my mEventSeries map
    public void reinit() {
      mEventSeriesMap.clear();
      for (EventSeries lEventSeries:mEventSeriess) {
        mEventSeriesMap.put(lEventSeries.getPageid(),lEventSeries);
      }
    }

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

    // default constructor for EventSeries Manager
    public EventSeriesManager() {}

    // add EventSeries from the given query
    public void addEventSeries(TripleQuery pEventSeriesQuery,TripleQuery query) {
      if (pEventSeriesQuery!=null) {
        for (Triple lEventSeriesTriple:pEventSeriesQuery.getTriples()) {
          add(query,lEventSeriesTriple);
        }
      }
    }

    // construct me from the given triple Query query
    public EventSeriesManager(TripleQuery query) {
      // first query the SiDIF bases triplestore
      TripleQuery lEventSeriesQuery=query.query(null,"isA","EventSeries");
      addEventSeries(lEventSeriesQuery,query);
      // then the SMW triplestore
      lEventSeriesQuery=query.query(null,"Property:IsA","EventSeries");
      addEventSeries(lEventSeriesQuery,query);
      init(query);
    } // constructor for EventSeries Manager
    
    // >>>{user defined topicmanager code}{EventSeries}{EventSeries}
    // <<<{user defined topicmanager code}{EventSeries}{EventSeries}
  } // class EventSeries Manager
 /**
  * Event
  * a meeting of researchers at a specific time and place
  */
  public static class Event extends TopicBase {
  
    public String acronym;
    public String homepage;
    public String wikidataid;
    public String series;
    public String city;
    public String region;
    public String country;

    public String getAcronym() { return acronym; }
    public void setAcronym(String pAcronym) { acronym=pAcronym; }
    public String getHomepage() { return homepage; }
    public void setHomepage(String pHomepage) { homepage=pHomepage; }
    public String getWikidataid() { return wikidataid; }
    public void setWikidataid(String pWikidataid) { wikidataid=pWikidataid; }
    public String getSeries() { return series; }
    public void setSeries(String pSeries) { series=pSeries; }
    public String getCity() { return city; }
    public void setCity(String pCity) { city=pCity; }
    public String getRegion() { return region; }
    public void setRegion(String pRegion) { region=pRegion; }
    public String getCountry() { return country; }
    public void setCountry(String pCountry) { country=pCountry; }
    /**
     * convert this Event to a JSON string
     * @return the JSON representation
     */
    public String toJson() { return JSON.toJSONString(this); }

    /**
     * convert this Event to a WikiSon string
     * @return the WikiSon representation of this Event
     */
    public String toWikiSon() {
      String wikison= "{{Event\n";
      wikison+=toWikiSon("acronym",acronym);
      wikison+=toWikiSon("homepage",homepage);
      wikison+=toWikiSon("wikidataid",wikidataid);
      wikison+=toWikiSon("series",series);
      wikison+=toWikiSon("city",city);
      wikison+=toWikiSon("region",region);
      wikison+=toWikiSon("country",country);
      wikison+="}}\n";
      return wikison;
    }

    /**
     * convert this Event to a SiDIF string
     * @return the SiDIF representation of this Event
     */
    public String toSiDIF() {
      String siDIF = String.format("%s isA Event\n",this.pageid);
      siDIF+=propertySiDIF("acronym",acronym,"text");
      siDIF+=propertySiDIF("homepage",homepage,"url");
      siDIF+=propertySiDIF("wikidataid",wikidataid,"text");
      siDIF+=propertySiDIF("series",series,"Page");
      siDIF+=propertySiDIF("city",city,"Page");
      siDIF+=propertySiDIF("region",region,"Page");
      siDIF+=propertySiDIF("country",country,"Page");
      return siDIF;
    }
 
    /**  
     * get the pageid for this topic
     */
    public String getPageid() { return pageid; };

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

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

    /**
     * construct a Event from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public Event(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple acronymTriple=query.selectSingle(pageid,"acronym",null);
      if (acronymTriple==null)
        acronymTriple=query.selectSingle(pageid,"Property:Event_acronym",null);
      if (acronymTriple!=null) 
        acronym=acronymTriple.getObject().toString();
      Triple homepageTriple=query.selectSingle(pageid,"homepage",null);
      if (homepageTriple==null)
        homepageTriple=query.selectSingle(pageid,"Property:Event_homepage",null);
      if (homepageTriple!=null) 
        homepage=homepageTriple.getObject().toString();
      Triple wikidataidTriple=query.selectSingle(pageid,"wikidataid",null);
      if (wikidataidTriple==null)
        wikidataidTriple=query.selectSingle(pageid,"Property:Event_wikidataid",null);
      if (wikidataidTriple!=null) 
        wikidataid=wikidataidTriple.getObject().toString();
      Triple seriesTriple=query.selectSingle(pageid,"series",null);
      if (seriesTriple==null)
        seriesTriple=query.selectSingle(pageid,"Property:Event_series",null);
      if (seriesTriple!=null) 
        series=seriesTriple.getObject().toString();
      Triple cityTriple=query.selectSingle(pageid,"city",null);
      if (cityTriple==null)
        cityTriple=query.selectSingle(pageid,"Property:Event_city",null);
      if (cityTriple!=null) 
        city=cityTriple.getObject().toString();
      Triple regionTriple=query.selectSingle(pageid,"region",null);
      if (regionTriple==null)
        regionTriple=query.selectSingle(pageid,"Property:Event_region",null);
      if (regionTriple!=null) 
        region=regionTriple.getObject().toString();
      Triple countryTriple=query.selectSingle(pageid,"country",null);
      if (countryTriple==null)
        countryTriple=query.selectSingle(pageid,"Property:Event_country",null);
      if (countryTriple!=null) 
        country=countryTriple.getObject().toString();
      init(query);
    } // constructor for Event
    
    // >>>{user defined topic code}{Event}{Event}
    // <<<{user defined topic code}{Event}{Event}
  } // class Event
  /**
   * Manager for Event
   */
  public static class EventManager extends TopicBase {
 
    public String topicName="Event";
    public transient List<Event> mEvents=new ArrayList<Event>();
    public transient Map<String,Event> mEventMap=new LinkedHashMap<String,Event>();

    /**
     * get my Events
     */
    public List<Event> getEvents() {
      List<Event> result=this.mEvents;
      return result;
    }

    /**
     *  add a new Event 
     */
    public Event add(Event pEvent) {
      mEvents.add(pEvent);
      mEventMap.put(pEvent.getPageid(),pEvent);
      return pEvent;
    }

    /**
     *  add a new Event from the given triple
     */
    public Event add(TripleQuery query,Triple pEventTriple) {
      Event lEvent=new Event(query,pEventTriple);
      add(lEvent);
      return lEvent;
    }

    // reinitialize my mEvent map
    public void reinit() {
      mEventMap.clear();
      for (Event lEvent:mEvents) {
        mEventMap.put(lEvent.getPageid(),lEvent);
      }
    }

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

    // default constructor for Event Manager
    public EventManager() {}

    // add Events from the given query
    public void addEvents(TripleQuery pEventQuery,TripleQuery query) {
      if (pEventQuery!=null) {
        for (Triple lEventTriple:pEventQuery.getTriples()) {
          add(query,lEventTriple);
        }
      }
    }

    // construct me from the given triple Query query
    public EventManager(TripleQuery query) {
      // first query the SiDIF bases triplestore
      TripleQuery lEventQuery=query.query(null,"isA","Event");
      addEvents(lEventQuery,query);
      // then the SMW triplestore
      lEventQuery=query.query(null,"Property:IsA","Event");
      addEvents(lEventQuery,query);
      init(query);
    } // constructor for Event Manager
    
    // >>>{user defined topicmanager code}{Event}{Event}
    // <<<{user defined topicmanager code}{Event}{Event}
  } // class Event Manager
 /**
  * City
  * large permanent human settlement
  */
  public static class City extends TopicBase {
  
    public String name;
    public String wikidataid;

    public String getName() { return name; }
    public void setName(String pName) { name=pName; }
    public String getWikidataid() { return wikidataid; }
    public void setWikidataid(String pWikidataid) { wikidataid=pWikidataid; }
    /**
     * convert this City to a JSON string
     * @return the JSON representation
     */
    public String toJson() { return JSON.toJSONString(this); }

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

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

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

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

    /**
     * construct a City from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public City(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple nameTriple=query.selectSingle(pageid,"name",null);
      if (nameTriple==null)
        nameTriple=query.selectSingle(pageid,"Property:City_name",null);
      if (nameTriple!=null) 
        name=nameTriple.getObject().toString();
      Triple wikidataidTriple=query.selectSingle(pageid,"wikidataid",null);
      if (wikidataidTriple==null)
        wikidataidTriple=query.selectSingle(pageid,"Property:City_wikidataid",null);
      if (wikidataidTriple!=null) 
        wikidataid=wikidataidTriple.getObject().toString();
      init(query);
    } // constructor for City
    
    // >>>{user defined topic code}{City}{City}
    // <<<{user defined topic code}{City}{City}
  } // class City
  /**
   * Manager for City
   */
  public static class CityManager extends TopicBase {
 
    public String topicName="City";
    public transient List<City> mCitys=new ArrayList<City>();
    public transient Map<String,City> mCityMap=new LinkedHashMap<String,City>();

    /**
     * get my Cities
     */
    public List<City> getCities() {
      List<City> result=this.mCitys;
      return result;
    }

    /**
     *  add a new City 
     */
    public City add(City pCity) {
      mCitys.add(pCity);
      mCityMap.put(pCity.getPageid(),pCity);
      return pCity;
    }

    /**
     *  add a new City from the given triple
     */
    public City add(TripleQuery query,Triple pCityTriple) {
      City lCity=new City(query,pCityTriple);
      add(lCity);
      return lCity;
    }

    // reinitialize my mCity map
    public void reinit() {
      mCityMap.clear();
      for (City lCity:mCitys) {
        mCityMap.put(lCity.getPageid(),lCity);
      }
    }

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

    // default constructor for City Manager
    public CityManager() {}

    // add Cities from the given query
    public void addCities(TripleQuery pCityQuery,TripleQuery query) {
      if (pCityQuery!=null) {
        for (Triple lCityTriple:pCityQuery.getTriples()) {
          add(query,lCityTriple);
        }
      }
    }

    // construct me from the given triple Query query
    public CityManager(TripleQuery query) {
      // first query the SiDIF bases triplestore
      TripleQuery lCityQuery=query.query(null,"isA","City");
      addCities(lCityQuery,query);
      // then the SMW triplestore
      lCityQuery=query.query(null,"Property:IsA","City");
      addCities(lCityQuery,query);
      init(query);
    } // constructor for City Manager
    
    // >>>{user defined topicmanager code}{City}{City}
    // <<<{user defined topicmanager code}{City}{City}
  } // class City Manager
 /**
  * Country
  * distinct region in geography; a broad term that can include political divisions or regions associated with distinct political characteristics
  */
  public static class Country extends TopicBase {
  
    public String name;
    public String wikidataid;

    public String getName() { return name; }
    public void setName(String pName) { name=pName; }
    public String getWikidataid() { return wikidataid; }
    public void setWikidataid(String pWikidataid) { wikidataid=pWikidataid; }
    /**
     * convert this Country to a JSON string
     * @return the JSON representation
     */
    public String toJson() { return JSON.toJSONString(this); }

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

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

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

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

    /**
     * construct a Country from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public Country(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple nameTriple=query.selectSingle(pageid,"name",null);
      if (nameTriple==null)
        nameTriple=query.selectSingle(pageid,"Property:Country_name",null);
      if (nameTriple!=null) 
        name=nameTriple.getObject().toString();
      Triple wikidataidTriple=query.selectSingle(pageid,"wikidataid",null);
      if (wikidataidTriple==null)
        wikidataidTriple=query.selectSingle(pageid,"Property:Country_wikidataid",null);
      if (wikidataidTriple!=null) 
        wikidataid=wikidataidTriple.getObject().toString();
      init(query);
    } // constructor for Country
    
    // >>>{user defined topic code}{Country}{Country}
    // <<<{user defined topic code}{Country}{Country}
  } // class Country
  /**
   * Manager for Country
   */
  public static class CountryManager extends TopicBase {
 
    public String topicName="Country";
    public transient List<Country> mCountrys=new ArrayList<Country>();
    public transient Map<String,Country> mCountryMap=new LinkedHashMap<String,Country>();

    /**
     * get my Countries
     */
    public List<Country> getCountries() {
      List<Country> result=this.mCountrys;
      return result;
    }

    /**
     *  add a new Country 
     */
    public Country add(Country pCountry) {
      mCountrys.add(pCountry);
      mCountryMap.put(pCountry.getPageid(),pCountry);
      return pCountry;
    }

    /**
     *  add a new Country from the given triple
     */
    public Country add(TripleQuery query,Triple pCountryTriple) {
      Country lCountry=new Country(query,pCountryTriple);
      add(lCountry);
      return lCountry;
    }

    // reinitialize my mCountry map
    public void reinit() {
      mCountryMap.clear();
      for (Country lCountry:mCountrys) {
        mCountryMap.put(lCountry.getPageid(),lCountry);
      }
    }

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

    // default constructor for Country Manager
    public CountryManager() {}

    // add Countries from the given query
    public void addCountries(TripleQuery pCountryQuery,TripleQuery query) {
      if (pCountryQuery!=null) {
        for (Triple lCountryTriple:pCountryQuery.getTriples()) {
          add(query,lCountryTriple);
        }
      }
    }

    // construct me from the given triple Query query
    public CountryManager(TripleQuery query) {
      // first query the SiDIF bases triplestore
      TripleQuery lCountryQuery=query.query(null,"isA","Country");
      addCountries(lCountryQuery,query);
      // then the SMW triplestore
      lCountryQuery=query.query(null,"Property:IsA","Country");
      addCountries(lCountryQuery,query);
      init(query);
    } // constructor for Country Manager
    
    // >>>{user defined topicmanager code}{Country}{Country}
    // <<<{user defined topicmanager code}{Country}{Country}
  } // class Country Manager
 /**
  * Region
  * first-level administrative country subdivision e.g. Region/province
  */
  public static class Region extends TopicBase {
  
    public String name;
    public String wikidataid;

    public String getName() { return name; }
    public void setName(String pName) { name=pName; }
    public String getWikidataid() { return wikidataid; }
    public void setWikidataid(String pWikidataid) { wikidataid=pWikidataid; }
    /**
     * convert this Region to a JSON string
     * @return the JSON representation
     */
    public String toJson() { return JSON.toJSONString(this); }

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

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

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

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

    /**
     * construct a Region from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public Region(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple nameTriple=query.selectSingle(pageid,"name",null);
      if (nameTriple==null)
        nameTriple=query.selectSingle(pageid,"Property:Region_name",null);
      if (nameTriple!=null) 
        name=nameTriple.getObject().toString();
      Triple wikidataidTriple=query.selectSingle(pageid,"wikidataid",null);
      if (wikidataidTriple==null)
        wikidataidTriple=query.selectSingle(pageid,"Property:Region_wikidataid",null);
      if (wikidataidTriple!=null) 
        wikidataid=wikidataidTriple.getObject().toString();
      init(query);
    } // constructor for Region
    
    // >>>{user defined topic code}{Region}{Region}
    // <<<{user defined topic code}{Region}{Region}
  } // class Region
  /**
   * Manager for Region
   */
  public static class RegionManager extends TopicBase {
 
    public String topicName="Region";
    public transient List<Region> mRegions=new ArrayList<Region>();
    public transient Map<String,Region> mRegionMap=new LinkedHashMap<String,Region>();

    /**
     * get my Regions
     */
    public List<Region> getRegions() {
      List<Region> result=this.mRegions;
      return result;
    }

    /**
     *  add a new Region 
     */
    public Region add(Region pRegion) {
      mRegions.add(pRegion);
      mRegionMap.put(pRegion.getPageid(),pRegion);
      return pRegion;
    }

    /**
     *  add a new Region from the given triple
     */
    public Region add(TripleQuery query,Triple pRegionTriple) {
      Region lRegion=new Region(query,pRegionTriple);
      add(lRegion);
      return lRegion;
    }

    // reinitialize my mRegion map
    public void reinit() {
      mRegionMap.clear();
      for (Region lRegion:mRegions) {
        mRegionMap.put(lRegion.getPageid(),lRegion);
      }
    }

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

    // default constructor for Region Manager
    public RegionManager() {}

    // add Regions from the given query
    public void addRegions(TripleQuery pRegionQuery,TripleQuery query) {
      if (pRegionQuery!=null) {
        for (Triple lRegionTriple:pRegionQuery.getTriples()) {
          add(query,lRegionTriple);
        }
      }
    }

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

}
Showing below 0 pages.

Retrieved from "https://cr.bitplan.com/index.php?title=Concept:Event/Java&oldid=536#smw-result"