Mercurial > hg > ng2-query-ismi
comparison src/app/ismi-relation-types.js @ 58:3b4046e0cc02 default
Merge from ng2-table branch.
d7c947909ab888c013171b8c037e4f9fab30fe57
author | casties |
---|---|
date | Wed, 29 Mar 2017 17:19:12 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
49:781a5387ca93 | 58:3b4046e0cc02 |
---|---|
1 "use strict"; | |
2 var relation_type_1 = require('./relation-type'); | |
3 exports.RELATION_TYPES = {}; | |
4 addRelationType('is_part_of', 'is included in', 'includes'); | |
5 addRelationType('is_exemplar_of', 'title of witness', 'witnesses to title'); | |
6 addRelationType('was_created_by', 'created by', 'works of'); | |
7 addRelationType('has_subject', 'subject of title', 'titles with subject'); | |
8 addRelationType('has_role', 'roles of person', 'persons with role'); | |
9 addRelationType('is_alias_name_of', 'person name for alias', 'alias of person'); | |
10 addRelationType('is_alias_title_of', 'title name for alias', 'alias of title'); | |
11 addRelationType('is_commentary_on', 'is commentary on', 'list of commentaries'); | |
12 addRelationType('has_title_written_as', 'title in witness', 'witness with title as'); | |
13 addRelationType('has_author_written_as', 'author in witness', 'witness with author as'); | |
14 addRelationType('lived_in', 'place person lived in', 'persons who lived in'); | |
15 addRelationType('was_copied_by', 'witness copied by', 'witnesses that were copied by'); | |
16 addRelationType('was_born_in', 'place person was born in', 'persons who were born in'); | |
17 addRelationType('owned_by', 'codex owned by', 'persons who owned codex'); | |
18 addRelationType('was_student_of', 'studied with', 'persons studying with'); | |
19 addRelationType('died_in', 'place person died in', 'persons who died in'); | |
20 addRelationType('was_created_in', 'place title was created', 'titles that were created in'); | |
21 addRelationType('was_copied_in', 'place witness was copied', 'witnesses that were copied in'); | |
22 addRelationType('misattributed_to', 'title misattributed to', 'misattributions to person'); | |
23 addRelationType('was_dedicated_to', 'text dedicated to', 'texts that were dedicated to'); | |
24 addRelationType('is_version_of', 'standard text of different version', 'different version of standard text'); | |
25 addRelationType('is_translation_of', 'original text of a translation', 'translation of a text'); | |
26 addRelationType('has_floruit_date', 'floruit date of person', 'persons with floruit date'); | |
27 addRelationType('was_studied_by', 'persons studying this text', 'text studied by'); | |
28 //addRelationType('', '', ''); | |
29 function getRelationType(relType, isOutgoing) { | |
30 var name = relType; | |
31 if (isOutgoing === false) { | |
32 // add prefix to name | |
33 name = relation_type_1.invNamePrefix + name; | |
34 } | |
35 var rt = exports.RELATION_TYPES[name]; | |
36 if (rt == null) { | |
37 rt = new relation_type_1.RelationType(relType, isOutgoing); | |
38 } | |
39 return rt; | |
40 } | |
41 exports.getRelationType = getRelationType; | |
42 function getRelationByName(name) { | |
43 var rt = exports.RELATION_TYPES[name]; | |
44 if (rt == null) { | |
45 if (name.indexOf(relation_type_1.invNamePrefix) == 0) { | |
46 // inverse relation | |
47 name = name.substr(relation_type_1.invNamePrefix.length); | |
48 rt = new relation_type_1.RelationType(name, false); | |
49 } | |
50 else { | |
51 rt = new relation_type_1.RelationType(name, true); | |
52 } | |
53 } | |
54 return rt; | |
55 } | |
56 exports.getRelationByName = getRelationByName; | |
57 function addRelationType(name, outLabel, inLabel) { | |
58 // add outgoing relation | |
59 exports.RELATION_TYPES[name] = new relation_type_1.RelationType(name, true, outLabel); | |
60 // add inverse relation | |
61 exports.RELATION_TYPES[relation_type_1.invNamePrefix + name] = new relation_type_1.RelationType(name, false, inLabel); | |
62 } | |
63 //# sourceMappingURL=ismi-relation-types.js.map |