diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/app/ismi-relation-types.js	Wed Mar 29 17:19:12 2017 +0200
@@ -0,0 +1,63 @@
+"use strict";
+var relation_type_1 = require('./relation-type');
+exports.RELATION_TYPES = {};
+addRelationType('is_part_of', 'is included in', 'includes');
+addRelationType('is_exemplar_of', 'title of witness', 'witnesses to title');
+addRelationType('was_created_by', 'created by', 'works of');
+addRelationType('has_subject', 'subject of title', 'titles with subject');
+addRelationType('has_role', 'roles of person', 'persons with role');
+addRelationType('is_alias_name_of', 'person name for alias', 'alias of person');
+addRelationType('is_alias_title_of', 'title name for alias', 'alias of title');
+addRelationType('is_commentary_on', 'is commentary on', 'list of commentaries');
+addRelationType('has_title_written_as', 'title in witness', 'witness with title as');
+addRelationType('has_author_written_as', 'author in witness', 'witness with author as');
+addRelationType('lived_in', 'place person lived in', 'persons who lived in');
+addRelationType('was_copied_by', 'witness copied by', 'witnesses that were copied by');
+addRelationType('was_born_in', 'place person was born in', 'persons who were born in');
+addRelationType('owned_by', 'codex owned by', 'persons who owned codex');
+addRelationType('was_student_of', 'studied with', 'persons studying with');
+addRelationType('died_in', 'place person died in', 'persons who died in');
+addRelationType('was_created_in', 'place title was created', 'titles that were created in');
+addRelationType('was_copied_in', 'place witness was copied', 'witnesses that were copied in');
+addRelationType('misattributed_to', 'title misattributed to', 'misattributions to person');
+addRelationType('was_dedicated_to', 'text dedicated to', 'texts that were dedicated to');
+addRelationType('is_version_of', 'standard text of different version', 'different version of standard text');
+addRelationType('is_translation_of', 'original text of a translation', 'translation of a text');
+addRelationType('has_floruit_date', 'floruit date of person', 'persons with floruit date');
+addRelationType('was_studied_by', 'persons studying this text', 'text studied by');
+//addRelationType('', '', '');
+function getRelationType(relType, isOutgoing) {
+    var name = relType;
+    if (isOutgoing === false) {
+        // add prefix to name
+        name = relation_type_1.invNamePrefix + name;
+    }
+    var rt = exports.RELATION_TYPES[name];
+    if (rt == null) {
+        rt = new relation_type_1.RelationType(relType, isOutgoing);
+    }
+    return rt;
+}
+exports.getRelationType = getRelationType;
+function getRelationByName(name) {
+    var rt = exports.RELATION_TYPES[name];
+    if (rt == null) {
+        if (name.indexOf(relation_type_1.invNamePrefix) == 0) {
+            // inverse relation
+            name = name.substr(relation_type_1.invNamePrefix.length);
+            rt = new relation_type_1.RelationType(name, false);
+        }
+        else {
+            rt = new relation_type_1.RelationType(name, true);
+        }
+    }
+    return rt;
+}
+exports.getRelationByName = getRelationByName;
+function addRelationType(name, outLabel, inLabel) {
+    // add outgoing relation
+    exports.RELATION_TYPES[name] = new relation_type_1.RelationType(name, true, outLabel);
+    // add inverse relation
+    exports.RELATION_TYPES[relation_type_1.invNamePrefix + name] = new relation_type_1.RelationType(name, false, inLabel);
+}
+//# sourceMappingURL=ismi-relation-types.js.map
\ No newline at end of file