-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathRelation.js
47 lines (37 loc) · 1.09 KB
/
Relation.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var Class = require('../ext/Class');
var ElementUtils = require('./ElementUtils');
/**
* A (binary) relation represents correspondences between two sets of resources
*
* The main intention of relations is to map a concept, such as 'Airports',
* to a related conecept, such as the set of labels.
*/
var Relation = Class.create({
initialize: function(element, sourceVar, targetVar) {
this.element = element;
this.sourceVar = sourceVar;
this.targetVar = targetVar;
},
getElement: function() {
return this.element;
},
getSourceVar: function() {
return this.sourceVar;
},
getTargetVar: function() {
return this.targetVar;
},
isEmpty: function() {
//if(relation.getSourceVar().equals(relation.getTargetVar)) {
// }
var result = ElementUtils.isEmpty(this.element);
return result;
},
//
// }
toString: function() {
var result = '(' + [this.element, this.sourceVar, this.targetVar].join('; ') + ')';
return result;
}
});
module.exports = Relation;