Skip to content

File wikt_parsed_empty_sql

Andrew Krizhanovsky edited this page Jan 19, 2020 · 16 revisions

Introduction

This guide helps to create, edit and load empty Wiktionary parsed database into MySQL (see /wikt_parser/doc).

This step should be done before the parsing of the Wiktionary database (see Getting started Wiktionary parser).

MySQL

mysql$ CREATE DATABASE enwikt20100824_parsed;
mysql$ USE enwikt20100824_parsed
mysql$ SOURCE /data/all/projects/git/wikokit/wikt_parser/doc/wikt_parsed_empty.sql
mysql$ GRANT SELECT ON enwikt20100824.* TO javawiki@'%';
mysql$ GRANT ALL ON enwikt20100824_parsed.* TO javawiki@'%';
mysql$ FLUSH PRIVILEGES;

If MySQL whines and prints error message that access is denied then you can try use "localhost" instead of "%":

mysql$ GRANT SELECT ON enwikt20100824.* TO javawiki@'localhost';

You can list the privileges that are granted to a MySQL user account ('javawiki'):

mysql$ SHOW GRANTS FOR javawiki;

Details

  • Edit wikt_parsed_empty.mwb file in MySQL Workbench, export it to wikt_parsed_empty.sql
  • Make substitution in wikt_parsed_empty.sql in VIM by RE:
%s/`mydb`\.//g
  • Create DB in MySQL, e.g. ruwikt20090122_parsed
  • USE ruwikt20090122_parsed
  • SOURCE wikt_parsed_empty.sql

Machine-readable database schema

The structure (tables and relations) of the Wiktionary parsed database (database layout, see the file wikt_parsed_empty_with_foreign_keys.png):

Wiktionary parsed database

Set of tables related to quotations (fragment of the Wiktionary parsed database):

quotations tables of the Wiktionary parsed database

Misc

Index

CREATE TABLE test (id INT, INDEX(id));

ALTER TABLE relation DROP INDEX idx_software_key , ADD INDEX idx_software_key ( software_key ( 3 ) );

TODO

Table image. Field filename, index UNIQUE, to constrain the length: 255.

Table label. Field short_name, index INDEX, to constrain the length: 255.

Next step

Previous step

  • MySQL import ‒ Import Wiktionary database into local MySQL database

See also

  • MySQL Workbench ‒ How to create empty SQL file for the Wiktionary parsed database.