wikidata-sdk
Advanced tools
Comparing version 3.2.0 to 3.2.1
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.3 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var wd_, wikidataTimeToDateObject; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.3 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var simplifyClaims, wd_; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.3 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var nonNull, simplifyClaim, simplifyClaims, simplifyPropertyClaims, wd_; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.3 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var fullDateData, negativeDate, parseInvalideDate, positiveDate; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.3 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var buildUrl, forceArray, isPlainObject, parseSite, ref, shortLang; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.3 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var buildUrl, wd_, wdq_; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.3 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var buildUrl, forceArray, isPlainObject, ref, shortLang, wd_; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.3 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var getEntities, getIdsGroups, isPlainObject; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.3 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var buildUrl, isPlainObject, wd_; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.3 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -17,2 +17,4 @@ var identifyVars, isLabelKey, parseUri, parseValue, | ||
return parseValue(result[varName]); | ||
}).filter(function(result) { | ||
return result != null; | ||
}); | ||
@@ -44,2 +46,4 @@ } else { | ||
return parseUri(valueOjb.value); | ||
case 'bnode': | ||
return null; | ||
default: | ||
@@ -46,0 +50,0 @@ return valueOjb.value; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.3 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ module.exports = function(sparql) { |
@@ -1,9 +0,9 @@ | ||
// Generated by CoffeeScript 1.9.3 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
var err, qs, roots; | ||
var err, error, qs, roots; | ||
try { | ||
qs = require('querystring'); | ||
} catch (_error) { | ||
err = _error; | ||
} catch (error) { | ||
err = error; | ||
qs = require('./querystring_lite'); | ||
@@ -10,0 +10,0 @@ } |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.3 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ module.exports = { |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.3 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ module.exports = { |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.9.3 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var helpers, k, ref, simplifyClaim, simplifyClaims, simplifyPropertyClaims, v, wdk; |
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.wdk = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
// Copyright Joyent, Inc. and other Node contributors. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the | ||
// "Software"), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to permit | ||
// persons to whom the Software is furnished to do so, subject to the | ||
// following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
// USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
'use strict'; | ||
// If obj.hasOwnProperty has been overridden, then calling | ||
// obj.hasOwnProperty(prop) will break. | ||
// See: https://github.com/joyent/node/issues/1707 | ||
function hasOwnProperty(obj, prop) { | ||
return Object.prototype.hasOwnProperty.call(obj, prop); | ||
} | ||
module.exports = function(qs, sep, eq, options) { | ||
sep = sep || '&'; | ||
eq = eq || '='; | ||
var obj = {}; | ||
if (typeof qs !== 'string' || qs.length === 0) { | ||
return obj; | ||
} | ||
var regexp = /\+/g; | ||
qs = qs.split(sep); | ||
var maxKeys = 1000; | ||
if (options && typeof options.maxKeys === 'number') { | ||
maxKeys = options.maxKeys; | ||
} | ||
var len = qs.length; | ||
// maxKeys <= 0 means that we should not limit keys count | ||
if (maxKeys > 0 && len > maxKeys) { | ||
len = maxKeys; | ||
} | ||
for (var i = 0; i < len; ++i) { | ||
var x = qs[i].replace(regexp, '%20'), | ||
idx = x.indexOf(eq), | ||
kstr, vstr, k, v; | ||
if (idx >= 0) { | ||
kstr = x.substr(0, idx); | ||
vstr = x.substr(idx + 1); | ||
} else { | ||
kstr = x; | ||
vstr = ''; | ||
} | ||
k = decodeURIComponent(kstr); | ||
v = decodeURIComponent(vstr); | ||
if (!hasOwnProperty(obj, k)) { | ||
obj[k] = v; | ||
} else if (isArray(obj[k])) { | ||
obj[k].push(v); | ||
} else { | ||
obj[k] = [obj[k], v]; | ||
} | ||
} | ||
return obj; | ||
}; | ||
var isArray = Array.isArray || function (xs) { | ||
return Object.prototype.toString.call(xs) === '[object Array]'; | ||
}; | ||
},{}],2:[function(require,module,exports){ | ||
// Copyright Joyent, Inc. and other Node contributors. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the | ||
// "Software"), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to permit | ||
// persons to whom the Software is furnished to do so, subject to the | ||
// following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
// USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
'use strict'; | ||
var stringifyPrimitive = function(v) { | ||
switch (typeof v) { | ||
case 'string': | ||
return v; | ||
case 'boolean': | ||
return v ? 'true' : 'false'; | ||
case 'number': | ||
return isFinite(v) ? v : ''; | ||
default: | ||
return ''; | ||
} | ||
}; | ||
module.exports = function(obj, sep, eq, name) { | ||
sep = sep || '&'; | ||
eq = eq || '='; | ||
if (obj === null) { | ||
obj = undefined; | ||
} | ||
if (typeof obj === 'object') { | ||
return map(objectKeys(obj), function(k) { | ||
var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; | ||
if (isArray(obj[k])) { | ||
return map(obj[k], function(v) { | ||
return ks + encodeURIComponent(stringifyPrimitive(v)); | ||
}).join(sep); | ||
} else { | ||
return ks + encodeURIComponent(stringifyPrimitive(obj[k])); | ||
} | ||
}).join(sep); | ||
} | ||
if (!name) return ''; | ||
return encodeURIComponent(stringifyPrimitive(name)) + eq + | ||
encodeURIComponent(stringifyPrimitive(obj)); | ||
}; | ||
var isArray = Array.isArray || function (xs) { | ||
return Object.prototype.toString.call(xs) === '[object Array]'; | ||
}; | ||
function map (xs, f) { | ||
if (xs.map) return xs.map(f); | ||
var res = []; | ||
for (var i = 0; i < xs.length; i++) { | ||
res.push(f(xs[i], i)); | ||
} | ||
return res; | ||
} | ||
var objectKeys = Object.keys || function (obj) { | ||
var res = []; | ||
for (var key in obj) { | ||
if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); | ||
} | ||
return res; | ||
}; | ||
},{}],3:[function(require,module,exports){ | ||
'use strict'; | ||
exports.decode = exports.parse = require('./decode'); | ||
exports.encode = exports.stringify = require('./encode'); | ||
},{"./decode":1,"./encode":2}],4:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -258,4 +79,4 @@ var wd_, wikidataTimeToDateObject; | ||
},{"./wikidata_time_to_date_object":7}],5:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
},{"./wikidata_time_to_date_object":4}],2:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -294,4 +115,4 @@ var simplifyClaims, wd_; | ||
},{"./helpers":4,"./simplify_claims":6}],6:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
},{"./helpers":1,"./simplify_claims":3}],3:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -355,4 +176,4 @@ var nonNull, simplifyClaim, simplifyClaims, simplifyPropertyClaims, wd_; | ||
},{"./helpers":4}],7:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
},{"./helpers":1}],4:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -399,4 +220,4 @@ var fullDateData, negativeDate, parseInvalideDate, positiveDate; | ||
},{}],8:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
},{}],5:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -450,4 +271,4 @@ var buildUrl, forceArray, isPlainObject, parseSite, ref, shortLang; | ||
},{"../utils/build_url":15,"../utils/utils":17}],9:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
},{"../utils/build_url":12,"../utils/utils":14}],6:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -486,4 +307,4 @@ var buildUrl, wd_, wdq_; | ||
},{"../helpers/helpers":4,"../utils/build_url":15}],10:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
},{"../helpers/helpers":1,"../utils/build_url":12}],7:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -529,4 +350,4 @@ var buildUrl, forceArray, isPlainObject, ref, shortLang, wd_; | ||
},{"../helpers/helpers":4,"../utils/build_url":15,"../utils/utils":17}],11:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
},{"../helpers/helpers":1,"../utils/build_url":12,"../utils/utils":14}],8:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -565,4 +386,4 @@ var getEntities, getIdsGroups, isPlainObject; | ||
},{"../utils/utils":17,"./wikidata_get_entities":10}],12:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
},{"../utils/utils":14,"./wikidata_get_entities":7}],9:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -601,4 +422,4 @@ var buildUrl, isPlainObject, wd_; | ||
},{"../helpers/helpers":4,"../utils/build_url":15,"../utils/utils":17}],13:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
},{"../helpers/helpers":1,"../utils/build_url":12,"../utils/utils":14}],10:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -619,2 +440,4 @@ var identifyVars, isLabelKey, parseUri, parseValue, | ||
return parseValue(result[varName]); | ||
}).filter(function(result) { | ||
return result != null; | ||
}); | ||
@@ -646,2 +469,4 @@ } else { | ||
return parseUri(valueOjb.value); | ||
case 'bnode': | ||
return null; | ||
default: | ||
@@ -677,4 +502,4 @@ return valueOjb.value; | ||
},{}],14:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
},{}],11:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -689,11 +514,11 @@ module.exports = function(sparql) { | ||
},{}],15:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
},{}],12:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
var err, qs, roots; | ||
var err, error, qs, roots; | ||
try { | ||
qs = require('querystring'); | ||
} catch (_error) { | ||
err = _error; | ||
} catch (error) { | ||
err = error; | ||
qs = require('./querystring_lite'); | ||
@@ -714,4 +539,4 @@ } | ||
},{"./querystring_lite":16,"querystring":3}],16:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
},{"./querystring_lite":13,"querystring":18}],13:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -738,4 +563,4 @@ module.exports = { | ||
},{}],17:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
},{}],14:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -768,4 +593,4 @@ module.exports = { | ||
},{}],18:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.9.3 | ||
},{}],15:[function(require,module,exports){ | ||
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
@@ -813,3 +638,182 @@ var helpers, k, ref, simplifyClaim, simplifyClaims, simplifyPropertyClaims, v, wdk; | ||
},{"./helpers/helpers":4,"./helpers/parse_responses":5,"./helpers/simplify_claims":6,"./queries/get_wikidata_ids_from_sitelinks":8,"./queries/wdq_get_reverse_claims":9,"./queries/wikidata_get_entities":10,"./queries/wikidata_get_many_entities":11,"./queries/wikidata_search_entities":12,"./queries/wikidata_simplify_sparql_results":13,"./queries/wikidata_sparql_query":14}]},{},[18])(18) | ||
},{"./helpers/helpers":1,"./helpers/parse_responses":2,"./helpers/simplify_claims":3,"./queries/get_wikidata_ids_from_sitelinks":5,"./queries/wdq_get_reverse_claims":6,"./queries/wikidata_get_entities":7,"./queries/wikidata_get_many_entities":8,"./queries/wikidata_search_entities":9,"./queries/wikidata_simplify_sparql_results":10,"./queries/wikidata_sparql_query":11}],16:[function(require,module,exports){ | ||
// Copyright Joyent, Inc. and other Node contributors. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the | ||
// "Software"), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to permit | ||
// persons to whom the Software is furnished to do so, subject to the | ||
// following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
// USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
'use strict'; | ||
// If obj.hasOwnProperty has been overridden, then calling | ||
// obj.hasOwnProperty(prop) will break. | ||
// See: https://github.com/joyent/node/issues/1707 | ||
function hasOwnProperty(obj, prop) { | ||
return Object.prototype.hasOwnProperty.call(obj, prop); | ||
} | ||
module.exports = function(qs, sep, eq, options) { | ||
sep = sep || '&'; | ||
eq = eq || '='; | ||
var obj = {}; | ||
if (typeof qs !== 'string' || qs.length === 0) { | ||
return obj; | ||
} | ||
var regexp = /\+/g; | ||
qs = qs.split(sep); | ||
var maxKeys = 1000; | ||
if (options && typeof options.maxKeys === 'number') { | ||
maxKeys = options.maxKeys; | ||
} | ||
var len = qs.length; | ||
// maxKeys <= 0 means that we should not limit keys count | ||
if (maxKeys > 0 && len > maxKeys) { | ||
len = maxKeys; | ||
} | ||
for (var i = 0; i < len; ++i) { | ||
var x = qs[i].replace(regexp, '%20'), | ||
idx = x.indexOf(eq), | ||
kstr, vstr, k, v; | ||
if (idx >= 0) { | ||
kstr = x.substr(0, idx); | ||
vstr = x.substr(idx + 1); | ||
} else { | ||
kstr = x; | ||
vstr = ''; | ||
} | ||
k = decodeURIComponent(kstr); | ||
v = decodeURIComponent(vstr); | ||
if (!hasOwnProperty(obj, k)) { | ||
obj[k] = v; | ||
} else if (isArray(obj[k])) { | ||
obj[k].push(v); | ||
} else { | ||
obj[k] = [obj[k], v]; | ||
} | ||
} | ||
return obj; | ||
}; | ||
var isArray = Array.isArray || function (xs) { | ||
return Object.prototype.toString.call(xs) === '[object Array]'; | ||
}; | ||
},{}],17:[function(require,module,exports){ | ||
// Copyright Joyent, Inc. and other Node contributors. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the | ||
// "Software"), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to permit | ||
// persons to whom the Software is furnished to do so, subject to the | ||
// following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
// USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
'use strict'; | ||
var stringifyPrimitive = function(v) { | ||
switch (typeof v) { | ||
case 'string': | ||
return v; | ||
case 'boolean': | ||
return v ? 'true' : 'false'; | ||
case 'number': | ||
return isFinite(v) ? v : ''; | ||
default: | ||
return ''; | ||
} | ||
}; | ||
module.exports = function(obj, sep, eq, name) { | ||
sep = sep || '&'; | ||
eq = eq || '='; | ||
if (obj === null) { | ||
obj = undefined; | ||
} | ||
if (typeof obj === 'object') { | ||
return map(objectKeys(obj), function(k) { | ||
var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; | ||
if (isArray(obj[k])) { | ||
return map(obj[k], function(v) { | ||
return ks + encodeURIComponent(stringifyPrimitive(v)); | ||
}).join(sep); | ||
} else { | ||
return ks + encodeURIComponent(stringifyPrimitive(obj[k])); | ||
} | ||
}).join(sep); | ||
} | ||
if (!name) return ''; | ||
return encodeURIComponent(stringifyPrimitive(name)) + eq + | ||
encodeURIComponent(stringifyPrimitive(obj)); | ||
}; | ||
var isArray = Array.isArray || function (xs) { | ||
return Object.prototype.toString.call(xs) === '[object Array]'; | ||
}; | ||
function map (xs, f) { | ||
if (xs.map) return xs.map(f); | ||
var res = []; | ||
for (var i = 0; i < xs.length; i++) { | ||
res.push(f(xs[i], i)); | ||
} | ||
return res; | ||
} | ||
var objectKeys = Object.keys || function (obj) { | ||
var res = []; | ||
for (var key in obj) { | ||
if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); | ||
} | ||
return res; | ||
}; | ||
},{}],18:[function(require,module,exports){ | ||
'use strict'; | ||
exports.decode = exports.parse = require('./decode'); | ||
exports.encode = exports.stringify = require('./encode'); | ||
},{"./decode":16,"./encode":17}]},{},[15])(15) | ||
}); |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.wdk=e()}}(function(){return function e(t,i,n){function r(s,o){if(!i[s]){if(!t[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=i[s]={exports:{}};t[s][0].call(c.exports,function(e){var i=t[s][1][e];return r(i?i:e)},c,c.exports,e,t,i,n)}return i[s].exports}for(var a="function"==typeof require&&require,s=0;s<n.length;s++)r(n[s]);return r}({1:[function(e,t,i){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,i,a){t=t||"&",i=i||"=";var s={};if("string"!=typeof e||0===e.length)return s;var o=/\+/g;e=e.split(t);var u=1e3;a&&"number"==typeof a.maxKeys&&(u=a.maxKeys);var l=e.length;u>0&&l>u&&(l=u);for(var c=0;l>c;++c){var f,p,d,m,h=e[c].replace(o,"%20"),g=h.indexOf(i);g>=0?(f=h.substr(0,g),p=h.substr(g+1)):(f=h,p=""),d=decodeURIComponent(f),m=decodeURIComponent(p),n(s,d)?r(s[d])?s[d].push(m):s[d]=[s[d],m]:s[d]=m}return s};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],2:[function(e,t,i){"use strict";function n(e,t){if(e.map)return e.map(t);for(var i=[],n=0;n<e.length;n++)i.push(t(e[n],n));return i}var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,i,o){return t=t||"&",i=i||"=",null===e&&(e=void 0),"object"==typeof e?n(s(e),function(s){var o=encodeURIComponent(r(s))+i;return a(e[s])?n(e[s],function(e){return o+encodeURIComponent(r(e))}).join(t):o+encodeURIComponent(r(e[s]))}).join(t):o?encodeURIComponent(r(o))+i+encodeURIComponent(r(e)):""};var a=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},s=Object.keys||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.push(i);return t}},{}],3:[function(e,t,i){"use strict";i.decode=i.parse=e("./decode"),i.encode=i.stringify=e("./encode")},{"./decode":1,"./encode":2}],4:[function(e,t,i){(function(){var i,n;n=e("./wikidata_time_to_date_object"),i={},i.isNumericId=function(e){return/^[0-9]+$/.test(e)},i.isWikidataId=function(e){return/^(Q|P)[0-9]+$/.test(e)},i.isWikidataEntityId=function(e){return/^Q[0-9]+$/.test(e)},i.isWikidataPropertyId=function(e){return/^P[0-9]+$/.test(e)},i.normalizeId=function(e,t,n){if(null==n&&(n="Q"),i.isNumericId(e))return t?e:""+n+e;if(i.isWikidataId(e))return t?e.slice(1):e;throw new Error("invalid id")},i.getNumericId=function(e){if(!i.isWikidataId(e))throw new Error("invalid wikidata id: "+e);return e.replace(/Q|P/,"")},i.normalizeIds=function(e,t,n){return null==n&&(n="Q"),e.map(function(e){return i.normalizeId(e,t,n)})},i.wikidataTimeToDateObject=n,i.wikidataTimeToEpochTime=function(e){return n(e).getTime()},i.wikidataTimeToISOString=function(e){return n(e).toISOString()},i.normalizeWikidataTime=i.wikidataTimeToEpochTime,t.exports=i}).call(this)},{"./wikidata_time_to_date_object":7}],5:[function(e,t,i){(function(){var i,n;n=e("./helpers"),i=e("./simplify_claims"),t.exports={wd:{entities:function(e){var t,n,r;e=e.body||e,t=e.entities;for(r in t)n=t[r],n.claims=i(n.claims);return t}},wdq:{entities:function(e){var t;return e=e.body||e,null!=(t=e.items)?t.map(function(e){return n.normalizeId(e)}):void 0}}}}).call(this)},{"./helpers":4,"./simplify_claims":6}],6:[function(e,t,i){(function(){var i,n,r,a,s;s=e("./helpers"),r=function(e){var t,i,n;n={};for(t in e)i=e[t],n[t]=a(i);return n},a=function(e){return e.map(n).filter(i)},i=function(e){return null!=e},n=function(e){var t,i,n;if(n=e.mainsnak,null==n)return null;if(t=n.datatype,i=n.datavalue,null==i)return null;switch(t){case"string":case"commonsMedia":case"url":case"external-id":return i.value;case"monolingualtext":return i.value.text;case"wikibase-item":return"Q"+i.value["numeric-id"];case"time":return s.normalizeWikidataTime(i.value.time);default:return null}},t.exports={simplifyClaims:r,simplifyPropertyClaims:a,simplifyClaim:n}}).call(this)},{"./helpers":4}],7:[function(e,t,i){(function(){var e,i,n,r;t.exports=function(t){var i,r,a;return a=t[0],r=t.slice(1),i=e(a,r),"Invalid Date"===i.toString()?n(a,r):i},e=function(e,t){return"-"===e?i(t):r(t)},r=function(e){return new Date(e)},i=function(e){var t;return t="-00"+e,new Date(t)},n=function(t,i){var n,r,a,s;return a=i.split("T")[0].split("-"),s=a[0],r=a[1],n=a[2],e(t,s)}}).call(this)},{}],8:[function(e,t,i){(function(){var i,n,r,a,s,o;i=e("../utils/build_url"),s=e("../utils/utils"),r=s.isPlainObject,n=s.forceArray,o=s.shortLang,t.exports=function(e,t,s,u,l){var c,f;if(r(e)&&(f=e,e=f.titles,t=f.sites,s=f.languages,u=f.props,l=f.format),l||(l="json"),null==e||0===e.length)throw new Error("no title provided");return(null==t||0===t.length)&&(t=["enwiki"]),e=n(e),t=n(t).map(a),u=n(u),c={action:"wbgetentities",titles:e.join("|"),sites:t.join("|"),format:l},null!=s&&(s=n(s).map(o),c.languages=s.join("|")),(null!=u?u.length:void 0)>0&&(c.props=u.join("|")),i("wikidata",c)},a=function(e){return 2===e.length?e+"wiki":e}}).call(this)},{"../utils/build_url":15,"../utils/utils":17}],9:[function(e,t,i){(function(){var i,n,r;i=e("../utils/build_url"),n=e("../helpers/helpers"),r={claim:function(e,t){return e=n.normalizeId(e,!0),t=n.normalizeId(t,!0),i("wdq",{q:"CLAIM["+e+":"+t+"]"})},string:function(e,t){return e=n.normalizeId(e,!0),i("wdq",{q:"STRING["+e+":"+t+"]"})}},t.exports=function(e,t){return n.isWikidataEntityId(t)?r.claim(e,t):r.string(e,t)}}).call(this)},{"../helpers/helpers":4,"../utils/build_url":15}],10:[function(e,t,i){(function(){var i,n,r,a,s,o;o=e("../helpers/helpers"),i=e("../utils/build_url"),a=e("../utils/utils"),r=a.isPlainObject,n=a.forceArray,s=a.shortLang,t.exports=function(e,t,a,u){var l,c;if(r(e)&&(c=e,e=c.ids,t=c.languages,a=c.props,u=c.format),u||(u="json"),null==e&&0!==e.length)throw new Error("no id provided");return e.length>50&&console.warn("getEntities accepts 50 ids max to match Wikidata API limitations:\nthis request won't get all the desired entities.\nYou can use getManyEntities instead to generate several request urls\nto work around this limitation"),e=o.normalizeIds(n(e)),a=n(a),l={action:"wbgetentities",ids:e.join("|"),format:u},null!=t&&(t=n(t).map(s),l.languages=t.join("|")),(null!=a?a.length:void 0)>0&&(l.props=a.join("|")),i("wikidata",l)}}).call(this)},{"../helpers/helpers":4,"../utils/build_url":15,"../utils/utils":17}],11:[function(e,t,i){(function(){var i,n,r;i=e("./wikidata_get_entities"),r=e("../utils/utils").isPlainObject,t.exports=function(e,t,a,s){var o;if(r(e)&&(o=e,e=o.ids,t=o.languages,a=o.props,s=o.format),!(e instanceof Array))throw new Error("getManyEntities expects an array of ids");return n(e).map(function(e){return i(e,t,a,s)})},n=function(e){var t,i;for(i=[];e.length>0;)t=e.slice(0,50),e=e.slice(50),i.push(t);return i}}).call(this)},{"../utils/utils":17,"./wikidata_get_entities":10}],12:[function(e,t,i){(function(){var i,n,r;r=e("../helpers/helpers"),i=e("../utils/build_url"),n=e("../utils/utils").isPlainObject,t.exports=function(e,t,r,a,s){var o;if(n(e)&&(o=e,e=o.search,t=o.language,r=o.limit,a=o.format,s=o.uselang),!((null!=e?e.length:void 0)>0))throw new Error("search can't be empty");return t||(t="en"),s||(s=t),r||(r="20"),a||(a="json"),i("wikidata",{action:"wbsearchentities",search:e,language:t,limit:r,format:a,uselang:s})}}).call(this)},{"../helpers/helpers":4,"../utils/build_url":15,"../utils/utils":17}],13:[function(e,t,i){(function(){var e,i,n,r,a=[].indexOf||function(e){for(var t=0,i=this.length;i>t;t++)if(t in this&&this[t]===e)return t;return-1};t.exports=function(t){var i,n,a,s,o,u;return"string"==typeof t&&(t=JSON.parse(t)),s=t.head.vars,n=t.results.bindings,1===s.length?(a=s[0],n.map(function(e){return r(e[a])})):(i=e(s),o=i[0],u=i[1],n.map(function(e){var t,i,n,s,l;for(l={},t=0,n=o.length;n>t;t++)a=o[t],l[a]={value:r(e[a]),label:e[a+"Label"].value};for(i=0,s=u.length;s>i;i++)a=u[i],l[a]=r(e[a]);return l}))},r=function(e){switch(e.type){case"uri":return n(e.value);default:return e.value}},n=function(e){return e.replace("http://www.wikidata.org/entity/","")},i=function(e){return/^\w+Label$/.test(e)},e=function(e){var t,i,n,r,s,o;for(s=[],o=[],t=0,i=e.length;i>t;t++)r=e[t],n=r+"Label",a.call(e,n)>=0?s.push(r):/^\w+Label$/.test(r)||o.push(r);return[s,o]}}).call(this)},{}],14:[function(e,t,i){(function(){t.exports=function(e){var t;return t=encodeURIComponent(e),"https://query.wikidata.org/sparql?format=json&query="+t}}).call(this)},{}],15:[function(e,t,i){(function(){var i,n,r;try{n=e("querystring")}catch(a){i=a,n=e("./querystring_lite")}r={wikidata:"https://www.wikidata.org/w/api.php",commons:"http://commons.wikimedia.org",wdq:"http://wdq.wmflabs.org/api"},t.exports=function(e,t){return r[e]+"?"+n.stringify(t)}}).call(this)},{"./querystring_lite":16,querystring:3}],16:[function(e,t,i){(function(){t.exports={stringify:function(e){var t,i,n;i="";for(t in e)n=e[t],null!=n&&(i+="&"+t+"="+n);return i=i.slice(1),"undefined"!=typeof encodeURI&&null!==encodeURI?encodeURI(i):i}}}).call(this)},{}],17:[function(e,t,i){(function(){t.exports={shortLang:function(e){return e.slice(0,3)},forceArray:function(e){return"string"==typeof e&&(e=[e]),e||[]},isPlainObject:function(e){return null==e?!1:"object"!=typeof e?!1:e instanceof Array?!1:!0}}}).call(this)},{}],18:[function(e,t,i){(function(){var i,n,r,a,s,o,u,l;t.exports=l={},i=e("./helpers/helpers"),l.searchEntities=e("./queries/wikidata_search_entities"),l.getEntities=e("./queries/wikidata_get_entities"),l.getManyEntities=e("./queries/wikidata_get_many_entities"),l.getWikidataIdsFromSitelinks=e("./queries/get_wikidata_ids_from_sitelinks"),l.sparqlQuery=e("./queries/wikidata_sparql_query"),l.getReverseClaims=e("./queries/wdq_get_reverse_claims"),l.parse=e("./helpers/parse_responses"),r=e("./helpers/simplify_claims"),a=r.simplifyClaim,o=r.simplifyPropertyClaims,s=r.simplifyClaims,l.simplifyClaim=a,l.simplifyPropertyClaims=o,l.simplifyClaims=s,l.simplifySparqlResults=e("./queries/wikidata_simplify_sparql_results"),l.getWikidataIdsFromWikipediaTitles=l.getWikidataIdsFromSitelinks,l.helpers=i;for(n in i)u=i[n],l[n]=u}).call(this)},{"./helpers/helpers":4,"./helpers/parse_responses":5,"./helpers/simplify_claims":6,"./queries/get_wikidata_ids_from_sitelinks":8,"./queries/wdq_get_reverse_claims":9,"./queries/wikidata_get_entities":10,"./queries/wikidata_get_many_entities":11,"./queries/wikidata_search_entities":12,"./queries/wikidata_simplify_sparql_results":13,"./queries/wikidata_sparql_query":14}]},{},[18])(18)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.wdk=e()}}(function(){return function e(t,i,n){function r(s,o){if(!i[s]){if(!t[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=i[s]={exports:{}};t[s][0].call(c.exports,function(e){var i=t[s][1][e];return r(i?i:e)},c,c.exports,e,t,i,n)}return i[s].exports}for(var a="function"==typeof require&&require,s=0;s<n.length;s++)r(n[s]);return r}({1:[function(e,t,i){(function(){var i,n;n=e("./wikidata_time_to_date_object"),i={},i.isNumericId=function(e){return/^[0-9]+$/.test(e)},i.isWikidataId=function(e){return/^(Q|P)[0-9]+$/.test(e)},i.isWikidataEntityId=function(e){return/^Q[0-9]+$/.test(e)},i.isWikidataPropertyId=function(e){return/^P[0-9]+$/.test(e)},i.normalizeId=function(e,t,n){if(null==n&&(n="Q"),i.isNumericId(e))return t?e:""+n+e;if(i.isWikidataId(e))return t?e.slice(1):e;throw new Error("invalid id")},i.getNumericId=function(e){if(!i.isWikidataId(e))throw new Error("invalid wikidata id: "+e);return e.replace(/Q|P/,"")},i.normalizeIds=function(e,t,n){return null==n&&(n="Q"),e.map(function(e){return i.normalizeId(e,t,n)})},i.wikidataTimeToDateObject=n,i.wikidataTimeToEpochTime=function(e){return n(e).getTime()},i.wikidataTimeToISOString=function(e){return n(e).toISOString()},i.normalizeWikidataTime=i.wikidataTimeToEpochTime,t.exports=i}).call(this)},{"./wikidata_time_to_date_object":4}],2:[function(e,t,i){(function(){var i,n;n=e("./helpers"),i=e("./simplify_claims"),t.exports={wd:{entities:function(e){var t,n,r;e=e.body||e,t=e.entities;for(r in t)n=t[r],n.claims=i(n.claims);return t}},wdq:{entities:function(e){var t;return e=e.body||e,null!=(t=e.items)?t.map(function(e){return n.normalizeId(e)}):void 0}}}}).call(this)},{"./helpers":1,"./simplify_claims":3}],3:[function(e,t,i){(function(){var i,n,r,a,s;s=e("./helpers"),r=function(e){var t,i,n;n={};for(t in e)i=e[t],n[t]=a(i);return n},a=function(e){return e.map(n).filter(i)},i=function(e){return null!=e},n=function(e){var t,i,n;if(n=e.mainsnak,null==n)return null;if(t=n.datatype,i=n.datavalue,null==i)return null;switch(t){case"string":case"commonsMedia":case"url":case"external-id":return i.value;case"monolingualtext":return i.value.text;case"wikibase-item":return"Q"+i.value["numeric-id"];case"time":return s.normalizeWikidataTime(i.value.time);default:return null}},t.exports={simplifyClaims:r,simplifyPropertyClaims:a,simplifyClaim:n}}).call(this)},{"./helpers":1}],4:[function(e,t,i){(function(){var e,i,n,r;t.exports=function(t){var i,r,a;return a=t[0],r=t.slice(1),i=e(a,r),"Invalid Date"===i.toString()?n(a,r):i},e=function(e,t){return"-"===e?i(t):r(t)},r=function(e){return new Date(e)},i=function(e){var t;return t="-00"+e,new Date(t)},n=function(t,i){var n,r,a,s;return a=i.split("T")[0].split("-"),s=a[0],r=a[1],n=a[2],e(t,s)}}).call(this)},{}],5:[function(e,t,i){(function(){var i,n,r,a,s,o;i=e("../utils/build_url"),s=e("../utils/utils"),r=s.isPlainObject,n=s.forceArray,o=s.shortLang,t.exports=function(e,t,s,u,l){var c,f;if(r(e)&&(f=e,e=f.titles,t=f.sites,s=f.languages,u=f.props,l=f.format),l||(l="json"),null==e||0===e.length)throw new Error("no title provided");return null!=t&&0!==t.length||(t=["enwiki"]),e=n(e),t=n(t).map(a),u=n(u),c={action:"wbgetentities",titles:e.join("|"),sites:t.join("|"),format:l},null!=s&&(s=n(s).map(o),c.languages=s.join("|")),(null!=u?u.length:void 0)>0&&(c.props=u.join("|")),i("wikidata",c)},a=function(e){return 2===e.length?e+"wiki":e}}).call(this)},{"../utils/build_url":12,"../utils/utils":14}],6:[function(e,t,i){(function(){var i,n,r;i=e("../utils/build_url"),n=e("../helpers/helpers"),r={claim:function(e,t){return e=n.normalizeId(e,!0),t=n.normalizeId(t,!0),i("wdq",{q:"CLAIM["+e+":"+t+"]"})},string:function(e,t){return e=n.normalizeId(e,!0),i("wdq",{q:"STRING["+e+":"+t+"]"})}},t.exports=function(e,t){return n.isWikidataEntityId(t)?r.claim(e,t):r.string(e,t)}}).call(this)},{"../helpers/helpers":1,"../utils/build_url":12}],7:[function(e,t,i){(function(){var i,n,r,a,s,o;o=e("../helpers/helpers"),i=e("../utils/build_url"),a=e("../utils/utils"),r=a.isPlainObject,n=a.forceArray,s=a.shortLang,t.exports=function(e,t,a,u){var l,c;if(r(e)&&(c=e,e=c.ids,t=c.languages,a=c.props,u=c.format),u||(u="json"),null==e&&0!==e.length)throw new Error("no id provided");return e.length>50&&console.warn("getEntities accepts 50 ids max to match Wikidata API limitations:\nthis request won't get all the desired entities.\nYou can use getManyEntities instead to generate several request urls\nto work around this limitation"),e=o.normalizeIds(n(e)),a=n(a),l={action:"wbgetentities",ids:e.join("|"),format:u},null!=t&&(t=n(t).map(s),l.languages=t.join("|")),(null!=a?a.length:void 0)>0&&(l.props=a.join("|")),i("wikidata",l)}}).call(this)},{"../helpers/helpers":1,"../utils/build_url":12,"../utils/utils":14}],8:[function(e,t,i){(function(){var i,n,r;i=e("./wikidata_get_entities"),r=e("../utils/utils").isPlainObject,t.exports=function(e,t,a,s){var o;if(r(e)&&(o=e,e=o.ids,t=o.languages,a=o.props,s=o.format),!(e instanceof Array))throw new Error("getManyEntities expects an array of ids");return n(e).map(function(e){return i(e,t,a,s)})},n=function(e){var t,i;for(i=[];e.length>0;)t=e.slice(0,50),e=e.slice(50),i.push(t);return i}}).call(this)},{"../utils/utils":14,"./wikidata_get_entities":7}],9:[function(e,t,i){(function(){var i,n,r;r=e("../helpers/helpers"),i=e("../utils/build_url"),n=e("../utils/utils").isPlainObject,t.exports=function(e,t,r,a,s){var o;if(n(e)&&(o=e,e=o.search,t=o.language,r=o.limit,a=o.format,s=o.uselang),!((null!=e?e.length:void 0)>0))throw new Error("search can't be empty");return t||(t="en"),s||(s=t),r||(r="20"),a||(a="json"),i("wikidata",{action:"wbsearchentities",search:e,language:t,limit:r,format:a,uselang:s})}}).call(this)},{"../helpers/helpers":1,"../utils/build_url":12,"../utils/utils":14}],10:[function(e,t,i){(function(){var e,i,n,r,a=[].indexOf||function(e){for(var t=0,i=this.length;t<i;t++)if(t in this&&this[t]===e)return t;return-1};t.exports=function(t){var i,n,a,s,o,u;return"string"==typeof t&&(t=JSON.parse(t)),s=t.head.vars,n=t.results.bindings,1===s.length?(a=s[0],n.map(function(e){return r(e[a])}).filter(function(e){return null!=e})):(i=e(s),o=i[0],u=i[1],n.map(function(e){var t,i,n,s,l;for(l={},t=0,n=o.length;t<n;t++)a=o[t],l[a]={value:r(e[a]),label:e[a+"Label"].value};for(i=0,s=u.length;i<s;i++)a=u[i],l[a]=r(e[a]);return l}))},r=function(e){switch(e.type){case"uri":return n(e.value);case"bnode":return null;default:return e.value}},n=function(e){return e.replace("http://www.wikidata.org/entity/","")},i=function(e){return/^\w+Label$/.test(e)},e=function(e){var t,i,n,r,s,o;for(s=[],o=[],t=0,i=e.length;t<i;t++)r=e[t],n=r+"Label",a.call(e,n)>=0?s.push(r):/^\w+Label$/.test(r)||o.push(r);return[s,o]}}).call(this)},{}],11:[function(e,t,i){(function(){t.exports=function(e){var t;return t=encodeURIComponent(e),"https://query.wikidata.org/sparql?format=json&query="+t}}).call(this)},{}],12:[function(e,t,i){(function(){var i,n,r;try{n=e("querystring")}catch(t){i=t,n=e("./querystring_lite")}r={wikidata:"https://www.wikidata.org/w/api.php",commons:"http://commons.wikimedia.org",wdq:"http://wdq.wmflabs.org/api"},t.exports=function(e,t){return r[e]+"?"+n.stringify(t)}}).call(this)},{"./querystring_lite":13,querystring:18}],13:[function(e,t,i){(function(){t.exports={stringify:function(e){var t,i,n;i="";for(t in e)n=e[t],null!=n&&(i+="&"+t+"="+n);return i=i.slice(1),"undefined"!=typeof encodeURI&&null!==encodeURI?encodeURI(i):i}}}).call(this)},{}],14:[function(e,t,i){(function(){t.exports={shortLang:function(e){return e.slice(0,3)},forceArray:function(e){return"string"==typeof e&&(e=[e]),e||[]},isPlainObject:function(e){return null!=e&&("object"==typeof e&&!(e instanceof Array))}}}).call(this)},{}],15:[function(e,t,i){(function(){var i,n,r,a,s,o,u,l;t.exports=l={},i=e("./helpers/helpers"),l.searchEntities=e("./queries/wikidata_search_entities"),l.getEntities=e("./queries/wikidata_get_entities"),l.getManyEntities=e("./queries/wikidata_get_many_entities"),l.getWikidataIdsFromSitelinks=e("./queries/get_wikidata_ids_from_sitelinks"),l.sparqlQuery=e("./queries/wikidata_sparql_query"),l.getReverseClaims=e("./queries/wdq_get_reverse_claims"),l.parse=e("./helpers/parse_responses"),r=e("./helpers/simplify_claims"),a=r.simplifyClaim,o=r.simplifyPropertyClaims,s=r.simplifyClaims,l.simplifyClaim=a,l.simplifyPropertyClaims=o,l.simplifyClaims=s,l.simplifySparqlResults=e("./queries/wikidata_simplify_sparql_results"),l.getWikidataIdsFromWikipediaTitles=l.getWikidataIdsFromSitelinks,l.helpers=i;for(n in i)u=i[n],l[n]=u}).call(this)},{"./helpers/helpers":1,"./helpers/parse_responses":2,"./helpers/simplify_claims":3,"./queries/get_wikidata_ids_from_sitelinks":5,"./queries/wdq_get_reverse_claims":6,"./queries/wikidata_get_entities":7,"./queries/wikidata_get_many_entities":8,"./queries/wikidata_search_entities":9,"./queries/wikidata_simplify_sparql_results":10,"./queries/wikidata_sparql_query":11}],16:[function(e,t,i){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,i,a){t=t||"&",i=i||"=";var s={};if("string"!=typeof e||0===e.length)return s;var o=/\+/g;e=e.split(t);var u=1e3;a&&"number"==typeof a.maxKeys&&(u=a.maxKeys);var l=e.length;u>0&&l>u&&(l=u);for(var c=0;c<l;++c){var f,p,d,m,h=e[c].replace(o,"%20"),g=h.indexOf(i);g>=0?(f=h.substr(0,g),p=h.substr(g+1)):(f=h,p=""),d=decodeURIComponent(f),m=decodeURIComponent(p),n(s,d)?r(s[d])?s[d].push(m):s[d]=[s[d],m]:s[d]=m}return s};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],17:[function(e,t,i){"use strict";function n(e,t){if(e.map)return e.map(t);for(var i=[],n=0;n<e.length;n++)i.push(t(e[n],n));return i}var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,i,o){return t=t||"&",i=i||"=",null===e&&(e=void 0),"object"==typeof e?n(s(e),function(s){var o=encodeURIComponent(r(s))+i;return a(e[s])?n(e[s],function(e){return o+encodeURIComponent(r(e))}).join(t):o+encodeURIComponent(r(e[s]))}).join(t):o?encodeURIComponent(r(o))+i+encodeURIComponent(r(e)):""};var a=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},s=Object.keys||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.push(i);return t}},{}],18:[function(e,t,i){"use strict";i.decode=i.parse=e("./decode"),i.encode=i.stringify=e("./encode")},{"./decode":16,"./encode":17}]},{},[15])(15)}); |
{ | ||
"name": "wikidata-sdk", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "a javascript tool suite to query and work with wikidata data", | ||
@@ -39,2 +39,3 @@ "main": "build/wikidata-sdk.js", | ||
"devDependencies": { | ||
"browserify": "^13.1.0", | ||
"coffee-script": "^1.9.3", | ||
@@ -41,0 +42,0 @@ "coffeelint": "^1.10.1", |
@@ -38,7 +38,4 @@  | ||
- [Command Line Interface](#cli) | ||
- [qlabel](#qlabel) | ||
- [wikiqid](#wikiqid) | ||
- [License](#license) | ||
# Installation | ||
@@ -45,0 +42,0 @@ |
@@ -23,4 +23,4 @@ { | ||
"entity" : { | ||
"type" : "uri", | ||
"value" : "http://www.wikidata.org/entity/Q8302875" | ||
"type" : "bnode", | ||
"value" : "t284055162" | ||
}, | ||
@@ -30,3 +30,3 @@ "entityLabel" : { | ||
"type" : "literal", | ||
"value" : "Jean-Claude Lalumière" | ||
"value" : "FAKE BNODE" | ||
}, | ||
@@ -33,0 +33,0 @@ "year" : { |
@@ -23,2 +23,7 @@ { | ||
"genre" : { | ||
"type" : "bnode", | ||
"value" : "t284055162" | ||
} | ||
}, { | ||
"genre" : { | ||
"type" : "uri", | ||
@@ -25,0 +30,0 @@ "value" : "http://www.wikidata.org/entity/Q1473346" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
277570
6599
7
493