Exemplo n.º 1
0
 /**
  * @param Publication $publication
  *
  * @return array
  */
 private function createFields(Publication $publication)
 {
     $fields = array();
     $fields[] = array('prism.title', $publication->getTitle());
     // TODO: valid? Isn't it part of the dc subset of prism?
     $fields[] = array('prism.publicationDate', $publication->getDatePublished('Y-m-d'));
     $fields[] = array('prism.publicationYear', $publication->getDatePublished('Y'));
     $fields[] = array('prism.publicationName', $publication->getJournal());
     $fields[] = array('prism.publicationName', $publication->getBooktitle());
     $fields[] = array('prism.volume', $publication->getVolume());
     $fields[] = array('prism.number', $publication->getNumber());
     $fields[] = array('prism.edition', $publication->getEdition());
     $fields[] = array('prism.startingPage', $publication->getFirstPage());
     $fields[] = array('prism.endingPage', $publication->getLastPage());
     $file = $publication->getFullTextFile();
     if ($file) {
         $fields[] = array('prism.url', Request::createUrl(array('p' => 'publication', 'id' => $publication->getId(), 'file_id' => $file->getId()), true));
     }
     //$fields[] = array('prism.issn', false); // TODO
     $fields[] = array('prism.isbn', $publication->getIsbn());
     $fields[] = array('prism.copyright', $publication->getCopyright());
     $fields[] = array('prism.organization', $publication->getInstitution());
     // TODO: check if valid usage
     $fields[] = array('prism.doi', $publication->getDoi());
     return $fields;
 }
Exemplo n.º 2
0
 /**
  * @param Publication $publication
  *
  * @return array
  */
 private function createFields(Publication $publication)
 {
     // NOTE: dc.citation.* are non standard tags recommended by Google Scholar
     $fields = array();
     foreach ($publication->getAuthors() as $author) {
         if ($author->getLastName() && $author->getFirstName()) {
             $fields[] = array('dc.creator', $author->getFirstName() . ' ' . $author->getLastName());
         }
     }
     $fields[] = array('dc.title', $publication->getTitle());
     // TODO: not dcterms.issued and YYYY-MM-DD according to https://wiki.whatwg.org/wiki/MetaExtensions?
     $fields[] = array('dc.issued', $publication->getDatePublished('Y/m/d'));
     $fields[] = array('dc.relation.ispartof', $publication->getJournal());
     $fields[] = array('dc.relation.ispartof', $publication->getBooktitle());
     $fields[] = array('dc.citation.volume', $publication->getVolume());
     $fields[] = array('dc.citation.issue', $publication->getNumber());
     $fields[] = array('dc.citation.spage', $publication->getFirstPage());
     $fields[] = array('dc.citation.epage', $publication->getLastPage());
     $file = $publication->getFullTextFile();
     if ($file) {
         $fields[] = array('dc.identifier', Request::createUrl(array('p' => 'publication', 'id' => $publication->getId(), 'file_id' => $file->getId()), true));
     }
     $fields[] = array('dc.publisher', $publication->getInstitution());
     // used for institution, too
     $fields[] = array('dc.publisher', $publication->getPublisher());
     $fields[] = array('dc.identifier', $publication->getDoi());
     return $fields;
 }
Exemplo n.º 3
0
 /**
  * @param Publication $publication
  *
  * @return array
  * @throws Exception
  */
 private function createFields(Publication $publication)
 {
     $fields = array();
     $fields[] = array('TY', $this->encodeType($publication->getTypeName()));
     foreach ($publication->getAuthors() as $keyword) {
         if ($keyword->getLastName() && $keyword->getFirstName()) {
             $fields[] = array('AU', $keyword->getLastName() . ', ' . $keyword->getFirstName());
         }
     }
     $fields[] = array('T1', $publication->getTitle());
     // TODO: check if valid
     $fields[] = array('JA', $publication->getJournal());
     // TODO: check if valid
     $fields[] = array('TI', $publication->getBooktitle());
     // TODO: check if valid
     $fields[] = array('VL', $publication->getVolume());
     $fields[] = array('IS', $publication->getNumber());
     $fields[] = array('SP', $publication->getFirstPage());
     $fields[] = array('EP', $publication->getLastPage());
     $fields[] = array('PY', $publication->getDatePublished('Y/m/d'));
     $fields[] = array('PB', $publication->getPublisher());
     $fields[] = array('N1', $publication->getNote());
     $file = $publication->getFullTextFile();
     if ($file) {
         $fields[] = array('L1', Request::createUrl(array('p' => 'publication', 'id' => $publication->getId(), 'file_id' => $file->getId()), true));
     }
     $fields[] = array('UR', $publication->getDoi());
     $fields[] = array('SN', $publication->getIsbn());
     $fields[] = array('AB', $publication->getAbstract());
     foreach ($publication->getKeywords() as $keyword) {
         $fields[] = array('KW', $keyword->getName());
     }
     return $fields;
 }
Exemplo n.º 4
0
    /**
     * @param Publication $publication
     *
     * @return string
     * @throws exceptions\DBDuplicateEntryException
     * @throws exceptions\DBForeignKeyException
     */
    public function store(Publication $publication)
    {
        if ($publication->getTypeId()) {
            $type_id = $publication->getTypeId();
        } else {
            $repo = new TypeRepository($this->db);
            $type = $repo->where('name', '=', $publication->getTypeName())->findSingle();
            $type_id = $type->getId();
        }
        if ($publication->getStudyFieldId()) {
            $study_field_id = $publication->getStudyFieldId();
        } else {
            $repo = new StudyFieldRepository($this->db);
            $type = $repo->where('name', '=', $publication->getStudyField())->findSingle();
            $study_field_id = $type->getId();
        }
        $query = 'INSERT INTO
  publications (type_id, study_field_id, title, date_published, booktitle, journal, volume, number, pages_from, pages_to, series, edition, note, location, publisher, institution, school, address, isbn, doi, howpublished, abstract, copyright, `foreign`)
VALUES
  (:type_id, :study_field_id, :title, :date_published, :booktitle, :journal, :volume, :number, :pages_from, :pages_to,
   :series, :edition, :note, :location, :publisher, :institution, :school, :address, :isbn, :doi, :howpublished,
   :abstract, :copyright, :foreign);';
        $this->db->prepare($query);
        $this->db->bindValue(':type_id', $type_id);
        $this->db->bindValue(':study_field_id', $study_field_id);
        $this->db->bindValue(':title', $publication->getTitle());
        $this->db->bindValue(':date_published', $publication->getDatePublished());
        $this->db->bindValue(':booktitle', $publication->getBooktitle());
        $this->db->bindValue(':journal', $publication->getJournal());
        $this->db->bindValue(':volume', $publication->getVolume());
        $this->db->bindValue(':number', $publication->getNumber());
        $this->db->bindValue(':pages_from', $publication->getFirstPage());
        $this->db->bindValue(':pages_to', $publication->getLastPage());
        $this->db->bindValue(':series', $publication->getSeries());
        $this->db->bindValue(':edition', $publication->getEdition());
        $this->db->bindValue(':note', $publication->getNote());
        $this->db->bindValue(':location', $publication->getLocation());
        $this->db->bindValue(':publisher', $publication->getPublisher());
        $this->db->bindValue(':institution', $publication->getInstitution());
        $this->db->bindValue(':school', $publication->getSchool());
        $this->db->bindValue(':address', $publication->getAddress());
        $this->db->bindValue(':isbn', $publication->getIsbn());
        $this->db->bindValue(':doi', $publication->getDoi());
        $this->db->bindValue(':howpublished', $publication->getHowpublished());
        $this->db->bindValue(':abstract', $publication->getAbstract());
        $this->db->bindValue(':copyright', $publication->getCopyright());
        $this->db->bindValue(':foreign', $publication->getForeign());
        $this->db->execute();
        return $this->db->lastInsertId();
    }
Exemplo n.º 5
0
 /**
  * @param Publication $publication
  *
  * @return array
  */
 private function createFields(Publication $publication)
 {
     $fields = array();
     $fields[] = array('citation_title', $publication->getTitle());
     foreach ($publication->getAuthors() as $author) {
         if ($author->getLastName() && $author->getFirstName()) {
             $fields[] = array('citation_author', $author->getLastName() . ', ' . $author->getFirstName());
         }
     }
     $fields[] = array('citation_publication_date', $publication->getDatePublished('Y/m/d'));
     $fields[] = array('citation_journal_title', $publication->getJournal());
     $fields[] = array('citation_conference_title', $publication->getBooktitle());
     $fields[] = array('citation_volume', $publication->getVolume());
     if ($publication->getTypeName() == 'techreport') {
         $fields[] = array('citation_technical_report_number', $publication->getNumber());
     } else {
         $fields[] = array('citation_issue', $publication->getNumber());
     }
     $fields[] = array('citation_firstpage', $publication->getFirstPage());
     $fields[] = array('citation_lastpage', $publication->getLastPage());
     $file = $publication->getFullTextFile();
     if ($file) {
         $fields[] = array('citation_pdf_url', Request::createUrl(array('p' => 'publication', 'id' => $publication->getId(), 'file_id' => $file->getId()), true));
     }
     //$fields[] = array('citation_issn', false); // TODO
     $fields[] = array('citation_isbn', $publication->getIsbn());
     $fields[] = array('citation_publisher', $publication->getPublisher());
     if ($publication->getTypeName() == 'techreport') {
         $fields[] = array('citation_technical_report_institution', $publication->getInstitution());
     } else {
         if (in_array($publication->getTypeName(), array('phdthesis', 'mastersthesis'))) {
             $fields[] = array('citation_dissertation_institution', $publication->getInstitution());
         }
     }
     $fields[] = array('citation_doi', $publication->getDoi());
     $keywords = '';
     foreach ($publication->getKeywords() as $keyword) {
         if ($keyword->getName()) {
             $keywords .= $keyword->getName() . '; ';
         }
     }
     $keywords = substr($keywords, 0, -2);
     $fields[] = array('citation_keywords', $keywords);
     return $fields;
 }
Exemplo n.º 6
0
 /**
  * @param Publication $publication
  *
  * @return array
  * @throws Exception
  */
 private function createFields(Publication $publication)
 {
     $fields = array();
     $fields['type'] = $this->encodeTypes($publication->getTypeName());
     $fields['id'] = 'TODO_' . $publication->getId();
     // TODO
     $fields['title'] = $publication->getTitle();
     foreach ($publication->getAuthors() as $author) {
         if ($author->getFirstName() && $author->getLastName()) {
             $fields['author'][] = array('family' => $author->getLastName(), 'given' => $author->getFirstName());
         }
     }
     $fields['issued'] = array('date-parts' => array($publication->getDatePublished('Y'), $publication->getDatePublished('m'), $publication->getDatePublished('d')));
     $fields['container-title'] = $publication->getJournal();
     // TODO
     $fields['container-title'] = $publication->getBooktitle();
     $fields['citation-number'] = $publication->getNumber();
     $fields['volume'] = $publication->getVolume();
     $fields['number'] = '';
     // TODO
     $fields['issue'] = '';
     // TODO
     $fields['page'] = '';
     $fields['page-first'] = $publication->getFirstPage();
     $fields['edition'] = $publication->getEdition();
     $fields['abstract'] = $publication->getAbstract();
     $fields['DOI'] = $publication->getDoi();
     $fields['ISBN'] = $publication->getIsbn();
     $fields['ISSN'] = '';
     // TODO
     $file = $publication->getFullTextFile();
     if ($file) {
         $fields['URL'] = Request::createUrl(array('p' => 'publication', 'id' => $publication->getId(), 'file_id' => $file->getId()), true);
     }
     $fields['note'] = $publication->getNote();
     $fields['publisher'] = $publication->getPublisher();
     return $fields;
 }
Exemplo n.º 7
0
 /**
  * @return string
  */
 public function showFirstPage()
 {
     return $this->html($this->publication->getFirstPage());
 }