forked from fuddl/wikibase-for-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wikibases.mjs
147 lines (143 loc) · 4.16 KB
/
wikibases.mjs
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import { WBK } from './importmap/wikibase-sdk/dist/src/wikibase-sdk.js';
import wikidataSites from './wikidataSites.mjs';
import trekSites from './trekSites.mjs';
const wikibases = {
wikidata: {
name: 'Wikidata',
// We don't want to resolve entities from wikidata but we still need some
// info about wikidata since some elements in wikibase are hardcoded to
// wikidata. `resolve: false` will prevent the extension from automatically
// resolving.
resolve: false,
instance: 'https://www.wikidata.org',
sparqlEndpoint: 'https://query.wikidata.org/sparql',
autodesc: 'https://autodesc.toolforge.org',
icon: 'icons/wikidata.svg',
props: {
appliesIfRegularExpressionMatches: 'P8460',
author: 'P50',
class: 'P2308',
duration: 'P2047',
equivalentClass: 'P1709',
equivalentProperty: 'P1628',
formatterURL: 'P1630',
hasCharacteristic: 'P1552',
instanceOf: 'P31',
isbn10: 'P957',
isbn13: 'P212',
itemOfPropertyConstraint: 'P2305',
location: 'P276',
mastodonAddress: 'P4033',
mobileFormatterURL: 'P7250',
numberOfPages: 'P1104',
numberOfReviewsRatings: 'P7887',
occupation: 'P106',
officialWebsite: 'P856',
partOfTheSeries: 'P179',
pointInTime: 'P585',
property: 'P2306',
propertyConstraint: 'P2302',
propertyScope: 'P5314',
publicationDate: 'P577',
referenceURL: 'P854',
relation: 'P2309',
retrieved: 'P813',
reviewScore: 'P444',
reviewScoreBy: 'P447',
shortTitle: 'P1813',
subclassOf: 'P279',
subpropertyOf: 'P1647',
thirdPartyFormatterURL: 'P3303',
title: 'P1476',
unitSymbol: 'P5061',
urlMatchPattern: 'P8966',
urlMatchReplacementValue: 'P8967',
websiteTitleExtractPattern: 'P10999',
},
items: {
album: 'Q482994',
allCaps: 'Q3960579',
allowedEntityTypesConstraint: 'Q52004125',
asMainValue: 'Q54828448',
bigInteger: 'Q84314203',
caseInsensitive: 'Q55121183',
day: 'Q573',
edition: 'Q3331189',
film: 'Q11424',
hour: 'Q25235',
human: 'Q5',
instanceOf: 'Q21503252',
instanceOrSubclassOf: 'Q30208840',
itemRequiresStatementConstraint: 'Q21503247',
lowercase: 'Q65048529',
minute: 'Q7727',
musicalWork: 'Q2188189',
obsoleteProperty: 'Q18644427',
playlist: 'Q1569406',
propertyLinkingToArticlesInMediaWikiWebsites: 'Q123667996',
propertyScopeConstraint: 'Q53869507',
radioStation: 'Q14350',
second: 'Q11574',
subjectTypeConstraint: 'Q21503250',
televisionSeries: 'Q5398426',
televisionSeriesEpisode: 'Q21191270',
userReview: 'Q20058247',
versionEditionOrTranslation: 'Q3331189',
week: 'Q23387',
wikibaseItem: 'Q29934200',
wikibaseLexeme: 'Q51885771',
wikibaseSense: 'Q54285715',
writer: 'Q36180',
year: 'Q577',
},
sites: wikidataSites,
badResolvers: [
'https://wikidata-externalid-url.toolforge.org/',
'https://web.archive.org/web/',
'https://resolve.eidr.org/',
],
},
commons: {
name: 'Wikimedia Commons',
instance: 'https://commons.wikimedia.org',
resolve: false,
//sparqlEndpoint: 'https://commons-query.wikimedia.org/sparql',
},
// configuration for datatrek starts here
datatrek: {
name: 'DataTrek',
instance: 'https://data.wikitrek.org',
wgScriptPath: '/dt',
icon: 'icons/datatrek.svg',
// you might like to add your equivalents of `props` and `items` of
// wikidata `props` and `items` assuming they work *exactly the same*.
props: {
author: 'P50',
// the property references in formatterURL for instance will be used
// to generate links from external ids.
formatterURL: 'P5',
instanceOf: 'P14',
},
items: {
human: 'Q52',
},
// this will be used to resolve wiki articles to datatrek items and
// hopefully the other way around.
// imported from external file
sites: trekSites,
badResolvers: [
'https://wikidata-externalid-url.toolforge.org/',
],
},
};
Object.keys(wikibases).forEach(name => {
wikibases[name].id = name;
const wgScriptPath = wikibases[name]?.wgScriptPath ?? '/w';
wikibases[name].api = WBK({
instance: wikibases[name].instance,
sparqlEndpoint: wikibases[name]?.sparqlEndpoint,
wgScriptPath: wgScriptPath,
wikiRoot: `${wikibases[name].instance}${wgScriptPath}`,
});
});
export default wikibases;