-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathBestLabelConfig.js
More file actions
78 lines (64 loc) · 1.95 KB
/
BestLabelConfig.js
File metadata and controls
78 lines (64 loc) · 1.95 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
var Class = require('../ext/Class');
var VarUtils = require('./VarUtils');
var LiteralPreference = require('./LiteralPreference');
/**
* TODO: Consider using LiteralPreference instead of this class
*
* This class augments a literalPreference with variables
*/
var BestLabelConfig = Class.create({
/*
initialize: function(langs, predicates, objectVar, subjectVar, predicateVar) {
this.langs = langs || ['en', ''];
this.predicates = predicates || [rdfs.label];
this.subjectVar = subjectVar || VarUtils.x;
this.predicateVar = predicateVar || VarUtils.y;
this.objectVar = objectVar || VarUtils.z;
},
getLangs: function() {
return this.langs;
},
getPredicates: function() {
return this.predicates;
},
*/
initialize: function(literalPreference, objectVar, subjectVar, predicateVar) {
this.literalPreference = literalPreference || new LiteralPreference();
this.subjectVar = subjectVar || VarUtils.x;
this.predicateVar = predicateVar || VarUtils.y;
this.objectVar = objectVar || VarUtils.z;
},
/**
* Convenience method
*
*/
getLangs: function() {
var result = this.literalPreference.getLangs();
return result;
},
/**
* Convenience method
*
*/
getPredicates: function() {
var result = this.literalPreference.getPredicates();
return result;
},
getLiteralPreference: function() {
return this.literalPrefence;
},
getSubjectVar: function() {
return this.subjectVar;
},
getPredicateVar: function() {
return this.predicateVar;
},
getObjectVar: function() {
return this.objectVar;
},
toString: function() {
var result = ['BestLabelConfig', this.langs, this.predicates, this.subjectVar, this.predicateVar, this.objectVar].join(', ');
return result;
}
});
module.exports = BestLabelConfig;