Changeset 3172

Show
Ignore:
Timestamp:
07/13/07 00:37:25 (3 years ago)
Author:
amit
Message:

There are a few related changes here:

  • Added new predicate to DublinCore? for general use and for citation
  • Modified the Citation class to use the bibtex model
  • Added License class to setup base for using different licenses
  • Modified Article to correspond to new Dublin Core and Citation.

Reference is not needed. This has been tested on black.topazproject.org with
both new data (on black itself) and old data (merlin).

Location:
head/plosone/libs/otm-models/src
Files:
1 added
1 removed
5 modified

Legend:

Unmodified
Added
Removed
  • head/plosone/libs/otm-models/src/main/java/org/plos/models/Article.java

    r3147 r3172  
    6666  @Predicate(uri = Rdf.topaz + "body") 
    6767  private String body; 
    68   @Predicate(uri = Rdf.topaz + "references", storeAs = Predicate.StoreAs.rdfList) 
    69   private List<Reference> references = new ArrayList<Reference>(); 
    7068 
    7169  /** 
     
    246244    this.body = body; 
    247245  } 
    248  
    249   /** 
    250    * @return list of references for the article 
    251    */ 
    252   public List<Reference> getReferences() { 
    253     return references; 
    254   } 
    255  
    256   /** 
    257    * @param set references for article 
    258    */ 
    259   public void setReferences(List<Reference> references) { 
    260     this.references = references; 
    261   } 
    262246} 
  • head/plosone/libs/otm-models/src/main/java/org/plos/models/Citation.java

    r3136 r3172  
    1010package org.plos.models; 
    1111 
     12import java.net.URI; 
     13 
    1214import java.util.List; 
    1315import java.util.ArrayList; 
    1416 
     17import org.topazproject.otm.annotations.Embeddable; 
     18import org.topazproject.otm.annotations.Entity; 
     19import org.topazproject.otm.annotations.Id; 
    1520import org.topazproject.otm.annotations.Predicate; 
    1621import org.topazproject.otm.annotations.Rdf; 
    17 import org.topazproject.otm.annotations.Embeddable; 
    1822import org.topazproject.otm.annotations.UriPrefix; 
    1923 
    20 @Embeddable 
     24/** 
     25 * Citation information 
     26 * 
     27 * @author Eric Brown 
     28 * @author Amit Kapoor 
     29 */ 
     30@Entity(type = PLoS.bibtex + "Entry", model = "ri") 
    2131@UriPrefix(Rdf.topaz) 
    22 public class Citation { 
    23   private String citationType; 
    24   private Integer year; 
    25   private String source; 
    26   private String comment; 
    27   private Integer volume; 
     32public abstract class Citation { 
     33  @Id 
     34  private URI   id; 
     35 
     36  /** 
     37   * The year of publication or, for an unpublished work, the year it was 
     38   * written. Generally it should consist of four numerals, such as 1984, 
     39   * although the standard styles can handle any year whose last four 
     40   * nonpunctuation characters are numerals, such as '(about 1984)' 
     41   */ 
     42  @Predicate(uri = PLoS.bibtex + "hasYear", dataType = Rdf.xsd + "nonNegativeInteger") 
     43  private int year; 
     44 
     45  @Predicate(uri = PLoS.bibtex + "hasMonth", dataType = Rdf.xsd + "string") 
     46  private String month; 
     47 
     48  /** 
     49   * The volume of a journal or multivolume book. 
     50   */ 
     51  @Predicate(uri = PLoS.bibtex + "hasVolume", dataType = Rdf.xsd + "nonNegativeInteger") 
     52  private int volume; 
     53 
     54  /** 
     55   * Typically, a Title will be a name by which the resource is formally known. 
     56   */ 
     57  @Predicate(uri = Rdf.dc + "title", dataType = Rdf.rdf + "XMLLiteral") 
     58  private String title; 
     59 
     60  /** 
     61   * Usually the address of the publisher or other type of institution. For 
     62   * major publishing houses, van Leunen recommends omitting the information 
     63   * entirely. For small publishers, on the other hand, you can help the reader 
     64   * by giving the complete address. 
     65   */ 
     66  @Predicate(uri = PLoS.bibtex + "hasAddress", dataType = Rdf.xsd + "String") 
    2867  private String publisherLocation; 
     68 
     69  /** 
     70   * The publisher's name. 
     71   */ 
     72  @Predicate(uri = PLoS.bibtex + "hasPublisher", dataType = Rdf.xsd + "String") 
    2973  private String publisherName; 
    3074 
    31   @Predicate(uri = Rdf.dc + "title", dataType = Rdf.rdf + "XMLLiteral") 
    32   private String articleTitle; 
    33   @Predicate(uri = Rdf.topaz + "firstPage") 
    34   private Integer firstPage; 
    35   @Predicate(uri = Rdf.topaz + "lastPage") 
    36   private Integer lastPage; 
    37   @Predicate(uri = Rdf.topaz + "authors", storeAs = Predicate.StoreAs.rdfList) 
     75  /** 
     76   * One or more page numbers or range of numbers, such as 42-111 or 7,41,73-97 
     77   * or 43+ (the `+' in this last example indicates pages following that don't 
     78   * form a simple range). To make it easier to maintain Scribe-compatible 
     79   * databases, the standard styles convert a single dash (as in 7-33) to the 
     80   * double dash used in TeX to denote number ranges (as in 7-33). 
     81   */ 
     82  @Predicate(uri = PLoS.bibtex + "hasPages", dataType = Rdf.xsd + "String") 
     83  private String pages; 
     84 
     85  /** 
     86   * A journal name. Abbreviations are provided for many journals; see the 
     87   * Local Guide 
     88   */ 
     89  @Predicate(uri = PLoS.bibtex + "hasJournal", dataType = Rdf.xsd + "String") 
     90  private String journal; 
     91 
     92  /** 
     93   * Any additional information that can help the reader. The first word should 
     94   * be capitalized. 
     95   */ 
     96  @Predicate(uri = PLoS.bibtex + "hasNote", dataType = Rdf.xsd + "String") 
     97  private String note; 
     98 
     99  /** 
     100   * Name(s) of editor(s), typed as indicated in the LaTeX book. If there is 
     101   * also an author field, then the editor field gives the editor of the book 
     102   * or collection in which the reference appears. 
     103   */ 
     104  @Predicate(uri = PLoS.bibtex + "hasEditorList", dataType = Rdf.xsd + "String", 
     105      storeAs = Predicate.StoreAs.rdfSeq) 
     106  private List<String> editors = new ArrayList<String>(); 
     107 
     108  /** 
     109   * The name(s) of the author(s), in the format described in the LaTeX book. 
     110   */ 
     111  @Predicate(uri = PLoS.bibtex + "hasAuthorList", dataType = Rdf.xsd + "String", 
     112      storeAs = Predicate.StoreAs.rdfSeq) 
    38113  private List<String> authors = new ArrayList<String>(); 
    39   @Predicate(uri = Rdf.topaz + "editors", storeAs = Predicate.StoreAs.rdfList) 
    40   private List<String> editors = new ArrayList<String>(); 
    41  
    42   /** 
    43    * @return the citation type 
    44    */ 
    45   public String getCitationType() { 
    46     return citationType; 
    47   } 
    48  
    49   /** 
    50    * @param citationType the type of this citation 
    51    */ 
    52   public void setCitationType(String citationType) { 
    53     this.citationType = citationType; 
     114 
     115  /** 
     116   * Get id. 
     117   * 
     118   * @return id as URI. 
     119   */ 
     120  public URI getId() { 
     121    return id; 
     122  } 
     123 
     124  /** 
     125   * Set id. 
     126   * 
     127   * @param id the value to set. 
     128   */ 
     129  public void setId(URI id) { 
     130    this.id = id; 
     131  } 
     132 
     133  /** 
     134   * @returns the year of the citation (if available) 
     135   */ 
     136  public int getYear() { 
     137    return year; 
     138  } 
     139 
     140  /** 
     141   * @param year the year of the citation 
     142   */ 
     143  public void setYear(int year) { 
     144    this.year = year; 
     145  } 
     146 
     147  /** 
     148   * @returns the month of the citation (if available) 
     149   */ 
     150  public String getMonth() { 
     151    return month; 
     152  } 
     153 
     154  /** 
     155   * @param month the month of the citation 
     156   */ 
     157  public void setMonth(String month) { 
     158    this.month = month; 
     159  } 
     160 
     161  /** 
     162   * @return the volume this citation is in 
     163   */ 
     164  public int getVolume() { 
     165    return volume; 
     166  } 
     167 
     168  /** 
     169   * @param volume the volume of this citation 
     170   */ 
     171  public void setVolume(int volume) { 
     172    this.volume = volume; 
     173  } 
     174 
     175  /** 
     176   * @return the title of the citation's article 
     177   */ 
     178  public String getTitle() { 
     179    return title; 
     180  } 
     181 
     182  /** 
     183   * @param title the title of the citation's article 
     184   */ 
     185  public void setTitle(String title) { 
     186    this.title = title; 
     187  } 
     188 
     189  /** 
     190   * @return the publisher's location 
     191   */ 
     192  public String getPublisherLocation() { 
     193    return publisherLocation; 
     194  } 
     195 
     196  /** 
     197   * @param publisherLocation the location of the publisher 
     198   */ 
     199  public void setPublisherLocation(String publisherLocation) { 
     200    this.publisherLocation = publisherLocation; 
     201  } 
     202 
     203  /** 
     204   * @return the publisher's name 
     205   */ 
     206  public String getPublisherName() { 
     207    return publisherName; 
     208  } 
     209 
     210  /** 
     211   * @param publisherName the name of the publisher 
     212   */ 
     213  public void setPublisherName(String publisherName) { 
     214    this.publisherName = publisherName; 
     215  } 
     216 
     217  /** 
     218   * @return the pages the citation is on 
     219   */ 
     220  public String getPages() { 
     221    return pages; 
     222  } 
     223 
     224  /** 
     225   * @param pages the pages the citation is from 
     226   */ 
     227  public void setPages(String pages) { 
     228    this.pages = pages; 
     229  } 
     230 
     231  /** 
     232   * @return journal the source of the citation 
     233   */ 
     234  public String getJournal() { 
     235    return journal; 
     236  } 
     237 
     238  /** 
     239   * @param journal the journal of the citation 
     240   */ 
     241  public void setJournal(String journal) { 
     242    this.journal = journal; 
     243  } 
     244 
     245  /** 
     246   * @return the note associated with this citation 
     247   */ 
     248  public String getNote() { 
     249    return note; 
     250  } 
     251 
     252  /** 
     253   * @param note the note for this citation 
     254   */ 
     255  public void setNote(String note) { 
     256    this.note = note; 
     257  } 
     258 
     259  /** 
     260   * @return the editors of this citation 
     261   */ 
     262  public List<String> getEditors() { 
     263    return editors; 
     264  } 
     265 
     266  /** 
     267   * @param editors the editors of this citation 
     268   */ 
     269  public void setEditors(List<String> editors) { 
     270    this.editors = editors; 
    54271  } 
    55272 
     
    67284    this.authors = authors; 
    68285  } 
    69  
    70   /** 
    71    * @return the editors of this citation 
    72    */ 
    73   public List<String> getEditors() { 
    74     return editors; 
    75   } 
    76  
    77   /** 
    78    * @param editors the editors of this citation 
    79    */ 
    80   public void setEditors(List<String> editors) { 
    81     this.editors = editors; 
    82   } 
    83  
    84   /** 
    85    * @returns the year of the citation (if available) 
    86    */ 
    87   public Integer getYear() { 
    88     return year; 
    89   } 
    90  
    91   /** 
    92    * @param year the year of the citation 
    93    */ 
    94   public void setYear(Integer year) { 
    95     this.year = year; 
    96   } 
    97  
    98   /** 
    99    * @return the title of the citation's article 
    100    */ 
    101   public String getArticleTitle() { 
    102     return articleTitle; 
    103   } 
    104  
    105   /** 
    106    * @param articleTitle the title of the citation's article 
    107    */ 
    108   public void setArticleTitle(String articleTitle) { 
    109     this.articleTitle = articleTitle; 
    110   } 
    111  
    112   /** 
    113    * @return source the source of the citation 
    114    */ 
    115   public String getSource() { 
    116     return source; 
    117   } 
    118  
    119   /** 
    120    * @param source the source of the citation 
    121    */ 
    122   public void setSource(String source) { 
    123     this.source = source; 
    124   } 
    125  
    126   /** 
    127    * @return the comment associated with this citation 
    128    */ 
    129   public String getComment() { 
    130     return comment; 
    131   } 
    132  
    133   /** 
    134    * @param comment the comment for this citation 
    135    */ 
    136   public void setComment(String comment) { 
    137     this.comment = comment; 
    138   } 
    139  
    140   /** 
    141    * @return the volume this citation is in 
    142    */ 
    143   public Integer getVolume() { 
    144     return volume; 
    145   } 
    146  
    147   /** 
    148    * @param volume the volume of this citation 
    149    */ 
    150   public void setVolume(Integer volume) { 
    151     this.volume = volume; 
    152   } 
    153  
    154   /** 
    155    * @return the first page the citaiton is on 
    156    */ 
    157   public Integer getFirstPage() { 
    158     return firstPage; 
    159   } 
    160  
    161   /** 
    162    * @param firstPage the page the citation is from 
    163    */ 
    164   public void setFirstPage(Integer firstPage) { 
    165     this.firstPage = firstPage; 
    166   } 
    167  
    168   /** 
    169    * @return the last page the citation is on 
    170    */ 
    171   public Integer getLastPage() { 
    172     return lastPage; 
    173   } 
    174  
    175   /** 
    176    * @param lastPage the last page the citaiton is found on 
    177    */ 
    178   public void setLastPage(Integer lastPage) { 
    179     this.lastPage = lastPage; 
    180   } 
    181  
    182   /** 
    183    * @return the publisher's location 
    184    */ 
    185   public String getPublisherLocation() { 
    186     return publisherLocation; 
    187   } 
    188  
    189   /** 
    190    * @param publisherLocation the location of the publisher 
    191    */ 
    192   public void setPublisherLocation(String publisherLocation) { 
    193     this.publisherLocation = publisherLocation; 
    194   } 
    195  
    196   /** 
    197    * @return the publisher's name 
    198    */ 
    199   public String getPublisherName() { 
    200     return publisherName; 
    201   } 
    202  
    203   /** 
    204    * @param publisherName the name of the publisher 
    205    */ 
    206   public void setPublisherName(String publisherName) { 
    207     this.publisherName = publisherName; 
    208   } 
    209286} 
  • head/plosone/libs/otm-models/src/main/java/org/plos/models/DublinCore.java

    r3147 r3172  
    125125 
    126126  /** 
     127   * The described resource may be derived from the related resource in whole 
     128   * or in part. Recommended best practice is to identify the related resource 
     129   * by means of a string conforming to a formal identification system. 
     130   */ 
     131  @Predicate(uri = Rdf.dc + "source") 
     132  private T source; 
     133 
     134  /** 
    127135   * Date (often a range) that the resource will become or did become 
    128136   * available. 
     
    134142   * The described resource includes the referenced resource either physically 
    135143   * or logically. 
     144   * 
     145   * TODO: This will need to be made Set<T> when OTM can handle this. 
    136146   */ 
    137147  @Predicate(uri = Rdf.dc_terms + "hasPart") 
     
    169179  @Predicate(uri = Rdf.dc_terms + "isPartOf") 
    170180  private T isPartOf; 
     181 
     182  /** 
     183   * A summary of the content of the resource. 
     184   */ 
     185  @Predicate(uri = Rdf.dc_terms + "abstract") 
     186  private Set<String> summary; 
     187 
     188  /** 
     189   * A bibliographic reference for the resource. 
     190   */ 
     191  @Predicate(uri = Rdf.dc_terms + "bibliographicCitation") 
     192  private Citation bibliographicCitation; 
     193 
     194  /** 
     195   * Date of creation of the object 
     196   */ 
     197  @Predicate(uri = Rdf.dc_terms + "created", dataType = Rdf.xsd + "date") 
     198  Date created; 
     199 
     200  /** 
     201   * The described resource is supplanted, displaced, or superseded by the 
     202   * referenced resource. 
     203   */ 
     204  @Predicate(uri = Rdf.dc_terms + "isReplacedBy") 
     205  private T replacedBy; 
     206 
     207  /** 
     208   * A legal document giving official permission to do something with the 
     209   * resource. 
     210   */ 
     211  @Predicate(uri = Rdf.dc_terms + "license") 
     212  private Set<License> license; 
     213 
     214  /** 
     215   * Date of modification of the object 
     216   */ 
     217  @Predicate(uri = Rdf.dc_terms + "modified", dataType = Rdf.xsd + "date") 
     218  Date modified; 
     219 
     220  /** 
     221   * The described resource references, cites, or otherwise points to the 
     222   * referenced resource. 
     223   */ 
     224  @Predicate(uri = Rdf.dc_terms + "references") 
     225  private Set<Citation> references; 
     226 
     227  /** 
     228   * The described resource supplants, displaces, or supersedes the referenced 
     229   * resource. 
     230   */ 
     231  @Predicate(uri = Rdf.dc_terms + "replaces") 
     232  private T replaces; 
    171233 
    172234  /** 
     
    514576    this.copyrightYear = copyrightYear; 
    515577  } 
     578 
     579  /** 
     580   * Return the source of the object 
     581   * 
     582   * @return the source of the object 
     583   */ 
     584  public T getSource() { 
     585    return source; 
     586  } 
     587 
     588  /** 
     589   * Set the source of the object 
     590   * 
     591   * @param source the source of the object 
     592   */ 
     593  public void setSource(T source) { 
     594    this.source = source; 
     595  } 
     596 
     597  /** 
     598   * Return the abstract/summary on the object 
     599   * 
     600   * @return the abstract/summary of the object 
     601   */ 
     602  public Set<String> getSummary() { 
     603    return summary; 
     604  } 
     605 
     606  /** 
     607   * Set the abstract/summary of the object 
     608   * 
     609   * @param summary the summary/abstract of the object 
     610   */ 
     611  public void setSummary(Set<String> summary) { 
     612    this.summary = summary; 
     613  } 
     614 
     615  /** 
     616   * Return the bibliographic citation for the object 
     617   * 
     618   * @return bibliographic citation for the object 
     619   */ 
     620  public Citation getBibliographicCitation() { 
     621    return bibliographicCitation; 
     622  } 
     623 
     624  /** 
     625   * bibliographic citation for the object 
     626   * 
     627   * @param bibliographicCitation bibliographic citation for the object 
     628   */ 
     629  public void setBibliographicCitation(Citation bibliographicCitation) { 
     630    this.bibliographicCitation = bibliographicCitation; 
     631  } 
     632 
     633  /** 
     634   * Return the creation date 
     635   * 
     636   * @return the creation date 
     637   */ 
     638  public Date getCreated() { 
     639    return created; 
     640  } 
     641 
     642  /** 
     643   * Set the creation date 
     644   * 
     645   * @param created the date the object was created 
     646   */ 
     647  public void setCreated(Date created) { 
     648    this.created = created; 
     649  } 
     650 
     651  /** 
     652   * Return the object replacing this 
     653   * 
     654   * @return the object replacing this 
     655   */ 
     656  public T getReplacedBy() { 
     657    return replacedBy; 
     658  } 
     659 
     660  /** 
     661   * Set the object replacing this 
     662   * 
     663   * @param replacedBy the object replacing this 
     664   */ 
     665  public void setReplacedBy(T replacedBy) { 
     666    this.replacedBy = replacedBy; 
     667  } 
     668 
     669  /** 
     670   * Return the set of licenses for this object 
     671   * 
     672   * @return the set of licenses for this object 
     673   */ 
     674  public Set<License> getLicense() { 
     675    return license; 
     676  } 
     677 
     678  /** 
     679   * Set the set of licenses for this object 
     680   * 
     681   * @param license the set of licenses governing this object 
     682   */ 
     683  public void setLicense(Set<License> license) { 
     684    this.license = license; 
     685  } 
     686 
     687  /** 
     688   * Return the modified date 
     689   * 
     690   * @return the modified date 
     691   */ 
     692  public Date getModified() { 
     693    return modified; 
     694  } 
     695 
     696  /** 
     697   * Set the modified date 
     698   * 
     699   * @param modified the date the object was modified 
     700   */ 
     701  public void setModified(Date modified) { 
     702    this.modified = modified; 
     703  } 
     704 
     705  /** 
     706   * Return the set of objects referred to by this object 
     707   * 
     708   * @return the set of objects referred to by this object 
     709   */ 
     710  public Set<Citation> getReferences() { 
     711    return references; 
     712  } 
     713 
     714  /** 
     715   * Set the set of objects referred to by this object 
     716   * 
     717   * @param references the set of objects referred to by this object 
     718   */ 
     719  public void setReferences(Set<Citation> references) { 
     720    this.references = references; 
     721  } 
     722 
     723  /** 
     724   * Return the object this replaces 
     725   * 
     726   * @return the object this replaces 
     727   */ 
     728  public T getReplaces() { 
     729    return replaces; 
     730  } 
     731 
     732  /** 
     733   * Set the object replacing this 
     734   * 
     735   * @param replaces the object this replaces 
     736   */ 
     737  public void setReplaces(T replaces) { 
     738    this.replaces = replaces; 
     739  } 
    516740} 
  • head/plosone/libs/otm-models/src/main/java/org/plos/models/PLoS.java

    r3138 r3172  
    1717public interface PLoS { 
    1818  /** PLoS namespace */ 
    19   public static final String plos    = "http://rdf.plos.org/RDF/"; 
     19  public static final String plos               = "http://rdf.plos.org/RDF/"; 
     20  /** Creative Commons namespace */ 
     21  public static final String creativeCommons    = "http://web.resource.org/cc/"; 
     22  /** Bibtex namespace */ 
     23  public static final String bibtex             = "http://purl.org/net/nknouf/ns/bibtex#"; 
    2024} 
  • head/plosone/libs/otm-models/src/test/java/org/plos/models/ModelsTest.java

    r3152 r3172  
    2929                  Category.class, Citation.class, Comment.class, DublinCore.class, FoafPerson.class, 
    3030                  ObjectInfo.class, PLoS.class, Rating.class, RatingContent.class, 
    31                   RatingSummary.class, RatingSummaryContent.class, Reference.class, Reply.class, 
     31                  RatingSummary.class, RatingSummaryContent.class, License.class, Reply.class, 
    3232                  ReplyThread.class, UserAccount.class, UserPreference.class, UserPreferences.class, 
    3333                  UserProfile.class, UserRole.class