Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
yogesh-est committed Jan 17, 2020
2 parents 5f1c1b8 + 664554c commit b6c901f
Show file tree
Hide file tree
Showing 34 changed files with 1,011 additions and 176 deletions.
@@ -1,9 +1,7 @@
package eki.ekilex.data.transport;
package eki.common.data;

import java.util.Map.Entry;

import eki.common.data.AbstractDataObject;

public class KeyValuePair<K, V> extends AbstractDataObject implements Entry<K, V> {

private static final long serialVersionUID = 1L;
Expand Down
@@ -1,4 +1,4 @@
package eki.ekilex.data.transport;
package eki.common.data;

import java.util.ArrayList;
import java.util.Collection;
Expand All @@ -8,8 +8,6 @@

import org.apache.commons.lang3.ArrayUtils;

import eki.common.data.AbstractDataObject;

public class OrderedMap<K, V> extends AbstractDataObject implements Map<K, V> {

private static final long serialVersionUID = 1L;
Expand Down
@@ -1,4 +1,4 @@
package eki.ekilex.data.transport;
package eki.common.data;

import java.util.Arrays;
import java.util.Collection;
Expand Down
101 changes: 81 additions & 20 deletions eki-common/src/main/resources/sql/create_views.sql
@@ -1,7 +1,19 @@
create type type_lang_complexity as (lang char(3), complexity varchar(100));
create type type_definition as (lexeme_id bigint, meaning_id bigint, value text, value_prese text, lang char(3), complexity varchar(100));
create type type_domain as (origin varchar(100), code varchar(100));
create type type_usage as (usage text, usage_prese text, usage_lang char(3), complexity varchar(100), usage_type_code varchar(100), usage_translations text array, usage_definitions text array, od_usage_definitions text array, od_usage_alternatives text array, usage_authors text array);
create type type_source_link as (source_id bigint, type varchar(100), name text, value text);
create type type_usage as (
usage text,
usage_prese text,
usage_lang char(3),
complexity varchar(100),
usage_type_code varchar(100),
usage_translations text array,
usage_definitions text array,
od_usage_definitions text array,
od_usage_alternatives text array,
usage_authors text array,
usage_source_links type_source_link array);
create type type_public_note as (value text, complexity varchar(100));
create type type_grammar as (value text, complexity varchar(100));
create type type_government as (value text, complexity varchar(100));
Expand All @@ -14,6 +26,7 @@ create type type_meaning_word as (
mw_lex_weight numeric(5,4),
mw_lex_governments type_government array,
mw_lex_register_codes varchar(100) array,
mw_lex_value_state_code varchar(100),
word_id bigint,
word text,
homonym_nr integer,
Expand Down Expand Up @@ -107,6 +120,7 @@ from (select w.id as word_id,
mw.mw_lex_complexity,
mw.mw_lex_weight,
null,
null,
null,
mw.mw_word_id,
mw.mw_word,
Expand Down Expand Up @@ -473,6 +487,7 @@ from lexeme l
mw.mw_lex_weight,
mw.mw_lex_governments,
mw.mw_lex_register_codes,
mw.mw_lex_value_state_code,
mw.mw_word_id,
mw.mw_word,
mw.mw_homonym_nr,
Expand All @@ -496,7 +511,8 @@ from lexeme l
l2.id mw_lex_id,
l2.complexity mw_lex_complexity,
l2.weight mw_lex_weight,
(select array_agg(row (ff.value_text,ff.complexity)::type_government order by ff.order_by)
--NB! space sym replaced by temp placeholder because nested complex type array masking failure by postgres
(select array_agg(row (replace(ff.value_text, ' ', '`'),ff.complexity)::type_government order by ff.order_by)
from lexeme_freeform lf,
freeform ff
where lf.lexeme_id = l2.id
Expand All @@ -507,6 +523,7 @@ from lexeme l
from lexeme_register l_reg
where l_reg.lexeme_id = l2.id
group by l_reg.lexeme_id) mw_lex_register_codes,
l2.value_state_code mw_lex_value_state_code,
w2.id mw_word_id,
f2.value mw_word,
w2.homonym_nr mw_homonym_nr,
Expand All @@ -532,9 +549,22 @@ from lexeme l
and l2ds.is_public = true) mw
group by mw.lexeme_id) mw on mw.lexeme_id = l.id
left outer join (select u.lexeme_id,
array_agg(row (u.usage,u.usage_prese,u.usage_lang,u.complexity,u.usage_type_code,u.usage_translations,u.usage_definitions,u.od_usage_definitions,u.od_usage_alternatives,u.usage_authors)::type_usage order by u.order_by) usages
array_agg(row (
u.usage,
u.usage_prese,
u.usage_lang,
u.complexity,
u.usage_type_code,
u.usage_translations,
u.usage_definitions,
u.od_usage_definitions,
u.od_usage_alternatives,
u.usage_authors,
null
)::type_usage
order by u.order_by) usages
from (select lf.lexeme_id,
u.value_text USAGE,
u.value_text usage,
u.value_prese usage_prese,
u.lang usage_lang,
u.complexity,
Expand All @@ -544,7 +574,8 @@ from lexeme l
ud.usage_definitions,
odud.od_usage_definitions,
odua.od_usage_alternatives,
ua.usage_authors
ua.usage_authors,
null
from lexeme_freeform lf
inner join freeform u on lf.freeform_id = u.id and u.type = 'USAGE'
left outer join freeform utp on utp.parent_id = u.id and utp.type = 'USAGE_TYPE'
Expand Down Expand Up @@ -1190,126 +1221,135 @@ create view view_ww_classifier
c.code,
cl.value,
cl.lang,
cl.type,
c.order_by
from
language c,
language_label cl
where
c.code = cl.code
and cl.type = 'wordweb'
order by c.order_by)
and cl.type in ('wordweb', 'iso2')
order by c.order_by, cl.lang, cl.type)
union all
(select
'MORPH' as name,
null as origin,
c.code,
cl.value,
cl.lang,
cl.type,
c.order_by
from
morph c,
morph_label cl
where
c.code = cl.code
and cl.type = 'wordweb'
order by c.order_by)
order by c.order_by, cl.lang, cl.type)
union all
(select
'DISPLAY_MORPH' as name,
null as origin,
c.code,
cl.value,
cl.lang,
cl.type,
c.order_by
from
display_morph c,
display_morph_label cl
where
c.code = cl.code
and cl.type = 'wordweb'
order by c.order_by)
order by c.order_by, cl.lang, cl.type)
union all
(select
'WORD_TYPE' as name,
null as origin,
c.code,
cl.value,
cl.lang,
cl.type,
c.order_by
from
word_type c,
word_type_label cl
where
c.code = cl.code
and cl.type = 'wordweb'
order by c.order_by)
order by c.order_by, cl.lang, cl.type)
union all
(select
'ASPECT' as name,
null as origin,
c.code,
cl.value,
cl.lang,
cl.type,
c.order_by
from
aspect c,
aspect_label cl
where
c.code = cl.code
and cl.type = 'wordweb'
order by c.order_by)
order by c.order_by, cl.lang, cl.type)
union all
(select
'POS' as name,
null as origin,
c.code,
cl.value,
cl.lang,
cl.type,
c.order_by
from
pos c,
pos_label cl
where
c.code = cl.code
and cl.type = 'wordweb'
order by c.order_by)
order by c.order_by, cl.lang, cl.type)
union all
(select
'REGISTER' as name,
null as origin,
c.code,
cl.value,
cl.lang,
cl.type,
c.order_by
from
register c,
register_label cl
where
c.code = cl.code
and cl.type = 'wordweb'
order by c.order_by)
order by c.order_by, cl.lang, cl.type)
union all
(select
'DERIV' as name,
null as origin,
c.code,
cl.value,
cl.lang,
cl.type,
c.order_by
from
deriv c,
deriv_label cl
where
c.code = cl.code
and cl.type = 'wordweb'
order by c.order_by)
order by c.order_by, cl.lang, cl.type)
union all
(select
'DOMAIN' as name,
c.origin,
c.code,
cl.value,
cl.lang,
cl.type,
c.order_by
from
domain c,
Expand All @@ -1318,81 +1358,102 @@ create view view_ww_classifier
c.code = cl.code
and c.origin = cl.origin
and cl.type = 'descrip'
order by c.order_by)
order by c.order_by, cl.lang, cl.type)
union all
(select
'USAGE_TYPE' as name,
null as origin,
c.code,
cl.value,
cl.lang,
cl.type,
c.order_by
from
usage_type c,
usage_type_label cl
where
c.code = cl.code
and cl.type = 'wordweb'
order by c.order_by)
order by c.order_by, cl.lang, cl.type)
union all
(select
'POS_GROUP' as name,
null as origin,
c.code,
cl.value,
cl.lang,
cl.type,
c.order_by
from
pos_group c,
pos_group_label cl
where
c.code = cl.code
and cl.type = 'wordweb'
order by c.order_by)
order by c.order_by, cl.lang, cl.type)
union all
(select
'WORD_REL_TYPE' as name,
null as origin,
c.code,
cl.value,
cl.lang,
cl.type,
c.order_by
from
word_rel_type c,
word_rel_type_label cl
where
c.code = cl.code
and cl.type = 'wordweb'
order by c.order_by)
order by c.order_by, cl.lang, cl.type)
union all
(select
'LEX_REL_TYPE' as name,
null as origin,
c.code,
cl.value,
cl.lang,
cl.type,
c.order_by
from
lex_rel_type c,
lex_rel_type_label cl
where
c.code = cl.code
and cl.type = 'wordweb'
order by c.order_by)
order by c.order_by, cl.lang, cl.type)
union all
(select
'MEANING_REL_TYPE' as name,
null as origin,
c.code,
cl.value,
cl.lang,
cl.type,
c.order_by
from
meaning_rel_type c,
meaning_rel_type_label cl
where
c.code = cl.code
and cl.type = 'wordweb'
order by c.order_by, cl.lang, cl.type)
union all
(select
'VALUE_STATE' as name,
null as origin,
c.code,
cl.value,
cl.lang,
cl.type,
c.order_by
from
meaning_rel_type c,
meaning_rel_type_label cl
where
c.code = cl.code
and cl.type = 'wordweb'
order by c.order_by)
order by c.order_by, cl.lang, cl.type)
);

1 change: 1 addition & 0 deletions eki-common/src/main/resources/sql/drop_all.sql
Expand Up @@ -21,6 +21,7 @@ drop type if exists type_word;--remove later
drop type if exists type_definition;
drop type if exists type_domain;
drop type if exists type_usage;
drop type if exists type_source_link;
drop type if exists type_colloc_member;
drop type if exists type_word_etym_relation;
drop type if exists type_word_relation;
Expand Down

0 comments on commit b6c901f

Please sign in to comment.