Difference between revisions of "Concept:OsProject/Java"

From BITPlan Wiki
Jump to navigation Jump to search
m (created by WikiTask 2018-08-21T04:21:09Z)
m (created by WikiTask 2022-01-24T07:08:54Z)
 
(3 intermediate revisions by the same user not shown)
Line 99: Line 99:
 
   } // TopicBase
 
   } // TopicBase
 
  /**
 
  /**
   * Brainteaser
+
   * OsProject
   * BITPlan Newsletter
+
   * An Open Source Project
 
   */
 
   */
   public static class Brainteaser extends TopicBase {
+
   public static class OsProject extends TopicBase {
 
    
 
    
     public String issue;
+
     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 problem;
+
     public String since;
     public String solution;
+
     public String until;
    public String finishDate;
 
    public String pdf;
 
    public String page;
 
  
     public String getIssue() { return issue; }
+
     public String getId() { return id; }
     public void setIssue(String pIssue) { issue=pIssue; }
+
     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 getProblem() { return problem; }
+
     public String getSince() { return since; }
     public void setProblem(String pProblem) { problem=pProblem; }
+
     public void setSince(String pSince) { since=pSince; }
     public String getSolution() { return solution; }
+
     public String getUntil() { return until; }
     public void setSolution(String pSolution) { solution=pSolution; }
+
     public void setUntil(String pUntil) { until=pUntil; }
    public String getFinishDate() { return finishDate; }
 
    public void setFinishDate(String pFinishDate) { finishDate=pFinishDate; }
 
    public String getPdf() { return pdf; }
 
    public void setPdf(String pPdf) { pdf=pPdf; }
 
    public String getPage() { return page; }
 
    public void setPage(String pPage) { page=pPage; }
 
 
     /**
 
     /**
     * convert this Brainteaser to a JSON string
+
     * convert this OsProject to a JSON string
 
     */
 
     */
 
     public String toJson() { return JSON.toJSONString(this); }
 
     public String toJson() { return JSON.toJSONString(this); }
  
 
     /**
 
     /**
     * convert this Brainteaser to a WikiSon string
+
     * convert this OsProject to a WikiSon string
     * @return the WikiSon representation of this Brainteaser
+
     * @return the WikiSon representation of this OsProject
 
     */
 
     */
 
     public String toWikiSon() {
 
     public String toWikiSon() {
       String wikison= "{{Brainteaser\n";
+
       String wikison= "{{OsProject\n";
       wikison+=toWikiSon("issue",issue);
+
       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("problem",problem);
+
       wikison+=toWikiSon("since",since);
       wikison+=toWikiSon("solution",solution);
+
       wikison+=toWikiSon("until",until);
      wikison+=toWikiSon("finishDate",finishDate);
 
      wikison+=toWikiSon("pdf",pdf);
 
      wikison+=toWikiSon("page",page);
 
 
       wikison+="}}\n";
 
       wikison+="}}\n";
 
       return wikison;
 
       return wikison;
Line 149: Line 161:
  
 
     /**
 
     /**
     * convert this Brainteaser to a SiDIF string
+
     * convert this OsProject to a SiDIF string
     * @return the SiDIF representation of this Brainteaser
+
     * @return the SiDIF representation of this OsProject
 
     */
 
     */
 
     public String toSiDIF() {
 
     public String toSiDIF() {
       String siDIF = String.format("%s isA Brainteaser\n",this.pageid);
+
       String siDIF = String.format("%s isA OsProject\n",this.pageid);
       siDIF+=propertySiDIF("issue",issue,"Text");
+
       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("problem",problem,"Text");
+
       siDIF+=propertySiDIF("since",since,"Date");
       siDIF+=propertySiDIF("solution",solution,"Text");
+
       siDIF+=propertySiDIF("until",until,"Date");
      siDIF+=propertySiDIF("finishDate",finishDate,"Date");
 
      siDIF+=propertySiDIF("pdf",pdf,"Page");
 
      siDIF+=propertySiDIF("page",page,"Page");
 
 
       return siDIF;
 
       return siDIF;
 
     }
 
     }
Line 170: Line 185:
  
 
     /**
 
     /**
     * default constructor for Brainteaser
+
     * default constructor for OsProject
 
     */
 
     */
     public Brainteaser() {}
+
     public OsProject() {}
  
 
     /**
 
     /**
     * construct a Brainteaser from the given Triple
+
     * 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 pBrainteaserTriple - the triple to construct me from
+
     * @param pOsProjectTriple - the triple to construct me from
 
     */
 
     */
     public Brainteaser(TripleQuery query,Triple pBrainteaserTriple) {
+
     public OsProject(TripleQuery query,Triple pOsProjectTriple) {
       this(query,pBrainteaserTriple.getSubject().toString());
+
       this(query,pOsProjectTriple.getSubject().toString());
 
     } // constructor
 
     } // constructor
  
 
     /**
 
     /**
     * construct a Brainteaser from the given pageId
+
     * 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 Brainteaser(TripleQuery query,String pageid) {
+
     public OsProject(TripleQuery query,String pageid) {
 
       this.pageid=pageid;
 
       this.pageid=pageid;
       Triple issueTriple=query.selectSingle(pageid,"issue",null);
+
       Triple idTriple=query.selectSingle(pageid,"id",null);
       if (issueTriple==null)
+
       if (idTriple==null)
         issueTriple=query.selectSingle(pageid,"Property:Brainteaser_issue",null);
+
         idTriple=query.selectSingle(pageid,"Property:OsProject_id",null);
       if (issueTriple!=null)  
+
       if (idTriple!=null)  
         issue=issueTriple.getObject().toString();
+
         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:Brainteaser_date",null);
+
         dateTriple=query.selectSingle(pageid,"Property:OsProject_date",null);
 
       if (dateTriple!=null)  
 
       if (dateTriple!=null)  
 
         date=dateTriple.getObject().toString();
 
         date=dateTriple.getObject().toString();
       Triple problemTriple=query.selectSingle(pageid,"problem",null);
+
       Triple sinceTriple=query.selectSingle(pageid,"since",null);
       if (problemTriple==null)
+
       if (sinceTriple==null)
         problemTriple=query.selectSingle(pageid,"Property:Brainteaser_problem",null);
+
         sinceTriple=query.selectSingle(pageid,"Property:OsProject_since",null);
       if (problemTriple!=null)  
+
       if (sinceTriple!=null)  
         problem=problemTriple.getObject().toString();
+
         since=sinceTriple.getObject().toString();
       Triple solutionTriple=query.selectSingle(pageid,"solution",null);
+
       Triple untilTriple=query.selectSingle(pageid,"until",null);
       if (solutionTriple==null)
+
       if (untilTriple==null)
         solutionTriple=query.selectSingle(pageid,"Property:Brainteaser_solution",null);
+
         untilTriple=query.selectSingle(pageid,"Property:OsProject_until",null);
       if (solutionTriple!=null)  
+
       if (untilTriple!=null)  
         solution=solutionTriple.getObject().toString();
+
         until=untilTriple.getObject().toString();
      Triple finishDateTriple=query.selectSingle(pageid,"finishDate",null);
 
      if (finishDateTriple==null)
 
        finishDateTriple=query.selectSingle(pageid,"Property:Brainteaser_finishDate",null);
 
      if (finishDateTriple!=null)
 
        finishDate=finishDateTriple.getObject().toString();
 
      Triple pdfTriple=query.selectSingle(pageid,"pdf",null);
 
      if (pdfTriple==null)
 
        pdfTriple=query.selectSingle(pageid,"Property:Brainteaser_pdf",null);
 
      if (pdfTriple!=null)
 
        pdf=pdfTriple.getObject().toString();
 
      Triple pageTriple=query.selectSingle(pageid,"page",null);
 
      if (pageTriple==null)
 
        pageTriple=query.selectSingle(pageid,"Property:Brainteaser_page",null);
 
      if (pageTriple!=null)
 
        page=pageTriple.getObject().toString();
 
 
       init(query);
 
       init(query);
     } // constructor for Brainteaser
+
     } // constructor for OsProject
 
      
 
      
     // >>>{user defined topic code}{Brainteaser}{Brainteaser}
+
     // >>>{user defined topic code}{OsProject}{OsProject}
     // <<<{user defined topic code}{Brainteaser}{Brainteaser}
+
     // <<<{user defined topic code}{OsProject}{OsProject}
   } // class Brainteaser
+
   } // class OsProject
 
   /**
 
   /**
   * Manager for Brainteaser
+
   * Manager for OsProject
 
   */
 
   */
   public static class BrainteaserManager extends TopicBase {
+
   public static class OsProjectManager extends TopicBase {
 
   
 
   
     public String topicName="Brainteaser";
+
     public String topicName="OsProject";
     public transient List<Brainteaser> mBrainteasers=new ArrayList<Brainteaser>();
+
     public transient List<OsProject> mOsProjects=new ArrayList<OsProject>();
     public transient Map<String,Brainteaser> mBrainteaserMap=new LinkedHashMap<String,Brainteaser>();
+
     public transient Map<String,OsProject> mOsProjectMap=new LinkedHashMap<String,OsProject>();
  
 
     /**
 
     /**
     * get my Brainteasers
+
     * get my OsProjects
 
     */
 
     */
     public List<Brainteaser> getBrainteasers() {
+
     public List<OsProject> getOsProjects() {
       List<Brainteaser> result=this.mBrainteasers;
+
       List<OsProject> result=this.mOsProjects;
 
       return result;
 
       return result;
 
     }
 
     }
  
 
     /**
 
     /**
     *  add a new Brainteaser
+
     *  add a new OsProject
 
     */
 
     */
     public Brainteaser add(Brainteaser pBrainteaser) {
+
     public OsProject add(OsProject pOsProject) {
       mBrainteasers.add(pBrainteaser);
+
       mOsProjects.add(pOsProject);
       mBrainteaserMap.put(pBrainteaser.getPageid(),pBrainteaser);
+
       mOsProjectMap.put(pOsProject.getPageid(),pOsProject);
       return pBrainteaser;
+
       return pOsProject;
 
     }
 
     }
  
 
     /**
 
     /**
     *  add a new Brainteaser from the given triple
+
     *  add a new OsProject from the given triple
 
     */
 
     */
     public Brainteaser add(TripleQuery query,Triple pBrainteaserTriple) {
+
     public OsProject add(TripleQuery query,Triple pOsProjectTriple) {
       Brainteaser lBrainteaser=new Brainteaser(query,pBrainteaserTriple);
+
       OsProject lOsProject=new OsProject(query,pOsProjectTriple);
       add(lBrainteaser);
+
       add(lOsProject);
       return lBrainteaser;
+
       return lOsProject;
 
     }
 
     }
  
     // reinitialize my mBrainteaser map
+
     // reinitialize my mOsProject map
 
     public void reinit() {
 
     public void reinit() {
       mBrainteaserMap.clear();
+
       mOsProjectMap.clear();
       for (Brainteaser lBrainteaser:mBrainteasers) {
+
       for (OsProject lOsProject:mOsProjects) {
         mBrainteaserMap.put(lBrainteaser.getPageid(),lBrainteaser);
+
         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 BrainteaserManager fromJson(String json) {
+
     public static OsProjectManager fromJson(String json) {
       BrainteaserManager result=JSON.parseObject(json, BrainteaserManager.class);
+
       OsProjectManager result=JSON.parseObject(json, OsProjectManager.class);
 
       result.reinit();
 
       result.reinit();
 
       return result;
 
       return result;
 
     }
 
     }
  
     // default constructor for Brainteaser Manager
+
     // default constructor for OsProject Manager
     public BrainteaserManager() {}
+
     public OsProjectManager() {}
  
     // add Brainteasers from the given query
+
     // add OsProjects from the given query
     public void addBrainteasers(TripleQuery pBrainteaserQuery,TripleQuery query) {
+
     public void addOsProjects(TripleQuery pOsProjectQuery,TripleQuery query) {
       if (pBrainteaserQuery!=null) {
+
       if (pOsProjectQuery!=null) {
         for (Triple lBrainteaserTriple:pBrainteaserQuery.getTriples()) {
+
         for (Triple lOsProjectTriple:pOsProjectQuery.getTriples()) {
           add(query,lBrainteaserTriple);
+
           add(query,lOsProjectTriple);
 
         }
 
         }
 
       }
 
       }
Line 297: Line 327:
  
 
     // construct me from the given triple Query query
 
     // construct me from the given triple Query query
     public BrainteaserManager(TripleQuery query) {
+
     public OsProjectManager(TripleQuery query) {
 
       // first query the SiDIF bases triplestore
 
       // first query the SiDIF bases triplestore
       TripleQuery lBrainteaserQuery=query.query(null,"isA","Brainteaser");
+
       TripleQuery lOsProjectQuery=query.query(null,"isA","OsProject");
       addBrainteasers(lBrainteaserQuery,query);
+
       addOsProjects(lOsProjectQuery,query);
 
       // then the SMW triplestore
 
       // then the SMW triplestore
       lBrainteaserQuery=query.query(null,"Property:IsA","Brainteaser");
+
       lOsProjectQuery=query.query(null,"Property:IsA","OsProject");
       addBrainteasers(lBrainteaserQuery,query);
+
       addOsProjects(lOsProjectQuery,query);
 
       init(query);
 
       init(query);
     } // constructor for Brainteaser Manager
+
     } // constructor for OsProject Manager
 
      
 
      
     // >>>{user defined topicmanager code}{Brainteaser}{Brainteaser}
+
     // >>>{user defined topicmanager code}{OsProject}{OsProject}
     // <<<{user defined topicmanager code}{Brainteaser}{Brainteaser}
+
     // <<<{user defined topicmanager code}{OsProject}{OsProject}
   } // class Brainteaser Manager
+
   } // class OsProject Manager
 
  /**
 
  /**
   * BlogEntry
+
   * Ticket
   * An Entry in the Blog
+
   * A ticket is an issue in an open source project
 
   */
 
   */
   public static class BlogEntry extends TopicBase {
+
   public static class Ticket extends TopicBase {
 
    
 
    
     public String date;
+
     public String no;
 
     public String title;
 
     public String title;
     public String author;
+
     public String project;
    public String pdf;
 
  
     public String getDate() { return date; }
+
     public String getNo() { return no; }
     public void setDate(String pDate) { date=pDate; }
+
     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 getAuthor() { return author; }
+
     public String getProject() { return project; }
     public void setAuthor(String pAuthor) { author=pAuthor; }
+
     public void setProject(String pProject) { project=pProject; }
    public String getPdf() { return pdf; }
 
    public void setPdf(String pPdf) { pdf=pPdf; }
 
 
     /**
 
     /**
     * convert this BlogEntry to a JSON string
+
     * convert this Ticket to a JSON string
 
     */
 
     */
 
     public String toJson() { return JSON.toJSONString(this); }
 
     public String toJson() { return JSON.toJSONString(this); }
  
 
     /**
 
     /**
     * convert this BlogEntry to a WikiSon string
+
     * convert this Ticket to a WikiSon string
     * @return the WikiSon representation of this BlogEntry
+
     * @return the WikiSon representation of this Ticket
 
     */
 
     */
 
     public String toWikiSon() {
 
     public String toWikiSon() {
       String wikison= "{{BlogEntry\n";
+
       String wikison= "{{Ticket\n";
       wikison+=toWikiSon("date",date);
+
       wikison+=toWikiSon("no",no);
 
       wikison+=toWikiSon("title",title);
 
       wikison+=toWikiSon("title",title);
       wikison+=toWikiSon("author",author);
+
       wikison+=toWikiSon("project",project);
      wikison+=toWikiSon("pdf",pdf);
 
 
       wikison+="}}\n";
 
       wikison+="}}\n";
 
       return wikison;
 
       return wikison;
Line 349: Line 375:
  
 
     /**
 
     /**
     * convert this BlogEntry to a SiDIF string
+
     * convert this Ticket to a SiDIF string
     * @return the SiDIF representation of this BlogEntry
+
     * @return the SiDIF representation of this Ticket
 
     */
 
     */
 
     public String toSiDIF() {
 
     public String toSiDIF() {
       String siDIF = String.format("%s isA BlogEntry\n",this.pageid);
+
       String siDIF = String.format("%s isA Ticket\n",this.pageid);
       siDIF+=propertySiDIF("date",date,"Date");
+
       siDIF+=propertySiDIF("no",no,"Text");
 
       siDIF+=propertySiDIF("title",title,"Text");
 
       siDIF+=propertySiDIF("title",title,"Text");
       siDIF+=propertySiDIF("author",author,"Text");
+
       siDIF+=propertySiDIF("project",project,"Page");
      siDIF+=propertySiDIF("pdf",pdf,"Page");
 
 
       return siDIF;
 
       return siDIF;
 
     }
 
     }
Line 367: Line 392:
  
 
     /**
 
     /**
     * default constructor for BlogEntry
+
     * default constructor for Ticket
 
     */
 
     */
     public BlogEntry() {}
+
     public Ticket() {}
  
 
     /**
 
     /**
     * construct a BlogEntry from the given Triple
+
     * 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 pBlogEntryTriple - the triple to construct me from
+
     * @param pTicketTriple - the triple to construct me from
 
     */
 
     */
     public BlogEntry(TripleQuery query,Triple pBlogEntryTriple) {
+
     public Ticket(TripleQuery query,Triple pTicketTriple) {
       this(query,pBlogEntryTriple.getSubject().toString());
+
       this(query,pTicketTriple.getSubject().toString());
 
     } // constructor
 
     } // constructor
  
 
     /**
 
     /**
     * construct a BlogEntry from the given pageId
+
     * 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 BlogEntry(TripleQuery query,String pageid) {
+
     public Ticket(TripleQuery query,String pageid) {
 
       this.pageid=pageid;
 
       this.pageid=pageid;
       Triple dateTriple=query.selectSingle(pageid,"date",null);
+
       Triple noTriple=query.selectSingle(pageid,"no",null);
       if (dateTriple==null)
+
       if (noTriple==null)
         dateTriple=query.selectSingle(pageid,"Property:BlogEntry_date",null);
+
         noTriple=query.selectSingle(pageid,"Property:Ticket_no",null);
       if (dateTriple!=null)  
+
       if (noTriple!=null)  
         date=dateTriple.getObject().toString();
+
         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:BlogEntry_title",null);
+
         titleTriple=query.selectSingle(pageid,"Property:Ticket_title",null);
 
       if (titleTriple!=null)  
 
       if (titleTriple!=null)  
 
         title=titleTriple.getObject().toString();
 
         title=titleTriple.getObject().toString();
       Triple authorTriple=query.selectSingle(pageid,"author",null);
+
       Triple projectTriple=query.selectSingle(pageid,"project",null);
       if (authorTriple==null)
+
       if (projectTriple==null)
         authorTriple=query.selectSingle(pageid,"Property:BlogEntry_author",null);
+
         projectTriple=query.selectSingle(pageid,"Property:Ticket_project",null);
       if (authorTriple!=null)  
+
       if (projectTriple!=null)  
         author=authorTriple.getObject().toString();
+
         project=projectTriple.getObject().toString();
      Triple pdfTriple=query.selectSingle(pageid,"pdf",null);
 
      if (pdfTriple==null)
 
        pdfTriple=query.selectSingle(pageid,"Property:BlogEntry_pdf",null);
 
      if (pdfTriple!=null)
 
        pdf=pdfTriple.getObject().toString();
 
 
       init(query);
 
       init(query);
     } // constructor for BlogEntry
+
     } // constructor for Ticket
 
      
 
      
     // >>>{user defined topic code}{BlogEntry}{BlogEntry}
+
     // >>>{user defined topic code}{Ticket}{Ticket}
     // <<<{user defined topic code}{BlogEntry}{BlogEntry}
+
     // <<<{user defined topic code}{Ticket}{Ticket}
   } // class BlogEntry
+
   } // class Ticket
 
   /**
 
   /**
   * Manager for BlogEntry
+
   * Manager for Ticket
 
   */
 
   */
   public static class BlogEntryManager extends TopicBase {
+
   public static class TicketManager extends TopicBase {
 
   
 
   
     public String topicName="BlogEntry";
+
     public String topicName="Ticket";
     public transient List<BlogEntry> mBlogEntrys=new ArrayList<BlogEntry>();
+
     public transient List<Ticket> mTickets=new ArrayList<Ticket>();
     public transient Map<String,BlogEntry> mBlogEntryMap=new LinkedHashMap<String,BlogEntry>();
+
     public transient Map<String,Ticket> mTicketMap=new LinkedHashMap<String,Ticket>();
  
 
     /**
 
     /**
     * get my BlogEntries
+
     * get my Tickets
 
     */
 
     */
     public List<BlogEntry> getBlogEntries() {
+
     public List<Ticket> getTickets() {
       List<BlogEntry> result=this.mBlogEntrys;
+
       List<Ticket> result=this.mTickets;
 
       return result;
 
       return result;
 
     }
 
     }
  
 
     /**
 
     /**
     *  add a new BlogEntry
+
     *  add a new Ticket
 
     */
 
     */
     public BlogEntry add(BlogEntry pBlogEntry) {
+
     public Ticket add(Ticket pTicket) {
       mBlogEntrys.add(pBlogEntry);
+
       mTickets.add(pTicket);
       mBlogEntryMap.put(pBlogEntry.getPageid(),pBlogEntry);
+
       mTicketMap.put(pTicket.getPageid(),pTicket);
       return pBlogEntry;
+
       return pTicket;
 
     }
 
     }
  
 
     /**
 
     /**
     *  add a new BlogEntry from the given triple
+
     *  add a new Ticket from the given triple
 
     */
 
     */
     public BlogEntry add(TripleQuery query,Triple pBlogEntryTriple) {
+
     public Ticket add(TripleQuery query,Triple pTicketTriple) {
       BlogEntry lBlogEntry=new BlogEntry(query,pBlogEntryTriple);
+
       Ticket lTicket=new Ticket(query,pTicketTriple);
       add(lBlogEntry);
+
       add(lTicket);
       return lBlogEntry;
+
       return lTicket;
 
     }
 
     }
  
     // reinitialize my mBlogEntry map
+
     // reinitialize my mTicket map
 
     public void reinit() {
 
     public void reinit() {
       mBlogEntryMap.clear();
+
       mTicketMap.clear();
       for (BlogEntry lBlogEntry:mBlogEntrys) {
+
       for (Ticket lTicket:mTickets) {
         mBlogEntryMap.put(lBlogEntry.getPageid(),lBlogEntry);
+
         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 BlogEntryManager fromJson(String json) {
+
     public static TicketManager fromJson(String json) {
       BlogEntryManager result=JSON.parseObject(json, BlogEntryManager.class);
+
       TicketManager result=JSON.parseObject(json, TicketManager.class);
 
       result.reinit();
 
       result.reinit();
 
       return result;
 
       return result;
 
     }
 
     }
  
     // default constructor for BlogEntry Manager
+
     // default constructor for Ticket Manager
     public BlogEntryManager() {}
+
     public TicketManager() {}
  
     // add BlogEntries from the given query
+
     // add Tickets from the given query
     public void addBlogEntries(TripleQuery pBlogEntryQuery,TripleQuery query) {
+
     public void addTickets(TripleQuery pTicketQuery,TripleQuery query) {
       if (pBlogEntryQuery!=null) {
+
       if (pTicketQuery!=null) {
         for (Triple lBlogEntryTriple:pBlogEntryQuery.getTriples()) {
+
         for (Triple lTicketTriple:pTicketQuery.getTriples()) {
           add(query,lBlogEntryTriple);
+
           add(query,lTicketTriple);
 
         }
 
         }
 
       }
 
       }
Line 479: Line 499:
  
 
     // construct me from the given triple Query query
 
     // construct me from the given triple Query query
     public BlogEntryManager(TripleQuery query) {
+
     public TicketManager(TripleQuery query) {
 
       // first query the SiDIF bases triplestore
 
       // first query the SiDIF bases triplestore
       TripleQuery lBlogEntryQuery=query.query(null,"isA","BlogEntry");
+
       TripleQuery lTicketQuery=query.query(null,"isA","Ticket");
       addBlogEntries(lBlogEntryQuery,query);
+
       addTickets(lTicketQuery,query);
 
       // then the SMW triplestore
 
       // then the SMW triplestore
       lBlogEntryQuery=query.query(null,"Property:IsA","BlogEntry");
+
       lTicketQuery=query.query(null,"Property:IsA","Ticket");
       addBlogEntries(lBlogEntryQuery,query);
+
       addTickets(lTicketQuery,query);
 
       init(query);
 
       init(query);
     } // constructor for BlogEntry Manager
+
     } // constructor for Ticket Manager
 
      
 
      
     // >>>{user defined topicmanager code}{BlogEntry}{BlogEntry}
+
     // >>>{user defined topicmanager code}{Ticket}{Ticket}
     // <<<{user defined topicmanager code}{BlogEntry}{BlogEntry}
+
     // <<<{user defined topicmanager code}{Ticket}{Ticket}
   } // class BlogEntry Manager
+
   } // class Ticket Manager
 
  /**
 
  /**
   * OsProject
+
   * Commit
   * An Open Source Project
+
   * A Git commit
 
   */
 
   */
   public static class OsProject extends TopicBase {
+
   public static class Commit extends TopicBase {
 
    
 
    
     public String id;
+
     public String host;
     public String owner;
+
     public String path;
     public String title;
+
     public String project;
     public String url;
+
     public String subject;
     public String version;
+
     public String name;
 
     public String date;
 
     public String date;
 +
    public String hash;
  
     public String getId() { return id; }
+
     public String getHost() { return host; }
     public void setId(String pId) { id=pId; }
+
     public void setHost(String pHost) { host=pHost; }
     public String getOwner() { return owner; }
+
     public String getPath() { return path; }
     public void setOwner(String pOwner) { owner=pOwner; }
+
     public void setPath(String pPath) { path=pPath; }
     public String getTitle() { return title; }
+
     public String getProject() { return project; }
     public void setTitle(String pTitle) { title=pTitle; }
+
     public void setProject(String pProject) { project=pProject; }
     public String getUrl() { return url; }
+
     public String getSubject() { return subject; }
     public void setUrl(String pUrl) { url=pUrl; }
+
     public void setSubject(String pSubject) { subject=pSubject; }
     public String getVersion() { return version; }
+
     public String getName() { return name; }
     public void setVersion(String pVersion) { version=pVersion; }
+
     public void setName(String pName) { name=pName; }
 
     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 getHash() { return hash; }
 +
    public void setHash(String pHash) { hash=pHash; }
 
     /**
 
     /**
     * convert this OsProject to a JSON string
+
     * convert this Commit to a JSON string
 
     */
 
     */
 
     public String toJson() { return JSON.toJSONString(this); }
 
     public String toJson() { return JSON.toJSONString(this); }
  
 
     /**
 
     /**
     * convert this OsProject to a WikiSon string
+
     * convert this Commit to a WikiSon string
     * @return the WikiSon representation of this OsProject
+
     * @return the WikiSon representation of this Commit
 
     */
 
     */
 
     public String toWikiSon() {
 
     public String toWikiSon() {
       String wikison= "{{OsProject\n";
+
       String wikison= "{{Commit\n";
       wikison+=toWikiSon("id",id);
+
       wikison+=toWikiSon("host",host);
       wikison+=toWikiSon("owner",owner);
+
       wikison+=toWikiSon("path",path);
       wikison+=toWikiSon("title",title);
+
       wikison+=toWikiSon("project",project);
       wikison+=toWikiSon("url",url);
+
       wikison+=toWikiSon("subject",subject);
       wikison+=toWikiSon("version",version);
+
       wikison+=toWikiSon("name",name);
 
       wikison+=toWikiSon("date",date);
 
       wikison+=toWikiSon("date",date);
 +
      wikison+=toWikiSon("hash",hash);
 
       wikison+="}}\n";
 
       wikison+="}}\n";
 
       return wikison;
 
       return wikison;
Line 539: Line 563:
  
 
     /**
 
     /**
     * convert this OsProject to a SiDIF string
+
     * convert this Commit to a SiDIF string
     * @return the SiDIF representation of this OsProject
+
     * @return the SiDIF representation of this Commit
 
     */
 
     */
 
     public String toSiDIF() {
 
     public String toSiDIF() {
       String siDIF = String.format("%s isA OsProject\n",this.pageid);
+
       String siDIF = String.format("%s isA Commit\n",this.pageid);
       siDIF+=propertySiDIF("id",id,"Text");
+
       siDIF+=propertySiDIF("host",host,"URL");
       siDIF+=propertySiDIF("owner",owner,"Text");
+
       siDIF+=propertySiDIF("path",path,"Text");
       siDIF+=propertySiDIF("title",title,"Text");
+
       siDIF+=propertySiDIF("project",project,"Text");
       siDIF+=propertySiDIF("url",url,"Text");
+
       siDIF+=propertySiDIF("subject",subject,"Text");
       siDIF+=propertySiDIF("version",version,"Text");
+
       siDIF+=propertySiDIF("name",name,"Text");
 
       siDIF+=propertySiDIF("date",date,"Date");
 
       siDIF+=propertySiDIF("date",date,"Date");
 +
      siDIF+=propertySiDIF("hash",hash,"Text");
 
       return siDIF;
 
       return siDIF;
 
     }
 
     }
Line 559: Line 584:
  
 
     /**
 
     /**
     * default constructor for OsProject
+
     * default constructor for Commit
 
     */
 
     */
     public OsProject() {}
+
     public Commit() {}
  
 
     /**
 
     /**
     * construct a OsProject from the given Triple
+
     * 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 pOsProjectTriple - the triple to construct me from
+
     * @param pCommitTriple - the triple to construct me from
 
     */
 
     */
     public OsProject(TripleQuery query,Triple pOsProjectTriple) {
+
     public Commit(TripleQuery query,Triple pCommitTriple) {
       this(query,pOsProjectTriple.getSubject().toString());
+
       this(query,pCommitTriple.getSubject().toString());
 
     } // constructor
 
     } // constructor
  
 
     /**
 
     /**
     * construct a OsProject from the given pageId
+
     * 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 OsProject(TripleQuery query,String pageid) {
+
     public Commit(TripleQuery query,String pageid) {
 
       this.pageid=pageid;
 
       this.pageid=pageid;
       Triple idTriple=query.selectSingle(pageid,"id",null);
+
       Triple hostTriple=query.selectSingle(pageid,"host",null);
       if (idTriple==null)
+
       if (hostTriple==null)
         idTriple=query.selectSingle(pageid,"Property:OsProject_id",null);
+
         hostTriple=query.selectSingle(pageid,"Property:Commit_host",null);
       if (idTriple!=null)  
+
       if (hostTriple!=null)  
         id=idTriple.getObject().toString();
+
         host=hostTriple.getObject().toString();
       Triple ownerTriple=query.selectSingle(pageid,"owner",null);
+
       Triple pathTriple=query.selectSingle(pageid,"path",null);
       if (ownerTriple==null)
+
       if (pathTriple==null)
         ownerTriple=query.selectSingle(pageid,"Property:OsProject_owner",null);
+
         pathTriple=query.selectSingle(pageid,"Property:Commit_path",null);
       if (ownerTriple!=null)  
+
       if (pathTriple!=null)  
         owner=ownerTriple.getObject().toString();
+
         path=pathTriple.getObject().toString();
       Triple titleTriple=query.selectSingle(pageid,"title",null);
+
       Triple projectTriple=query.selectSingle(pageid,"project",null);
       if (titleTriple==null)
+
       if (projectTriple==null)
         titleTriple=query.selectSingle(pageid,"Property:OsProject_title",null);
+
         projectTriple=query.selectSingle(pageid,"Property:Commit_project",null);
       if (titleTriple!=null)  
+
       if (projectTriple!=null)  
         title=titleTriple.getObject().toString();
+
         project=projectTriple.getObject().toString();
       Triple urlTriple=query.selectSingle(pageid,"url",null);
+
       Triple subjectTriple=query.selectSingle(pageid,"subject",null);
       if (urlTriple==null)
+
       if (subjectTriple==null)
         urlTriple=query.selectSingle(pageid,"Property:OsProject_url",null);
+
         subjectTriple=query.selectSingle(pageid,"Property:Commit_subject",null);
       if (urlTriple!=null)  
+
       if (subjectTriple!=null)  
         url=urlTriple.getObject().toString();
+
         subject=subjectTriple.getObject().toString();
       Triple versionTriple=query.selectSingle(pageid,"version",null);
+
       Triple nameTriple=query.selectSingle(pageid,"name",null);
       if (versionTriple==null)
+
       if (nameTriple==null)
         versionTriple=query.selectSingle(pageid,"Property:OsProject_version",null);
+
         nameTriple=query.selectSingle(pageid,"Property:Commit_name",null);
       if (versionTriple!=null)  
+
       if (nameTriple!=null)  
         version=versionTriple.getObject().toString();
+
         name=nameTriple.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:OsProject_date",null);
+
         dateTriple=query.selectSingle(pageid,"Property:Commit_date",null);
 
       if (dateTriple!=null)  
 
       if (dateTriple!=null)  
 
         date=dateTriple.getObject().toString();
 
         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 OsProject
+
     } // constructor for Commit
 
      
 
      
     // >>>{user defined topic code}{OsProject}{OsProject}
+
     // >>>{user defined topic code}{Commit}{Commit}
     // <<<{user defined topic code}{OsProject}{OsProject}
+
     // <<<{user defined topic code}{Commit}{Commit}
   } // class OsProject
+
   } // class Commit
 
   /**
 
   /**
   * Manager for OsProject
+
   * Manager for Commit
 
   */
 
   */
   public static class OsProjectManager extends TopicBase {
+
   public static class CommitManager extends TopicBase {
 
   
 
   
     public String topicName="OsProject";
+
     public String topicName="Commit";
     public transient List<OsProject> mOsProjects=new ArrayList<OsProject>();
+
     public transient List<Commit> mCommits=new ArrayList<Commit>();
     public transient Map<String,OsProject> mOsProjectMap=new LinkedHashMap<String,OsProject>();
+
     public transient Map<String,Commit> mCommitMap=new LinkedHashMap<String,Commit>();
  
 
     /**
 
     /**
     * get my OsProjects
+
     * get my Commits
 
     */
 
     */
     public List<OsProject> getOsProjects() {
+
     public List<Commit> getCommits() {
       List<OsProject> result=this.mOsProjects;
+
       List<Commit> result=this.mCommits;
 
       return result;
 
       return result;
 
     }
 
     }
  
 
     /**
 
     /**
     *  add a new OsProject
+
     *  add a new Commit
 
     */
 
     */
     public OsProject add(OsProject pOsProject) {
+
     public Commit add(Commit pCommit) {
       mOsProjects.add(pOsProject);
+
       mCommits.add(pCommit);
       mOsProjectMap.put(pOsProject.getPageid(),pOsProject);
+
       mCommitMap.put(pCommit.getPageid(),pCommit);
       return pOsProject;
+
       return pCommit;
 
     }
 
     }
  
 
     /**
 
     /**
     *  add a new OsProject from the given triple
+
     *  add a new Commit from the given triple
 
     */
 
     */
     public OsProject add(TripleQuery query,Triple pOsProjectTriple) {
+
     public Commit add(TripleQuery query,Triple pCommitTriple) {
       OsProject lOsProject=new OsProject(query,pOsProjectTriple);
+
       Commit lCommit=new Commit(query,pCommitTriple);
       add(lOsProject);
+
       add(lCommit);
       return lOsProject;
+
       return lCommit;
 
     }
 
     }
  
     // reinitialize my mOsProject map
+
     // reinitialize my mCommit map
 
     public void reinit() {
 
     public void reinit() {
       mOsProjectMap.clear();
+
       mCommitMap.clear();
       for (OsProject lOsProject:mOsProjects) {
+
       for (Commit lCommit:mCommits) {
         mOsProjectMap.put(lOsProject.getPageid(),lOsProject);
+
         mCommitMap.put(lCommit.getPageid(),lCommit);
 
       }
 
       }
 
     }
 
     }
Line 662: Line 692:
 
      
 
      
 
     // get a new manager from the given json string
 
     // get a new manager from the given json string
     public static OsProjectManager fromJson(String json) {
+
     public static CommitManager fromJson(String json) {
       OsProjectManager result=JSON.parseObject(json, OsProjectManager.class);
+
       CommitManager result=JSON.parseObject(json, CommitManager.class);
 
       result.reinit();
 
       result.reinit();
 
       return result;
 
       return result;
 
     }
 
     }
  
     // default constructor for OsProject Manager
+
     // default constructor for Commit Manager
     public OsProjectManager() {}
+
     public CommitManager() {}
  
     // add OsProjects from the given query
+
     // add Commits from the given query
     public void addOsProjects(TripleQuery pOsProjectQuery,TripleQuery query) {
+
     public void addCommits(TripleQuery pCommitQuery,TripleQuery query) {
       if (pOsProjectQuery!=null) {
+
       if (pCommitQuery!=null) {
         for (Triple lOsProjectTriple:pOsProjectQuery.getTriples()) {
+
         for (Triple lCommitTriple:pCommitQuery.getTriples()) {
           add(query,lOsProjectTriple);
+
           add(query,lCommitTriple);
 
         }
 
         }
 
       }
 
       }
Line 681: Line 711:
  
 
     // construct me from the given triple Query query
 
     // construct me from the given triple Query query
     public OsProjectManager(TripleQuery query) {
+
     public CommitManager(TripleQuery query) {
 
       // first query the SiDIF bases triplestore
 
       // first query the SiDIF bases triplestore
       TripleQuery lOsProjectQuery=query.query(null,"isA","OsProject");
+
       TripleQuery lCommitQuery=query.query(null,"isA","Commit");
       addOsProjects(lOsProjectQuery,query);
+
       addCommits(lCommitQuery,query);
 
       // then the SMW triplestore
 
       // then the SMW triplestore
       lOsProjectQuery=query.query(null,"Property:IsA","OsProject");
+
       lCommitQuery=query.query(null,"Property:IsA","Commit");
       addOsProjects(lOsProjectQuery,query);
+
       addCommits(lCommitQuery,query);
 
       init(query);
 
       init(query);
     } // constructor for OsProject Manager
+
     } // constructor for Commit Manager
 
      
 
      
     // >>>{user defined topicmanager code}{OsProject}{OsProject}
+
     // >>>{user defined topicmanager code}{Commit}{Commit}
     // <<<{user defined topicmanager code}{OsProject}{OsProject}
+
     // <<<{user defined topicmanager code}{Commit}{Commit}
   } // class OsProject Manager
+
   } // 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

}
Showing below 0 pages.

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