Difference between revisions of "Concept:OsProject/Java"
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
 
 
		
	|  (created by WikiTask 2018-08-21T03:52:30Z) | m (created by WikiTask 2022-01-24T07:08:54Z) | ||
| (4 intermediate revisions by the same user not shown) | |||
| Line 99: | Line 99: | ||
|    } // TopicBase |    } // TopicBase | ||
|   /** |   /** | ||
| − |    *  | + |    * OsProject | 
| − |    *  | + |    * An Open Source Project | 
|    */ |    */ | ||
| − |    public static class  | + |    public static class OsProject extends TopicBase { | 
| − |      public String  | + |      public String id; | 
| + |     public String state; | ||
| + |     public String owner; | ||
| + |     public String title; | ||
| + |     public String url; | ||
| + |     public String description; | ||
| + |     public String version; | ||
|      public String date; |      public String date; | ||
| − |      public String  | + |      public String since; | 
| − |      public String  | + |      public String until; | 
| − | |||
| − | |||
| − | |||
| − |      public String  | + |      public String getId() { return id; } | 
| − |      public void  | + |      public void setId(String pId) { id=pId; } | 
| + |     public String getState() { return state; } | ||
| + |     public void setState(String pState) { state=pState; } | ||
| + |     public String getOwner() { return owner; } | ||
| + |     public void setOwner(String pOwner) { owner=pOwner; } | ||
| + |     public String getTitle() { return title; } | ||
| + |     public void setTitle(String pTitle) { title=pTitle; } | ||
| + |     public String getUrl() { return url; } | ||
| + |     public void setUrl(String pUrl) { url=pUrl; } | ||
| + |     public String getDescription() { return description; } | ||
| + |     public void setDescription(String pDescription) { description=pDescription; } | ||
| + |     public String getVersion() { return version; } | ||
| + |     public void setVersion(String pVersion) { version=pVersion; } | ||
|      public String getDate() { return date; } |      public String getDate() { return date; } | ||
|      public void setDate(String pDate) { date=pDate; } |      public void setDate(String pDate) { date=pDate; } | ||
| − |      public String  | + |      public String getSince() { return since; } | 
| − |      public void  | + |      public void setSince(String pSince) { since=pSince; } | 
| − |      public String  | + |      public String getUntil() { return until; } | 
| − |      public void  | + |      public void setUntil(String pUntil) { until=pUntil; } | 
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|      /** |      /** | ||
| − |       * convert this  | + |       * convert this OsProject to a JSON string | 
|       */ |       */ | ||
|      public String toJson() { return JSON.toJSONString(this); } |      public String toJson() { return JSON.toJSONString(this); } | ||
|      /** |      /** | ||
| − |       * convert this  | + |       * convert this OsProject to a WikiSon string | 
| − |       * @return the WikiSon representation of this  | + |       * @return the WikiSon representation of this OsProject | 
|       */ |       */ | ||
|      public String toWikiSon() { |      public String toWikiSon() { | ||
| − |        String wikison= "{{ | + |        String wikison= "{{OsProject\n"; | 
| − |        wikison+=toWikiSon(" | + |        wikison+=toWikiSon("id",id); | 
| + |       wikison+=toWikiSon("state",state); | ||
| + |       wikison+=toWikiSon("owner",owner); | ||
| + |       wikison+=toWikiSon("title",title); | ||
| + |       wikison+=toWikiSon("url",url); | ||
| + |       wikison+=toWikiSon("description",description); | ||
| + |       wikison+=toWikiSon("version",version); | ||
|        wikison+=toWikiSon("date",date); |        wikison+=toWikiSon("date",date); | ||
| − |        wikison+=toWikiSon(" | + |        wikison+=toWikiSon("since",since); | 
| − |        wikison+=toWikiSon(" | + |        wikison+=toWikiSon("until",until); | 
| − | |||
| − | |||
| − | |||
|        wikison+="}}\n"; |        wikison+="}}\n"; | ||
|        return wikison; |        return wikison; | ||
| Line 149: | Line 161: | ||
|      /** |      /** | ||
| − |       * convert this  | + |       * convert this OsProject to a SiDIF string | 
| − |       * @return the SiDIF representation of this  | + |       * @return the SiDIF representation of this OsProject | 
|       */ |       */ | ||
|      public String toSiDIF() { |      public String toSiDIF() { | ||
| − |        String siDIF = String.format("%s isA  | + |        String siDIF = String.format("%s isA OsProject\n",this.pageid); | 
| − |        siDIF+=propertySiDIF(" | + |        siDIF+=propertySiDIF("id",id,"Text"); | 
| + |       siDIF+=propertySiDIF("state",state,"Text"); | ||
| + |       siDIF+=propertySiDIF("owner",owner,"Text"); | ||
| + |       siDIF+=propertySiDIF("title",title,"Text"); | ||
| + |       siDIF+=propertySiDIF("url",url,"Text"); | ||
| + |       siDIF+=propertySiDIF("description",description,"Text"); | ||
| + |       siDIF+=propertySiDIF("version",version,"Text"); | ||
|        siDIF+=propertySiDIF("date",date,"Date"); |        siDIF+=propertySiDIF("date",date,"Date"); | ||
| − |        siDIF+=propertySiDIF(" | + |        siDIF+=propertySiDIF("since",since,"Date"); | 
| − |        siDIF+=propertySiDIF(" | + |        siDIF+=propertySiDIF("until",until,"Date"); | 
| − | |||
| − | |||
| − | |||
|        return siDIF; |        return siDIF; | ||
|      } |      } | ||
| Line 170: | Line 185: | ||
|      /** |      /** | ||
| − |       * default constructor for  | + |       * default constructor for OsProject | 
|       */ |       */ | ||
| − |      public  | + |      public OsProject() {} | 
|      /** |      /** | ||
| − |       * construct a  | + |       * construct a OsProject from the given Triple | 
|       * @param query - the TripleQuery to get the triples from |       * @param query - the TripleQuery to get the triples from | ||
| − |       * @param  | + |       * @param pOsProjectTriple - the triple to construct me from | 
|       */ |       */ | ||
| − |      public  | + |      public OsProject(TripleQuery query,Triple pOsProjectTriple) { | 
| − |        this(query, | + |        this(query,pOsProjectTriple.getSubject().toString()); | 
|      } // constructor |      } // constructor | ||
|      /** |      /** | ||
| − |       * construct a  | + |       * construct a OsProject 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  | + |      public OsProject(TripleQuery query,String pageid) { | 
|        this.pageid=pageid; |        this.pageid=pageid; | ||
| − |        Triple  | + |        Triple idTriple=query.selectSingle(pageid,"id",null); | 
| − |        if ( | + |        if (idTriple==null) | 
| − | + |          idTriple=query.selectSingle(pageid,"Property:OsProject_id",null); | |
| − |        if ( | + |        if (idTriple!=null)   | 
| − | + |          id=idTriple.getObject().toString(); | |
| + |       Triple stateTriple=query.selectSingle(pageid,"state",null); | ||
| + |       if (stateTriple==null) | ||
| + |         stateTriple=query.selectSingle(pageid,"Property:OsProject_state",null); | ||
| + |       if (stateTriple!=null)  | ||
| + |         state=stateTriple.getObject().toString(); | ||
| + |       Triple ownerTriple=query.selectSingle(pageid,"owner",null); | ||
| + |       if (ownerTriple==null) | ||
| + |         ownerTriple=query.selectSingle(pageid,"Property:OsProject_owner",null); | ||
| + |       if (ownerTriple!=null)  | ||
| + |         owner=ownerTriple.getObject().toString(); | ||
| + |       Triple titleTriple=query.selectSingle(pageid,"title",null); | ||
| + |       if (titleTriple==null) | ||
| + |         titleTriple=query.selectSingle(pageid,"Property:OsProject_title",null); | ||
| + |       if (titleTriple!=null)  | ||
| + |         title=titleTriple.getObject().toString(); | ||
| + |       Triple urlTriple=query.selectSingle(pageid,"url",null); | ||
| + |       if (urlTriple==null) | ||
| + |         urlTriple=query.selectSingle(pageid,"Property:OsProject_url",null); | ||
| + |       if (urlTriple!=null)  | ||
| + |         url=urlTriple.getObject().toString(); | ||
| + |       Triple descriptionTriple=query.selectSingle(pageid,"description",null); | ||
| + |       if (descriptionTriple==null) | ||
| + |         descriptionTriple=query.selectSingle(pageid,"Property:OsProject_description",null); | ||
| + |       if (descriptionTriple!=null)  | ||
| + |         description=descriptionTriple.getObject().toString(); | ||
| + |       Triple versionTriple=query.selectSingle(pageid,"version",null); | ||
| + |       if (versionTriple==null) | ||
| + |         versionTriple=query.selectSingle(pageid,"Property:OsProject_version",null); | ||
| + |       if (versionTriple!=null)  | ||
| + |         version=versionTriple.getObject().toString(); | ||
|        Triple dateTriple=query.selectSingle(pageid,"date",null); |        Triple dateTriple=query.selectSingle(pageid,"date",null); | ||
|        if (dateTriple==null) |        if (dateTriple==null) | ||
| − |          dateTriple=query.selectSingle(pageid,"Property: | + |          dateTriple=query.selectSingle(pageid,"Property:OsProject_date",null); | 
|        if (dateTriple!=null)   |        if (dateTriple!=null)   | ||
|          date=dateTriple.getObject().toString(); |          date=dateTriple.getObject().toString(); | ||
| − |        Triple  | + |        Triple sinceTriple=query.selectSingle(pageid,"since",null); | 
| − |        if ( | + |        if (sinceTriple==null) | 
| − | + |          sinceTriple=query.selectSingle(pageid,"Property:OsProject_since",null); | |
| − |        if ( | + |        if (sinceTriple!=null)   | 
| − | + |          since=sinceTriple.getObject().toString(); | |
| − |        Triple  | + |        Triple untilTriple=query.selectSingle(pageid,"until",null); | 
| − |        if ( | + |        if (untilTriple==null) | 
| − | + |          untilTriple=query.selectSingle(pageid,"Property:OsProject_until",null); | |
| − |        if ( | + |        if (untilTriple!=null)   | 
| − | + |          until=untilTriple.getObject().toString(); | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|        init(query); |        init(query); | ||
| − |      } // constructor for  | + |      } // constructor for OsProject | 
| − |      // >>>{user defined topic code}{ | + |      // >>>{user defined topic code}{OsProject}{OsProject} | 
| − |      // <<<{user defined topic code}{ | + |      // <<<{user defined topic code}{OsProject}{OsProject} | 
| − |    } // class  | + |    } // class OsProject | 
|    /** |    /** | ||
| − |     * Manager for  | + |     * Manager for OsProject | 
|     */ |     */ | ||
| − |    public static class  | + |    public static class OsProjectManager extends TopicBase { | 
| − |      public String topicName=" | + |      public String topicName="OsProject"; | 
| − |      public transient List< | + |      public transient List<OsProject> mOsProjects=new ArrayList<OsProject>(); | 
| − |      public transient Map<String, | + |      public transient Map<String,OsProject> mOsProjectMap=new LinkedHashMap<String,OsProject>(); | 
|      /** |      /** | ||
| − |       * get my  | + |       * get my OsProjects | 
|       */ |       */ | ||
| − |      public List< | + |      public List<OsProject> getOsProjects() { | 
| − |        List< | + |        List<OsProject> result=this.mOsProjects; | 
|        return result; |        return result; | ||
|      } |      } | ||
|      /** |      /** | ||
| − |       *  add a new  | + |       *  add a new OsProject  | 
|       */ |       */ | ||
| − |      public  | + |      public OsProject add(OsProject pOsProject) { | 
| − | + |        mOsProjects.add(pOsProject); | |
| − | + |        mOsProjectMap.put(pOsProject.getPageid(),pOsProject); | |
| − |        return  | + |        return pOsProject; | 
|      } |      } | ||
|      /** |      /** | ||
| − |       *  add a new  | + |       *  add a new OsProject from the given triple | 
|       */ |       */ | ||
| − |      public  | + |      public OsProject add(TripleQuery query,Triple pOsProjectTriple) { | 
| − | + |        OsProject lOsProject=new OsProject(query,pOsProjectTriple); | |
| − |        add( | + |        add(lOsProject); | 
| − |        return  | + |        return lOsProject; | 
|      } |      } | ||
| − |      // reinitialize my  | + |      // reinitialize my mOsProject map | 
|      public void reinit() { |      public void reinit() { | ||
| − | + |        mOsProjectMap.clear(); | |
| − |        for ( | + |        for (OsProject lOsProject:mOsProjects) { | 
| − | + |          mOsProjectMap.put(lOsProject.getPageid(),lOsProject); | |
|        } |        } | ||
|      } |      } | ||
| Line 278: | Line 308: | ||
|      // get a new manager from the given json string |      // get a new manager from the given json string | ||
| − |      public static  | + |      public static OsProjectManager fromJson(String json) { | 
| − | + |        OsProjectManager result=JSON.parseObject(json, OsProjectManager.class); | |
|        result.reinit(); |        result.reinit(); | ||
|        return result; |        return result; | ||
|      } |      } | ||
| − |      // default constructor for  | + |      // default constructor for OsProject Manager | 
| − |      public  | + |      public OsProjectManager() {} | 
| − |      // add  | + |      // add OsProjects from the given query | 
| − |      public void  | + |      public void addOsProjects(TripleQuery pOsProjectQuery,TripleQuery query) { | 
| − |        if ( | + |        if (pOsProjectQuery!=null) { | 
| − |          for (Triple  | + |          for (Triple lOsProjectTriple:pOsProjectQuery.getTriples()) { | 
| − |            add(query, | + |            add(query,lOsProjectTriple); | 
|          } |          } | ||
|        } |        } | ||
| Line 297: | Line 327: | ||
|      // construct me from the given triple Query query |      // construct me from the given triple Query query | ||
| − |      public  | + |      public OsProjectManager(TripleQuery query) { | 
|        // first query the SiDIF bases triplestore |        // first query the SiDIF bases triplestore | ||
| − |        TripleQuery  | + |        TripleQuery lOsProjectQuery=query.query(null,"isA","OsProject"); | 
| − | + |        addOsProjects(lOsProjectQuery,query); | |
|        // then the SMW triplestore |        // then the SMW triplestore | ||
| − | + |        lOsProjectQuery=query.query(null,"Property:IsA","OsProject"); | |
| − | + |        addOsProjects(lOsProjectQuery,query); | |
|        init(query); |        init(query); | ||
| − |      } // constructor for  | + |      } // constructor for OsProject Manager | 
| − |      // >>>{user defined topicmanager code}{ | + |      // >>>{user defined topicmanager code}{OsProject}{OsProject} | 
| − |      // <<<{user defined topicmanager code}{ | + |      // <<<{user defined topicmanager code}{OsProject}{OsProject} | 
| − |    } // class  | + |    } // class OsProject Manager | 
|   /** |   /** | ||
| − |    *  | + |    * Ticket | 
| − |    *  | + |    * A ticket is an issue in an open source project | 
|    */ |    */ | ||
| − |    public static class  | + |    public static class Ticket extends TopicBase { | 
| − |      public String  | + |      public String no; | 
|      public String title; |      public String title; | ||
| − |      public String  | + |      public String project; | 
| − | |||
| − |      public String  | + |      public String getNo() { return no; } | 
| − |      public void  | + |      public void setNo(String pNo) { no=pNo; } | 
|      public String getTitle() { return title; } |      public String getTitle() { return title; } | ||
|      public void setTitle(String pTitle) { title=pTitle; } |      public void setTitle(String pTitle) { title=pTitle; } | ||
| − |      public String  | + |      public String getProject() { return project; } | 
| − |      public void  | + |      public void setProject(String pProject) { project=pProject; } | 
| − | |||
| − | |||
|      /** |      /** | ||
| − |       * convert this  | + |       * convert this Ticket to a JSON string | 
|       */ |       */ | ||
|      public String toJson() { return JSON.toJSONString(this); } |      public String toJson() { return JSON.toJSONString(this); } | ||
|      /** |      /** | ||
| − |       * convert this  | + |       * convert this Ticket to a WikiSon string | 
| − |       * @return the WikiSon representation of this  | + |       * @return the WikiSon representation of this Ticket | 
|       */ |       */ | ||
|      public String toWikiSon() { |      public String toWikiSon() { | ||
| − |        String wikison= "{{ | + |        String wikison= "{{Ticket\n"; | 
| − |        wikison+=toWikiSon(" | + |        wikison+=toWikiSon("no",no); | 
|        wikison+=toWikiSon("title",title); |        wikison+=toWikiSon("title",title); | ||
| − |        wikison+=toWikiSon(" | + |        wikison+=toWikiSon("project",project); | 
| − | |||
|        wikison+="}}\n"; |        wikison+="}}\n"; | ||
|        return wikison; |        return wikison; | ||
| Line 349: | Line 375: | ||
|      /** |      /** | ||
| − |       * convert this  | + |       * convert this Ticket to a SiDIF string | 
| − |       * @return the SiDIF representation of this  | + |       * @return the SiDIF representation of this Ticket | 
|       */ |       */ | ||
|      public String toSiDIF() { |      public String toSiDIF() { | ||
| − |        String siDIF = String.format("%s isA  | + |        String siDIF = String.format("%s isA Ticket\n",this.pageid); | 
| − |        siDIF+=propertySiDIF(" | + |        siDIF+=propertySiDIF("no",no,"Text"); | 
|        siDIF+=propertySiDIF("title",title,"Text"); |        siDIF+=propertySiDIF("title",title,"Text"); | ||
| − |        siDIF+=propertySiDIF(" | + |        siDIF+=propertySiDIF("project",project,"Page"); | 
| − | |||
|        return siDIF; |        return siDIF; | ||
|      } |      } | ||
| Line 367: | Line 392: | ||
|      /** |      /** | ||
| − |       * default constructor for  | + |       * default constructor for Ticket | 
|       */ |       */ | ||
| − |      public  | + |      public Ticket() {} | 
|      /** |      /** | ||
| − |       * construct a  | + |       * construct a Ticket from the given Triple | 
|       * @param query - the TripleQuery to get the triples from |       * @param query - the TripleQuery to get the triples from | ||
| − |       * @param  | + |       * @param pTicketTriple - the triple to construct me from | 
|       */ |       */ | ||
| − |      public  | + |      public Ticket(TripleQuery query,Triple pTicketTriple) { | 
| − |        this(query, | + |        this(query,pTicketTriple.getSubject().toString()); | 
|      } // constructor |      } // constructor | ||
|      /** |      /** | ||
| − |       * construct a  | + |       * construct a Ticket 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  | + |      public Ticket(TripleQuery query,String pageid) { | 
|        this.pageid=pageid; |        this.pageid=pageid; | ||
| − |        Triple  | + |        Triple noTriple=query.selectSingle(pageid,"no",null); | 
| − |        if ( | + |        if (noTriple==null) | 
| − | + |          noTriple=query.selectSingle(pageid,"Property:Ticket_no",null); | |
| − |        if ( | + |        if (noTriple!=null)   | 
| − | + |          no=noTriple.getObject().toString(); | |
|        Triple titleTriple=query.selectSingle(pageid,"title",null); |        Triple titleTriple=query.selectSingle(pageid,"title",null); | ||
|        if (titleTriple==null) |        if (titleTriple==null) | ||
| − |          titleTriple=query.selectSingle(pageid,"Property: | + |          titleTriple=query.selectSingle(pageid,"Property:Ticket_title",null); | 
|        if (titleTriple!=null)   |        if (titleTriple!=null)   | ||
|          title=titleTriple.getObject().toString(); |          title=titleTriple.getObject().toString(); | ||
| − |        Triple  | + |        Triple projectTriple=query.selectSingle(pageid,"project",null); | 
| − |        if ( | + |        if (projectTriple==null) | 
| − | + |          projectTriple=query.selectSingle(pageid,"Property:Ticket_project",null); | |
| − |        if ( | + |        if (projectTriple!=null)   | 
| − | + |          project=projectTriple.getObject().toString(); | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|        init(query); |        init(query); | ||
| − |      } // constructor for  | + |      } // constructor for Ticket | 
| − |      // >>>{user defined topic code}{ | + |      // >>>{user defined topic code}{Ticket}{Ticket} | 
| − |      // <<<{user defined topic code}{ | + |      // <<<{user defined topic code}{Ticket}{Ticket} | 
| − |    } // class  | + |    } // class Ticket | 
|    /** |    /** | ||
| − |     * Manager for  | + |     * Manager for Ticket | 
|     */ |     */ | ||
| − |    public static class  | + |    public static class TicketManager extends TopicBase { | 
| − |      public String topicName=" | + |      public String topicName="Ticket"; | 
| − |      public transient List< | + |      public transient List<Ticket> mTickets=new ArrayList<Ticket>(); | 
| − |      public transient Map<String, | + |      public transient Map<String,Ticket> mTicketMap=new LinkedHashMap<String,Ticket>(); | 
|      /** |      /** | ||
| − |       * get my  | + |       * get my Tickets | 
|       */ |       */ | ||
| − |      public List< | + |      public List<Ticket> getTickets() { | 
| − |        List< | + |        List<Ticket> result=this.mTickets; | 
|        return result; |        return result; | ||
|      } |      } | ||
|      /** |      /** | ||
| − |       *  add a new  | + |       *  add a new Ticket  | 
|       */ |       */ | ||
| − |      public  | + |      public Ticket add(Ticket pTicket) { | 
| − | + |        mTickets.add(pTicket); | |
| − | + |        mTicketMap.put(pTicket.getPageid(),pTicket); | |
| − |        return  | + |        return pTicket; | 
|      } |      } | ||
|      /** |      /** | ||
| − |       *  add a new  | + |       *  add a new Ticket from the given triple | 
|       */ |       */ | ||
| − |      public  | + |      public Ticket add(TripleQuery query,Triple pTicketTriple) { | 
| − | + |        Ticket lTicket=new Ticket(query,pTicketTriple); | |
| − |        add( | + |        add(lTicket); | 
| − |        return  | + |        return lTicket; | 
|      } |      } | ||
| − |      // reinitialize my  | + |      // reinitialize my mTicket map | 
|      public void reinit() { |      public void reinit() { | ||
| − | + |        mTicketMap.clear(); | |
| − |        for ( | + |        for (Ticket lTicket:mTickets) { | 
| − | + |          mTicketMap.put(lTicket.getPageid(),lTicket); | |
|        } |        } | ||
|      } |      } | ||
| Line 460: | Line 480: | ||
|      // get a new manager from the given json string |      // get a new manager from the given json string | ||
| − |      public static  | + |      public static TicketManager fromJson(String json) { | 
| − | + |        TicketManager result=JSON.parseObject(json, TicketManager.class); | |
|        result.reinit(); |        result.reinit(); | ||
|        return result; |        return result; | ||
|      } |      } | ||
| − |      // default constructor for  | + |      // default constructor for Ticket Manager | 
| − |      public  | + |      public TicketManager() {} | 
| − |      // add  | + |      // add Tickets from the given query | 
| − |      public void  | + |      public void addTickets(TripleQuery pTicketQuery,TripleQuery query) { | 
| − |        if ( | + |        if (pTicketQuery!=null) { | 
| − |          for (Triple  | + |          for (Triple lTicketTriple:pTicketQuery.getTriples()) { | 
| − |            add(query, | + |            add(query,lTicketTriple); | 
|          } |          } | ||
|        } |        } | ||
| Line 479: | Line 499: | ||
|      // construct me from the given triple Query query |      // construct me from the given triple Query query | ||
| − |      public  | + |      public TicketManager(TripleQuery query) { | 
|        // first query the SiDIF bases triplestore |        // first query the SiDIF bases triplestore | ||
| − |        TripleQuery  | + |        TripleQuery lTicketQuery=query.query(null,"isA","Ticket"); | 
| − | + |        addTickets(lTicketQuery,query); | |
|        // then the SMW triplestore |        // then the SMW triplestore | ||
| − | + |        lTicketQuery=query.query(null,"Property:IsA","Ticket"); | |
| − | + |        addTickets(lTicketQuery,query); | |
|        init(query); |        init(query); | ||
| − |      } // constructor for  | + |      } // constructor for Ticket Manager | 
| − |      // >>>{user defined topicmanager code}{ | + |      // >>>{user defined topicmanager code}{Ticket}{Ticket} | 
| − |      // <<<{user defined topicmanager code}{ | + |      // <<<{user defined topicmanager code}{Ticket}{Ticket} | 
| − |    } // class  | + |    } // class Ticket Manager | 
|   /** |   /** | ||
| − |    *  | + |    * Commit | 
| − |    *  | + |    * A Git commit | 
|    */ |    */ | ||
| − |    public static class  | + |    public static class Commit extends TopicBase { | 
| − |      public String  | + |      public String host; | 
| − |      public String  | + |      public String path; | 
| − |      public String  | + |      public String project; | 
| − |      public String  | + |      public String subject; | 
| − |      public String  | + |      public String name; | 
| + |     public String date; | ||
| + |     public String hash; | ||
| − |      public String  | + |      public String getHost() { return host; } | 
| − |      public void  | + |      public void setHost(String pHost) { host=pHost; } | 
| − |      public String  | + |      public String getPath() { return path; } | 
| − |      public void  | + |      public void setPath(String pPath) { path=pPath; } | 
| − |      public String  | + |      public String getProject() { return project; } | 
| − |      public void  | + |      public void setProject(String pProject) { project=pProject; } | 
| − |      public String  | + |      public String getSubject() { return subject; } | 
| − |      public void  | + |      public void setSubject(String pSubject) { subject=pSubject; } | 
| − |      public String  | + |      public String getName() { return name; } | 
| − |      public void  | + |      public void setName(String pName) { name=pName; } | 
| + |     public String getDate() { return date; } | ||
| + |     public void setDate(String pDate) { date=pDate; } | ||
| + |     public String getHash() { return hash; } | ||
| + |     public void setHash(String pHash) { hash=pHash; } | ||
|      /** |      /** | ||
| − |       * convert this  | + |       * convert this Commit to a JSON string | 
|       */ |       */ | ||
|      public String toJson() { return JSON.toJSONString(this); } |      public String toJson() { return JSON.toJSONString(this); } | ||
|      /** |      /** | ||
| − |       * convert this  | + |       * convert this Commit to a WikiSon string | 
| − |       * @return the WikiSon representation of this  | + |       * @return the WikiSon representation of this Commit | 
|       */ |       */ | ||
|      public String toWikiSon() { |      public String toWikiSon() { | ||
| − |        String wikison= "{{ | + |        String wikison= "{{Commit\n"; | 
| − |        wikison+=toWikiSon(" | + |        wikison+=toWikiSon("host",host); | 
| − |        wikison+=toWikiSon(" | + |        wikison+=toWikiSon("path",path); | 
| − |        wikison+=toWikiSon(" | + |        wikison+=toWikiSon("project",project); | 
| − |        wikison+=toWikiSon(" | + |        wikison+=toWikiSon("subject",subject); | 
| − |        wikison+=toWikiSon(" | + |        wikison+=toWikiSon("name",name); | 
| + |       wikison+=toWikiSon("date",date); | ||
| + |       wikison+=toWikiSon("hash",hash); | ||
|        wikison+="}}\n"; |        wikison+="}}\n"; | ||
|        return wikison; |        return wikison; | ||
| Line 535: | Line 563: | ||
|      /** |      /** | ||
| − |       * convert this  | + |       * convert this Commit to a SiDIF string | 
| − |       * @return the SiDIF representation of this  | + |       * @return the SiDIF representation of this Commit | 
|       */ |       */ | ||
|      public String toSiDIF() { |      public String toSiDIF() { | ||
| − |        String siDIF = String.format("%s isA  | + |        String siDIF = String.format("%s isA Commit\n",this.pageid); | 
| − |        siDIF+=propertySiDIF(" | + |        siDIF+=propertySiDIF("host",host,"URL"); | 
| − |        siDIF+=propertySiDIF(" | + |       siDIF+=propertySiDIF("path",path,"Text"); | 
| − |        siDIF+=propertySiDIF(" | + |        siDIF+=propertySiDIF("project",project,"Text"); | 
| − |        siDIF+=propertySiDIF(" | + |        siDIF+=propertySiDIF("subject",subject,"Text"); | 
| − |        siDIF+=propertySiDIF(" | + |        siDIF+=propertySiDIF("name",name,"Text"); | 
| + |        siDIF+=propertySiDIF("date",date,"Date"); | ||
| + |       siDIF+=propertySiDIF("hash",hash,"Text"); | ||
|        return siDIF; |        return siDIF; | ||
|      } |      } | ||
| Line 554: | Line 584: | ||
|      /** |      /** | ||
| − |       * default constructor for  | + |       * default constructor for Commit | 
|       */ |       */ | ||
| − |      public  | + |      public Commit() {} | 
|      /** |      /** | ||
| − |       * construct a  | + |       * construct a Commit from the given Triple | 
|       * @param query - the TripleQuery to get the triples from |       * @param query - the TripleQuery to get the triples from | ||
| − |       * @param  | + |       * @param pCommitTriple - the triple to construct me from | 
|       */ |       */ | ||
| − |      public  | + |      public Commit(TripleQuery query,Triple pCommitTriple) { | 
| − |        this(query, | + |        this(query,pCommitTriple.getSubject().toString()); | 
|      } // constructor |      } // constructor | ||
|      /** |      /** | ||
| − |       * construct a  | + |       * construct a Commit 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  | + |      public Commit(TripleQuery query,String pageid) { | 
|        this.pageid=pageid; |        this.pageid=pageid; | ||
| − |        Triple  | + |        Triple hostTriple=query.selectSingle(pageid,"host",null); | 
| − |        if ( | + |        if (hostTriple==null) | 
| − | + |          hostTriple=query.selectSingle(pageid,"Property:Commit_host",null); | |
| − |        if ( | + |        if (hostTriple!=null)   | 
| − | + |          host=hostTriple.getObject().toString(); | |
| − |        Triple  | + |        Triple pathTriple=query.selectSingle(pageid,"path",null); | 
| − |        if ( | + |        if (pathTriple==null) | 
| − | + |          pathTriple=query.selectSingle(pageid,"Property:Commit_path",null); | |
| − |        if ( | + |        if (pathTriple!=null)   | 
| − | + |          path=pathTriple.getObject().toString(); | |
| − |        Triple  | + |        Triple projectTriple=query.selectSingle(pageid,"project",null); | 
| − |        if ( | + |        if (projectTriple==null) | 
| − | + |          projectTriple=query.selectSingle(pageid,"Property:Commit_project",null); | |
| − |        if ( | + |        if (projectTriple!=null)   | 
| − | + |          project=projectTriple.getObject().toString(); | |
| − |        Triple  | + |        Triple subjectTriple=query.selectSingle(pageid,"subject",null); | 
| − |        if ( | + |        if (subjectTriple==null) | 
| − | + |          subjectTriple=query.selectSingle(pageid,"Property:Commit_subject",null); | |
| − |        if ( | + |        if (subjectTriple!=null)   | 
| − | + |          subject=subjectTriple.getObject().toString(); | |
| − |        Triple  | + |        Triple nameTriple=query.selectSingle(pageid,"name",null); | 
| − |        if ( | + |        if (nameTriple==null) | 
| − | + |          nameTriple=query.selectSingle(pageid,"Property:Commit_name",null); | |
| − |        if ( | + |        if (nameTriple!=null)   | 
| − | + |          name=nameTriple.getObject().toString(); | |
| + |       Triple dateTriple=query.selectSingle(pageid,"date",null); | ||
| + |       if (dateTriple==null) | ||
| + |         dateTriple=query.selectSingle(pageid,"Property:Commit_date",null); | ||
| + |       if (dateTriple!=null)  | ||
| + |         date=dateTriple.getObject().toString(); | ||
| + |       Triple hashTriple=query.selectSingle(pageid,"hash",null); | ||
| + |       if (hashTriple==null) | ||
| + |         hashTriple=query.selectSingle(pageid,"Property:Commit_hash",null); | ||
| + |       if (hashTriple!=null)  | ||
| + |         hash=hashTriple.getObject().toString(); | ||
|        init(query); |        init(query); | ||
| − |      } // constructor for  | + |      } // constructor for Commit | 
| − |      // >>>{user defined topic code}{ | + |      // >>>{user defined topic code}{Commit}{Commit} | 
| − |      // <<<{user defined topic code}{ | + |      // <<<{user defined topic code}{Commit}{Commit} | 
| − |    } // class  | + |    } // class Commit | 
|    /** |    /** | ||
| − |     * Manager for  | + |     * Manager for Commit | 
|     */ |     */ | ||
| − |    public static class  | + |    public static class CommitManager extends TopicBase { | 
| − |      public String topicName=" | + |      public String topicName="Commit"; | 
| − |      public transient List< | + |      public transient List<Commit> mCommits=new ArrayList<Commit>(); | 
| − |      public transient Map<String, | + |      public transient Map<String,Commit> mCommitMap=new LinkedHashMap<String,Commit>(); | 
|      /** |      /** | ||
| − |       * get my  | + |       * get my Commits | 
|       */ |       */ | ||
| − |      public List< | + |      public List<Commit> getCommits() { | 
| − |        List< | + |        List<Commit> result=this.mCommits; | 
|        return result; |        return result; | ||
|      } |      } | ||
|      /** |      /** | ||
| − |       *  add a new  | + |       *  add a new Commit  | 
|       */ |       */ | ||
| − |      public  | + |      public Commit add(Commit pCommit) { | 
| − | + |        mCommits.add(pCommit); | |
| − | + |        mCommitMap.put(pCommit.getPageid(),pCommit); | |
| − |        return  | + |        return pCommit; | 
|      } |      } | ||
|      /** |      /** | ||
| − |       *  add a new  | + |       *  add a new Commit from the given triple | 
|       */ |       */ | ||
| − |      public  | + |      public Commit add(TripleQuery query,Triple pCommitTriple) { | 
| − | + |        Commit lCommit=new Commit(query,pCommitTriple); | |
| − |        add( | + |        add(lCommit); | 
| − |        return  | + |        return lCommit; | 
|      } |      } | ||
| − |      // reinitialize my  | + |      // reinitialize my mCommit map | 
|      public void reinit() { |      public void reinit() { | ||
| − | + |        mCommitMap.clear(); | |
| − |        for ( | + |        for (Commit lCommit:mCommits) { | 
| − | + |          mCommitMap.put(lCommit.getPageid(),lCommit); | |
|        } |        } | ||
|      } |      } | ||
| Line 652: | Line 692: | ||
|      // get a new manager from the given json string |      // get a new manager from the given json string | ||
| − |      public static  | + |      public static CommitManager fromJson(String json) { | 
| − | + |        CommitManager result=JSON.parseObject(json, CommitManager.class); | |
|        result.reinit(); |        result.reinit(); | ||
|        return result; |        return result; | ||
|      } |      } | ||
| − |      // default constructor for  | + |      // default constructor for Commit Manager | 
| − |      public  | + |      public CommitManager() {} | 
| − |      // add  | + |      // add Commits from the given query | 
| − |      public void  | + |      public void addCommits(TripleQuery pCommitQuery,TripleQuery query) { | 
| − |        if ( | + |        if (pCommitQuery!=null) { | 
| − |          for (Triple  | + |          for (Triple lCommitTriple:pCommitQuery.getTriples()) { | 
| − |            add(query, | + |            add(query,lCommitTriple); | 
|          } |          } | ||
|        } |        } | ||
| Line 671: | Line 711: | ||
|      // construct me from the given triple Query query |      // construct me from the given triple Query query | ||
| − |      public  | + |      public CommitManager(TripleQuery query) { | 
|        // first query the SiDIF bases triplestore |        // first query the SiDIF bases triplestore | ||
| − |        TripleQuery  | + |        TripleQuery lCommitQuery=query.query(null,"isA","Commit"); | 
| − | + |        addCommits(lCommitQuery,query); | |
|        // then the SMW triplestore |        // then the SMW triplestore | ||
| − | + |        lCommitQuery=query.query(null,"Property:IsA","Commit"); | |
| − | + |        addCommits(lCommitQuery,query); | |
|        init(query); |        init(query); | ||
| − |      } // constructor for  | + |      } // constructor for Commit Manager | 
| − |      // >>>{user defined topicmanager code}{ | + |      // >>>{user defined topicmanager code}{Commit}{Commit} | 
| − |      // <<<{user defined topicmanager code}{ | + |      // <<<{user defined topicmanager code}{Commit}{Commit} | 
| − |    } // class  | + |    } // class Commit Manager | 
| } | } | ||
| </source> | </source> | ||
Latest revision as of 08:08, 24 January 2022
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
 /**
  * OsProject
  * An Open Source Project
  */
  public static class OsProject extends TopicBase {
  
    public String id;
    public String state;
    public String owner;
    public String title;
    public String url;
    public String description;
    public String version;
    public String date;
    public String since;
    public String until;
    public String getId() { return id; }
    public void setId(String pId) { id=pId; }
    public String getState() { return state; }
    public void setState(String pState) { state=pState; }
    public String getOwner() { return owner; }
    public void setOwner(String pOwner) { owner=pOwner; }
    public String getTitle() { return title; }
    public void setTitle(String pTitle) { title=pTitle; }
    public String getUrl() { return url; }
    public void setUrl(String pUrl) { url=pUrl; }
    public String getDescription() { return description; }
    public void setDescription(String pDescription) { description=pDescription; }
    public String getVersion() { return version; }
    public void setVersion(String pVersion) { version=pVersion; }
    public String getDate() { return date; }
    public void setDate(String pDate) { date=pDate; }
    public String getSince() { return since; }
    public void setSince(String pSince) { since=pSince; }
    public String getUntil() { return until; }
    public void setUntil(String pUntil) { until=pUntil; }
    /**
     * convert this OsProject to a JSON string
     */
    public String toJson() { return JSON.toJSONString(this); }
    /**
     * convert this OsProject to a WikiSon string
     * @return the WikiSon representation of this OsProject
     */
    public String toWikiSon() {
      String wikison= "{{OsProject\n";
      wikison+=toWikiSon("id",id);
      wikison+=toWikiSon("state",state);
      wikison+=toWikiSon("owner",owner);
      wikison+=toWikiSon("title",title);
      wikison+=toWikiSon("url",url);
      wikison+=toWikiSon("description",description);
      wikison+=toWikiSon("version",version);
      wikison+=toWikiSon("date",date);
      wikison+=toWikiSon("since",since);
      wikison+=toWikiSon("until",until);
      wikison+="}}\n";
      return wikison;
    }
    /**
     * convert this OsProject to a SiDIF string
     * @return the SiDIF representation of this OsProject
     */
    public String toSiDIF() {
      String siDIF = String.format("%s isA OsProject\n",this.pageid);
      siDIF+=propertySiDIF("id",id,"Text");
      siDIF+=propertySiDIF("state",state,"Text");
      siDIF+=propertySiDIF("owner",owner,"Text");
      siDIF+=propertySiDIF("title",title,"Text");
      siDIF+=propertySiDIF("url",url,"Text");
      siDIF+=propertySiDIF("description",description,"Text");
      siDIF+=propertySiDIF("version",version,"Text");
      siDIF+=propertySiDIF("date",date,"Date");
      siDIF+=propertySiDIF("since",since,"Date");
      siDIF+=propertySiDIF("until",until,"Date");
      return siDIF;
    }
 
    /**  
     * get the pageid for this topic
     */
    public String getPageid() { return pageid; };
    /**
     * default constructor for OsProject
     */
    public OsProject() {}
    /**
     * construct a OsProject from the given Triple
     * @param query - the TripleQuery to get the triples from
     * @param pOsProjectTriple - the triple to construct me from
     */
    public OsProject(TripleQuery query,Triple pOsProjectTriple) {
      this(query,pOsProjectTriple.getSubject().toString());
    } // constructor
    /**
     * construct a OsProject from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public OsProject(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple idTriple=query.selectSingle(pageid,"id",null);
      if (idTriple==null)
        idTriple=query.selectSingle(pageid,"Property:OsProject_id",null);
      if (idTriple!=null) 
        id=idTriple.getObject().toString();
      Triple stateTriple=query.selectSingle(pageid,"state",null);
      if (stateTriple==null)
        stateTriple=query.selectSingle(pageid,"Property:OsProject_state",null);
      if (stateTriple!=null) 
        state=stateTriple.getObject().toString();
      Triple ownerTriple=query.selectSingle(pageid,"owner",null);
      if (ownerTriple==null)
        ownerTriple=query.selectSingle(pageid,"Property:OsProject_owner",null);
      if (ownerTriple!=null) 
        owner=ownerTriple.getObject().toString();
      Triple titleTriple=query.selectSingle(pageid,"title",null);
      if (titleTriple==null)
        titleTriple=query.selectSingle(pageid,"Property:OsProject_title",null);
      if (titleTriple!=null) 
        title=titleTriple.getObject().toString();
      Triple urlTriple=query.selectSingle(pageid,"url",null);
      if (urlTriple==null)
        urlTriple=query.selectSingle(pageid,"Property:OsProject_url",null);
      if (urlTriple!=null) 
        url=urlTriple.getObject().toString();
      Triple descriptionTriple=query.selectSingle(pageid,"description",null);
      if (descriptionTriple==null)
        descriptionTriple=query.selectSingle(pageid,"Property:OsProject_description",null);
      if (descriptionTriple!=null) 
        description=descriptionTriple.getObject().toString();
      Triple versionTriple=query.selectSingle(pageid,"version",null);
      if (versionTriple==null)
        versionTriple=query.selectSingle(pageid,"Property:OsProject_version",null);
      if (versionTriple!=null) 
        version=versionTriple.getObject().toString();
      Triple dateTriple=query.selectSingle(pageid,"date",null);
      if (dateTriple==null)
        dateTriple=query.selectSingle(pageid,"Property:OsProject_date",null);
      if (dateTriple!=null) 
        date=dateTriple.getObject().toString();
      Triple sinceTriple=query.selectSingle(pageid,"since",null);
      if (sinceTriple==null)
        sinceTriple=query.selectSingle(pageid,"Property:OsProject_since",null);
      if (sinceTriple!=null) 
        since=sinceTriple.getObject().toString();
      Triple untilTriple=query.selectSingle(pageid,"until",null);
      if (untilTriple==null)
        untilTriple=query.selectSingle(pageid,"Property:OsProject_until",null);
      if (untilTriple!=null) 
        until=untilTriple.getObject().toString();
      init(query);
    } // constructor for OsProject
    
    // >>>{user defined topic code}{OsProject}{OsProject}
    // <<<{user defined topic code}{OsProject}{OsProject}
  } // class OsProject
  /**
   * Manager for OsProject
   */
  public static class OsProjectManager extends TopicBase {
 
    public String topicName="OsProject";
    public transient List<OsProject> mOsProjects=new ArrayList<OsProject>();
    public transient Map<String,OsProject> mOsProjectMap=new LinkedHashMap<String,OsProject>();
    /**
     * get my OsProjects
     */
    public List<OsProject> getOsProjects() {
      List<OsProject> result=this.mOsProjects;
      return result;
    }
    /**
     *  add a new OsProject 
     */
    public OsProject add(OsProject pOsProject) {
      mOsProjects.add(pOsProject);
      mOsProjectMap.put(pOsProject.getPageid(),pOsProject);
      return pOsProject;
    }
    /**
     *  add a new OsProject from the given triple
     */
    public OsProject add(TripleQuery query,Triple pOsProjectTriple) {
      OsProject lOsProject=new OsProject(query,pOsProjectTriple);
      add(lOsProject);
      return lOsProject;
    }
    // reinitialize my mOsProject map
    public void reinit() {
      mOsProjectMap.clear();
      for (OsProject lOsProject:mOsProjects) {
        mOsProjectMap.put(lOsProject.getPageid(),lOsProject);
      }
    }
    // convert this manager to json format 
    public String toJson() { return JSON.toJSONString(this); }
    
    // get a new manager from the given json string
    public static OsProjectManager fromJson(String json) {
      OsProjectManager result=JSON.parseObject(json, OsProjectManager.class);
      result.reinit();
      return result;
    }
    // default constructor for OsProject Manager
    public OsProjectManager() {}
    // add OsProjects from the given query
    public void addOsProjects(TripleQuery pOsProjectQuery,TripleQuery query) {
      if (pOsProjectQuery!=null) {
        for (Triple lOsProjectTriple:pOsProjectQuery.getTriples()) {
          add(query,lOsProjectTriple);
        }
      }
    }
    // construct me from the given triple Query query
    public OsProjectManager(TripleQuery query) {
      // first query the SiDIF bases triplestore
      TripleQuery lOsProjectQuery=query.query(null,"isA","OsProject");
      addOsProjects(lOsProjectQuery,query);
      // then the SMW triplestore
      lOsProjectQuery=query.query(null,"Property:IsA","OsProject");
      addOsProjects(lOsProjectQuery,query);
      init(query);
    } // constructor for OsProject Manager
    
    // >>>{user defined topicmanager code}{OsProject}{OsProject}
    // <<<{user defined topicmanager code}{OsProject}{OsProject}
  } // class OsProject Manager
 /**
  * Ticket
  * A ticket is an issue in an open source project
  */
  public static class Ticket extends TopicBase {
  
    public String no;
    public String title;
    public String project;
    public String getNo() { return no; }
    public void setNo(String pNo) { no=pNo; }
    public String getTitle() { return title; }
    public void setTitle(String pTitle) { title=pTitle; }
    public String getProject() { return project; }
    public void setProject(String pProject) { project=pProject; }
    /**
     * convert this Ticket to a JSON string
     */
    public String toJson() { return JSON.toJSONString(this); }
    /**
     * convert this Ticket to a WikiSon string
     * @return the WikiSon representation of this Ticket
     */
    public String toWikiSon() {
      String wikison= "{{Ticket\n";
      wikison+=toWikiSon("no",no);
      wikison+=toWikiSon("title",title);
      wikison+=toWikiSon("project",project);
      wikison+="}}\n";
      return wikison;
    }
    /**
     * convert this Ticket to a SiDIF string
     * @return the SiDIF representation of this Ticket
     */
    public String toSiDIF() {
      String siDIF = String.format("%s isA Ticket\n",this.pageid);
      siDIF+=propertySiDIF("no",no,"Text");
      siDIF+=propertySiDIF("title",title,"Text");
      siDIF+=propertySiDIF("project",project,"Page");
      return siDIF;
    }
 
    /**  
     * get the pageid for this topic
     */
    public String getPageid() { return pageid; };
    /**
     * default constructor for Ticket
     */
    public Ticket() {}
    /**
     * construct a Ticket from the given Triple
     * @param query - the TripleQuery to get the triples from
     * @param pTicketTriple - the triple to construct me from
     */
    public Ticket(TripleQuery query,Triple pTicketTriple) {
      this(query,pTicketTriple.getSubject().toString());
    } // constructor
    /**
     * construct a Ticket from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public Ticket(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple noTriple=query.selectSingle(pageid,"no",null);
      if (noTriple==null)
        noTriple=query.selectSingle(pageid,"Property:Ticket_no",null);
      if (noTriple!=null) 
        no=noTriple.getObject().toString();
      Triple titleTriple=query.selectSingle(pageid,"title",null);
      if (titleTriple==null)
        titleTriple=query.selectSingle(pageid,"Property:Ticket_title",null);
      if (titleTriple!=null) 
        title=titleTriple.getObject().toString();
      Triple projectTriple=query.selectSingle(pageid,"project",null);
      if (projectTriple==null)
        projectTriple=query.selectSingle(pageid,"Property:Ticket_project",null);
      if (projectTriple!=null) 
        project=projectTriple.getObject().toString();
      init(query);
    } // constructor for Ticket
    
    // >>>{user defined topic code}{Ticket}{Ticket}
    // <<<{user defined topic code}{Ticket}{Ticket}
  } // class Ticket
  /**
   * Manager for Ticket
   */
  public static class TicketManager extends TopicBase {
 
    public String topicName="Ticket";
    public transient List<Ticket> mTickets=new ArrayList<Ticket>();
    public transient Map<String,Ticket> mTicketMap=new LinkedHashMap<String,Ticket>();
    /**
     * get my Tickets
     */
    public List<Ticket> getTickets() {
      List<Ticket> result=this.mTickets;
      return result;
    }
    /**
     *  add a new Ticket 
     */
    public Ticket add(Ticket pTicket) {
      mTickets.add(pTicket);
      mTicketMap.put(pTicket.getPageid(),pTicket);
      return pTicket;
    }
    /**
     *  add a new Ticket from the given triple
     */
    public Ticket add(TripleQuery query,Triple pTicketTriple) {
      Ticket lTicket=new Ticket(query,pTicketTriple);
      add(lTicket);
      return lTicket;
    }
    // reinitialize my mTicket map
    public void reinit() {
      mTicketMap.clear();
      for (Ticket lTicket:mTickets) {
        mTicketMap.put(lTicket.getPageid(),lTicket);
      }
    }
    // convert this manager to json format 
    public String toJson() { return JSON.toJSONString(this); }
    
    // get a new manager from the given json string
    public static TicketManager fromJson(String json) {
      TicketManager result=JSON.parseObject(json, TicketManager.class);
      result.reinit();
      return result;
    }
    // default constructor for Ticket Manager
    public TicketManager() {}
    // add Tickets from the given query
    public void addTickets(TripleQuery pTicketQuery,TripleQuery query) {
      if (pTicketQuery!=null) {
        for (Triple lTicketTriple:pTicketQuery.getTriples()) {
          add(query,lTicketTriple);
        }
      }
    }
    // construct me from the given triple Query query
    public TicketManager(TripleQuery query) {
      // first query the SiDIF bases triplestore
      TripleQuery lTicketQuery=query.query(null,"isA","Ticket");
      addTickets(lTicketQuery,query);
      // then the SMW triplestore
      lTicketQuery=query.query(null,"Property:IsA","Ticket");
      addTickets(lTicketQuery,query);
      init(query);
    } // constructor for Ticket Manager
    
    // >>>{user defined topicmanager code}{Ticket}{Ticket}
    // <<<{user defined topicmanager code}{Ticket}{Ticket}
  } // class Ticket Manager
 /**
  * Commit
  * A Git commit
  */
  public static class Commit extends TopicBase {
  
    public String host;
    public String path;
    public String project;
    public String subject;
    public String name;
    public String date;
    public String hash;
    public String getHost() { return host; }
    public void setHost(String pHost) { host=pHost; }
    public String getPath() { return path; }
    public void setPath(String pPath) { path=pPath; }
    public String getProject() { return project; }
    public void setProject(String pProject) { project=pProject; }
    public String getSubject() { return subject; }
    public void setSubject(String pSubject) { subject=pSubject; }
    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 getHash() { return hash; }
    public void setHash(String pHash) { hash=pHash; }
    /**
     * convert this Commit to a JSON string
     */
    public String toJson() { return JSON.toJSONString(this); }
    /**
     * convert this Commit to a WikiSon string
     * @return the WikiSon representation of this Commit
     */
    public String toWikiSon() {
      String wikison= "{{Commit\n";
      wikison+=toWikiSon("host",host);
      wikison+=toWikiSon("path",path);
      wikison+=toWikiSon("project",project);
      wikison+=toWikiSon("subject",subject);
      wikison+=toWikiSon("name",name);
      wikison+=toWikiSon("date",date);
      wikison+=toWikiSon("hash",hash);
      wikison+="}}\n";
      return wikison;
    }
    /**
     * convert this Commit to a SiDIF string
     * @return the SiDIF representation of this Commit
     */
    public String toSiDIF() {
      String siDIF = String.format("%s isA Commit\n",this.pageid);
      siDIF+=propertySiDIF("host",host,"URL");
      siDIF+=propertySiDIF("path",path,"Text");
      siDIF+=propertySiDIF("project",project,"Text");
      siDIF+=propertySiDIF("subject",subject,"Text");
      siDIF+=propertySiDIF("name",name,"Text");
      siDIF+=propertySiDIF("date",date,"Date");
      siDIF+=propertySiDIF("hash",hash,"Text");
      return siDIF;
    }
 
    /**  
     * get the pageid for this topic
     */
    public String getPageid() { return pageid; };
    /**
     * default constructor for Commit
     */
    public Commit() {}
    /**
     * construct a Commit from the given Triple
     * @param query - the TripleQuery to get the triples from
     * @param pCommitTriple - the triple to construct me from
     */
    public Commit(TripleQuery query,Triple pCommitTriple) {
      this(query,pCommitTriple.getSubject().toString());
    } // constructor
    /**
     * construct a Commit from the given pageId
     * @param query - the TripleQuery to get the triples from
     * @param pageid - pageid
     */
    public Commit(TripleQuery query,String pageid) {
      this.pageid=pageid;
      Triple hostTriple=query.selectSingle(pageid,"host",null);
      if (hostTriple==null)
        hostTriple=query.selectSingle(pageid,"Property:Commit_host",null);
      if (hostTriple!=null) 
        host=hostTriple.getObject().toString();
      Triple pathTriple=query.selectSingle(pageid,"path",null);
      if (pathTriple==null)
        pathTriple=query.selectSingle(pageid,"Property:Commit_path",null);
      if (pathTriple!=null) 
        path=pathTriple.getObject().toString();
      Triple projectTriple=query.selectSingle(pageid,"project",null);
      if (projectTriple==null)
        projectTriple=query.selectSingle(pageid,"Property:Commit_project",null);
      if (projectTriple!=null) 
        project=projectTriple.getObject().toString();
      Triple subjectTriple=query.selectSingle(pageid,"subject",null);
      if (subjectTriple==null)
        subjectTriple=query.selectSingle(pageid,"Property:Commit_subject",null);
      if (subjectTriple!=null) 
        subject=subjectTriple.getObject().toString();
      Triple nameTriple=query.selectSingle(pageid,"name",null);
      if (nameTriple==null)
        nameTriple=query.selectSingle(pageid,"Property:Commit_name",null);
      if (nameTriple!=null) 
        name=nameTriple.getObject().toString();
      Triple dateTriple=query.selectSingle(pageid,"date",null);
      if (dateTriple==null)
        dateTriple=query.selectSingle(pageid,"Property:Commit_date",null);
      if (dateTriple!=null) 
        date=dateTriple.getObject().toString();
      Triple hashTriple=query.selectSingle(pageid,"hash",null);
      if (hashTriple==null)
        hashTriple=query.selectSingle(pageid,"Property:Commit_hash",null);
      if (hashTriple!=null) 
        hash=hashTriple.getObject().toString();
      init(query);
    } // constructor for Commit
    
    // >>>{user defined topic code}{Commit}{Commit}
    // <<<{user defined topic code}{Commit}{Commit}
  } // class Commit
  /**
   * Manager for Commit
   */
  public static class CommitManager extends TopicBase {
 
    public String topicName="Commit";
    public transient List<Commit> mCommits=new ArrayList<Commit>();
    public transient Map<String,Commit> mCommitMap=new LinkedHashMap<String,Commit>();
    /**
     * get my Commits
     */
    public List<Commit> getCommits() {
      List<Commit> result=this.mCommits;
      return result;
    }
    /**
     *  add a new Commit 
     */
    public Commit add(Commit pCommit) {
      mCommits.add(pCommit);
      mCommitMap.put(pCommit.getPageid(),pCommit);
      return pCommit;
    }
    /**
     *  add a new Commit from the given triple
     */
    public Commit add(TripleQuery query,Triple pCommitTriple) {
      Commit lCommit=new Commit(query,pCommitTriple);
      add(lCommit);
      return lCommit;
    }
    // reinitialize my mCommit map
    public void reinit() {
      mCommitMap.clear();
      for (Commit lCommit:mCommits) {
        mCommitMap.put(lCommit.getPageid(),lCommit);
      }
    }
    // convert this manager to json format 
    public String toJson() { return JSON.toJSONString(this); }
    
    // get a new manager from the given json string
    public static CommitManager fromJson(String json) {
      CommitManager result=JSON.parseObject(json, CommitManager.class);
      result.reinit();
      return result;
    }
    // default constructor for Commit Manager
    public CommitManager() {}
    // add Commits from the given query
    public void addCommits(TripleQuery pCommitQuery,TripleQuery query) {
      if (pCommitQuery!=null) {
        for (Triple lCommitTriple:pCommitQuery.getTriples()) {
          add(query,lCommitTriple);
        }
      }
    }
    // construct me from the given triple Query query
    public CommitManager(TripleQuery query) {
      // first query the SiDIF bases triplestore
      TripleQuery lCommitQuery=query.query(null,"isA","Commit");
      addCommits(lCommitQuery,query);
      // then the SMW triplestore
      lCommitQuery=query.query(null,"Property:IsA","Commit");
      addCommits(lCommitQuery,query);
      init(query);
    } // constructor for Commit Manager
    
    // >>>{user defined topicmanager code}{Commit}{Commit}
    // <<<{user defined topicmanager code}{Commit}{Commit}
  } // class Commit Manager
}