Knowledge Information Exercise I Report Assignment 201811528 (Wednesday Group)
- This repository is...
- Issues created in the "Building OPAC" task in Knowledge Information Exercise I.
- Awarded as the Grand Prize in class. (2019)
Introduction
This page is a report on the issue of "Building OPAC" in the " Knowledge Information Exercise I, " which is the opening of the Spring AB module for Knowledge Information and Library Science.
Contents
- 1. The URL of the OPAC you built
- 2. CGI Program Source List and their Description
- 3. Relationship (table) structure and its explanation
- 4. Ideal points
- 5. Findings
1. The URL of the OPAC you built
The index page for the OPAC system " Simple OPAC " that we have built is https://cgi.u.tsukuba.ac.jp/~s1811528/opac/index.html .
Below is a diagram that summarizes the hierarchical structure below the opac directory and the explanations of each file .
W:wwwscgi-binopac > tree /F
フォルダー パスの一覧: ボリューム vol_home01
ボリューム シリアル番号は 000000FB 8082:1532 です
W:.
│ .htaccess...ユーザのサーバ設定ファイル
│ report.html...レポートページ
│ index.html...トップページ
│ sitemap.xml...サイトの構造文書
│ yet_list.html...未実装/実装したい機能のメモ
│
├─.git
│
│(省略)
│
├─data
│ bib_sche.sql...opac.dbスキーマ
│ kakou.rb...jbisc.txtをcsvに成形するプログラム
│ isbn.txt...isbn(10桁)を抽出したもの
│ jbisc.txt...書誌情報の元データ
│ kd.csv...DBにimportできる形式にしたもの
│ opac.db...書誌データベース
│
├─css
│ index.css...index.htmlのCSS
│ search.css...search.cgi
│ accurate.css...accurate.cgi
│ yet_list.css...yet_list.html
│ report.css...report.html
│
├─img
│ icon.png...ページicon
│ notfound.png...書誌画像がnullの時表示される画像
│ requirement.png...要件のスクリーンショット
│
├─cgi
│ accurate.cgi...書誌の詳細表示ページ
│ search.cgi...検索結果一覧ページ
│ def.rb...上記2つのcgi内で用いる関数を集めたもの
│
└─md
yet_list.md...yet_list.htmlの雛型
report.md...report.htmlの雛型▲Figure 1, Hierarchical structure of the OPAC system
2. CGI Program Source List and their Description
Source List
Below is a list of the pages and source code for the CGI program I created.
explanation
search.cgi (each function is written in def.rb)
- makeword(cgi)
- This is a method of processing data retrieved from index.html to make it easier to separate search terms.
- <field>:<value> shape
- gsub(/[rn]/") removes line breaks in the variable word
- delete_if{|i|...} deletes AND, and or null items.
- Return value is edited search statement
- makekeys(words)
- Split the search statement received from makeword() into each keyword to throw it into the SQL query and insert it into an array
- Or, when OR comes, insert it as is
- When TITLE: or ED: comes in, it is a hash of {"TITLE"=>"val"} or something similar, insert it.
- If there is no field specified, insert it as is
- Returns are arrays containing hashs and strings
- all_any_search(key,db)
- Do an ANY search (search from all fields) and retrieve data from the DB
- The return value is a two-dimensional array containing the NBC (national bibliographic number) of the hit data [[NBC1],[NBC2],...,[NBCn]]
- field_search_s(key,db)
- Performs individual searches for specified fields
- The return value is a 2D array containing NBC (national bibliographic number) of hit data.
- andor(keys,db)
- Iterate the values received from makekeys() and insert search results into the array appropriately passed to all_any_search() and all_any_search() respectively.
- If or,OR is passed, insert it into the array as is
- Return values are two-dimensional arrays containing NBC (national bibliographic number) of hit data
- strinterpret(keys)
- Interprets the OR and AND of the return value of andor(keys,db) to create the final search result
- If [DATAn] is followed by [DATAn+1], then the union ([DATAn]|[DATAn+1]) is taken.
- When the next or or OR comes after [DATAn], take the next [DATAn+1] and the next [DATAn+1], and the accumulation set ([DATAn]&[DATAn+1])
- Return values are one-dimensional array
- retr_hitdata(hit,db)
- Get full bibliographic field data from NBC of hit bibliographic data created with strinterpret(keys)
- Returns are the entire hit bibliographic data
- create_paging_link(hits,par)
- Generating page links for pagenation functionality
- If the value of ps(pagesize) received from the index page or search.cgi is empty, set it to 20.
- p(page) is the value of the number of pages currently available
- Assign the required number of pages (= number of page links) to hmp, taking into account the number of searches and PS.
- If p_size=0, hmp=0
- Insert page links in pagelinks
- Return value is the html of the page link in table
- create_table_html(data,par)
- Mold search results into html table
- Give each TITLE a link to send NBC to accurate.cgi
- Considering p and ps, the required statement is extracted from data(=retr_hitdata(hit,db))
- Return value is table's html
- rep_hide(per)
- Take over/save the GET value for reloading by changing ps
- Embed it in <input type="hidden">
- The return value is the html of <input type="hidden">, which embeds GET values other than ps.
- main()(#main() and the part written in search.cgi)
- Execution part of each function
- db and cgi specify opac.db as the database object of the SQLite module, and have CGI objects.
- cgi_values must have all GET values using cgi.instance_variable_get(:@params)
- Begin
rescue End avoids errors when nothing is filled out in the search form - hit_num assigns the number of hits
- Have a search word in search_display
- If hit_num is 0, the pagenation and result table will not be displayed in heading.
- Change search word between title element and <h1 />
- Send rep_hide when you click "Reload" (or enter using the PS input form).
Accurate.cgi (each function is written in def.rb)
- isbnto13(isbn10)
- Convert ISBN from 10 to 13 digits to pound openDB
- Return value is String (13 digits)
- field_search_a(key,db)
- Receive NBC from search.cgi to retrieve the entire bibliographic data
- Return values are arrays containing all bibliographic data of one book
- bibimage(isbn13,per)
- Acquiring a book image
- Access the openDB endpoint and check if there is bibliographic data (= image)
- If JSON is nil, pass 404 image display html to bibhash
- If JSON is not nil, pass the copy display html to bibhash
- The return value is html of <img ... />
- main()(the part written in #main() and the accurate.cgi)
- db and cgi specify opac.db as the database object of the SQLite module, and have CGI objects.
- Bibliographic data for all fields obtained from the GET value (NBC) passed from search.cgi with field_search_a(key,db)[0] to row
- row[1].scan(/[0-9]/).join[0,10], only the number in the ISBN field is taken from the beginning of 10 digits, and it is passed to isbnto13 along with row, and it is passed to isbnto13 along with row, and it is called image display html.
- Each item is displayed as a table.
3. Relationship (table) structure and its explanation
structure
Below is the SQL (data/bib_sche.sql) when creating table bibdata in opac.db.
CREATE TABLE bibdata (
NBC TEXT primary key ,
ISBN TEXT ,
TITLE TEXT ,
AUTH TEXT ,
PUB TEXT ,
PUBDATE TEXT ,
ED TEXT ,
PHYS TEXT ,
SERIES TEXT ,
NOTE TEXT ,
TITLEHEADING TEXT ,
AUTHORHEADING TEXT ,
HOLDINGSRECORD TEXT ,
HOLDINGPHYS TEXT ,
HOLDINGLOC TEXT ); ▲Figure 2, SQL to create table bibdata
explanation
Each value is explained.
- NBC
- National Bibliographic Number
- ex)JP20564340
- ISBN
- ISBN number (10 digits)
- ex)4-86004-040-6
- TITLE
- title
- ex) A story of friendship between a teacher and a student
- AUTH
- author
- ex) Written by Omori Masao
- PUB
- Publishing and Distribution
- ex) Tsuchiura Tsukuba Shorin
- PUBDATE
- Publication year
- ex)2004.1
- ED
- PHYS
- SERIES
- series
- ex)Kobunshapaperbacks;41
- NOTE
- Notes
- ex) Colophon Title (typographical error) A story of friendship between a teacher and a student
- TITLEHEADING
- Reading the title
- ex) Sensei Saw Meow
- AUTHORHEADING
- Author's reading
- ex)Omori, Masao (Omori, Masao)
- HOLDINGSRECORD
- Identification number of individual materials
- ex)JP20564340-01
- HOLDINGPHYS
- Location name
- ex) African Union heading towards the 21st century
- HOLDINGLOC
- Classification number
- ex)F9-128
Fields that could have multiple values were inserted by combining the values to be inserted.
I've not done any normalization, so I'd like to reflect on it.
Since NBC is always unique (TITLE and HOLDINGLOC are not unique), I specified it as primary key.
4. Ideal points
Supports AND/OR search
- AND/OR searches can be made using the AND/OR operator.
Select/input the number of paging items
- You can now input/select the number of pages displayed using <datalist>. ##Field-specified search in search box
- We have now made it possible to search for each field.
- At first, I didn't think about searching for fields from the form, so I thought about adding an operator to point to a specific field, such as "TITLE: Tsukuba."
design
- Overall, it is easy to read, and the display does not break even when viewed on a smartphone.
- We also made a color scheme/size that is easy to see even for visually impaired people.
Creating a site map for a hierarchical structure of a site
- I created sitemap.xml.
- I was reading a crawler book and found it to say "I should write about it," so I wrote it.
HTML and CSS validation/standardization
- Since HTML documents do not get basic errors, standardization was performed using W3C's Validator (HTML/CSS) to check whether there are any problems with format, inheritance relationships, hierarchical structure, and whether the HTML tags contain any content that should be written in CSS.
5. Findings
Building a server-side system
ㅤ Usually, the web pages we see are front-ends and consist of HTML/CSS/JS. We cannot view the programs or systems on that server. In this exercise, when creating dynamic pages, we were able to understand how they work by creating the internal programs. We also deepened our knowledge in the PHP + MySQL classes that we were taking at the same time.
Designing using web page style sheets
ㅤ Until now, when I started creating web pages, I didn't write much CSS using MarkDown or Bootstrap. However, in order to focus on design, I wrote CSS from the beginning. I think I gained basic knowledge of web page design using style sheets.
Creating a structured document
ㅤI gained knowledge about markup of HTML and XML structured documents.
DB construction using SQLite
ㅤI've been using MySQL basically in Python and Ruby, but this is the first time I've tried SQLite. I was able to learn the differences in notation, built-in variables, and insertion formats.
Difference management on website github
Differences were managed as eggplants/opac.