made with requirebin
Last active
September 12, 2015 18:22
-
-
Save pietercolpaert/a9d8bce043eeff6b768e to your computer and use it in GitHub Desktop.
requirebin sketch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// require() some stuff from npm (like you were using browserify) | |
// and then hit Run Code to run it on the right | |
var ldf = require('ldf-client'); | |
var fragmentsClient = new ldf.FragmentsClient('http://fragments.dbpedia.org/2014/en'); | |
var query = 'SELECT * { ?s ?p <http://dbpedia.org/resource/Belgium>. ?s ?p ?o } LIMIT 10', | |
results = new ldf.SparqlIterator(query, { fragmentsClient: fragmentsClient }); | |
results.on('data', function (data) { | |
window.alert(JSON.stringify(data)); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require=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){},{}],2:[function(require,module,exports){var util=require("util/");var pSlice=Array.prototype.slice;var hasOwn=Object.prototype.hasOwnProperty;var assert=module.exports=ok;assert.AssertionError=function AssertionError(options){this.name="AssertionError";this.actual=options.actual;this.expected=options.expected;this.operator=options.operator;if(options.message){this.message=options.message;this.generatedMessage=false}else{this.message=getMessage(this);this.generatedMessage=true}var stackStartFunction=options.stackStartFunction||fail;if(Error.captureStackTrace){Error.captureStackTrace(this,stackStartFunction)}else{var err=new Error;if(err.stack){var out=err.stack;var fn_name=stackStartFunction.name;var idx=out.indexOf("\n"+fn_name);if(idx>=0){var next_line=out.indexOf("\n",idx+1);out=out.substring(next_line+1)}this.stack=out}}};util.inherits(assert.AssertionError,Error);function replacer(key,value){if(util.isUndefined(value)){return""+value}if(util.isNumber(value)&&(isNaN(value)||!isFinite(value))){return value.toString()}if(util.isFunction(value)||util.isRegExp(value)){return value.toString()}return value}function truncate(s,n){if(util.isString(s)){return s.length<n?s:s.slice(0,n)}else{return s}}function getMessage(self){return truncate(JSON.stringify(self.actual,replacer),128)+" "+self.operator+" "+truncate(JSON.stringify(self.expected,replacer),128)}function fail(actual,expected,message,operator,stackStartFunction){throw new assert.AssertionError({message:message,actual:actual,expected:expected,operator:operator,stackStartFunction:stackStartFunction})}assert.fail=fail;function ok(value,message){if(!value)fail(value,true,message,"==",assert.ok)}assert.ok=ok;assert.equal=function equal(actual,expected,message){if(actual!=expected)fail(actual,expected,message,"==",assert.equal)};assert.notEqual=function notEqual(actual,expected,message){if(actual==expected){fail(actual,expected,message,"!=",assert.notEqual)}};assert.deepEqual=function deepEqual(actual,expected,message){if(!_deepEqual(actual,expected)){fail(actual,expected,message,"deepEqual",assert.deepEqual)}};function _deepEqual(actual,expected){if(actual===expected){return true}else if(util.isBuffer(actual)&&util.isBuffer(expected)){if(actual.length!=expected.length)return false;for(var i=0;i<actual.length;i++){if(actual[i]!==expected[i])return false}return true}else if(util.isDate(actual)&&util.isDate(expected)){return actual.getTime()===expected.getTime()}else if(util.isRegExp(actual)&&util.isRegExp(expected)){return actual.source===expected.source&&actual.global===expected.global&&actual.multiline===expected.multiline&&actual.lastIndex===expected.lastIndex&&actual.ignoreCase===expected.ignoreCase}else if(!util.isObject(actual)&&!util.isObject(expected)){return actual==expected}else{return objEquiv(actual,expected)}}function isArguments(object){return Object.prototype.toString.call(object)=="[object Arguments]"}function objEquiv(a,b){if(util.isNullOrUndefined(a)||util.isNullOrUndefined(b))return false;if(a.prototype!==b.prototype)return false;if(isArguments(a)){if(!isArguments(b)){return false}a=pSlice.call(a);b=pSlice.call(b);return _deepEqual(a,b)}try{var ka=objectKeys(a),kb=objectKeys(b),key,i}catch(e){return false}if(ka.length!=kb.length)return false;ka.sort();kb.sort();for(i=ka.length-1;i>=0;i--){if(ka[i]!=kb[i])return false}for(i=ka.length-1;i>=0;i--){key=ka[i];if(!_deepEqual(a[key],b[key]))return false}return true}assert.notDeepEqual=function notDeepEqual(actual,expected,message){if(_deepEqual(actual,expected)){fail(actual,expected,message,"notDeepEqual",assert.notDeepEqual)}};assert.strictEqual=function strictEqual(actual,expected,message){if(actual!==expected){fail(actual,expected,message,"===",assert.strictEqual)}};assert.notStrictEqual=function notStrictEqual(actual,expected,message){if(actual===expected){fail(actual,expected,message,"!==",assert.notStrictEqual)}};function expectedException(actual,expected){if(!actual||!expected){return false}if(Object.prototype.toString.call(expected)=="[object RegExp]"){return expected.test(actual)}else if(actual instanceof expected){return true}else if(expected.call({},actual)===true){return true}return false}function _throws(shouldThrow,block,expected,message){var actual;if(util.isString(expected)){message=expected;expected=null}try{block()}catch(e){actual=e}message=(expected&&expected.name?" ("+expected.name+").":".")+(message?" "+message:".");if(shouldThrow&&!actual){fail(actual,expected,"Missing expected exception"+message)}if(!shouldThrow&&expectedException(actual,expected)){fail(actual,expected,"Got unwanted exception"+message)}if(shouldThrow&&actual&&expected&&!expectedException(actual,expected)||!shouldThrow&&actual){throw actual}}assert.throws=function(block,error,message){_throws.apply(this,[true].concat(pSlice.call(arguments)))};assert.doesNotThrow=function(block,message){_throws.apply(this,[false].concat(pSlice.call(arguments)))};assert.ifError=function(err){if(err){throw err}};var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj){if(hasOwn.call(obj,key))keys.push(key)}return keys}},{"util/":27}],3:[function(require,module,exports){arguments[4][1][0].apply(exports,arguments)},{dup:1}],4:[function(require,module,exports){var base64=require("base64-js");var ieee754=require("ieee754");var isArray=require("is-array");exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;Buffer.poolSize=8192;var kMaxLength=1073741823;var rootParent={};Buffer.TYPED_ARRAY_SUPPORT=function(){try{var buf=new ArrayBuffer(0);var arr=new Uint8Array(buf);arr.foo=function(){return 42};return 42===arr.foo()&&typeof arr.subarray==="function"&&new Uint8Array(1).subarray(1,1).byteLength===0}catch(e){return false}}();function Buffer(subject,encoding,noZero){if(!(this instanceof Buffer))return new Buffer(subject,encoding,noZero);var type=typeof subject;var length;if(type==="number")length=subject>0?subject>>>0:0;else if(type==="string"){length=Buffer.byteLength(subject,encoding)}else if(type==="object"&&subject!==null){if(subject.type==="Buffer"&&isArray(subject.data))subject=subject.data;length=+subject.length>0?Math.floor(+subject.length):0}else throw new TypeError("must start with number, buffer, array or string");if(length>kMaxLength)throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+kMaxLength.toString(16)+" bytes");var buf;if(Buffer.TYPED_ARRAY_SUPPORT){buf=Buffer._augment(new Uint8Array(length))}else{buf=this;buf.length=length;buf._isBuffer=true}var i;if(Buffer.TYPED_ARRAY_SUPPORT&&typeof subject.byteLength==="number"){buf._set(subject)}else if(isArrayish(subject)){if(Buffer.isBuffer(subject)){for(i=0;i<length;i++)buf[i]=subject.readUInt8(i)}else{for(i=0;i<length;i++)buf[i]=(subject[i]%256+256)%256}}else if(type==="string"){buf.write(subject,0,encoding)}else if(type==="number"&&!Buffer.TYPED_ARRAY_SUPPORT&&!noZero){for(i=0;i<length;i++){buf[i]=0}}if(length>0&&length<=Buffer.poolSize)buf.parent=rootParent;return buf}function SlowBuffer(subject,encoding,noZero){if(!(this instanceof SlowBuffer))return new SlowBuffer(subject,encoding,noZero);var buf=new Buffer(subject,encoding,noZero);delete buf.parent;return buf}Buffer.isBuffer=function(b){return!!(b!=null&&b._isBuffer)};Buffer.compare=function(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError("Arguments must be Buffers");var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i<len&&a[i]===b[i];i++){}if(i!==len){x=a[i];y=b[i]}if(x<y)return-1;if(y<x)return 1;return 0};Buffer.isEncoding=function(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return true;default:return false}};Buffer.concat=function(list,totalLength){if(!isArray(list))throw new TypeError("Usage: Buffer.concat(list[, length])");if(list.length===0){return new Buffer(0)}else if(list.length===1){return list[0]}var i;if(totalLength===undefined){totalLength=0;for(i=0;i<list.length;i++){totalLength+=list[i].length}}var buf=new Buffer(totalLength);var pos=0;for(i=0;i<list.length;i++){var item=list[i];item.copy(buf,pos);pos+=item.length}return buf};Buffer.byteLength=function(str,encoding){var ret;str=str+"";switch(encoding||"utf8"){case"ascii":case"binary":case"raw":ret=str.length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=str.length*2;break;case"hex":ret=str.length>>>1;break;case"utf8":case"utf-8":ret=utf8ToBytes(str).length;break;case"base64":ret=base64ToBytes(str).length;break;default:ret=str.length}return ret};Buffer.prototype.length=undefined;Buffer.prototype.parent=undefined;Buffer.prototype.toString=function(encoding,start,end){var loweredCase=false;start=start>>>0;end=end===undefined||end===Infinity?this.length:end>>>0;if(!encoding)encoding="utf8";if(start<0)start=0;if(end>this.length)end=this.length;if(end<=start)return"";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"binary":return binarySlice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}};Buffer.prototype.equals=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return Buffer.compare(this,b)===0};Buffer.prototype.inspect=function(){var str="";var max=exports.INSPECT_MAX_BYTES;if(this.length>0){str=this.toString("hex",0,max).match(/.{2}/g).join(" ");if(this.length>max)str+=" ... "}return"<Buffer "+str+">"};Buffer.prototype.compare=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return Buffer.compare(this,b)};Buffer.prototype.get=function(offset){console.log(".get() is deprecated. Access using array indexes instead.");return this.readUInt8(offset)};Buffer.prototype.set=function(v,offset){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(v,offset)};function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}var strLen=string.length;if(strLen%2!==0)throw new Error("Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;i<length;i++){var byte=parseInt(string.substr(i*2,2),16);if(isNaN(byte))throw new Error("Invalid hex string");buf[offset+i]=byte}return i}function utf8Write(buf,string,offset,length){var charsWritten=blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length);return charsWritten}function asciiWrite(buf,string,offset,length){var charsWritten=blitBuffer(asciiToBytes(string),buf,offset,length);return charsWritten}function binaryWrite(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){var charsWritten=blitBuffer(base64ToBytes(string),buf,offset,length);return charsWritten}function utf16leWrite(buf,string,offset,length){var charsWritten=blitBuffer(utf16leToBytes(string,buf.length-offset),buf,offset,length,2);return charsWritten}Buffer.prototype.write=function(string,offset,length,encoding){if(isFinite(offset)){if(!isFinite(length)){encoding=length;length=undefined}}else{var swap=encoding;encoding=offset;offset=length;length=swap}offset=Number(offset)||0;if(length<0||offset<0||offset>this.length)throw new RangeError("attempt to write outside buffer bounds");var remaining=this.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}encoding=String(encoding||"utf8").toLowerCase();var ret;switch(encoding){case"hex":ret=hexWrite(this,string,offset,length);break;case"utf8":case"utf-8":ret=utf8Write(this,string,offset,length);break;case"ascii":ret=asciiWrite(this,string,offset,length);break;case"binary":ret=binaryWrite(this,string,offset,length);break;case"base64":ret=base64Write(this,string,offset,length);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=utf16leWrite(this,string,offset,length);break;default:throw new TypeError("Unknown encoding: "+encoding)}return ret};Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){var res="";var tmp="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){if(buf[i]<=127){res+=decodeUtf8Char(tmp)+String.fromCharCode(buf[i]);tmp=""}else{tmp+="%"+buf[i].toString(16)}}return res+decodeUtf8Char(tmp)}function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){ret+=String.fromCharCode(buf[i]&127)}return ret}function binarySlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){ret+=String.fromCharCode(buf[i])}return ret}function hexSlice(buf,start,end){var len=buf.length;if(!start||start<0)start=0;if(!end||end<0||end>len)end=len;var out="";for(var i=start;i<end;i++){out+=toHex(buf[i])}return out}function utf16leSlice(buf,start,end){var bytes=buf.slice(start,end);var res="";for(var i=0;i<bytes.length;i+=2){res+=String.fromCharCode(bytes[i]+bytes[i+1]*256)}return res}Buffer.prototype.slice=function(start,end){var len=this.length;start=~~start;end=end===undefined?len:~~end;if(start<0){start+=len;if(start<0)start=0}else if(start>len){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(end<start)end=start;var newBuf;if(Buffer.TYPED_ARRAY_SUPPORT){newBuf=Buffer._augment(this.subarray(start,end))}else{var sliceLen=end-start;newBuf=new Buffer(sliceLen,undefined,true);for(var i=0;i<sliceLen;i++){newBuf[i]=this[i+start]}}if(newBuf.length)newBuf.parent=this.parent||this;return newBuf};function checkOffset(offset,ext,length){if(offset%1!==0||offset<0)throw new RangeError("offset is not uint");if(offset+ext>length)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256))val+=this[offset+i]*mul;return val};Buffer.prototype.readUIntBE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset+--byteLength];var mul=1;while(byteLength>0&&(mul*=256))val+=this[offset+--byteLength]*mul;return val};Buffer.prototype.readUInt8=function(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256))val+=this[offset+i]*mul;mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256))val+=this[offset+--i]*mul;mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError("buffer must be a Buffer instance");if(value>max||value<min)throw new RangeError("value is out of bounds");if(offset+ext>buf.length)throw new RangeError("index out of range")}Buffer.prototype.writeUIntLE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength),0);var mul=1;var i=0;this[offset]=value&255;while(++i<byteLength&&(mul*=256))this[offset+i]=value/mul>>>0&255;return offset+byteLength};Buffer.prototype.writeUIntBE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength),0);var i=byteLength-1;var mul=1;this[offset+i]=value&255;while(--i>=0&&(mul*=256))this[offset+i]=value/mul>>>0&255;return offset+byteLength};Buffer.prototype.writeUInt8=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,255,0);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);this[offset]=value;return offset+1};function objectWriteUInt16(buf,value,offset,littleEndian){if(value<0)value=65535+value+1;for(var i=0,j=Math.min(buf.length-offset,2);i<j;i++){buf[offset+i]=(value&255<<8*(littleEndian?i:1-i))>>>(littleEndian?i:1-i)*8}}Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8}else objectWriteUInt16(this,value,offset,true);return offset+2};Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value}else objectWriteUInt16(this,value,offset,false);return offset+2};function objectWriteUInt32(buf,value,offset,littleEndian){if(value<0)value=4294967295+value+1;for(var i=0,j=Math.min(buf.length-offset,4);i<j;i++){buf[offset+i]=value>>>(littleEndian?i:3-i)*8&255}}Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value}else objectWriteUInt32(this,value,offset,true);return offset+4};Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value}else objectWriteUInt32(this,value,offset,false);return offset+4};Buffer.prototype.writeIntLE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength-1)-1,-Math.pow(2,8*byteLength-1))}var i=0;var mul=1;var sub=value<0?1:0;this[offset]=value&255;while(++i<byteLength&&(mul*=256))this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength};Buffer.prototype.writeIntBE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength-1)-1,-Math.pow(2,8*byteLength-1))}var i=byteLength-1;var mul=1;var sub=value<0?1:0;this[offset+i]=value&255;while(--i>=0&&(mul*=256))this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength};Buffer.prototype.writeInt8=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);if(value<0)value=255+value+1;this[offset]=value;return offset+1};Buffer.prototype.writeInt16LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8}else objectWriteUInt16(this,value,offset,true);return offset+2};Buffer.prototype.writeInt16BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value}else objectWriteUInt16(this,value,offset,false);return offset+2};Buffer.prototype.writeInt32LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24}else objectWriteUInt32(this,value,offset,true);return offset+4};Buffer.prototype.writeInt32BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value}else objectWriteUInt32(this,value,offset,false);return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(value>max||value<min)throw new RangeError("value is out of bounds");if(offset+ext>buf.length)throw new RangeError("index out of range");if(offset<0)throw new RangeError("index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert)checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38);ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert)checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308);ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function(target,target_start,start,end){var source=this;if(!start)start=0;if(!end&&end!==0)end=this.length;if(target_start>=target.length)target_start=target.length;if(!target_start)target_start=0;if(end>0&&end<start)end=start;if(end===start)return 0;if(target.length===0||source.length===0)return 0;if(target_start<0)throw new RangeError("targetStart out of bounds");if(start<0||start>=source.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-target_start<end-start)end=target.length-target_start+start;var len=end-start;if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT){for(var i=0;i<len;i++){target[i+target_start]=this[i+start]}}else{target._set(this.subarray(start,start+len),target_start)}return len};Buffer.prototype.fill=function(value,start,end){if(!value)value=0;if(!start)start=0;if(!end)end=this.length;if(end<start)throw new RangeError("end < start");if(end===start)return;if(this.length===0)return;if(start<0||start>=this.length)throw new RangeError("start out of bounds");if(end<0||end>this.length)throw new RangeError("end out of bounds");var i;if(typeof value==="number"){for(i=start;i<end;i++){this[i]=value}}else{var bytes=utf8ToBytes(value.toString());var len=bytes.length;for(i=start;i<end;i++){this[i]=bytes[i%len]}}return this};Buffer.prototype.toArrayBuffer=function(){if(typeof Uint8Array!=="undefined"){if(Buffer.TYPED_ARRAY_SUPPORT){return new Buffer(this).buffer}else{var buf=new Uint8Array(this.length);for(var i=0,len=buf.length;i<len;i+=1){buf[i]=this[i]}return buf.buffer}}else{throw new TypeError("Buffer.toArrayBuffer not supported in this browser")}};var BP=Buffer.prototype;Buffer._augment=function(arr){arr.constructor=Buffer;arr._isBuffer=true;arr._get=arr.get;arr._set=arr.set;arr.get=BP.get;arr.set=BP.set;arr.write=BP.write;arr.toString=BP.toString;arr.toLocaleString=BP.toString;arr.toJSON=BP.toJSON;arr.equals=BP.equals;arr.compare=BP.compare;arr.copy=BP.copy;arr.slice=BP.slice;arr.readUIntLE=BP.readUIntLE;arr.readUIntBE=BP.readUIntBE;arr.readUInt8=BP.readUInt8;arr.readUInt16LE=BP.readUInt16LE;arr.readUInt16BE=BP.readUInt16BE;arr.readUInt32LE=BP.readUInt32LE;arr.readUInt32BE=BP.readUInt32BE;arr.readIntLE=BP.readIntLE;arr.readIntBE=BP.readIntBE;arr.readInt8=BP.readInt8;arr.readInt16LE=BP.readInt16LE;arr.readInt16BE=BP.readInt16BE;arr.readInt32LE=BP.readInt32LE;arr.readInt32BE=BP.readInt32BE;arr.readFloatLE=BP.readFloatLE;arr.readFloatBE=BP.readFloatBE;arr.readDoubleLE=BP.readDoubleLE;arr.readDoubleBE=BP.readDoubleBE;arr.writeUInt8=BP.writeUInt8;arr.writeUIntLE=BP.writeUIntLE;arr.writeUIntBE=BP.writeUIntBE;arr.writeUInt16LE=BP.writeUInt16LE;arr.writeUInt16BE=BP.writeUInt16BE;arr.writeUInt32LE=BP.writeUInt32LE;arr.writeUInt32BE=BP.writeUInt32BE;arr.writeIntLE=BP.writeIntLE;arr.writeIntBE=BP.writeIntBE;arr.writeInt8=BP.writeInt8;arr.writeInt16LE=BP.writeInt16LE;arr.writeInt16BE=BP.writeInt16BE;arr.writeInt32LE=BP.writeInt32LE;arr.writeInt32BE=BP.writeInt32BE;arr.writeFloatLE=BP.writeFloatLE;arr.writeFloatBE=BP.writeFloatBE;arr.writeDoubleLE=BP.writeDoubleLE;arr.writeDoubleBE=BP.writeDoubleBE;arr.fill=BP.fill;arr.inspect=BP.inspect;arr.toArrayBuffer=BP.toArrayBuffer;return arr};var INVALID_BASE64_RE=/[^+\/0-9A-z\-]/g;function base64clean(str){str=stringtrim(str).replace(INVALID_BASE64_RE,"");if(str.length<2)return"";while(str.length%4!==0){str=str+"="}return str}function stringtrim(str){if(str.trim)return str.trim();return str.replace(/^\s+|\s+$/g,"")}function isArrayish(subject){return isArray(subject)||Buffer.isBuffer(subject)||subject&&typeof subject==="object"&&typeof subject.length==="number"}function toHex(n){if(n<16)return"0"+n.toString(16);return n.toString(16)}function utf8ToBytes(string,units){var codePoint,length=string.length;var leadSurrogate=null;units=units||Infinity;var bytes=[];var i=0;for(;i<length;i++){codePoint=string.charCodeAt(i);if(codePoint>55295&&codePoint<57344){if(leadSurrogate){if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}else{codePoint=leadSurrogate-55296<<10|codePoint-56320|65536;leadSurrogate=null}}else{if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}else{leadSurrogate=codePoint;continue}}}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=null}if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<2097152){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i<str.length;i++){byteArray.push(str.charCodeAt(i)&255)}return byteArray}function utf16leToBytes(str,units){var c,hi,lo;var byteArray=[];for(var i=0;i<str.length;i++){if((units-=2)<0)break;c=str.charCodeAt(i);hi=c>>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length,unitSize){if(unitSize)length-=length%unitSize;for(var i=0;i<length;i++){if(i+offset>=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function decodeUtf8Char(str){try{return decodeURIComponent(str)}catch(err){return String.fromCharCode(65533)}}},{"base64-js":5,ieee754:6,"is-array":7}],5:[function(require,module,exports){var lookup="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(exports){"use strict";var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var PLUS="+".charCodeAt(0);var SLASH="/".charCodeAt(0);var NUMBER="0".charCodeAt(0);var LOWER="a".charCodeAt(0);var UPPER="A".charCodeAt(0);var PLUS_URL_SAFE="-".charCodeAt(0);var SLASH_URL_SAFE="_".charCodeAt(0);function decode(elt){var code=elt.charCodeAt(0);if(code===PLUS||code===PLUS_URL_SAFE)return 62;if(code===SLASH||code===SLASH_URL_SAFE)return 63;if(code<NUMBER)return-1;if(code<NUMBER+10)return code-NUMBER+26+26;if(code<UPPER+26)return code-UPPER;if(code<LOWER+26)return code-LOWER+26}function b64ToByteArray(b64){var i,j,l,tmp,placeHolders,arr;if(b64.length%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var len=b64.length;placeHolders="="===b64.charAt(len-2)?2:"="===b64.charAt(len-1)?1:0;arr=new Arr(b64.length*3/4-placeHolders);l=placeHolders>0?b64.length-4:b64.length;var L=0;function push(v){arr[L++]=v}for(i=0,j=0;i<l;i+=4,j+=3){tmp=decode(b64.charAt(i))<<18|decode(b64.charAt(i+1))<<12|decode(b64.charAt(i+2))<<6|decode(b64.charAt(i+3));push((tmp&16711680)>>16);push((tmp&65280)>>8);push(tmp&255)}if(placeHolders===2){tmp=decode(b64.charAt(i))<<2|decode(b64.charAt(i+1))>>4;push(tmp&255)}else if(placeHolders===1){tmp=decode(b64.charAt(i))<<10|decode(b64.charAt(i+1))<<4|decode(b64.charAt(i+2))>>2;push(tmp>>8&255);push(tmp&255)}return arr}function uint8ToBase64(uint8){var i,extraBytes=uint8.length%3,output="",temp,length;function encode(num){return lookup.charAt(num)}function tripletToBase64(num){return encode(num>>18&63)+encode(num>>12&63)+encode(num>>6&63)+encode(num&63)}for(i=0,length=uint8.length-extraBytes;i<length;i+=3){temp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2]; | |
output+=tripletToBase64(temp)}switch(extraBytes){case 1:temp=uint8[uint8.length-1];output+=encode(temp>>2);output+=encode(temp<<4&63);output+="==";break;case 2:temp=(uint8[uint8.length-2]<<8)+uint8[uint8.length-1];output+=encode(temp>>10);output+=encode(temp>>4&63);output+=encode(temp<<2&63);output+="=";break}return output}exports.toByteArray=b64ToByteArray;exports.fromByteArray=uint8ToBase64})(typeof exports==="undefined"?this.base64js={}:exports)},{}],6:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8);m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8);if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8);e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=s*128}},{}],7:[function(require,module,exports){var isArray=Array.isArray;var str=Object.prototype.toString;module.exports=isArray||function(val){return!!val&&"[object Array]"==str.call(val)}},{}],8:[function(require,module,exports){function EventEmitter(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}module.exports=EventEmitter;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=undefined;EventEmitter.prototype._maxListeners=undefined;EventEmitter.defaultMaxListeners=10;EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||n<0||isNaN(n))throw TypeError("n must be a positive number");this._maxListeners=n;return this};EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(!this._events)this._events={};if(type==="error"){if(!this._events.error||isObject(this._events.error)&&!this._events.error.length){er=arguments[1];if(er instanceof Error){throw er}throw TypeError('Uncaught, unspecified "error" event.')}}handler=this._events[type];if(isUndefined(handler))return false;if(isFunction(handler)){switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:len=arguments.length;args=new Array(len-1);for(i=1;i<len;i++)args[i-1]=arguments[i];handler.apply(this,args)}}else if(isObject(handler)){len=arguments.length;args=new Array(len-1);for(i=1;i<len;i++)args[i-1]=arguments[i];listeners=handler.slice();len=listeners.length;for(i=0;i<len;i++)listeners[i].apply(this,args)}return true};EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events)this._events={};if(this._events.newListener)this.emit("newListener",type,isFunction(listener.listener)?listener.listener:listener);if(!this._events[type])this._events[type]=listener;else if(isObject(this._events[type]))this._events[type].push(listener);else this._events[type]=[this._events[type],listener];if(isObject(this._events[type])&&!this._events[type].warned){var m;if(!isUndefined(this._maxListeners)){m=this._maxListeners}else{m=EventEmitter.defaultMaxListeners}if(m&&m>0&&this._events[type].length>m){this._events[type].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[type].length);if(typeof console.trace==="function"){console.trace()}}}return this};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.once=function(type,listener){if(!isFunction(listener))throw TypeError("listener must be a function");var fired=false;function g(){this.removeListener(type,g);if(!fired){fired=true;listener.apply(this,arguments)}}g.listener=listener;this.on(type,g);return this};EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;list=this._events[type];length=list.length;position=-1;if(list===listener||isFunction(list.listener)&&list.listener===listener){delete this._events[type];if(this._events.removeListener)this.emit("removeListener",type,listener)}else if(isObject(list)){for(i=length;i-->0;){if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}}if(position<0)return this;if(list.length===1){list.length=0;delete this._events[type]}else{list.splice(position,1)}if(this._events.removeListener)this.emit("removeListener",type,listener)}return this};EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[type])delete this._events[type];return this}if(arguments.length===0){for(key in this._events){if(key==="removeListener")continue;this.removeAllListeners(key)}this.removeAllListeners("removeListener");this._events={};return this}listeners=this._events[type];if(isFunction(listeners)){this.removeListener(type,listeners)}else{while(listeners.length)this.removeListener(type,listeners[listeners.length-1])}delete this._events[type];return this};EventEmitter.prototype.listeners=function(type){var ret;if(!this._events||!this._events[type])ret=[];else if(isFunction(this._events[type]))ret=[this._events[type]];else ret=this._events[type].slice();return ret};EventEmitter.listenerCount=function(emitter,type){var ret;if(!emitter._events||!emitter._events[type])ret=0;else if(isFunction(emitter._events[type]))ret=1;else ret=emitter._events[type].length;return ret};function isFunction(arg){return typeof arg==="function"}function isNumber(arg){return typeof arg==="number"}function isObject(arg){return typeof arg==="object"&&arg!==null}function isUndefined(arg){return arg===void 0}},{}],9:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],10:[function(require,module,exports){module.exports=Array.isArray||function(arr){return Object.prototype.toString.call(arr)=="[object Array]"}},{}],11:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function(filename){return splitPathRe.exec(filename).slice(1)};exports.resolve=function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){continue}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."};exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==="/";path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path};exports.isAbsolute=function(path){return path.charAt(0)==="/"};exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=="string"){throw new TypeError("Arguments to path.join must be strings")}return p}).join("/"))};exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")};exports.sep="/";exports.delimiter=":";exports.dirname=function(path){var result=splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir};exports.basename=function(path,ext){var f=splitPath(path)[2];if(ext&&f.substr(-1*ext.length)===ext){f=f.substr(0,f.length-ext.length)}return f};exports.extname=function(path){return splitPath(path)[3]};function filter(xs,f){if(xs.filter)return xs.filter(f);var res=[];for(var i=0;i<xs.length;i++){if(f(xs[i],i,xs))res.push(xs[i])}return res}var substr="ab".substr(-1)==="b"?function(str,start,len){return str.substr(start,len)}:function(str,start,len){if(start<0)start=str.length+start;return str.substr(start,len)}}).call(this,require("_process"))},{_process:12}],12:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canMutationObserver=typeof window!=="undefined"&&window.MutationObserver;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}var queue=[];if(canMutationObserver){var hiddenDiv=document.createElement("div");var observer=new MutationObserver(function(){var queueList=queue.slice();queue.length=0;queueList.forEach(function(fn){fn()})});observer.observe(hiddenDiv,{attributes:true});return function nextTick(fn){if(!queue.length){hiddenDiv.setAttribute("yes","no")}queue.push(fn)}}if(canPost){window.addEventListener("message",function(ev){var source=ev.source;if((source===window||source===null)&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],13:[function(require,module,exports){module.exports=require("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":14}],14:[function(require,module,exports){(function(process){module.exports=Duplex;var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj)keys.push(key);return keys};var util=require("core-util-is");util.inherits=require("inherits");var Readable=require("./_stream_readable");var Writable=require("./_stream_writable");util.inherits(Duplex,Readable);forEach(objectKeys(Writable.prototype),function(method){if(!Duplex.prototype[method])Duplex.prototype[method]=Writable.prototype[method]});function Duplex(options){if(!(this instanceof Duplex))return new Duplex(options);Readable.call(this,options);Writable.call(this,options);if(options&&options.readable===false)this.readable=false;if(options&&options.writable===false)this.writable=false;this.allowHalfOpen=true;if(options&&options.allowHalfOpen===false)this.allowHalfOpen=false;this.once("end",onend)}function onend(){if(this.allowHalfOpen||this._writableState.ended)return;process.nextTick(this.end.bind(this))}function forEach(xs,f){for(var i=0,l=xs.length;i<l;i++){f(xs[i],i)}}}).call(this,require("_process"))},{"./_stream_readable":16,"./_stream_writable":18,_process:12,"core-util-is":19,inherits:9}],15:[function(require,module,exports){module.exports=PassThrough;var Transform=require("./_stream_transform");var util=require("core-util-is");util.inherits=require("inherits");util.inherits(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options)}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk)}},{"./_stream_transform":17,"core-util-is":19,inherits:9}],16:[function(require,module,exports){(function(process){module.exports=Readable;var isArray=require("isarray");var Buffer=require("buffer").Buffer;Readable.ReadableState=ReadableState;var EE=require("events").EventEmitter;if(!EE.listenerCount)EE.listenerCount=function(emitter,type){return emitter.listeners(type).length};var Stream=require("stream");var util=require("core-util-is");util.inherits=require("inherits");var StringDecoder;util.inherits(Readable,Stream);function ReadableState(options,stream){options=options||{};var hwm=options.highWaterMark;this.highWaterMark=hwm||hwm===0?hwm:16*1024;this.highWaterMark=~~this.highWaterMark;this.buffer=[];this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=false;this.ended=false;this.endEmitted=false;this.reading=false;this.calledRead=false;this.sync=true;this.needReadable=false;this.emittedReadable=false;this.readableListening=false;this.objectMode=!!options.objectMode;this.defaultEncoding=options.defaultEncoding||"utf8";this.ranOut=false;this.awaitDrain=0;this.readingMore=false;this.decoder=null;this.encoding=null;if(options.encoding){if(!StringDecoder)StringDecoder=require("string_decoder/").StringDecoder;this.decoder=new StringDecoder(options.encoding);this.encoding=options.encoding}}function Readable(options){if(!(this instanceof Readable))return new Readable(options);this._readableState=new ReadableState(options,this);this.readable=true;Stream.call(this)}Readable.prototype.push=function(chunk,encoding){var state=this._readableState;if(typeof chunk==="string"&&!state.objectMode){encoding=encoding||state.defaultEncoding;if(encoding!==state.encoding){chunk=new Buffer(chunk,encoding);encoding=""}}return readableAddChunk(this,state,chunk,encoding,false)};Readable.prototype.unshift=function(chunk){var state=this._readableState;return readableAddChunk(this,state,chunk,"",true)};function readableAddChunk(stream,state,chunk,encoding,addToFront){var er=chunkInvalid(state,chunk);if(er){stream.emit("error",er)}else if(chunk===null||chunk===undefined){state.reading=false;if(!state.ended)onEofChunk(stream,state)}else if(state.objectMode||chunk&&chunk.length>0){if(state.ended&&!addToFront){var e=new Error("stream.push() after EOF");stream.emit("error",e)}else if(state.endEmitted&&addToFront){var e=new Error("stream.unshift() after end event");stream.emit("error",e)}else{if(state.decoder&&!addToFront&&!encoding)chunk=state.decoder.write(chunk);state.length+=state.objectMode?1:chunk.length;if(addToFront){state.buffer.unshift(chunk)}else{state.reading=false;state.buffer.push(chunk)}if(state.needReadable)emitReadable(stream);maybeReadMore(stream,state)}}else if(!addToFront){state.reading=false}return needMoreData(state)}function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||state.length===0)}Readable.prototype.setEncoding=function(enc){if(!StringDecoder)StringDecoder=require("string_decoder/").StringDecoder;this._readableState.decoder=new StringDecoder(enc);this._readableState.encoding=enc};var MAX_HWM=8388608;function roundUpToNextPowerOf2(n){if(n>=MAX_HWM){n=MAX_HWM}else{n--;for(var p=1;p<32;p<<=1)n|=n>>p;n++}return n}function howMuchToRead(n,state){if(state.length===0&&state.ended)return 0;if(state.objectMode)return n===0?0:1;if(n===null||isNaN(n)){if(state.flowing&&state.buffer.length)return state.buffer[0].length;else return state.length}if(n<=0)return 0;if(n>state.highWaterMark)state.highWaterMark=roundUpToNextPowerOf2(n);if(n>state.length){if(!state.ended){state.needReadable=true;return 0}else return state.length}return n}Readable.prototype.read=function(n){var state=this._readableState;state.calledRead=true;var nOrig=n;var ret;if(typeof n!=="number"||n>0)state.emittedReadable=false;if(n===0&&state.needReadable&&(state.length>=state.highWaterMark||state.ended)){emitReadable(this);return null}n=howMuchToRead(n,state);if(n===0&&state.ended){ret=null;if(state.length>0&&state.decoder){ret=fromList(n,state);state.length-=ret.length}if(state.length===0)endReadable(this);return ret}var doRead=state.needReadable;if(state.length-n<=state.highWaterMark)doRead=true;if(state.ended||state.reading)doRead=false;if(doRead){state.reading=true;state.sync=true;if(state.length===0)state.needReadable=true;this._read(state.highWaterMark);state.sync=false}if(doRead&&!state.reading)n=howMuchToRead(nOrig,state);if(n>0)ret=fromList(n,state);else ret=null;if(ret===null){state.needReadable=true;n=0}state.length-=n;if(state.length===0&&!state.ended)state.needReadable=true;if(state.ended&&!state.endEmitted&&state.length===0)endReadable(this);return ret};function chunkInvalid(state,chunk){var er=null;if(!Buffer.isBuffer(chunk)&&"string"!==typeof chunk&&chunk!==null&&chunk!==undefined&&!state.objectMode){er=new TypeError("Invalid non-string/buffer chunk")}return er}function onEofChunk(stream,state){if(state.decoder&&!state.ended){var chunk=state.decoder.end();if(chunk&&chunk.length){state.buffer.push(chunk);state.length+=state.objectMode?1:chunk.length}}state.ended=true;if(state.length>0)emitReadable(stream);else endReadable(stream)}function emitReadable(stream){var state=stream._readableState;state.needReadable=false;if(state.emittedReadable)return;state.emittedReadable=true;if(state.sync)process.nextTick(function(){emitReadable_(stream)});else emitReadable_(stream)}function emitReadable_(stream){stream.emit("readable")}function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;process.nextTick(function(){maybeReadMore_(stream,state)})}}function maybeReadMore_(stream,state){var len=state.length;while(!state.reading&&!state.flowing&&!state.ended&&state.length<state.highWaterMark){stream.read(0);if(len===state.length)break;else len=state.length}state.readingMore=false}Readable.prototype._read=function(n){this.emit("error",new Error("not implemented"))};Readable.prototype.pipe=function(dest,pipeOpts){var src=this;var state=this._readableState;switch(state.pipesCount){case 0:state.pipes=dest;break;case 1:state.pipes=[state.pipes,dest];break;default:state.pipes.push(dest);break}state.pipesCount+=1;var doEnd=(!pipeOpts||pipeOpts.end!==false)&&dest!==process.stdout&&dest!==process.stderr;var endFn=doEnd?onend:cleanup;if(state.endEmitted)process.nextTick(endFn);else src.once("end",endFn);dest.on("unpipe",onunpipe);function onunpipe(readable){if(readable!==src)return;cleanup()}function onend(){dest.end()}var ondrain=pipeOnDrain(src);dest.on("drain",ondrain);function cleanup(){dest.removeListener("close",onclose);dest.removeListener("finish",onfinish);dest.removeListener("drain",ondrain);dest.removeListener("error",onerror);dest.removeListener("unpipe",onunpipe);src.removeListener("end",onend);src.removeListener("end",cleanup);if(!dest._writableState||dest._writableState.needDrain)ondrain()}function onerror(er){unpipe();dest.removeListener("error",onerror);if(EE.listenerCount(dest,"error")===0)dest.emit("error",er)}if(!dest._events||!dest._events.error)dest.on("error",onerror);else if(isArray(dest._events.error))dest._events.error.unshift(onerror);else dest._events.error=[onerror,dest._events.error];function onclose(){dest.removeListener("finish",onfinish);unpipe()}dest.once("close",onclose);function onfinish(){dest.removeListener("close",onclose);unpipe()}dest.once("finish",onfinish);function unpipe(){src.unpipe(dest)}dest.emit("pipe",src);if(!state.flowing){this.on("readable",pipeOnReadable);state.flowing=true;process.nextTick(function(){flow(src)})}return dest};function pipeOnDrain(src){return function(){var dest=this;var state=src._readableState;state.awaitDrain--;if(state.awaitDrain===0)flow(src)}}function flow(src){var state=src._readableState;var chunk;state.awaitDrain=0;function write(dest,i,list){var written=dest.write(chunk);if(false===written){state.awaitDrain++}}while(state.pipesCount&&null!==(chunk=src.read())){if(state.pipesCount===1)write(state.pipes,0,null);else forEach(state.pipes,write);src.emit("data",chunk);if(state.awaitDrain>0)return}if(state.pipesCount===0){state.flowing=false;if(EE.listenerCount(src,"data")>0)emitDataEvents(src);return}state.ranOut=true}function pipeOnReadable(){if(this._readableState.ranOut){this._readableState.ranOut=false;flow(this)}}Readable.prototype.unpipe=function(dest){var state=this._readableState;if(state.pipesCount===0)return this;if(state.pipesCount===1){if(dest&&dest!==state.pipes)return this;if(!dest)dest=state.pipes;state.pipes=null;state.pipesCount=0;this.removeListener("readable",pipeOnReadable);state.flowing=false;if(dest)dest.emit("unpipe",this);return this}if(!dest){var dests=state.pipes;var len=state.pipesCount;state.pipes=null;state.pipesCount=0;this.removeListener("readable",pipeOnReadable);state.flowing=false;for(var i=0;i<len;i++)dests[i].emit("unpipe",this);return this}var i=indexOf(state.pipes,dest);if(i===-1)return this;state.pipes.splice(i,1);state.pipesCount-=1;if(state.pipesCount===1)state.pipes=state.pipes[0];dest.emit("unpipe",this);return this};Readable.prototype.on=function(ev,fn){var res=Stream.prototype.on.call(this,ev,fn);if(ev==="data"&&!this._readableState.flowing)emitDataEvents(this);if(ev==="readable"&&this.readable){var state=this._readableState;if(!state.readableListening){state.readableListening=true;state.emittedReadable=false;state.needReadable=true;if(!state.reading){this.read(0)}else if(state.length){emitReadable(this,state)}}}return res};Readable.prototype.addListener=Readable.prototype.on;Readable.prototype.resume=function(){emitDataEvents(this);this.read(0);this.emit("resume")};Readable.prototype.pause=function(){emitDataEvents(this,true);this.emit("pause")};function emitDataEvents(stream,startPaused){var state=stream._readableState;if(state.flowing){throw new Error("Cannot switch to old mode now.")}var paused=startPaused||false;var readable=false;stream.readable=true;stream.pipe=Stream.prototype.pipe;stream.on=stream.addListener=Stream.prototype.on;stream.on("readable",function(){readable=true;var c;while(!paused&&null!==(c=stream.read()))stream.emit("data",c);if(c===null){readable=false;stream._readableState.needReadable=true}});stream.pause=function(){paused=true;this.emit("pause")};stream.resume=function(){paused=false;if(readable)process.nextTick(function(){stream.emit("readable")});else this.read(0);this.emit("resume")};stream.emit("readable")}Readable.prototype.wrap=function(stream){var state=this._readableState;var paused=false;var self=this;stream.on("end",function(){if(state.decoder&&!state.ended){var chunk=state.decoder.end();if(chunk&&chunk.length)self.push(chunk)}self.push(null)});stream.on("data",function(chunk){if(state.decoder)chunk=state.decoder.write(chunk);if(state.objectMode&&(chunk===null||chunk===undefined))return;else if(!state.objectMode&&(!chunk||!chunk.length))return;var ret=self.push(chunk);if(!ret){paused=true;stream.pause()}});for(var i in stream){if(typeof stream[i]==="function"&&typeof this[i]==="undefined"){this[i]=function(method){return function(){return stream[method].apply(stream,arguments)}}(i)}}var events=["error","close","destroy","pause","resume"];forEach(events,function(ev){stream.on(ev,self.emit.bind(self,ev))});self._read=function(n){if(paused){paused=false;stream.resume()}};return self};Readable._fromList=fromList;function fromList(n,state){var list=state.buffer;var length=state.length;var stringMode=!!state.decoder;var objectMode=!!state.objectMode;var ret;if(list.length===0)return null;if(length===0)ret=null;else if(objectMode)ret=list.shift();else if(!n||n>=length){if(stringMode)ret=list.join("");else ret=Buffer.concat(list,length);list.length=0}else{if(n<list[0].length){var buf=list[0];ret=buf.slice(0,n);list[0]=buf.slice(n)}else if(n===list[0].length){ret=list.shift()}else{if(stringMode)ret="";else ret=new Buffer(n);var c=0;for(var i=0,l=list.length;i<l&&c<n;i++){var buf=list[0];var cpy=Math.min(n-c,buf.length);if(stringMode)ret+=buf.slice(0,cpy);else buf.copy(ret,c,0,cpy);if(cpy<buf.length)list[0]=buf.slice(cpy);else list.shift();c+=cpy}}}return ret}function endReadable(stream){var state=stream._readableState;if(state.length>0)throw new Error("endReadable called on non-empty stream");if(!state.endEmitted&&state.calledRead){state.ended=true;process.nextTick(function(){if(!state.endEmitted&&state.length===0){state.endEmitted=true;stream.readable=false;stream.emit("end")}})}}function forEach(xs,f){for(var i=0,l=xs.length;i<l;i++){f(xs[i],i)}}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x)return i}return-1}}).call(this,require("_process"))},{_process:12,buffer:4,"core-util-is":19,events:8,inherits:9,isarray:10,stream:24,"string_decoder/":25}],17:[function(require,module,exports){module.exports=Transform;var Duplex=require("./_stream_duplex");var util=require("core-util-is");util.inherits=require("inherits");util.inherits(Transform,Duplex);function TransformState(options,stream){this.afterTransform=function(er,data){return afterTransform(stream,er,data)};this.needTransform=false;this.transforming=false;this.writecb=null;this.writechunk=null}function afterTransform(stream,er,data){var ts=stream._transformState;ts.transforming=false;var cb=ts.writecb;if(!cb)return stream.emit("error",new Error("no writecb in Transform class"));ts.writechunk=null;ts.writecb=null;if(data!==null&&data!==undefined)stream.push(data);if(cb)cb(er);var rs=stream._readableState;rs.reading=false;if(rs.needReadable||rs.length<rs.highWaterMark){stream._read(rs.highWaterMark)}}function Transform(options){if(!(this instanceof Transform))return new Transform(options);Duplex.call(this,options);var ts=this._transformState=new TransformState(options,this);var stream=this;this._readableState.needReadable=true;this._readableState.sync=false;this.once("finish",function(){if("function"===typeof this._flush)this._flush(function(er){done(stream,er)});else done(stream)})}Transform.prototype.push=function(chunk,encoding){this._transformState.needTransform=false;return Duplex.prototype.push.call(this,chunk,encoding)};Transform.prototype._transform=function(chunk,encoding,cb){throw new Error("not implemented")};Transform.prototype._write=function(chunk,encoding,cb){var ts=this._transformState;ts.writecb=cb;ts.writechunk=chunk;ts.writeencoding=encoding;if(!ts.transforming){var rs=this._readableState;if(ts.needTransform||rs.needReadable||rs.length<rs.highWaterMark)this._read(rs.highWaterMark)}};Transform.prototype._read=function(n){var ts=this._transformState;if(ts.writechunk!==null&&ts.writecb&&!ts.transforming){ts.transforming=true;this._transform(ts.writechunk,ts.writeencoding,ts.afterTransform)}else{ts.needTransform=true}};function done(stream,er){if(er)return stream.emit("error",er);var ws=stream._writableState;var rs=stream._readableState;var ts=stream._transformState;if(ws.length)throw new Error("calling transform done when ws.length != 0");if(ts.transforming)throw new Error("calling transform done when still transforming");return stream.push(null)}},{"./_stream_duplex":14,"core-util-is":19,inherits:9}],18:[function(require,module,exports){(function(process){module.exports=Writable;var Buffer=require("buffer").Buffer;Writable.WritableState=WritableState;var util=require("core-util-is");util.inherits=require("inherits");var Stream=require("stream");util.inherits(Writable,Stream);function WriteReq(chunk,encoding,cb){this.chunk=chunk;this.encoding=encoding;this.callback=cb}function WritableState(options,stream){options=options||{};var hwm=options.highWaterMark;this.highWaterMark=hwm||hwm===0?hwm:16*1024;this.objectMode=!!options.objectMode;this.highWaterMark=~~this.highWaterMark;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;var noDecode=options.decodeStrings===false;this.decodeStrings=!noDecode;this.defaultEncoding=options.defaultEncoding||"utf8";this.length=0;this.writing=false;this.sync=true;this.bufferProcessing=false;this.onwrite=function(er){onwrite(stream,er)};this.writecb=null;this.writelen=0;this.buffer=[];this.errorEmitted=false}function Writable(options){var Duplex=require("./_stream_duplex");if(!(this instanceof Writable)&&!(this instanceof Duplex))return new Writable(options);this._writableState=new WritableState(options,this);this.writable=true;Stream.call(this)}Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))};function writeAfterEnd(stream,state,cb){var er=new Error("write after end");stream.emit("error",er);process.nextTick(function(){cb(er)})}function validChunk(stream,state,chunk,cb){var valid=true;if(!Buffer.isBuffer(chunk)&&"string"!==typeof chunk&&chunk!==null&&chunk!==undefined&&!state.objectMode){var er=new TypeError("Invalid non-string/buffer chunk");stream.emit("error",er);process.nextTick(function(){cb(er)});valid=false}return valid}Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState;var ret=false;if(typeof encoding==="function"){cb=encoding;encoding=null}if(Buffer.isBuffer(chunk))encoding="buffer";else if(!encoding)encoding=state.defaultEncoding;if(typeof cb!=="function")cb=function(){};if(state.ended)writeAfterEnd(this,state,cb);else if(validChunk(this,state,chunk,cb))ret=writeOrBuffer(this,state,chunk,encoding,cb);return ret};function decodeChunk(state,chunk,encoding){if(!state.objectMode&&state.decodeStrings!==false&&typeof chunk==="string"){chunk=new Buffer(chunk,encoding)}return chunk}function writeOrBuffer(stream,state,chunk,encoding,cb){chunk=decodeChunk(state,chunk,encoding);if(Buffer.isBuffer(chunk))encoding="buffer";var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length<state.highWaterMark;if(!ret)state.needDrain=true;if(state.writing)state.buffer.push(new WriteReq(chunk,encoding,cb));else doWrite(stream,state,len,chunk,encoding,cb);return ret}function doWrite(stream,state,len,chunk,encoding,cb){state.writelen=len;state.writecb=cb;state.writing=true;state.sync=true;stream._write(chunk,encoding,state.onwrite);state.sync=false}function onwriteError(stream,state,sync,er,cb){if(sync)process.nextTick(function(){cb(er)});else cb(er);stream._writableState.errorEmitted=true;stream.emit("error",er)}function onwriteStateUpdate(state){state.writing=false;state.writecb=null;state.length-=state.writelen;state.writelen=0; | |
}function onwrite(stream,er){var state=stream._writableState;var sync=state.sync;var cb=state.writecb;onwriteStateUpdate(state);if(er)onwriteError(stream,state,sync,er,cb);else{var finished=needFinish(stream,state);if(!finished&&!state.bufferProcessing&&state.buffer.length)clearBuffer(stream,state);if(sync){process.nextTick(function(){afterWrite(stream,state,finished,cb)})}else{afterWrite(stream,state,finished,cb)}}}function afterWrite(stream,state,finished,cb){if(!finished)onwriteDrain(stream,state);cb();if(finished)finishMaybe(stream,state)}function onwriteDrain(stream,state){if(state.length===0&&state.needDrain){state.needDrain=false;stream.emit("drain")}}function clearBuffer(stream,state){state.bufferProcessing=true;for(var c=0;c<state.buffer.length;c++){var entry=state.buffer[c];var chunk=entry.chunk;var encoding=entry.encoding;var cb=entry.callback;var len=state.objectMode?1:chunk.length;doWrite(stream,state,len,chunk,encoding,cb);if(state.writing){c++;break}}state.bufferProcessing=false;if(c<state.buffer.length)state.buffer=state.buffer.slice(c);else state.buffer.length=0}Writable.prototype._write=function(chunk,encoding,cb){cb(new Error("not implemented"))};Writable.prototype.end=function(chunk,encoding,cb){var state=this._writableState;if(typeof chunk==="function"){cb=chunk;chunk=null;encoding=null}else if(typeof encoding==="function"){cb=encoding;encoding=null}if(typeof chunk!=="undefined"&&chunk!==null)this.write(chunk,encoding);if(!state.ending&&!state.finished)endWritable(this,state,cb)};function needFinish(stream,state){return state.ending&&state.length===0&&!state.finished&&!state.writing}function finishMaybe(stream,state){var need=needFinish(stream,state);if(need){state.finished=true;stream.emit("finish")}return need}function endWritable(stream,state,cb){state.ending=true;finishMaybe(stream,state);if(cb){if(state.finished)process.nextTick(cb);else stream.once("finish",cb)}state.ended=true}}).call(this,require("_process"))},{"./_stream_duplex":14,_process:12,buffer:4,"core-util-is":19,inherits:9,stream:24}],19:[function(require,module,exports){(function(Buffer){function isArray(ar){return Array.isArray(ar)}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return isObject(re)&&objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return isObject(d)&&objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return isObject(e)&&(objectToString(e)==="[object Error]"||e instanceof Error)}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;function isBuffer(arg){return Buffer.isBuffer(arg)}exports.isBuffer=isBuffer;function objectToString(o){return Object.prototype.toString.call(o)}}).call(this,require("buffer").Buffer)},{buffer:4}],20:[function(require,module,exports){module.exports=require("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":15}],21:[function(require,module,exports){var Stream=require("stream");exports=module.exports=require("./lib/_stream_readable.js");exports.Stream=Stream;exports.Readable=exports;exports.Writable=require("./lib/_stream_writable.js");exports.Duplex=require("./lib/_stream_duplex.js");exports.Transform=require("./lib/_stream_transform.js");exports.PassThrough=require("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":14,"./lib/_stream_passthrough.js":15,"./lib/_stream_readable.js":16,"./lib/_stream_transform.js":17,"./lib/_stream_writable.js":18,stream:24}],22:[function(require,module,exports){module.exports=require("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":17}],23:[function(require,module,exports){module.exports=require("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":18}],24:[function(require,module,exports){module.exports=Stream;var EE=require("events").EventEmitter;var inherits=require("inherits");inherits(Stream,EE);Stream.Readable=require("readable-stream/readable.js");Stream.Writable=require("readable-stream/writable.js");Stream.Duplex=require("readable-stream/duplex.js");Stream.Transform=require("readable-stream/transform.js");Stream.PassThrough=require("readable-stream/passthrough.js");Stream.Stream=Stream;function Stream(){EE.call(this)}Stream.prototype.pipe=function(dest,options){var source=this;function ondata(chunk){if(dest.writable){if(false===dest.write(chunk)&&source.pause){source.pause()}}}source.on("data",ondata);function ondrain(){if(source.readable&&source.resume){source.resume()}}dest.on("drain",ondrain);if(!dest._isStdio&&(!options||options.end!==false)){source.on("end",onend);source.on("close",onclose)}var didOnEnd=false;function onend(){if(didOnEnd)return;didOnEnd=true;dest.end()}function onclose(){if(didOnEnd)return;didOnEnd=true;if(typeof dest.destroy==="function")dest.destroy()}function onerror(er){cleanup();if(EE.listenerCount(this,"error")===0){throw er}}source.on("error",onerror);dest.on("error",onerror);function cleanup(){source.removeListener("data",ondata);dest.removeListener("drain",ondrain);source.removeListener("end",onend);source.removeListener("close",onclose);source.removeListener("error",onerror);dest.removeListener("error",onerror);source.removeListener("end",cleanup);source.removeListener("close",cleanup);dest.removeListener("close",cleanup)}source.on("end",cleanup);source.on("close",cleanup);dest.on("close",cleanup);dest.emit("pipe",source);return dest}},{events:8,inherits:9,"readable-stream/duplex.js":13,"readable-stream/passthrough.js":20,"readable-stream/readable.js":21,"readable-stream/transform.js":22,"readable-stream/writable.js":23}],25:[function(require,module,exports){var Buffer=require("buffer").Buffer;var isBufferEncoding=Buffer.isEncoding||function(encoding){switch(encoding&&encoding.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return true;default:return false}};function assertEncoding(encoding){if(encoding&&!isBufferEncoding(encoding)){throw new Error("Unknown encoding: "+encoding)}}var StringDecoder=exports.StringDecoder=function(encoding){this.encoding=(encoding||"utf8").toLowerCase().replace(/[-_]/,"");assertEncoding(encoding);switch(this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2;this.detectIncompleteChar=utf16DetectIncompleteChar;break;case"base64":this.surrogateSize=3;this.detectIncompleteChar=base64DetectIncompleteChar;break;default:this.write=passThroughWrite;return}this.charBuffer=new Buffer(6);this.charReceived=0;this.charLength=0};StringDecoder.prototype.write=function(buffer){var charStr="";while(this.charLength){var available=buffer.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:buffer.length;buffer.copy(this.charBuffer,this.charReceived,0,available);this.charReceived+=available;if(this.charReceived<this.charLength){return""}buffer=buffer.slice(available,buffer.length);charStr=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var charCode=charStr.charCodeAt(charStr.length-1);if(charCode>=55296&&charCode<=56319){this.charLength+=this.surrogateSize;charStr="";continue}this.charReceived=this.charLength=0;if(buffer.length===0){return charStr}break}this.detectIncompleteChar(buffer);var end=buffer.length;if(this.charLength){buffer.copy(this.charBuffer,0,buffer.length-this.charReceived,end);end-=this.charReceived}charStr+=buffer.toString(this.encoding,0,end);var end=charStr.length-1;var charCode=charStr.charCodeAt(end);if(charCode>=55296&&charCode<=56319){var size=this.surrogateSize;this.charLength+=size;this.charReceived+=size;this.charBuffer.copy(this.charBuffer,size,0,size);buffer.copy(this.charBuffer,0,0,size);return charStr.substring(0,end)}return charStr};StringDecoder.prototype.detectIncompleteChar=function(buffer){var i=buffer.length>=3?3:buffer.length;for(;i>0;i--){var c=buffer[buffer.length-i];if(i==1&&c>>5==6){this.charLength=2;break}if(i<=2&&c>>4==14){this.charLength=3;break}if(i<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=i};StringDecoder.prototype.end=function(buffer){var res="";if(buffer&&buffer.length)res=this.write(buffer);if(this.charReceived){var cr=this.charReceived;var buf=this.charBuffer;var enc=this.encoding;res+=buf.slice(0,cr).toString(enc)}return res};function passThroughWrite(buffer){return buffer.toString(this.encoding)}function utf16DetectIncompleteChar(buffer){this.charReceived=buffer.length%2;this.charLength=this.charReceived?2:0}function base64DetectIncompleteChar(buffer){this.charReceived=buffer.length%3;this.charLength=this.charReceived?3:0}},{buffer:4}],26:[function(require,module,exports){module.exports=function isBuffer(arg){return arg&&typeof arg==="object"&&typeof arg.copy==="function"&&typeof arg.fill==="function"&&typeof arg.readUInt8==="function"}},{}],27:[function(require,module,exports){(function(process,global){var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){var objects=[];for(var i=0;i<arguments.length;i++){objects.push(inspect(arguments[i]))}return objects.join(" ")}var i=1;var args=arguments;var len=args.length;var str=String(f).replace(formatRegExp,function(x){if(x==="%%")return"%";if(i>=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}});for(var x=args[i];i<len;x=args[++i]){if(isNull(x)||!isObject(x)){str+=" "+x}else{str+=" "+inspect(x)}}return str};exports.deprecate=function(fn,msg){if(isUndefined(global.process)){return function(){return exports.deprecate(fn,msg).apply(this,arguments)}}if(process.noDeprecation===true){return fn}var warned=false;function deprecated(){if(!warned){if(process.throwDeprecation){throw new Error(msg)}else if(process.traceDeprecation){console.trace(msg)}else{console.error(msg)}warned=true}return fn.apply(this,arguments)}return deprecated};var debugs={};var debugEnviron;exports.debuglog=function(set){if(isUndefined(debugEnviron))debugEnviron=process.env.NODE_DEBUG||"";set=set.toUpperCase();if(!debugs[set]){if(new RegExp("\\b"+set+"\\b","i").test(debugEnviron)){var pid=process.pid;debugs[set]=function(){var msg=exports.format.apply(exports,arguments);console.error("%s %d: %s",set,pid,msg)}}else{debugs[set]=function(){}}}return debugs[set]};function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};if(arguments.length>=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts)){ctx.showHidden=opts}else if(opts){exports._extend(ctx,opts)}if(isUndefined(ctx.showHidden))ctx.showHidden=false;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=false;if(isUndefined(ctx.customInspect))ctx.customInspect=true;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}exports.inspect=inspect;inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};inspect.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style){return"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m"}else{return str}}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};array.forEach(function(val,idx){hash[val]=true});return hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret)){ret=formatValue(ctx,ret,recurseTimes)}return ret}var primitive=formatPrimitive(ctx,value);if(primitive){return primitive}var keys=Object.keys(value);var visibleKeys=arrayToHash(keys);if(ctx.showHidden){keys=Object.getOwnPropertyNames(value)}if(isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0)){return formatError(value)}if(keys.length===0){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}if(isDate(value)){return ctx.stylize(Date.prototype.toString.call(value),"date")}if(isError(value)){return formatError(value)}}var base="",array=false,braces=["{","}"];if(isArray(value)){array=true;braces=["[","]"]}if(isFunction(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp(value)){base=" "+RegExp.prototype.toString.call(value)}if(isDate(value)){base=" "+Date.prototype.toUTCString.call(value)}if(isError(value)){base=" "+formatError(value)}if(keys.length===0&&(!array||value.length==0)){return braces[0]+base+braces[1]}if(recurseTimes<0){if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}else{return ctx.stylize("[Object]","special")}}ctx.seen.push(value);var output;if(array){output=formatArray(ctx,value,recurseTimes,visibleKeys,keys)}else{output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)})}ctx.seen.pop();return reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}if(isNumber(value))return ctx.stylize(""+value,"number");if(isBoolean(value))return ctx.stylize(""+value,"boolean");if(isNull(value))return ctx.stylize("null","null")}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i<l;++i){if(hasOwnProperty(value,String(i))){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),true))}else{output.push("")}}keys.forEach(function(key){if(!key.match(/^\d+$/)){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,true))}});return output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]};if(desc.get){if(desc.set){str=ctx.stylize("[Getter/Setter]","special")}else{str=ctx.stylize("[Getter]","special")}}else{if(desc.set){str=ctx.stylize("[Setter]","special")}}if(!hasOwnProperty(visibleKeys,key)){name="["+key+"]"}if(!str){if(ctx.seen.indexOf(desc.value)<0){if(isNull(recurseTimes)){str=formatValue(ctx,desc.value,null)}else{str=formatValue(ctx,desc.value,recurseTimes-1)}if(str.indexOf("\n")>-1){if(array){str=str.split("\n").map(function(line){return" "+line}).join("\n").substr(2)}else{str="\n"+str.split("\n").map(function(line){return" "+line}).join("\n")}}}else{str=ctx.stylize("[Circular]","special")}}if(isUndefined(name)){if(array&&key.match(/^\d+$/)){return str}name=JSON.stringify(""+key);if(name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){name=name.substr(1,name.length-2);name=ctx.stylize(name,"name")}else{name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");name=ctx.stylize(name,"string")}}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0;var length=output.reduce(function(prev,cur){numLinesEst++;if(cur.indexOf("\n")>=0)numLinesEst++;return prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(length>60){return braces[0]+(base===""?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]}return braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return isObject(re)&&objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return isObject(d)&&objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return isObject(e)&&(objectToString(e)==="[object Error]"||e instanceof Error)}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=require("./support/isBuffer");function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var d=new Date;var time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))};exports.inherits=require("inherits");exports._extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add);var i=keys.length;while(i--){origin[keys[i]]=add[keys[i]]}return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./support/isBuffer":26,_process:12,inherits:9}],28:[function(require,module,exports){var MetadataExtractor=require("./MetadataExtractor"),_=require("lodash");function CompositeExtractor(extractors){if(!(this instanceof CompositeExtractor))return new CompositeExtractor(extractors);MetadataExtractor.call(this);this._extractors=_.isArray(extractors)?{"":extractors}:extractors;if(!_.any(this._extractors,"length"))this._extractors=null}MetadataExtractor.inherits(CompositeExtractor);CompositeExtractor.prototype._extract=function(metadata,tripleStream,callback){_.each(this._extractors||void callback(null,{}),function(extractors,type){var combined,pending=extractors.length;function addMetadata(error,metadata){if(!error)combined=combined?_.defaults(combined,metadata):metadata;if(--pending===0){var result=combined;if(type)result={},result[type]=combined;callback(null,result)}}_.each(extractors,function(e){e.extract(metadata,tripleStream,addMetadata)})})};module.exports=CompositeExtractor},{"./MetadataExtractor":31,lodash:55}],29:[function(require,module,exports){var MetadataExtractor=require("./MetadataExtractor"),UriTemplate=require("uritemplate"),rdf=require("../util/RdfUtil"),assert=require("assert");var LINK_TYPES=["firstPage","nextPage","previousPage","lastPage"];function ControlsExtractor(){if(!(this instanceof ControlsExtractor))return new ControlsExtractor;MetadataExtractor.call(this)}MetadataExtractor.inherits(ControlsExtractor);ControlsExtractor.prototype._extract=function(metadata,tripleStream,callback){var controlData=Object.create(null);tripleStream.on("data",function(triple){if(triple.predicate.indexOf(rdf.HYDRA)===0){var property=triple.predicate.substr(rdf.HYDRA.length),propertyData=controlData[property]||(controlData[property]={}),subjectData=propertyData[triple.subject]||(propertyData[triple.subject]=[]);subjectData.push(triple.object)}});tripleStream.on("end",function(){var controls=Object.create(defaultControls);controls.fragment=metadata.fragmentUrl;LINK_TYPES.forEach(function(property){var linkTargets=(controlData[property]||{})[controls.fragment];if(linkTargets&&linkTargets.length>0)Object.defineProperty(controls,property,{value:linkTargets[0],enumerable:true})});var searchForms=controlData.search;if(searchForms){assert(Object.keys(searchForms).length===1,"Expected 1 hydra:search");var searchForm=searchForms[Object.keys(searchForms)[0]][0],searchTemplates=(controlData.template||{})[searchForm]||[];assert(searchTemplates.length===1,"Expected 1 hydra:template for "+searchForm);var searchTemplateValue=rdf.getLiteralValue(searchTemplates[0]),searchTemplate=UriTemplate.parse(searchTemplateValue);var mappings=(controlData.mapping||{})[searchForm]||[];assert(mappings.length===3,"Expected 3 hydra:mappings for "+searchForm);mappings=mappings.reduce(function(mappings,mapping){var variable=((controlData.variable||{})[mapping]||[])[0],property=((controlData.property||{})[mapping]||[])[0];assert(variable,"Expected a hydra:variable for "+mapping);assert(property,"Expected a hydra:property for "+mapping);mappings[property]=rdf.getLiteralValue(variable);return mappings},{});controls.getFragmentUrl=function(triplePattern){var variables={};variables[mappings[rdf.RDF_SUBJECT]]=triplePattern.subject;variables[mappings[rdf.RDF_PREDICATE]]=triplePattern.predicate;variables[mappings[rdf.RDF_OBJECT]]=triplePattern.object;return searchTemplate.expand(variables)}}callback(null,controls)})};var defaultControls={getFragmentUrl:function(triplePattern){throw new Error("The fragment "+this.fragment+" does not contain Triple Pattern Fragment hypermedia controls.")}};LINK_TYPES.forEach(function(property){Object.defineProperty(defaultControls,property,{get:function(){throw new Error("The fragment "+this.fragment+" does not contain controls for "+property+".")}})});module.exports=ControlsExtractor},{"../util/RdfUtil":50,"./MetadataExtractor":31,assert:2,uritemplate:69}],30:[function(require,module,exports){var MetadataExtractor=require("./MetadataExtractor"),rdf=require("../util/RdfUtil");var DEFAULT_COUNT_PREDICATES=toHash([rdf.VOID_TRIPLES,rdf.HYDRA_TOTALITEMS]);function CountExtractor(options){if(!(this instanceof CountExtractor))return new CountExtractor(options);MetadataExtractor.call(this);this._countPredicates=toHash(options&&options.countPredicates)||DEFAULT_COUNT_PREDICATES}MetadataExtractor.inherits(CountExtractor);CountExtractor.prototype._extract=function(metadata,tripleStream,callback){var countPredicates=this._countPredicates;tripleStream.on("end",sendMetadata);tripleStream.on("data",extractCount);function extractCount(triple){if(triple.predicate in countPredicates&&triple.subject===metadata.fragmentUrl){var count=triple.object.match(/\d+/);count&&sendMetadata({totalTriples:parseInt(count[0],10)})}}function sendMetadata(metadata){tripleStream.removeListener("end",sendMetadata);tripleStream.removeListener("data",extractCount);callback(null,metadata||{})}};function toHash(array){return array&&array.reduce(function(hash,key){return hash[key]=true,hash},Object.create(null))}module.exports=CountExtractor},{"../util/RdfUtil":50,"./MetadataExtractor":31}],31:[function(require,module,exports){var util=require("util");function MetadataExtractor(){if(!(this instanceof MetadataExtractor))return new MetadataExtractor}MetadataExtractor.inherits=function(child){util.inherits(child,this);child.inherits=this.inherits};MetadataExtractor.prototype.extract=function(metadata,tripleStream,callback){if(!callback)return;if(!tripleStream)return callback(null,{});this._extract(metadata||{},tripleStream,callback)};MetadataExtractor.prototype._extract=function(metadata,tripleStream,callback){throw new Error("Not implemented")};module.exports=MetadataExtractor},{util:27}],32:[function(require,module,exports){var FilterIterator=require("./FilterIterator"),crypto=require("crypto");function DistinctIterator(source,options){if(!(this instanceof DistinctIterator))return new DistinctIterator(source,options);FilterIterator.call(this,source,null,options);this._uniques={}}FilterIterator.inherits(DistinctIterator);DistinctIterator.prototype._filter=function(item){var uniques=this._uniques,itemHash=createHash(item);if(!(itemHash in uniques)){uniques[itemHash]=true;this._push(item)}};function createHash(object){var hash=crypto.createHash("sha1");hash.update(JSON.stringify(object));return hash.digest("base64")}module.exports=DistinctIterator},{"./FilterIterator":33,crypto:52}],33:[function(require,module,exports){var TransformIterator=require("./Iterator").TransformIterator;function FilterIterator(source,filter,options){if(!(this instanceof FilterIterator))return new FilterIterator(filter,options);TransformIterator.call(this,source,options);if(typeof filter==="function")this._filter=filter}TransformIterator.inherits(FilterIterator);FilterIterator.prototype._read=function(){var source=this._source;if(source){var item;do{if((item=source.read())===null)return}while(!this._filter(item));this._push(item)}};FilterIterator.prototype._filter=function(item){throw new Error("The _filter method has not been implemented.")};module.exports=FilterIterator},{"./Iterator":34}],34:[function(require,module,exports){var EventEmitter=require("events").EventEmitter,util=require("util");function noop(){}function Iterator(options){if(!(this instanceof Iterator))return new Iterator(options);EventEmitter.call(this);options=options||{};this._buffer=[];this._maxBufferSize=options.bufferSize||4;this.on("newListener",function waitForReadableListener(event){if(event==="readable"){this._fillBufferAsync();this.removeListener("newListener",waitForReadableListener)}});this.on("newListener",function waitForDataListener(event){if(event==="data"){var self=this;this.removeListener("newListener",waitForDataListener);function readAll(){var item;while(EventEmitter.listenerCount(self,"data")!==0&&(item=self.read())!==null)self.emit("data",item);if(EventEmitter.listenerCount(self,"data")===0){self.removeListener("readable",readAll);self.removeListener("newListener",waitForDataListener);self.addListener("newListener",waitForDataListener)}}this.removeListener("readable",readAll);this.addListener("readable",readAll);setImmediate(readAll)}})}util.inherits(Iterator,EventEmitter);Iterator.prototype.read=function(){var item=null,buffer=this._buffer;if(buffer.length===0&&this._maxBufferSize>=0){try{this._read()}catch(readError){this._error(readError)}}if(buffer.length!==0){item=buffer.shift();this._fillBufferAsync()}return item};Iterator.prototype.close=function(){if(!this._ended){this.emit("close");this._rejectDataListeners()}};Iterator.prototype._read=function(){throw new Error("The _read method has not been implemented.")};Iterator.prototype._push=function(item){if(item===null)return this._end();if(item===undefined)return this._ended||this.emit("readable");if(this._maxBufferSize<0)throw new Error("Cannot push because the iterator was ended.");this._buffer.push(item);this.emit("readable")};Iterator.prototype._end=function(){if(this._maxBufferSize>=0){this._maxBufferSize=-1;this._fillBufferAsync()}};Iterator.prototype._fillBuffer=function(){var buffer=this._buffer,prevBufferLength=-1;while(prevBufferLength!==buffer.length&&this._buffer.length<this._maxBufferSize){prevBufferLength=buffer.length;try{this._read&&this._read()}catch(readError){this._error(readError)}}if(this.ended){this.emit("end");this._rejectDataListeners()}};Iterator.prototype._fillBufferAsync=function(){if(!this._fillBufferPending&&(this._buffer.length<this._maxBufferSize||this.ended)){this._fillBufferPending=true;setImmediate(function(self){self._fillBufferPending=false;self._fillBuffer()},this)}};Iterator.prototype._bufferAll=function(){this._maxBufferSize=Infinity;this._fillBufferAsync();this.on("readable",this._fillBuffer.bind(this))};Iterator.prototype._error=function(error){if(!this._handlingError){this._handlingError=true;this.emit("error",error)}};Iterator.prototype._rejectDataListeners=function(){removeDataListeners.call(this);this.removeListener("newListener",removeDataListeners);this.on("newListener",removeDataListeners)};function removeDataListeners(){this.removeAllListeners("data");this.removeAllListeners("readable");this.removeAllListeners("end");this.removeAllListeners("error")}Object.defineProperty(Iterator.prototype,"ended",{enumerable:true,get:function(){return this._buffer.length===0&&this._maxBufferSize<0}});Iterator.prototype.hasProperty=function(propertyName){return"_properties"in this&&propertyName in this._properties};Iterator.prototype.getProperty=function(propertyName,callback,self){if(this.hasProperty(propertyName)){var value=this._properties[propertyName];return callback?self?callback.call(self,value):callback(value):value}callback&&this.once(propertyName+"Set",self?callback.bind(self):callback)};Iterator.prototype.setProperty=function(propertyName,value){var properties=this._properties||(this._properties=Object.create(null));properties[propertyName]=value;this.emit(propertyName+"Set",value)};Iterator.prototype._inheritProperties=function(source){if(source.setProperty){source.setProperty("child",true);this._properties=Object.create(source._properties);for(var event in this._events){/\Set$/.test(event)&&this.listeners(event).forEach(function(listener){source.addListener(event,listener)})}this.on("newListener",function(event,listener){if(/\Set$/.test(event))source.addListener(event,listener)})}};Iterator.prototype.toArray=function(callback){var self=this,items=[];if(this.ended)return done();this.on("data",read);this.on("end",done);this.on("error",done);function read(item){items.push(item)}function done(error){self.removeListener("data",read);self.removeListener("end",done);self.removeListener("error",done);try{callback&&callback(error,error?null:items)}finally{callback=items=null}}};Iterator.prototype.clone=function(){if(!this._origRead){this._cache=[];this.setMaxListeners(0);this._origRead=this.read;this.read=function(){throw new Error("This iterator has been cloned and may not be read directly.")}}var clone=new Iterator;clone._inheritProperties(this);if(this.ended&&this._cache.length===0)clone._end();else{var source=this,readPosition=0;clone.read=function(){var item;if(readPosition<source._cache.length)item=source._cache[readPosition++];else{item=source._origRead();item&&(source._cache[readPosition++]=item)}if(source.ended&&readPosition===source._cache.length)clone._end();return item};clone._read=noop;this.on("readable",function(){clone.emit("readable")});this.on("end",function(){if(readPosition===source._cache.length)clone._end()});this.on("error",function(error){clone.emit("error",error)})}var toString=this.toString();clone.toString=function(){return"(cloneOf) "+toString};return clone};Iterator.prototype.toString=function(){return"["+this.constructor.name+"]"};Iterator.inherits=function(child){util.inherits(child,this);child.inherits=this.inherits};function EmptyIterator(){if(!(this instanceof EmptyIterator))return new EmptyIterator;Iterator.call(this);this._end()}Iterator.inherits(EmptyIterator);function SingleIterator(item){if(!(this instanceof SingleIterator))return new SingleIterator(item);Iterator.call(this); | |
this._push(item);this._end()}Iterator.inherits(SingleIterator);function WaitingIterator(){if(!(this instanceof WaitingIterator))return new WaitingIterator;Iterator.call(this);this._rejectDataListeners()}Iterator.inherits(WaitingIterator);WaitingIterator.prototype.read=function(){return null};function ArrayIterator(array){if(!(this instanceof ArrayIterator))return new ArrayIterator(array);Iterator.call(this);var length=(array&&array.length)|0;if(length>0){var buffer=this._buffer=new Array(length);for(var i=0;i<length;i++)buffer[i]=array[i]}this._end()}Iterator.inherits(ArrayIterator);function TransformIterator(source,options){if(!(this instanceof TransformIterator))return new TransformIterator(source,options);if(source&&typeof source.on!=="function")options=source,source=null;Iterator.call(this,options);source&&this.setSource(source)}Iterator.inherits(TransformIterator);var WAITING=0,TRANSFORMING=1,ENDING=2;TransformIterator.prototype._transformStatus=WAITING;TransformIterator.prototype.setSource=function(source){if(this.hasOwnProperty("_source"))throw new Error("Source already set.");this._source=source;this._properties||this._inheritProperties(source);if(!source.ended){var self=this;source.on("error",function(error){self._error(error)});source.on("end",function(){if(self._transformStatus===WAITING)self._flush();else self._transformStatus=ENDING});this.on("newListener",function waitForReadable(event){if(event==="readable"){self._fillBufferAsync();source.on("readable",function(){self._fillBuffer()});this.removeListener("newListener",waitForReadable)}});if(EventEmitter.listenerCount(this,"readable")!==0)this.emit("newListener","readable")}else this._end()};TransformIterator.prototype._source=WaitingIterator();TransformIterator.prototype._read=function(){switch(this._transformStatus){case WAITING:var item=this._source.read();if(item!==null){var self=this;this._transformStatus=TRANSFORMING;this._transform(item,function(){if(self._transformStatus===TRANSFORMING)self._transformStatus=WAITING;self.emit("readable",self)})}break;case ENDING:this._transformStatus=WAITING;this._flush();break}};TransformIterator.prototype._transform=function(item,done){throw new Error("The _transform method has not been implemented.")};TransformIterator.prototype._flush=function(){this._end()};TransformIterator.prototype.toString=function(){return Iterator.prototype.toString.call(this)+"\n <= "+this.getSourceString()};TransformIterator.prototype.getSourceString=function(){return this.hasOwnProperty("_source")?this._source.toString():"(none)"};function PassthroughIterator(source,options){if(!(this instanceof PassthroughIterator))return new PassthroughIterator(source,options);TransformIterator.call(this,source,options)}TransformIterator.inherits(PassthroughIterator);PassthroughIterator.prototype.setSource=function(source){TransformIterator.prototype.setSource.call(this,source);this._inheritProperties(source)};PassthroughIterator.prototype._read=function(){var item=this._source&&this._source.read();if(item!==null)this._push(item)};PassthroughIterator.prototype.toString=function(){if(!this.hasOwnProperty("_source"))return Iterator.prototype.toString.call(this);return this.getSourceString()};function BufferIterator(){if(!(this instanceof BufferIterator))return new BufferIterator;Iterator.call(this)}Iterator.inherits(BufferIterator);BufferIterator.prototype._read=noop;module.exports=Iterator;Iterator.Iterator=Iterator;Iterator.EmptyIterator=Iterator.empty=EmptyIterator;Iterator.SingleIterator=Iterator.single=SingleIterator;Iterator.WaitingIterator=Iterator.waiting=WaitingIterator;Iterator.ArrayIterator=Iterator.fromArray=ArrayIterator;Iterator.TransformIterator=Iterator.transform=TransformIterator;Iterator.StreamIterator=Iterator.fromStream=PassthroughIterator;Iterator.PassthroughIterator=Iterator.passthrough=PassthroughIterator;Iterator.BufferIterator=Iterator.buffered=BufferIterator},{events:8,util:27}],35:[function(require,module,exports){var TransformIterator=require("./Iterator").TransformIterator;function LimitIterator(source,offset,limit,options){if(!(this instanceof LimitIterator))return new LimitIterator(source,offset,limit,options);TransformIterator.call(this,source,options);this._offset=offset=isFinite(offset)?Math.max(~~offset,0):0;this._limit=limit=isFinite(limit)?Math.max(~~limit,0):Infinity;limit===0&&this._end()}TransformIterator.inherits(LimitIterator);LimitIterator.prototype._read=function(){if(!this._reading&&this._limit!==0){var source=this._source,item;if(source){this._reading=true;while(this._offset!==0){if((item=source.read())===null)return this._reading=false;this._offset--}if((item=source.read())!==null){if(this._maxBufferSize>-1)this._push(item);if(--this._limit<=0)this._end()}this._reading=false}}};module.exports=LimitIterator},{"./Iterator":34}],36:[function(require,module,exports){var TransformIterator=require("./Iterator").TransformIterator;function MultiTransformIterator(source,options){if(!(this instanceof MultiTransformIterator))return new MultiTransformIterator(source,options);TransformIterator.call(this,source,options);this._options=options||{};if(this._optional=this._options.optional||false)(this._options=Object.create(this._options)).optional=false;this._transformerQueue=[];var self=this;this._emitError=function(error){self.emit("error",error)};this._fillBufferBound=function(){self._fillBuffer()}}TransformIterator.inherits(MultiTransformIterator);var WAITING=0,TRANSFORMING=1,ENDING=2;MultiTransformIterator.prototype._read=function(){var item,transformer,transformerQueue=this._transformerQueue,optional=this._optional;if(this._transformStatus!==WAITING)return;this._transformStatus=TRANSFORMING;while((transformer=transformerQueue[0])&&transformer.ended){transformerQueue.shift();if(optional){if(!this._itemTransformed){this._push(transformer.item);return this._transformStatus=WAITING}this._itemTransformed=false}}if(!transformer){do{if(item=this._source.read()){transformer=this._createTransformer(item,this._options);if(transformer&&!transformer.ended){transformer.item=item;transformerQueue.push(transformer);transformer.on("error",this._emitError);transformer.on("readable",this._fillBufferBound);transformer.on("end",this._fillBufferBound)}else if(optional){this._push(item);return this._transformStatus=WAITING}}}while(item&&transformerQueue.length<this._maxBufferSize);if(!(transformer=transformerQueue[0])){if(this._source.ended)this._end();return this._transformStatus=WAITING}}item=this._readTransformer(transformer,transformer.item);if(item!==null){optional&&(this._itemTransformed=true);this._push(item)}this._transformStatus=WAITING};MultiTransformIterator.prototype._createTransformer=function(item,options){throw new Error("The _createTransformer method has not been implemented.")};MultiTransformIterator.prototype._readTransformer=function(transformer,transformerItem){return transformer.read()};MultiTransformIterator.prototype._flush=function(){this._fillBuffer()};module.exports=MultiTransformIterator},{"./Iterator":34}],37:[function(require,module,exports){var TransformIterator=require("./Iterator").TransformIterator;function SortIterator(source,sort,options){if(!(this instanceof SortIterator))return new SortIterator(source,sort,options);if(typeof sort!=="function")options=sort,sort=null;TransformIterator.call(this,source,options);var window=options&&options.window;this._windowLength=isFinite(window)&&window>0?~~window:Infinity;this._sort=sort||defaultSort;this._sorted=[]}TransformIterator.inherits(SortIterator);SortIterator.prototype._read=function(){var item,sorted=this._sorted,source=this._source,length=sorted.length;if(source){while(length!==this._windowLength&&(item=source.read())!==null){var left=0,right=length-1,mid,order;while(left<=right){order=this._sort(item,sorted[mid=left+right>>1]);if(order<0)left=mid+1;else if(order>0)right=mid-1;else left=mid,right=-1}sorted.splice(left,0,item),length++}length===this._windowLength&&this._push(sorted.pop())}};SortIterator.prototype._flush=function(){var sorted=this._sorted,length=sorted.length;while(length--)this._push(sorted.pop());this._end()};function defaultSort(a,b){if(a<b)return-1;if(a>b)return 1;return 0}module.exports=SortIterator},{"./Iterator":34}],38:[function(require,module,exports){var Iterator=require("./Iterator");function UnionIterator(sources,options){if(!(this instanceof UnionIterator))return new UnionIterator(sources,options);Iterator.call(this,options);this._sources=[];this._sourceIndex=0;if(sources&&sources.length){var self=this;function fillBuffer(){self._fillBuffer()}function emitError(error){self._error(error)}for(var i=0,l=sources.length;i<l;i++){var source=sources[i];if(source&&!source.ended){this._sources.push(source);source.on("readable",fillBuffer);source.on("end",fillBuffer);source.on("error",emitError)}}}this._sources.length===0&&this._end();this._reading=false}Iterator.inherits(UnionIterator);UnionIterator.prototype._read=function(){if(this._reading)return;this._reading=true;var item=null,sources=this._sources,attempts=sources.length;while(!item&&attempts--){var source=sources[this._sourceIndex];item=source.read();source.ended?sources.splice(this._sourceIndex,1):this._sourceIndex++;this._sourceIndex<sources.length||(this._sourceIndex=0)}item!==null&&this._push(item);this._sources.length===0&&this._end();this._reading=false};module.exports=UnionIterator},{"./Iterator":34}],39:[function(require,module,exports){var HttpClient=require("../util/HttpClient"),Iterator=require("../iterators/Iterator"),rdf=require("../util/RdfUtil"),Cache=require("lru-cache"),CompositeExtractor=require("../extractors/CompositeExtractor"),CountExtractor=require("../extractors/CountExtractor"),ControlsExtractor=require("../extractors/ControlsExtractor"),_=require("lodash");var DEFAULT_ACCEPT="application/trig;q=1.0,application/n-quads;q=0.7,"+"text/turtle;q=0.6,application/n-triples;q=0.3,text/n3;q=0.2";var parserTypes=[require("./TrigFragmentIterator"),require("./TurtleFragmentIterator")];function FragmentsClient(startFragment,options){if(!(this instanceof FragmentsClient))return new FragmentsClient(startFragment,options);options=_.defaults(options||{},{contentType:DEFAULT_ACCEPT});var cache=this._cache=new Cache({max:100});this._httpClient=options.httpClient||new HttpClient(options);this._metadataExtractor=options.metadataExtractor||new CompositeExtractor({metadata:[new CountExtractor],controls:[new ControlsExtractor]});if(startFragment){if(typeof startFragment==="string"){var startFragmentUrl=this._startFragmentUrl=startFragment;startFragment=new Fragment(this);startFragment.loadFromUrl(startFragmentUrl)}this._startFragment=startFragment;startFragment.setMaxListeners(100);startFragment.once("error",function(error){cache.reset();startFragment.error=error});startFragment.getProperty("controls",function(){startFragment.error=null;startFragment.removeAllListeners("error")})}}FragmentsClient.prototype.getFragmentByPattern=function(pattern){var cache=this._cache,key=JSON.stringify(pattern);if(cache.has(key))return cache.get(key).clone();var fragment=new Fragment(this,pattern);var startFragment=this._startFragment;if(startFragment.error!==null){if(startFragment.error)return setImmediate(startFragmentError),fragment;startFragment.once("error",startFragmentError)}function startFragmentError(){fragment.emit("error",startFragment.error);fragment._end()}startFragment.getProperty("controls",function(controls){var subject=rdf.isVariableOrBlank(pattern.subject)?null:pattern.subject;var predicate=rdf.isVariableOrBlank(pattern.predicate)?null:pattern.predicate;var object=rdf.isVariableOrBlank(pattern.object)?null:pattern.object;if(rdf.isLiteral(subject)||rdf.isLiteral(predicate))return fragment.empty();pattern={subject:subject,predicate:predicate,object:object};fragment.loadFromUrl(controls.getFragmentUrl(pattern))});cache.set(key,fragment);return fragment.clone()};function Fragment(fragmentsClient,pattern){if(!(this instanceof Fragment))return new Fragment(fragmentsClient);Iterator.call(this);this._fragmentsClient=fragmentsClient;this._pattern=pattern}Iterator.inherits(Fragment);Fragment.prototype._read=function(){if(this._fragmentPage){var item=this._fragmentPage.read();item&&this._push(item)}};Fragment.prototype.loadFromUrl=function(pageUrl){var self=this,fragmentsClient=this._fragmentsClient,fragmentPage,headers={"user-agent":"Triple Pattern Fragments Client"};if(fragmentsClient._startFragmentUrl)headers.referer=fragmentsClient._startFragmentUrl;fragmentPage=fragmentsClient._httpClient.get(pageUrl,headers);fragmentPage.on("error",function(error){self.emit("error",error)});fragmentPage.getProperty("statusCode",function(statusCode){if(statusCode!==200){fragmentPage.emit("error",new Error("Could not retrieve "+pageUrl+" ("+statusCode+")"));return self._end()}fragmentPage.getProperty("contentType",function(contentType){var Parser=_.find(parserTypes,function(P){return P.supportsContentType(contentType)});if(!Parser)return self.emit("error",new Error("No parser for "+contentType+" at "+pageUrl));var parsedPage=self._fragmentPage=new Parser(fragmentPage,pageUrl);parsedPage.on("readable",function(){self.emit("readable")});var controls={};fragmentsClient._metadataExtractor.extract({fragmentUrl:pageUrl},parsedPage.metadataStream,function(error,metadata){for(var type in metadata)if(!self.getProperty(type))self.setProperty(type,metadata[type]);controls=metadata.controls||controls});parsedPage.on("end",function(){setImmediate(loadNextPage)});function loadNextPage(){var nextPage;try{nextPage=controls&&controls.nextPage}catch(controlError){}nextPage?self.loadFromUrl(nextPage):self._end()}parsedPage.on("error",function(error){fragmentPage.emit("error",error)});self.emit("readable")})})};Fragment.prototype.empty=function(){if(!this.getProperty("metadata"))this.setProperty("metadata",{totalTriples:0});return this._end(),this};Fragment.prototype.toString=function(){return"["+this.constructor.name+" {"+rdf.toQuickString(this._pattern)+")}"};module.exports=FragmentsClient},{"../extractors/CompositeExtractor":28,"../extractors/ControlsExtractor":29,"../extractors/CountExtractor":30,"../iterators/Iterator":34,"../util/HttpClient":48,"../util/RdfUtil":50,"./TrigFragmentIterator":42,"./TurtleFragmentIterator":44,lodash:55,"lru-cache":56}],40:[function(require,module,exports){var Iterator=require("../iterators/Iterator"),MultiTransformIterator=require("../iterators/MultiTransformIterator"),rdf=require("../util/RdfUtil"),_=require("lodash"),Logger=require("../util/ExecutionLogger")("ReorderingGraphPatternIterator");var TriplePatternIterator=require("./TriplePatternIterator");function ReorderingGraphPatternIterator(parent,pattern,options){if(!pattern||!pattern.length)return new Iterator.passthrough(parent,options);if(pattern.length===1)return new TriplePatternIterator(parent,pattern[0],options);if(!(this instanceof ReorderingGraphPatternIterator))return new ReorderingGraphPatternIterator(parent,pattern,options);MultiTransformIterator.call(this,parent,options);this._pattern=pattern;this._client=this._options.fragmentsClient}MultiTransformIterator.inherits(ReorderingGraphPatternIterator);ReorderingGraphPatternIterator.prototype._createTransformer=function(bindings,options){var boundPattern=rdf.applyBindings(bindings,this._pattern);var subPatterns=_.sortBy(rdf.findConnectedPatterns(boundPattern),function(patterns){var distinctVariableCount=_.union.apply(_,patterns.map(rdf.getVariables)).length;return-(boundPattern.length*distinctVariableCount+patterns.length)}),subPattern=subPatterns.pop(),remainingPatterns=subPattern.length,pipeline;if(remainingPatterns===1)return createPipeline(subPattern.pop());pipeline=new Iterator.PassthroughIterator(true);var bestIndex=0,minMatches=Infinity;subPattern.forEach(function(triplePattern,index){var fragment=this._client.getFragmentByPattern(triplePattern);fragment.getProperty("metadata",function(metadata){Logger.logBinding(this,bindings,triplePattern,metadata.totalTriples);fragment.close();if(metadata.totalTriples===0)return pipeline._end();if(metadata.totalTriples<minMatches)bestIndex=index,minMatches=metadata.totalTriples;if(--remainingPatterns===0)pipeline.setSource(createPipeline(subPattern.splice(bestIndex,1)[0]))},this);fragment.on("error",function(error){Logger.warning(error.message);if(!fragment.getProperty("metadata"))fragment.setProperty("metadata",{totalTriples:0})})},this);return pipeline;function createPipeline(triplePattern){var startIterator=Iterator.single(bindings),pipeline=new TriplePatternIterator(startIterator,triplePattern,options);if(subPattern&&subPattern.length!==0)pipeline=new ReorderingGraphPatternIterator(pipeline,subPattern,options);while(subPattern=subPatterns.pop())pipeline=new ReorderingGraphPatternIterator(pipeline,subPattern,options);return pipeline}};ReorderingGraphPatternIterator.prototype.toString=function(){return"["+this.constructor.name+" {"+this._pattern.map(rdf.toQuickString).join(" ")+"}]"+"\n <= "+this.getSourceString()};module.exports=ReorderingGraphPatternIterator},{"../iterators/Iterator":34,"../iterators/MultiTransformIterator":36,"../util/ExecutionLogger":47,"../util/RdfUtil":50,"./TriplePatternIterator":43,lodash:55}],41:[function(require,module,exports){var SparqlParser=require("sparqljs").Parser,Iterator=require("../iterators/Iterator"),TransformIterator=Iterator.TransformIterator,ReorderingGraphPatternIterator=require("./ReorderingGraphPatternIterator"),UnionIterator=require("../iterators/UnionIterator"),FilterIterator=require("../iterators/FilterIterator"),SortIterator=require("../iterators/SortIterator"),LimitIterator=require("../iterators/LimitIterator"),DistinctIterator=require("../iterators/DistinctIterator"),SparqlExpressionEvaluator=require("../util/SparqlExpressionEvaluator"),_=require("lodash"),util=require("util"),rdf=require("../util/RdfUtil"),createErrorType=require("../util/CustomError");function SparqlIterator(source,queryText,options){if(typeof source==="string")options=queryText,queryText=source,source=null;try{var query=new SparqlParser(options.prefixes).parse(queryText),queryIterator,QueryConstructor=queryConstructors[query.queryType];if(!QueryConstructor)throw new Error("No iterator available for query type: "+query.queryType);queryIterator=new QueryConstructor(true,query,options);var graphIterator=new SparqlGroupsIterator(source||Iterator.single({}),queryIterator.patterns||query.where,options);for(var i=query.order&&query.order.length-1;i>=0;i--){var order=SparqlExpressionEvaluator(query.order[i].expression),ascending=!query.order[i].descending;graphIterator=new SortIterator(graphIterator,function(a,b){var orderA=order(a),orderB=order(b);if(orderA<orderB)return ascending?-1:1;if(orderB<orderA)return ascending?1:-1;return 0},options)}queryIterator.setSource(graphIterator);if(query.distinct)queryIterator=new DistinctIterator(queryIterator,options);if("offset"in query||"limit"in query)queryIterator=new LimitIterator(queryIterator,query.offset,query.limit,options);queryIterator.queryType=query.queryType;return queryIterator}catch(error){if(/Parse error/.test(error.message))error=new InvalidQueryError(queryText,error);else error=new UnsupportedQueryError(queryText,error);throw error}}TransformIterator.inherits(SparqlIterator);var queryConstructors={SELECT:SparqlSelectIterator,CONSTRUCT:SparqlConstructIterator,DESCRIBE:SparqlDescribeIterator,ASK:SparqlAskIterator};function SparqlSelectIterator(source,query,options){TransformIterator.call(this,source,options);this.setProperty("variables",query.variables)}SparqlIterator.inherits(SparqlSelectIterator);SparqlSelectIterator.prototype._transform=function(bindings,done){this._push(this.getProperty("variables").reduce(function(row,variable){if(variable!=="*")row[variable]=rdf.deskolemize(bindings[variable]);else for(variable in bindings)if(rdf.isVariable(variable))row[variable]=rdf.deskolemize(bindings[variable]);return row},Object.create(null)));done()};function SparqlConstructIterator(source,query,options){TransformIterator.call(this,source,options);this._template=query.template.filter(function(triplePattern){return rdf.hasVariables(triplePattern)||this._push(triplePattern)},this);this._blankNodeId=0}SparqlIterator.inherits(SparqlConstructIterator);SparqlConstructIterator.prototype._transform=function(bindings,done){var blanks=Object.create(null);this._template.forEach(function(triplePattern){var s=triplePattern.subject,p=triplePattern.predicate,o=triplePattern.object,s0=s[0],p0=p[0],o0=o[0];if(s0==="?"){if((s=rdf.deskolemize(bindings[s]))===undefined)return}else if(s0==="_")s=blanks[s]||(blanks[s]="_:b"+this._blankNodeId++);if(p0==="?"){if((p=rdf.deskolemize(bindings[p]))===undefined)return}else if(p0==="_")p=blanks[p]||(blanks[p]="_:b"+this._blankNodeId++);if(o0==="?"){if((o=rdf.deskolemize(bindings[o]))===undefined)return}else if(o0==="_")o=blanks[o]||(blanks[o]="_:b"+this._blankNodeId++);this._push({subject:s,predicate:p,object:o})},this);done()};function SparqlDescribeIterator(source,query,options){var variables=query.variables,template=query.template=[];for(var i=0,l=variables.length;i<l;i++)template.push(rdf.triple(variables[i],"?__predicate"+i,"?__object"+i));query.where=query.where.concat({type:"bgp",triples:template});SparqlConstructIterator.call(this,source,query,options)}SparqlConstructIterator.inherits(SparqlDescribeIterator);function SparqlAskIterator(source,query,options){TransformIterator.call(this,source,options)}SparqlIterator.inherits(SparqlAskIterator);SparqlAskIterator.prototype._transform=function(bindings,done){this._push(true);this._push(null);done()};SparqlAskIterator.prototype._flush=function(){if(!this.ended){this._push(false);this._push(null)}};function SparqlGroupsIterator(source,groups,options){return groups.reduce(function(source,group){return new SparqlGroupIterator(source,group,options)},source)}Iterator.inherits(SparqlGroupsIterator);function SparqlGroupIterator(source,group,options){var childOptions=options.optional?_.create(options,{optional:false}):options;switch(group.type){case"bgp":return new ReorderingGraphPatternIterator(source,group.triples,options);case"group":return new SparqlGroupsIterator(source,group.patterns,childOptions);case"optional":childOptions=_.create(options,{optional:true});return new SparqlGroupsIterator(source,group.patterns,childOptions);case"union":return new UnionIterator(group.patterns.map(function(patternToken){return new SparqlGroupIterator(source.clone(),patternToken,childOptions)}),options);case"filter":var evaluate=SparqlExpressionEvaluator(group.expression);return new FilterIterator(source,function(bindings){return!/^"false"|^"0"/.test(evaluate(bindings))},options);default:throw new Error("Unsupported group type: "+group.type)}}Iterator.inherits(SparqlGroupIterator);var InvalidQueryError=createErrorType("InvalidQueryError",function(query,cause){this.message="Syntax error in query\n"+cause.message});var UnsupportedQueryError=createErrorType("UnsupportedQueryError",function(query,cause){this.message="The query is not yet supported\n"+cause.message});module.exports=SparqlIterator;SparqlIterator.InvalidQueryError=InvalidQueryError;SparqlIterator.UnsupportedQueryError=UnsupportedQueryError},{"../iterators/DistinctIterator":32,"../iterators/FilterIterator":33,"../iterators/Iterator":34,"../iterators/LimitIterator":35,"../iterators/SortIterator":37,"../iterators/UnionIterator":38,"../util/CustomError":46,"../util/RdfUtil":50,"../util/SparqlExpressionEvaluator":51,"./ReorderingGraphPatternIterator":40,lodash:55,sparqljs:68,util:27}],42:[function(require,module,exports){var TurtleFragmentIterator=require("./TurtleFragmentIterator");function TrigFragmentIterator(source,fragmentUrl){if(!(this instanceof TrigFragmentIterator))return new TrigFragmentIterator(source,fragmentUrl);TurtleFragmentIterator.call(this,source,fragmentUrl)}TurtleFragmentIterator.inherits(TrigFragmentIterator);TrigFragmentIterator.prototype._processTriple=function(quad){if(!quad.graph)this._push(quad);else this.metadataStream._push(quad)};TrigFragmentIterator.supportsContentType=function(contentType){return/^application\/(?:trig|n-quads)$/.test(contentType)};module.exports=TrigFragmentIterator},{"./TurtleFragmentIterator":44}],43:[function(require,module,exports){var MultiTransformIterator=require("../iterators/MultiTransformIterator"),rdf=require("../util/RdfUtil"),Logger=require("../util/ExecutionLogger")("TriplePatternIterator");function TriplePatternIterator(parent,pattern,options){if(!(this instanceof TriplePatternIterator))return new TriplePatternIterator(parent,pattern,options);MultiTransformIterator.call(this,parent,options);this._pattern=pattern;this._client=this._options.fragmentsClient}MultiTransformIterator.inherits(TriplePatternIterator);TriplePatternIterator.prototype._createTransformer=function(bindings,options){var boundPattern=rdf.applyBindings(bindings,this._pattern);var fragment=this._client.getFragmentByPattern(boundPattern);Logger.logFragment(this,fragment,bindings);fragment.on("error",function(error){Logger.warning(error.message)});return fragment};TriplePatternIterator.prototype._readTransformer=function(fragment,fragmentBindings){var triple;while(triple=fragment.read()){try{return rdf.extendBindings(fragmentBindings,this._pattern,triple)}catch(bindingError){}}return null};TriplePatternIterator.prototype.toString=function(){return"["+this.constructor.name+" {"+rdf.toQuickString(this._pattern)+")}"+"\n <= "+this.getSourceString()};module.exports=TriplePatternIterator},{"../iterators/MultiTransformIterator":36,"../util/ExecutionLogger":47,"../util/RdfUtil":50}],44:[function(require,module,exports){var TransformIterator=require("../iterators/Iterator").TransformIterator,BufferIterator=require("../iterators/Iterator").BufferIterator,rdf=require("../util/RdfUtil"),N3=require("n3");function TurtleFragmentIterator(source,fragmentUrl){if(!(this instanceof TurtleFragmentIterator))return new TurtleFragmentIterator(source,fragmentUrl);TransformIterator.call(this,source);this.metadataStream=new BufferIterator;if(source&&source.ended)return this.metadataStream._push(null);this.metadataStream.on("newListener",function metadataListenerAdded(event){if(event==="data"||event==="end"){this.removeListener("newListener",metadataListenerAdded);self._bufferAll()}});var self=this;this._parser=new N3.Parser({documentURI:fragmentUrl});this._parser.parse(function(error,triple){triple&&self._push(self._processTriple(triple))||error&&self.emit("error",error)});this._fragmentUrl=fragmentUrl}TransformIterator.inherits(TurtleFragmentIterator);TurtleFragmentIterator.prototype._transform=function(chunk,done){this._parser.addChunk(chunk),done()};TurtleFragmentIterator.prototype._processTriple=function(triple){if(triple.subject!==this._fragmentUrl&&triple.predicate.indexOf(rdf.HYDRA)!==0)this._push(triple);else this.metadataStream._push(triple)};TurtleFragmentIterator.prototype._flush=function(){this._parser.end();this.metadataStream._end();this._end()};TurtleFragmentIterator.supportsContentType=function(contentType){return/^(?:text\/turtle|text\/n3|application\/n-triples)$/.test(contentType)};module.exports=TurtleFragmentIterator},{"../iterators/Iterator":34,"../util/RdfUtil":50,n3:57}],45:[function(require,module,exports){var FragmentsClient=require("../FragmentsClient"),Iterator=require("../../iterators/Iterator"),rdf=require("../../util/RdfUtil"),_=require("lodash");function FederatedFragmentsClient(startFragments,options){if(!(this instanceof FederatedFragmentsClient))return new FederatedFragmentsClient(startFragments,options);if(!_.isArray(startFragments))return new FragmentsClient(startFragments,options);if(startFragments.length===1)return new FragmentsClient(startFragments[0],options);var clients=this._clients=(startFragments||[]).map(function(startFragment){var client=new FragmentsClient(startFragment,options);client._emptyPatterns=[];return client});this._options=_.extend({allowedFragmentErrors:clients.length-1},options)}FederatedFragmentsClient.prototype.getFragmentByPattern=function(pattern){var fragments=[];this._clients.forEach(function(client){var empty=_.some(client._emptyPatterns,rdf.isBoundPatternOf.bind(null,pattern));if(!empty){var fragment=client.getFragmentByPattern(pattern);fragment.getProperty("metadata",function(metadata){if(metadata.totalTriples===0)client._emptyPatterns.push(pattern)});fragments.push(fragment)}});return new CompoundFragment(fragments,this._options)};function CompoundFragment(fragments,options){if(!(this instanceof CompoundFragment))return new CompoundFragment(fragments,options);Iterator.call(this);if(!fragments||!fragments.length)return this.empty(),this;var pendingFragments=this._pendingFragments=_.indexBy(fragments,getIndex),combinedMetadata=this._metadata={totalTriples:0},pendingFragmentsCount=fragments.length,pendingMetadataCount=fragments.length,allowedErrors=options.allowedFragmentErrors||0;var self=this;_.each(pendingFragments,function(fragment,index){fragment.on("readable",emitReadable);var metadataDone=_.once(function(fragmentMetadata){if(fragmentMetadata)combinedMetadata.totalTriples+=fragmentMetadata.totalTriples;if(--pendingMetadataCount===0)self.setProperty("metadata",combinedMetadata)});fragment.getProperty("metadata",metadataDone);var fragmentDone=_.once(function(){delete pendingFragments[index];if(--pendingFragmentsCount===0)self._end()});fragment.on("end",fragmentDone);fragment.on("error",function(error){if(allowedErrors--===0)return self.emit("error",error);metadataDone();fragmentDone()})});function emitReadable(){self.emit("readable")}}Iterator.inherits(CompoundFragment);CompoundFragment.prototype._read=function(){if(this._reading)return;this._reading=true;_.find(this._pendingFragments,function(fragment,item){if(item=fragment.read()){this._push(item);return true}},this);this._reading=false};CompoundFragment.prototype.empty=function(){if(!this.getProperty("metadata"))this.setProperty("metadata",{totalTriples:0});this._end()};CompoundFragment.prototype.toString=function(){return this.toString()+"{"+_.map(this._pendingFragments,function(f){return f.toString()}).join(", ")+"}"};function getIndex(element,index){return index}module.exports=FederatedFragmentsClient},{"../../iterators/Iterator":34,"../../util/RdfUtil":50,"../FragmentsClient":39,lodash:55}],46:[function(require,module,exports){function createErrorType(name,init){function E(message){this.name=name;if(!Error.captureStackTrace)this.stack=(new Error).stack;else Error.captureStackTrace(this,this.constructor);this.message=message;init&&init.apply(this,arguments)}E.prototype=new Error;E.prototype.name=name;E.prototype.constructor=E;return E}module.exports=createErrorType},{}],47:[function(require,module,exports){var Logger=require("./Logger"),util=require("util"),Iterator=require("../iterators/Iterator");if(typeof Iterator.prototype.uniqueId==="undefined"){var uniqueId=0;Iterator.prototype.uniqueId=function(){if(typeof this.__uniqueid==="undefined")this.__uniqueid=++uniqueId;return this.__uniqueid}}function ExecutionLogger(name){if(!(this instanceof ExecutionLogger))return new ExecutionLogger(name);Logger.call(this,name)}util.inherits(ExecutionLogger,Logger);ExecutionLogger.prototype.logBinding=function(iterator,bindings,triplePattern,count){if(Logger.enabled("debug"))this.debug(ExecutionLogger.index++,iterator.uniqueId(),bindings,triplePattern,count)};ExecutionLogger.prototype.logFragment=function(iterator,fragment,bindings){if(Logger.enabled("debug")){var self=this;fragment.getProperty("metadata",function(metadata){self.logBinding(iterator,bindings,iterator._pattern,metadata&&metadata.totalTriples)})}};ExecutionLogger.index=1;module.exports=ExecutionLogger},{"../iterators/Iterator":34,"./Logger":49,util:27}],48:[function(require,module,exports){var Iterator=require("../iterators/Iterator"),request=require("request"),Logger=require("../util/Logger.js"),zlib=require("zlib"),_=require("lodash");var activeRequests={},requestId=0; | |
function HttpClient(options){if(!(this instanceof HttpClient))return new HttpClient(options);options=options||{};this._request=options.request||request;this._contentType=options.contentType||"*/*";this._queue=[];this._activeRequests=0;this._maxActiveRequests=options.concurrentRequests||20;this._logger=options.logger||Logger("HttpClient")}HttpClient.prototype.get=function(url,headers,options){return this.request(url,"GET",headers,options)};HttpClient.prototype.request=function(url,method,headers,options){var responseIterator=new Iterator.PassthroughIterator(true),self=this;function performRequest(){self._logger.info("Requesting",url);self._activeRequests++;var acceptHeaders={accept:self._contentType,"accept-encoding":"gzip,deflate"};var requestOptions={url:url,method:method||"GET",headers:headers?_.assign(acceptHeaders,headers):acceptHeaders,timeout:5e3,followRedirect:true},request,startTime=new Date;try{request=self._request(options?_.assign(requestOptions,options):requestOptions)}catch(error){return setImmediate(emitError,error),responseIterator}activeRequests[request._id=requestId++]=request;function emitError(error){if(!this._aborted||!error||error.code!=="ETIMEDOUT")responseIterator._error(error);delete activeRequests[request&&request._id]}request.on("response",function(response){var statusCode=response.statusCode,headers=response.headers,responseTime=new Date-startTime,encoding,contentType,nextRequest;delete activeRequests[request._id];self._activeRequests--;(nextRequest=self._queue.shift())&&nextRequest();switch(encoding=headers["content-encoding"]||""){case"gzip":response.pipe(response=zlib.createGunzip());break;case"deflate":response.pipe(response=zlib.createInflate());break;case"":break;default:return responseIterator._error(new Error("Unsupported encoding: "+encoding))}response.on("error",emitError);response.setEncoding&&response.setEncoding("utf8");response.pause&&response.pause();responseIterator.setSource(response);responseIterator._bufferAll();contentType=(headers["content-type"]||"").replace(/\s*(?:;.*)?$/,"");responseIterator.setProperty("statusCode",statusCode);responseIterator.setProperty("contentType",contentType);responseIterator.setProperty("responseTime",responseTime)}).on("error",emitError)}if(this._activeRequests<this._maxActiveRequests)performRequest();else this._queue.push(performRequest);return responseIterator};HttpClient.abortAll=function(){for(var id in activeRequests){activeRequests[id].abort();delete activeRequests[id]}};module.exports=HttpClient},{"../iterators/Iterator":34,"../util/Logger.js":49,lodash:55,request:53,zlib:3}],49:[function(require,module,exports){var rdf=require("./RdfUtil"),_=require("lodash");var LOG_LEVELS=["EMERGENCY","ALERT","CRITICAL","ERROR","WARNING","NOTICE","INFO","DEBUG"];function Logger(name){if(!(this instanceof Logger))return new Logger(name);this._name=name||""}Logger.prototype.log=function(level,items){items=_.map(items,this._format,this);items.unshift("["+new Date+"]",level,this._name);this._print(items)};LOG_LEVELS.forEach(function(level){Logger.prototype[level.toLowerCase()]=function(){this.log(level,arguments)}});Logger.prototype._format=function(item){if(!item)return""+item;if(item instanceof Array)return JSON.stringify(item.map(this._format,this));if(item.subject&&item.predicate&&item.object)return rdf.toQuickString(item);return typeof item==="string"?item:JSON.stringify(item)};Logger.prototype._print=function(items){console.error.apply(console,items)};Logger.prototype._printCSV=function(items){console.error(items.map(function(item){return!/["\n\r,]/.test(item)?item:'"'+item.replace(/"/g,'""')+'"'}).join(","))};Logger.setLevel=function(level){var levelIndex=_.indexOf(LOG_LEVELS,level.toUpperCase());if(levelIndex>=0)while(++levelIndex<LOG_LEVELS.length)Logger.prototype[LOG_LEVELS[levelIndex].toLowerCase()]=_.noop};Logger.enabled=function(level){return level in Logger.prototype&&Logger.prototype[level]!==_.noop};Logger.setMode=function(modeName){if(modeName.toUpperCase()==="CSV")Logger.prototype._print=Logger.prototype._printCSV};module.exports=Logger},{"./RdfUtil":50,lodash:55}],50:[function(require,module,exports){var N3=require("n3"),_=require("lodash");var util=module.exports=N3.Util({});util.decodedURIEquals=function(URIa,URIb){if(URIa===URIb)return true;try{return decodeURI(URIa)===decodeURI(URIb)}catch(error){return false}};util.deskolemize=function(URI){return URI&&URI.replace(genidMatcher,function(URI,id){return"_:"+id.replace(/\W/g,"_")})};var genidMatcher=/^https?:\/\/[^\/]+\/\.well-known\/genid\/([^]+)$/;util.triple=function(subject,predicate,object){return{subject:subject,predicate:predicate,object:object}};util.toQuickString=function(triple){if(!triple)return"";if(typeof triple==="string"){if(util.isVariableOrBlank(triple))return triple;if(util.isLiteral(triple))return'"'+util.getLiteralValue(triple)+'"';var match=triple.match(/([a-zA-Z\(\)_\.,'0-9]+)[^a-zAZ]*?$/);return match?match[1]:triple}return util.toQuickString(triple.subject)+" "+util.toQuickString(triple.predicate)+" "+util.toQuickString(triple.object)+"."};util.isVariable=function(entity){return typeof entity!=="string"||entity[0]==="?"};util.hasVariables=function(pattern){return!!pattern&&(util.isVariable(pattern.subject)||util.isVariable(pattern.predicate)||util.isVariable(pattern.object))};util.getVariables=function(pattern){var variables=[];if(util.isVariable(pattern.subject))variables.push(pattern.subject);if(util.isVariable(pattern.predicate))variables.push(pattern.predicate);if(util.isVariable(pattern.object))variables.push(pattern.object);return variables};util.isVariableOrBlank=function(entity){return typeof entity!=="string"||entity[0]==="?"||entity[0]==="_"&&entity[1]===":"};util.hasVariablesOrBlanks=function(pattern){return!!pattern&&(util.isVariableOrBlank(pattern.subject)||util.isVariableOrBlank(pattern.predicate)||util.isVariableOrBlank(pattern.object))};util.tripleFilter=function(triplePattern){var pattern=triplePattern||{},subject=util.isVariableOrBlank(pattern.subject)?null:pattern.subject,predicate=util.isVariableOrBlank(pattern.predicate)?null:pattern.predicate,object=util.isVariableOrBlank(pattern.object)?null:pattern.object;return function(triple){return(subject===null||subject===triple.subject)&&(predicate===null||predicate===triple.predicate)&&(object===null||object===triple.object)}};util.applyBindings=function(bindings,pattern){if(typeof pattern.map==="function")return pattern.map(function(p){return util.applyBindings(bindings,p)});return{subject:bindings[pattern.subject]||pattern.subject,predicate:bindings[pattern.predicate]||pattern.predicate,object:bindings[pattern.object]||pattern.object}};util.findBindings=function(triplePattern,boundTriple){return util.extendBindings(null,triplePattern,boundTriple)};util.extendBindings=function(bindings,triplePattern,boundTriple){var newBindings=Object.create(null);for(var binding in bindings)newBindings[binding]=bindings[binding];util.addBinding(newBindings,triplePattern.subject,boundTriple.subject);util.addBinding(newBindings,triplePattern.predicate,boundTriple.predicate);util.addBinding(newBindings,triplePattern.object,boundTriple.object);return newBindings};util.addBinding=function(bindings,left,right){if(util.isVariableOrBlank(right))throw new Error("Right-hand side must not be variable.");if(util.isVariableOrBlank(left)){if(!(left in bindings))bindings[left]=right;else if(right!==bindings[left])throw new Error(["Cannot bind",left,"to",right,"because it was already bound to",bindings[left]+"."].join(" "))}else if(left!==right){throw new Error(["Cannot bind",left,"to",right].join(" "))}return bindings};util.isBoundPatternOf=function(child,parent){return(util.isVariable(parent.subject)||parent.subject===child.subject)&&(util.isVariable(parent.predicate)||parent.predicate===child.predicate)&&(util.isVariable(parent.object)||parent.object===child.object)};util.findConnectedPatterns=function(graphPattern){if(graphPattern.length<=1)return[graphPattern];var clusters=graphPattern.map(function(triple){return{triples:[triple],variables:_.values(triple).filter(util.isVariableOrBlank)}}),commonVar;do{var allVariables=_.flatten(_.pluck(clusters,"variables"));if(commonVar=_.find(allVariables,hasDuplicate)){var hasCommon=_.groupBy(clusters,function(c){return _.contains(c.variables,commonVar)});clusters=hasCommon[false]||[];clusters.push({triples:_.union.apply(_,_.pluck(hasCommon[true],"triples")),variables:_.union.apply(_,_.pluck(hasCommon[true],"variables"))})}}while(commonVar);return _.pluck(clusters,"triples")};function hasDuplicate(value,index,array){return index!==array.lastIndexOf(value)}namespace("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#",["type","subject","predicate","object"]);namespace("void","http://rdfs.org/ns/void#",["triples"]);namespace("hydra","http://www.w3.org/ns/hydra/core#",["search","template","mapping","property","variable","totalItems"]);namespace("foaf","http://xmlns.com/foaf/0.1/");namespace("dbpedia","http://dbpedia.org/resource/");namespace("dbpedia-owl","http://dbpedia.org/ontology/");function namespace(prefix,base,names){var key=prefix.replace(/[^a-z]/g,"").toUpperCase();util[key]=base;names&&names.forEach(function(name){util[key+"_"+name.toUpperCase()]=base+name})}Object.freeze(util)},{lodash:55,n3:57}],51:[function(require,module,exports){var util=require("util"),N3Util=require("n3").Util,createErrorType=require("./CustomError");var XSD="http://www.w3.org/2001/XMLSchema#",XSD_INTEGER=XSD+"integer",XSD_DOUBLE=XSD+"double",XSD_BOOLEAN=XSD+"boolean",XSD_TRUE='"true"^^'+XSD_BOOLEAN,XSD_FALSE='"false"^^'+XSD_BOOLEAN;function SparqlExpressionEvaluator(expression){if(!expression)return noop;var expressionType=expression&&expression.type||typeof expression,evaluator=evaluators[expressionType];if(!evaluator)throw new UnsupportedExpressionError(expressionType);return evaluator(expression)}SparqlExpressionEvaluator.evaluate=function(expression,bindings){return SparqlExpressionEvaluator(expression)(bindings)};function noop(){}var evaluators={"null":function(){return noop},string:function(expression){if(expression[0]!=="?")return function(){return expression};else return function(bindings){return bindings&&bindings[expression]}},operation:function(expression){var operatorName=expression.operator,operator=operators[operatorName];if(!operator)throw new UnsupportedOperatorError(operatorName);if(operator.length!==expression.args.length)throw new InvalidArgumentsNumberError(operatorName,expression.args.length,operator.length);if(operator.acceptsExpressions){return function(operator,args){return function(bindings){return operator.apply(bindings,args)}}(operator,expression.args)}var argumentExpressions=new Array(expression.args.length);for(var i=0;i<expression.args.length;i++)argumentExpressions[i]=SparqlExpressionEvaluator(expression.args[i]);return function(operator,argumentExpressions){return function(bindings){var args=new Array(argumentExpressions.length),origArgs=new Array(argumentExpressions.length);for(var i=0;i<argumentExpressions.length;i++){var arg=args[i]=origArgs[i]=argumentExpressions[i](bindings);if(arg===undefined)return;switch(operator.type){case"numeric":args[i]=parseFloat(N3Util.getLiteralValue(arg));break;case"boolean":args[i]=arg!==XSD_FALSE&&(!N3Util.isLiteral(arg)||N3Util.getLiteralValue(arg)!=="0");break}}var result=operator.apply(null,args);switch(operator.resultType){case"numeric":var type=N3Util.getLiteralType(origArgs[0])||XSD_INTEGER;return'"'+result+'"^^'+type;case"boolean":return result?XSD_TRUE:XSD_FALSE;default:return result}}}(operator,argumentExpressions)}};var operators={"+":function(a,b){return a+b},"-":function(a,b){return a-b},"*":function(a,b){return a*b},"/":function(a,b){return a/b},"=":function(a,b){return a===b},"!=":function(a,b){return a!==b},"<":function(a,b){return a<b},"<=":function(a,b){return a<=b},">":function(a,b){return a>b},">=":function(a,b){return a>=b},"!":function(a){return!a},"&&":function(a,b){return a&&b},"||":function(a,b){return a||b},lang:function(a){return'"'+N3Util.getLiteralLanguage(a).toLowerCase()+'"'},langmatches:function(a,b){return a.toLowerCase()===b.toLowerCase()},regex:function(subject,pattern){if(N3Util.isLiteral(subject))subject=N3Util.getLiteralValue(subject);return new RegExp(N3Util.getLiteralValue(pattern)).test(subject)},str:function(a){return N3Util.isLiteral(a)?a:'"'+a+'"'},"http://www.w3.org/2001/XMLSchema#double":function(a){a=a.toFixed();if(a.indexOf(".")<0)a+=".0";return'"'+a+'"^^http://www.w3.org/2001/XMLSchema#double'},bound:function(a){if(a[0]!=="?")throw new Error("BOUND expects a variable but got: "+a);return a in this?XSD_TRUE:XSD_FALSE}};["+","-","*","/","<","<=",">",">=","http://www.w3.org/2001/XMLSchema#double"].forEach(function(operatorName){operators[operatorName].type="numeric"});["!","&&","||"].forEach(function(operatorName){operators[operatorName].type="boolean"});["+","-","*","/","<","<=",">",">="].forEach(function(operatorName){operators[operatorName].type=operators[operatorName].resultType="numeric"});["!","&&","||","=","<","<=",">",">=","langmatches","regex"].forEach(function(operatorName){operators[operatorName].resultType="boolean"});operators.bound.acceptsExpressions=true;var UnsupportedExpressionError=createErrorType("UnsupportedExpressionError",function(expressionType){this.message="Unsupported expression type: "+expressionType+"."});var UnsupportedOperatorError=createErrorType("UnsupportedExpressionError",function(operatorName){this.message="Unsupported operator: "+operatorName.toUpperCase()+"."});var InvalidArgumentsNumberError=createErrorType("InvalidArgumentsNumberError",function(operatorName,actualNumber,expectedNumber){this.message="Invalid number of arguments for "+operatorName.toUpperCase()+": "+actualNumber+" (expected: "+expectedNumber+")."});module.exports=SparqlExpressionEvaluator;module.exports.UnsupportedExpressionError=UnsupportedExpressionError;module.exports.UnsupportedOperatorError=UnsupportedOperatorError;module.exports.InvalidArgumentsNumberError=InvalidArgumentsNumberError},{"./CustomError":46,n3:57,util:27}],52:[function(require,module,exports){exports.createHash=function(){var contents;return{update:function(c){contents?contents+=c:contents=c},digest:function(){return sha1(contents)}}};function sha1(msg){var K=[1518500249,1859775393,2400959708,3395469782];msg+=String.fromCharCode(128);var l=msg.length/4+2;var N=Math.ceil(l/16);var M=new Array(N);for(var i=0;i<N;i++){M[i]=new Array(16);for(var j=0;j<16;j++){M[i][j]=msg.charCodeAt(i*64+j*4)<<24|msg.charCodeAt(i*64+j*4+1)<<16|msg.charCodeAt(i*64+j*4+2)<<8|msg.charCodeAt(i*64+j*4+3)}}M[N-1][14]=(msg.length-1)*8/Math.pow(2,32);M[N-1][14]=Math.floor(M[N-1][14]);M[N-1][15]=(msg.length-1)*8&4294967295;var H0=1732584193;var H1=4023233417;var H2=2562383102;var H3=271733878;var H4=3285377520;var W=new Array(80),a,b,c,d,e,t;for(i=0;i<N;i++){for(t=0;t<16;t++)W[t]=M[i][t];for(t=16;t<80;t++)W[t]=ROTL(W[t-3]^W[t-8]^W[t-14]^W[t-16],1);a=H0,b=H1,c=H2,d=H3,e=H4;for(t=0;t<80;t++){var s=Math.floor(t/20);var T=ROTL(a,5)+f(s,b,c,d)+e+K[s]+W[t]&4294967295;e=d;d=c;c=ROTL(b,30);b=a;a=T}H0=H0+a&4294967295;H1=H1+b&4294967295;H2=H2+c&4294967295;H3=H3+d&4294967295;H4=H4+e&4294967295}return toHexStr(H0)+toHexStr(H1)+toHexStr(H2)+toHexStr(H3)+toHexStr(H4)}function f(s,x,y,z){switch(s){case 0:return x&y^~x&z;case 1:return x^y^z;case 2:return x&y^x&z^y&z;case 3:return x^y^z}}function ROTL(x,n){return x<<n|x>>>32-n}function toHexStr(n){var s="",v;for(var i=7;i>=0;i--){v=n>>>i*4&15;s+=v.toString(16)}return s}},{}],53:[function(require,module,exports){var EventEmitter=require("events").EventEmitter,SingleIterator=require("../../lib/iterators/Iterator").SingleIterator;require("setimmediate");function createRequest(settings){var request=new EventEmitter;var jqXHR=jQuery.ajax({url:settings.url,timeout:settings.timeout,type:settings.method,headers:{accept:settings.headers&&settings.headers.accept||"*/*"}}).success(function(){var response=new SingleIterator(jqXHR.responseText||"");response.statusCode=jqXHR.status;response.headers={"content-type":jqXHR.getResponseHeader("content-type")};request.emit("response",response)}).fail(function(){request.emit("error",new Error("Error requesting "+settings.url))});request.abort=function(){jqXHR.abort()};return request}module.exports=createRequest},{"../../lib/iterators/Iterator":34,events:8,setimmediate:65}],54:[function(require,module,exports){var TransformIterator=require("../iterators/Iterator").TransformIterator;function SparqlResultWriter(mediaType,sparqlIterator){if(mediaType===true){TransformIterator.call(this,true);this._empty=true;return setImmediate(function(){var variables=sparqlIterator.getProperty("variables")||[];this._writeHead(variables.map(function(v){return v.substring(1)}));this.setSource(sparqlIterator)}.bind(this))}else{var ResultWriter=SparqlResultWriter.writers[mediaType];if(!ResultWriter)throw new Error("The requested result format "+mediaType+" is not supported.");if(typeof ResultWriter==="string")ResultWriter=SparqlResultWriter.writers[mediaType]=require(ResultWriter);return new ResultWriter(sparqlIterator)}}TransformIterator.inherits(SparqlResultWriter);SparqlResultWriter.writers={};SparqlResultWriter.register=function(mimeType,ResultWriter){SparqlResultWriter.writers[mimeType]=ResultWriter};SparqlResultWriter.prototype._writeHead=function(variableNames){};SparqlResultWriter.prototype._transform=function(result,done){if(typeof result==="boolean")this._writeBoolean(result);else this._writeBindings(result);delete this._empty;done()};SparqlResultWriter.prototype._writeBindings=function(result,done){throw new Error("The _writeBindings method has not been implemented.")};SparqlResultWriter.prototype._writeBoolean=function(result,done){throw new Error("The _writeBoolean method has not been implemented.")};module.exports=SparqlResultWriter},{"../iterators/Iterator":34}],55:[function(require,module,exports){(function(global){(function(){var undefined;var arrayPool=[],objectPool=[];var idCounter=0;var keyPrefix=+new Date+"";var largeArraySize=75;var maxPoolSize=40;var whitespace=" \f \ufeff"+"\n\r\u2028\u2029"+" ";var reEmptyStringLeading=/\b__p \+= '';/g,reEmptyStringMiddle=/\b(__p \+=) '' \+/g,reEmptyStringTrailing=/(__e\(.*?\)|\b__t\)) \+\n'';/g;var reEsTemplate=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;var reFlags=/\w*$/;var reFuncName=/^\s*function[ \n\r\t]+\w/;var reInterpolate=/<%=([\s\S]+?)%>/g;var reLeadingSpacesAndZeros=RegExp("^["+whitespace+"]*0+(?=.$)");var reNoMatch=/($^)/;var reThis=/\bthis\b/;var reUnescapedString=/['\n\r\t\u2028\u2029\\]/g;var contextProps=["Array","Boolean","Date","Function","Math","Number","Object","RegExp","String","_","attachEvent","clearTimeout","isFinite","isNaN","parseInt","setTimeout"];var templateCounter=0;var argsClass="[object Arguments]",arrayClass="[object Array]",boolClass="[object Boolean]",dateClass="[object Date]",funcClass="[object Function]",numberClass="[object Number]",objectClass="[object Object]",regexpClass="[object RegExp]",stringClass="[object String]";var cloneableClasses={};cloneableClasses[funcClass]=false;cloneableClasses[argsClass]=cloneableClasses[arrayClass]=cloneableClasses[boolClass]=cloneableClasses[dateClass]=cloneableClasses[numberClass]=cloneableClasses[objectClass]=cloneableClasses[regexpClass]=cloneableClasses[stringClass]=true;var debounceOptions={leading:false,maxWait:0,trailing:false};var descriptor={configurable:false,enumerable:false,value:null,writable:false};var objectTypes={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false};var stringEscapes={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};var root=objectTypes[typeof window]&&window||this;var freeExports=objectTypes[typeof exports]&&exports&&!exports.nodeType&&exports;var freeModule=objectTypes[typeof module]&&module&&!module.nodeType&&module;var moduleExports=freeModule&&freeModule.exports===freeExports&&freeExports;var freeGlobal=objectTypes[typeof global]&&global;if(freeGlobal&&(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal)){root=freeGlobal}function baseIndexOf(array,value,fromIndex){var index=(fromIndex||0)-1,length=array?array.length:0;while(++index<length){if(array[index]===value){return index}}return-1}function cacheIndexOf(cache,value){var type=typeof value;cache=cache.cache;if(type=="boolean"||value==null){return cache[value]?0:-1}if(type!="number"&&type!="string"){type="object"}var key=type=="number"?value:keyPrefix+value;cache=(cache=cache[type])&&cache[key];return type=="object"?cache&&baseIndexOf(cache,value)>-1?0:-1:cache?0:-1}function cachePush(value){var cache=this.cache,type=typeof value;if(type=="boolean"||value==null){cache[value]=true}else{if(type!="number"&&type!="string"){type="object"}var key=type=="number"?value:keyPrefix+value,typeCache=cache[type]||(cache[type]={});if(type=="object"){(typeCache[key]||(typeCache[key]=[])).push(value)}else{typeCache[key]=true}}}function charAtCallback(value){return value.charCodeAt(0)}function compareAscending(a,b){var ac=a.criteria,bc=b.criteria,index=-1,length=ac.length;while(++index<length){var value=ac[index],other=bc[index];if(value!==other){if(value>other||typeof value=="undefined"){return 1}if(value<other||typeof other=="undefined"){return-1}}}return a.index-b.index}function createCache(array){var index=-1,length=array.length,first=array[0],mid=array[length/2|0],last=array[length-1];if(first&&typeof first=="object"&&mid&&typeof mid=="object"&&last&&typeof last=="object"){return false}var cache=getObject();cache["false"]=cache["null"]=cache["true"]=cache["undefined"]=false;var result=getObject();result.array=array;result.cache=cache;result.push=cachePush;while(++index<length){result.push(array[index])}return result}function escapeStringChar(match){return"\\"+stringEscapes[match]}function getArray(){return arrayPool.pop()||[]}function getObject(){return objectPool.pop()||{array:null,cache:null,criteria:null,"false":false,index:0,"null":false,number:null,object:null,push:null,string:null,"true":false,undefined:false,value:null}}function releaseArray(array){array.length=0;if(arrayPool.length<maxPoolSize){arrayPool.push(array)}}function releaseObject(object){var cache=object.cache;if(cache){releaseObject(cache)}object.array=object.cache=object.criteria=object.object=object.number=object.string=object.value=null;if(objectPool.length<maxPoolSize){objectPool.push(object)}}function slice(array,start,end){start||(start=0);if(typeof end=="undefined"){end=array?array.length:0}var index=-1,length=end-start||0,result=Array(length<0?0:length);while(++index<length){result[index]=array[start+index]}return result}function runInContext(context){context=context?_.defaults(root.Object(),context,_.pick(root,contextProps)):root;var Array=context.Array,Boolean=context.Boolean,Date=context.Date,Function=context.Function,Math=context.Math,Number=context.Number,Object=context.Object,RegExp=context.RegExp,String=context.String,TypeError=context.TypeError;var arrayRef=[];var objectProto=Object.prototype;var oldDash=context._;var toString=objectProto.toString;var reNative=RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$");var ceil=Math.ceil,clearTimeout=context.clearTimeout,floor=Math.floor,fnToString=Function.prototype.toString,getPrototypeOf=isNative(getPrototypeOf=Object.getPrototypeOf)&&getPrototypeOf,hasOwnProperty=objectProto.hasOwnProperty,push=arrayRef.push,setTimeout=context.setTimeout,splice=arrayRef.splice,unshift=arrayRef.unshift;var defineProperty=function(){try{var o={},func=isNative(func=Object.defineProperty)&&func,result=func(o,o,o)&&func}catch(e){}return result}();var nativeCreate=isNative(nativeCreate=Object.create)&&nativeCreate,nativeIsArray=isNative(nativeIsArray=Array.isArray)&&nativeIsArray,nativeIsFinite=context.isFinite,nativeIsNaN=context.isNaN,nativeKeys=isNative(nativeKeys=Object.keys)&&nativeKeys,nativeMax=Math.max,nativeMin=Math.min,nativeParseInt=context.parseInt,nativeRandom=Math.random;var ctorByClass={};ctorByClass[arrayClass]=Array;ctorByClass[boolClass]=Boolean;ctorByClass[dateClass]=Date;ctorByClass[funcClass]=Function;ctorByClass[objectClass]=Object;ctorByClass[numberClass]=Number;ctorByClass[regexpClass]=RegExp;ctorByClass[stringClass]=String;function lodash(value){return value&&typeof value=="object"&&!isArray(value)&&hasOwnProperty.call(value,"__wrapped__")?value:new lodashWrapper(value)}function lodashWrapper(value,chainAll){this.__chain__=!!chainAll;this.__wrapped__=value}lodashWrapper.prototype=lodash.prototype;var support=lodash.support={};support.funcDecomp=!isNative(context.WinRTError)&&reThis.test(runInContext);support.funcNames=typeof Function.name=="string";lodash.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:reInterpolate,variable:"",imports:{_:lodash}};function baseBind(bindData){var func=bindData[0],partialArgs=bindData[2],thisArg=bindData[4];function bound(){if(partialArgs){var args=slice(partialArgs);push.apply(args,arguments)}if(this instanceof bound){var thisBinding=baseCreate(func.prototype),result=func.apply(thisBinding,args||arguments);return isObject(result)?result:thisBinding}return func.apply(thisArg,args||arguments)}setBindData(bound,bindData);return bound}function baseClone(value,isDeep,callback,stackA,stackB){if(callback){var result=callback(value);if(typeof result!="undefined"){return result}}var isObj=isObject(value);if(isObj){var className=toString.call(value);if(!cloneableClasses[className]){return value}var ctor=ctorByClass[className];switch(className){case boolClass:case dateClass:return new ctor(+value);case numberClass:case stringClass:return new ctor(value);case regexpClass:result=ctor(value.source,reFlags.exec(value));result.lastIndex=value.lastIndex;return result}}else{return value}var isArr=isArray(value);if(isDeep){var initedStack=!stackA;stackA||(stackA=getArray());stackB||(stackB=getArray());var length=stackA.length;while(length--){if(stackA[length]==value){return stackB[length]}}result=isArr?ctor(value.length):{}}else{result=isArr?slice(value):assign({},value)}if(isArr){if(hasOwnProperty.call(value,"index")){result.index=value.index}if(hasOwnProperty.call(value,"input")){result.input=value.input}}if(!isDeep){return result}stackA.push(value);stackB.push(result);(isArr?forEach:forOwn)(value,function(objValue,key){result[key]=baseClone(objValue,isDeep,callback,stackA,stackB)});if(initedStack){releaseArray(stackA);releaseArray(stackB)}return result}function baseCreate(prototype,properties){return isObject(prototype)?nativeCreate(prototype):{}}if(!nativeCreate){baseCreate=function(){function Object(){}return function(prototype){if(isObject(prototype)){Object.prototype=prototype;var result=new Object;Object.prototype=null}return result||context.Object()}}()}function baseCreateCallback(func,thisArg,argCount){if(typeof func!="function"){return identity}if(typeof thisArg=="undefined"||!("prototype"in func)){return func}var bindData=func.__bindData__;if(typeof bindData=="undefined"){if(support.funcNames){bindData=!func.name}bindData=bindData||!support.funcDecomp;if(!bindData){var source=fnToString.call(func);if(!support.funcNames){bindData=!reFuncName.test(source)}if(!bindData){bindData=reThis.test(source);setBindData(func,bindData)}}}if(bindData===false||bindData!==true&&bindData[1]&1){return func}switch(argCount){case 1:return function(value){return func.call(thisArg,value)};case 2:return function(a,b){return func.call(thisArg,a,b)};case 3:return function(value,index,collection){return func.call(thisArg,value,index,collection)};case 4:return function(accumulator,value,index,collection){return func.call(thisArg,accumulator,value,index,collection)}}return bind(func,thisArg)}function baseCreateWrapper(bindData){var func=bindData[0],bitmask=bindData[1],partialArgs=bindData[2],partialRightArgs=bindData[3],thisArg=bindData[4],arity=bindData[5];var isBind=bitmask&1,isBindKey=bitmask&2,isCurry=bitmask&4,isCurryBound=bitmask&8,key=func;function bound(){var thisBinding=isBind?thisArg:this;if(partialArgs){var args=slice(partialArgs);push.apply(args,arguments)}if(partialRightArgs||isCurry){args||(args=slice(arguments));if(partialRightArgs){push.apply(args,partialRightArgs)}if(isCurry&&args.length<arity){bitmask|=16&~32;return baseCreateWrapper([func,isCurryBound?bitmask:bitmask&~3,args,null,thisArg,arity])}}args||(args=arguments);if(isBindKey){func=thisBinding[key]}if(this instanceof bound){thisBinding=baseCreate(func.prototype);var result=func.apply(thisBinding,args);return isObject(result)?result:thisBinding}return func.apply(thisBinding,args)}setBindData(bound,bindData);return bound}function baseDifference(array,values){var index=-1,indexOf=getIndexOf(),length=array?array.length:0,isLarge=length>=largeArraySize&&indexOf===baseIndexOf,result=[];if(isLarge){var cache=createCache(values);if(cache){indexOf=cacheIndexOf;values=cache}else{isLarge=false}}while(++index<length){var value=array[index];if(indexOf(values,value)<0){result.push(value)}}if(isLarge){releaseObject(values)}return result}function baseFlatten(array,isShallow,isStrict,fromIndex){var index=(fromIndex||0)-1,length=array?array.length:0,result=[];while(++index<length){var value=array[index];if(value&&typeof value=="object"&&typeof value.length=="number"&&(isArray(value)||isArguments(value))){if(!isShallow){value=baseFlatten(value,isShallow,isStrict)}var valIndex=-1,valLength=value.length,resIndex=result.length;result.length+=valLength;while(++valIndex<valLength){result[resIndex++]=value[valIndex]}}else if(!isStrict){result.push(value)}}return result}function baseIsEqual(a,b,callback,isWhere,stackA,stackB){if(callback){var result=callback(a,b);if(typeof result!="undefined"){return!!result}}if(a===b){return a!==0||1/a==1/b}var type=typeof a,otherType=typeof b;if(a===a&&!(a&&objectTypes[type])&&!(b&&objectTypes[otherType])){return false}if(a==null||b==null){return a===b}var className=toString.call(a),otherClass=toString.call(b);if(className==argsClass){className=objectClass}if(otherClass==argsClass){otherClass=objectClass}if(className!=otherClass){return false}switch(className){case boolClass:case dateClass:return+a==+b;case numberClass:return a!=+a?b!=+b:a==0?1/a==1/b:a==+b;case regexpClass:case stringClass:return a==String(b)}var isArr=className==arrayClass;if(!isArr){var aWrapped=hasOwnProperty.call(a,"__wrapped__"),bWrapped=hasOwnProperty.call(b,"__wrapped__");if(aWrapped||bWrapped){return baseIsEqual(aWrapped?a.__wrapped__:a,bWrapped?b.__wrapped__:b,callback,isWhere,stackA,stackB)}if(className!=objectClass){return false}var ctorA=a.constructor,ctorB=b.constructor;if(ctorA!=ctorB&&!(isFunction(ctorA)&&ctorA instanceof ctorA&&isFunction(ctorB)&&ctorB instanceof ctorB)&&("constructor"in a&&"constructor"in b)){return false}}var initedStack=!stackA;stackA||(stackA=getArray());stackB||(stackB=getArray());var length=stackA.length;while(length--){if(stackA[length]==a){return stackB[length]==b}}var size=0;result=true;stackA.push(a);stackB.push(b);if(isArr){length=a.length;size=b.length;result=size==length;if(result||isWhere){while(size--){var index=length,value=b[size];if(isWhere){while(index--){if(result=baseIsEqual(a[index],value,callback,isWhere,stackA,stackB)){break}}}else if(!(result=baseIsEqual(a[size],value,callback,isWhere,stackA,stackB))){break}}}}else{forIn(b,function(value,key,b){if(hasOwnProperty.call(b,key)){size++;return result=hasOwnProperty.call(a,key)&&baseIsEqual(a[key],value,callback,isWhere,stackA,stackB)}});if(result&&!isWhere){forIn(a,function(value,key,a){if(hasOwnProperty.call(a,key)){return result=--size>-1}})}}stackA.pop();stackB.pop();if(initedStack){releaseArray(stackA);releaseArray(stackB)}return result}function baseMerge(object,source,callback,stackA,stackB){(isArray(source)?forEach:forOwn)(source,function(source,key){var found,isArr,result=source,value=object[key];if(source&&((isArr=isArray(source))||isPlainObject(source))){ | |
var stackLength=stackA.length;while(stackLength--){if(found=stackA[stackLength]==source){value=stackB[stackLength];break}}if(!found){var isShallow;if(callback){result=callback(value,source);if(isShallow=typeof result!="undefined"){value=result}}if(!isShallow){value=isArr?isArray(value)?value:[]:isPlainObject(value)?value:{}}stackA.push(source);stackB.push(value);if(!isShallow){baseMerge(value,source,callback,stackA,stackB)}}}else{if(callback){result=callback(value,source);if(typeof result=="undefined"){result=source}}if(typeof result!="undefined"){value=result}}object[key]=value})}function baseRandom(min,max){return min+floor(nativeRandom()*(max-min+1))}function baseUniq(array,isSorted,callback){var index=-1,indexOf=getIndexOf(),length=array?array.length:0,result=[];var isLarge=!isSorted&&length>=largeArraySize&&indexOf===baseIndexOf,seen=callback||isLarge?getArray():result;if(isLarge){var cache=createCache(seen);indexOf=cacheIndexOf;seen=cache}while(++index<length){var value=array[index],computed=callback?callback(value,index,array):value;if(isSorted?!index||seen[seen.length-1]!==computed:indexOf(seen,computed)<0){if(callback||isLarge){seen.push(computed)}result.push(value)}}if(isLarge){releaseArray(seen.array);releaseObject(seen)}else if(callback){releaseArray(seen)}return result}function createAggregator(setter){return function(collection,callback,thisArg){var result={};callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++index<length){var value=collection[index];setter(result,value,callback(value,index,collection),collection)}}else{forOwn(collection,function(value,key,collection){setter(result,value,callback(value,key,collection),collection)})}return result}}function createWrapper(func,bitmask,partialArgs,partialRightArgs,thisArg,arity){var isBind=bitmask&1,isBindKey=bitmask&2,isCurry=bitmask&4,isCurryBound=bitmask&8,isPartial=bitmask&16,isPartialRight=bitmask&32;if(!isBindKey&&!isFunction(func)){throw new TypeError}if(isPartial&&!partialArgs.length){bitmask&=~16;isPartial=partialArgs=false}if(isPartialRight&&!partialRightArgs.length){bitmask&=~32;isPartialRight=partialRightArgs=false}var bindData=func&&func.__bindData__;if(bindData&&bindData!==true){bindData=slice(bindData);if(bindData[2]){bindData[2]=slice(bindData[2])}if(bindData[3]){bindData[3]=slice(bindData[3])}if(isBind&&!(bindData[1]&1)){bindData[4]=thisArg}if(!isBind&&bindData[1]&1){bitmask|=8}if(isCurry&&!(bindData[1]&4)){bindData[5]=arity}if(isPartial){push.apply(bindData[2]||(bindData[2]=[]),partialArgs)}if(isPartialRight){unshift.apply(bindData[3]||(bindData[3]=[]),partialRightArgs)}bindData[1]|=bitmask;return createWrapper.apply(null,bindData)}var creater=bitmask==1||bitmask===17?baseBind:baseCreateWrapper;return creater([func,bitmask,partialArgs,partialRightArgs,thisArg,arity])}function escapeHtmlChar(match){return htmlEscapes[match]}function getIndexOf(){var result=(result=lodash.indexOf)===indexOf?baseIndexOf:result;return result}function isNative(value){return typeof value=="function"&&reNative.test(value)}var setBindData=!defineProperty?noop:function(func,value){descriptor.value=value;defineProperty(func,"__bindData__",descriptor);descriptor.value=null};function shimIsPlainObject(value){var ctor,result;if(!(value&&toString.call(value)==objectClass)||(ctor=value.constructor,isFunction(ctor)&&!(ctor instanceof ctor))){return false}forIn(value,function(value,key){result=key});return typeof result=="undefined"||hasOwnProperty.call(value,result)}function unescapeHtmlChar(match){return htmlUnescapes[match]}function isArguments(value){return value&&typeof value=="object"&&typeof value.length=="number"&&toString.call(value)==argsClass||false}var isArray=nativeIsArray||function(value){return value&&typeof value=="object"&&typeof value.length=="number"&&toString.call(value)==arrayClass||false};var shimKeys=function(object){var index,iterable=object,result=[];if(!iterable)return result;if(!objectTypes[typeof object])return result;for(index in iterable){if(hasOwnProperty.call(iterable,index)){result.push(index)}}return result};var keys=!nativeKeys?shimKeys:function(object){if(!isObject(object)){return[]}return nativeKeys(object)};var htmlEscapes={"&":"&","<":"<",">":">",'"':""","'":"'"};var htmlUnescapes=invert(htmlEscapes);var reEscapedHtml=RegExp("("+keys(htmlUnescapes).join("|")+")","g"),reUnescapedHtml=RegExp("["+keys(htmlEscapes).join("")+"]","g");var assign=function(object,source,guard){var index,iterable=object,result=iterable;if(!iterable)return result;var args=arguments,argsIndex=0,argsLength=typeof guard=="number"?2:args.length;if(argsLength>3&&typeof args[argsLength-2]=="function"){var callback=baseCreateCallback(args[--argsLength-1],args[argsLength--],2)}else if(argsLength>2&&typeof args[argsLength-1]=="function"){callback=args[--argsLength]}while(++argsIndex<argsLength){iterable=args[argsIndex];if(iterable&&objectTypes[typeof iterable]){var ownIndex=-1,ownProps=objectTypes[typeof iterable]&&keys(iterable),length=ownProps?ownProps.length:0;while(++ownIndex<length){index=ownProps[ownIndex];result[index]=callback?callback(result[index],iterable[index]):iterable[index]}}}return result};function clone(value,isDeep,callback,thisArg){if(typeof isDeep!="boolean"&&isDeep!=null){thisArg=callback;callback=isDeep;isDeep=false}return baseClone(value,isDeep,typeof callback=="function"&&baseCreateCallback(callback,thisArg,1))}function cloneDeep(value,callback,thisArg){return baseClone(value,true,typeof callback=="function"&&baseCreateCallback(callback,thisArg,1))}function create(prototype,properties){var result=baseCreate(prototype);return properties?assign(result,properties):result}var defaults=function(object,source,guard){var index,iterable=object,result=iterable;if(!iterable)return result;var args=arguments,argsIndex=0,argsLength=typeof guard=="number"?2:args.length;while(++argsIndex<argsLength){iterable=args[argsIndex];if(iterable&&objectTypes[typeof iterable]){var ownIndex=-1,ownProps=objectTypes[typeof iterable]&&keys(iterable),length=ownProps?ownProps.length:0;while(++ownIndex<length){index=ownProps[ownIndex];if(typeof result[index]=="undefined")result[index]=iterable[index]}}}return result};function findKey(object,callback,thisArg){var result;callback=lodash.createCallback(callback,thisArg,3);forOwn(object,function(value,key,object){if(callback(value,key,object)){result=key;return false}});return result}function findLastKey(object,callback,thisArg){var result;callback=lodash.createCallback(callback,thisArg,3);forOwnRight(object,function(value,key,object){if(callback(value,key,object)){result=key;return false}});return result}var forIn=function(collection,callback,thisArg){var index,iterable=collection,result=iterable;if(!iterable)return result;if(!objectTypes[typeof iterable])return result;callback=callback&&typeof thisArg=="undefined"?callback:baseCreateCallback(callback,thisArg,3);for(index in iterable){if(callback(iterable[index],index,collection)===false)return result}return result};function forInRight(object,callback,thisArg){var pairs=[];forIn(object,function(value,key){pairs.push(key,value)});var length=pairs.length;callback=baseCreateCallback(callback,thisArg,3);while(length--){if(callback(pairs[length--],pairs[length],object)===false){break}}return object}var forOwn=function(collection,callback,thisArg){var index,iterable=collection,result=iterable;if(!iterable)return result;if(!objectTypes[typeof iterable])return result;callback=callback&&typeof thisArg=="undefined"?callback:baseCreateCallback(callback,thisArg,3);var ownIndex=-1,ownProps=objectTypes[typeof iterable]&&keys(iterable),length=ownProps?ownProps.length:0;while(++ownIndex<length){index=ownProps[ownIndex];if(callback(iterable[index],index,collection)===false)return result}return result};function forOwnRight(object,callback,thisArg){var props=keys(object),length=props.length;callback=baseCreateCallback(callback,thisArg,3);while(length--){var key=props[length];if(callback(object[key],key,object)===false){break}}return object}function functions(object){var result=[];forIn(object,function(value,key){if(isFunction(value)){result.push(key)}});return result.sort()}function has(object,key){return object?hasOwnProperty.call(object,key):false}function invert(object){var index=-1,props=keys(object),length=props.length,result={};while(++index<length){var key=props[index];result[object[key]]=key}return result}function isBoolean(value){return value===true||value===false||value&&typeof value=="object"&&toString.call(value)==boolClass||false}function isDate(value){return value&&typeof value=="object"&&toString.call(value)==dateClass||false}function isElement(value){return value&&value.nodeType===1||false}function isEmpty(value){var result=true;if(!value){return result}var className=toString.call(value),length=value.length;if(className==arrayClass||className==stringClass||className==argsClass||className==objectClass&&typeof length=="number"&&isFunction(value.splice)){return!length}forOwn(value,function(){return result=false});return result}function isEqual(a,b,callback,thisArg){return baseIsEqual(a,b,typeof callback=="function"&&baseCreateCallback(callback,thisArg,2))}function isFinite(value){return nativeIsFinite(value)&&!nativeIsNaN(parseFloat(value))}function isFunction(value){return typeof value=="function"}function isObject(value){return!!(value&&objectTypes[typeof value])}function isNaN(value){return isNumber(value)&&value!=+value}function isNull(value){return value===null}function isNumber(value){return typeof value=="number"||value&&typeof value=="object"&&toString.call(value)==numberClass||false}var isPlainObject=!getPrototypeOf?shimIsPlainObject:function(value){if(!(value&&toString.call(value)==objectClass)){return false}var valueOf=value.valueOf,objProto=isNative(valueOf)&&(objProto=getPrototypeOf(valueOf))&&getPrototypeOf(objProto);return objProto?value==objProto||getPrototypeOf(value)==objProto:shimIsPlainObject(value)};function isRegExp(value){return value&&typeof value=="object"&&toString.call(value)==regexpClass||false}function isString(value){return typeof value=="string"||value&&typeof value=="object"&&toString.call(value)==stringClass||false}function isUndefined(value){return typeof value=="undefined"}function mapValues(object,callback,thisArg){var result={};callback=lodash.createCallback(callback,thisArg,3);forOwn(object,function(value,key,object){result[key]=callback(value,key,object)});return result}function merge(object){var args=arguments,length=2;if(!isObject(object)){return object}if(typeof args[2]!="number"){length=args.length}if(length>3&&typeof args[length-2]=="function"){var callback=baseCreateCallback(args[--length-1],args[length--],2)}else if(length>2&&typeof args[length-1]=="function"){callback=args[--length]}var sources=slice(arguments,1,length),index=-1,stackA=getArray(),stackB=getArray();while(++index<length){baseMerge(object,sources[index],callback,stackA,stackB)}releaseArray(stackA);releaseArray(stackB);return object}function omit(object,callback,thisArg){var result={};if(typeof callback!="function"){var props=[];forIn(object,function(value,key){props.push(key)});props=baseDifference(props,baseFlatten(arguments,true,false,1));var index=-1,length=props.length;while(++index<length){var key=props[index];result[key]=object[key]}}else{callback=lodash.createCallback(callback,thisArg,3);forIn(object,function(value,key,object){if(!callback(value,key,object)){result[key]=value}})}return result}function pairs(object){var index=-1,props=keys(object),length=props.length,result=Array(length);while(++index<length){var key=props[index];result[index]=[key,object[key]]}return result}function pick(object,callback,thisArg){var result={};if(typeof callback!="function"){var index=-1,props=baseFlatten(arguments,true,false,1),length=isObject(object)?props.length:0;while(++index<length){var key=props[index];if(key in object){result[key]=object[key]}}}else{callback=lodash.createCallback(callback,thisArg,3);forIn(object,function(value,key,object){if(callback(value,key,object)){result[key]=value}})}return result}function transform(object,callback,accumulator,thisArg){var isArr=isArray(object);if(accumulator==null){if(isArr){accumulator=[]}else{var ctor=object&&object.constructor,proto=ctor&&ctor.prototype;accumulator=baseCreate(proto)}}if(callback){callback=lodash.createCallback(callback,thisArg,4);(isArr?forEach:forOwn)(object,function(value,index,object){return callback(accumulator,value,index,object)})}return accumulator}function values(object){var index=-1,props=keys(object),length=props.length,result=Array(length);while(++index<length){result[index]=object[props[index]]}return result}function at(collection){var args=arguments,index=-1,props=baseFlatten(args,true,false,1),length=args[2]&&args[2][args[1]]===collection?1:props.length,result=Array(length);while(++index<length){result[index]=collection[props[index]]}return result}function contains(collection,target,fromIndex){var index=-1,indexOf=getIndexOf(),length=collection?collection.length:0,result=false;fromIndex=(fromIndex<0?nativeMax(0,length+fromIndex):fromIndex)||0;if(isArray(collection)){result=indexOf(collection,target,fromIndex)>-1}else if(typeof length=="number"){result=(isString(collection)?collection.indexOf(target,fromIndex):indexOf(collection,target,fromIndex))>-1}else{forOwn(collection,function(value){if(++index>=fromIndex){return!(result=value===target)}})}return result}var countBy=createAggregator(function(result,value,key){hasOwnProperty.call(result,key)?result[key]++:result[key]=1});function every(collection,callback,thisArg){var result=true;callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++index<length){if(!(result=!!callback(collection[index],index,collection))){break}}}else{forOwn(collection,function(value,index,collection){return result=!!callback(value,index,collection)})}return result}function filter(collection,callback,thisArg){var result=[];callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++index<length){var value=collection[index];if(callback(value,index,collection)){result.push(value)}}}else{forOwn(collection,function(value,index,collection){if(callback(value,index,collection)){result.push(value)}})}return result}function find(collection,callback,thisArg){callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++index<length){var value=collection[index];if(callback(value,index,collection)){return value}}}else{var result;forOwn(collection,function(value,index,collection){if(callback(value,index,collection)){result=value;return false}});return result}}function findLast(collection,callback,thisArg){var result;callback=lodash.createCallback(callback,thisArg,3);forEachRight(collection,function(value,index,collection){if(callback(value,index,collection)){result=value;return false}});return result}function forEach(collection,callback,thisArg){var index=-1,length=collection?collection.length:0;callback=callback&&typeof thisArg=="undefined"?callback:baseCreateCallback(callback,thisArg,3);if(typeof length=="number"){while(++index<length){if(callback(collection[index],index,collection)===false){break}}}else{forOwn(collection,callback)}return collection}function forEachRight(collection,callback,thisArg){var length=collection?collection.length:0;callback=callback&&typeof thisArg=="undefined"?callback:baseCreateCallback(callback,thisArg,3);if(typeof length=="number"){while(length--){if(callback(collection[length],length,collection)===false){break}}}else{var props=keys(collection);length=props.length;forOwn(collection,function(value,key,collection){key=props?props[--length]:--length;return callback(collection[key],key,collection)})}return collection}var groupBy=createAggregator(function(result,value,key){(hasOwnProperty.call(result,key)?result[key]:result[key]=[]).push(value)});var indexBy=createAggregator(function(result,value,key){result[key]=value});function invoke(collection,methodName){var args=slice(arguments,2),index=-1,isFunc=typeof methodName=="function",length=collection?collection.length:0,result=Array(typeof length=="number"?length:0);forEach(collection,function(value){result[++index]=(isFunc?methodName:value[methodName]).apply(value,args)});return result}function map(collection,callback,thisArg){var index=-1,length=collection?collection.length:0;callback=lodash.createCallback(callback,thisArg,3);if(typeof length=="number"){var result=Array(length);while(++index<length){result[index]=callback(collection[index],index,collection)}}else{result=[];forOwn(collection,function(value,key,collection){result[++index]=callback(value,key,collection)})}return result}function max(collection,callback,thisArg){var computed=-Infinity,result=computed;if(typeof callback!="function"&&thisArg&&thisArg[callback]===collection){callback=null}if(callback==null&&isArray(collection)){var index=-1,length=collection.length;while(++index<length){var value=collection[index];if(value>result){result=value}}}else{callback=callback==null&&isString(collection)?charAtCallback:lodash.createCallback(callback,thisArg,3);forEach(collection,function(value,index,collection){var current=callback(value,index,collection);if(current>computed){computed=current;result=value}})}return result}function min(collection,callback,thisArg){var computed=Infinity,result=computed;if(typeof callback!="function"&&thisArg&&thisArg[callback]===collection){callback=null}if(callback==null&&isArray(collection)){var index=-1,length=collection.length;while(++index<length){var value=collection[index];if(value<result){result=value}}}else{callback=callback==null&&isString(collection)?charAtCallback:lodash.createCallback(callback,thisArg,3);forEach(collection,function(value,index,collection){var current=callback(value,index,collection);if(current<computed){computed=current;result=value}})}return result}var pluck=map;function reduce(collection,callback,accumulator,thisArg){if(!collection)return accumulator;var noaccum=arguments.length<3;callback=lodash.createCallback(callback,thisArg,4);var index=-1,length=collection.length;if(typeof length=="number"){if(noaccum){accumulator=collection[++index]}while(++index<length){accumulator=callback(accumulator,collection[index],index,collection)}}else{forOwn(collection,function(value,index,collection){accumulator=noaccum?(noaccum=false,value):callback(accumulator,value,index,collection)})}return accumulator}function reduceRight(collection,callback,accumulator,thisArg){var noaccum=arguments.length<3;callback=lodash.createCallback(callback,thisArg,4);forEachRight(collection,function(value,index,collection){accumulator=noaccum?(noaccum=false,value):callback(accumulator,value,index,collection)});return accumulator}function reject(collection,callback,thisArg){callback=lodash.createCallback(callback,thisArg,3);return filter(collection,function(value,index,collection){return!callback(value,index,collection)})}function sample(collection,n,guard){if(collection&&typeof collection.length!="number"){collection=values(collection)}if(n==null||guard){return collection?collection[baseRandom(0,collection.length-1)]:undefined}var result=shuffle(collection);result.length=nativeMin(nativeMax(0,n),result.length);return result}function shuffle(collection){var index=-1,length=collection?collection.length:0,result=Array(typeof length=="number"?length:0);forEach(collection,function(value){var rand=baseRandom(0,++index);result[index]=result[rand];result[rand]=value});return result}function size(collection){var length=collection?collection.length:0;return typeof length=="number"?length:keys(collection).length}function some(collection,callback,thisArg){var result;callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++index<length){if(result=callback(collection[index],index,collection)){break}}}else{forOwn(collection,function(value,index,collection){return!(result=callback(value,index,collection))})}return!!result}function sortBy(collection,callback,thisArg){var index=-1,isArr=isArray(callback),length=collection?collection.length:0,result=Array(typeof length=="number"?length:0);if(!isArr){callback=lodash.createCallback(callback,thisArg,3)}forEach(collection,function(value,key,collection){var object=result[++index]=getObject();if(isArr){object.criteria=map(callback,function(key){return value[key]})}else{(object.criteria=getArray())[0]=callback(value,key,collection)}object.index=index;object.value=value});length=result.length;result.sort(compareAscending);while(length--){var object=result[length];result[length]=object.value;if(!isArr){releaseArray(object.criteria)}releaseObject(object)}return result}function toArray(collection){if(collection&&typeof collection.length=="number"){return slice(collection)}return values(collection)}var where=filter;function compact(array){var index=-1,length=array?array.length:0,result=[];while(++index<length){var value=array[index];if(value){result.push(value)}}return result}function difference(array){return baseDifference(array,baseFlatten(arguments,true,true,1))}function findIndex(array,callback,thisArg){var index=-1,length=array?array.length:0;callback=lodash.createCallback(callback,thisArg,3);while(++index<length){if(callback(array[index],index,array)){return index}}return-1}function findLastIndex(array,callback,thisArg){var length=array?array.length:0;callback=lodash.createCallback(callback,thisArg,3);while(length--){if(callback(array[length],length,array)){return length}}return-1}function first(array,callback,thisArg){var n=0,length=array?array.length:0;if(typeof callback!="number"&&callback!=null){var index=-1;callback=lodash.createCallback(callback,thisArg,3);while(++index<length&&callback(array[index],index,array)){n++}}else{n=callback;if(n==null||thisArg){return array?array[0]:undefined}}return slice(array,0,nativeMin(nativeMax(0,n),length))}function flatten(array,isShallow,callback,thisArg){if(typeof isShallow!="boolean"&&isShallow!=null){thisArg=callback;callback=typeof isShallow!="function"&&thisArg&&thisArg[isShallow]===array?null:isShallow;isShallow=false}if(callback!=null){array=map(array,callback,thisArg)}return baseFlatten(array,isShallow)}function indexOf(array,value,fromIndex){if(typeof fromIndex=="number"){var length=array?array.length:0;fromIndex=fromIndex<0?nativeMax(0,length+fromIndex):fromIndex||0}else if(fromIndex){var index=sortedIndex(array,value);return array[index]===value?index:-1}return baseIndexOf(array,value,fromIndex)}function initial(array,callback,thisArg){var n=0,length=array?array.length:0;if(typeof callback!="number"&&callback!=null){var index=length;callback=lodash.createCallback(callback,thisArg,3);while(index--&&callback(array[index],index,array)){n++}}else{n=callback==null||thisArg?1:callback||n}return slice(array,0,nativeMin(nativeMax(0,length-n),length))}function intersection(){var args=[],argsIndex=-1,argsLength=arguments.length,caches=getArray(),indexOf=getIndexOf(),trustIndexOf=indexOf===baseIndexOf,seen=getArray();while(++argsIndex<argsLength){var value=arguments[argsIndex];if(isArray(value)||isArguments(value)){args.push(value);caches.push(trustIndexOf&&value.length>=largeArraySize&&createCache(argsIndex?args[argsIndex]:seen))}}var array=args[0],index=-1,length=array?array.length:0,result=[];outer:while(++index<length){var cache=caches[0];value=array[index];if((cache?cacheIndexOf(cache,value):indexOf(seen,value))<0){argsIndex=argsLength;(cache||seen).push(value);while(--argsIndex){cache=caches[argsIndex];if((cache?cacheIndexOf(cache,value):indexOf(args[argsIndex],value))<0){continue outer}}result.push(value)}}while(argsLength--){cache=caches[argsLength];if(cache){releaseObject(cache)}}releaseArray(caches);releaseArray(seen);return result}function last(array,callback,thisArg){var n=0,length=array?array.length:0;if(typeof callback!="number"&&callback!=null){var index=length;callback=lodash.createCallback(callback,thisArg,3);while(index--&&callback(array[index],index,array)){n++}}else{n=callback;if(n==null||thisArg){return array?array[length-1]:undefined}}return slice(array,nativeMax(0,length-n))}function lastIndexOf(array,value,fromIndex){var index=array?array.length:0;if(typeof fromIndex=="number"){index=(fromIndex<0?nativeMax(0,index+fromIndex):nativeMin(fromIndex,index-1))+1}while(index--){if(array[index]===value){return index}}return-1}function pull(array){var args=arguments,argsIndex=0,argsLength=args.length,length=array?array.length:0;while(++argsIndex<argsLength){var index=-1,value=args[argsIndex];while(++index<length){if(array[index]===value){splice.call(array,index--,1);length--}}}return array}function range(start,end,step){start=+start||0;step=typeof step=="number"?step:+step||1;if(end==null){end=start;start=0}var index=-1,length=nativeMax(0,ceil((end-start)/(step||1))),result=Array(length);while(++index<length){result[index]=start;start+=step}return result}function remove(array,callback,thisArg){var index=-1,length=array?array.length:0,result=[];callback=lodash.createCallback(callback,thisArg,3);while(++index<length){var value=array[index];if(callback(value,index,array)){result.push(value);splice.call(array,index--,1);length--}}return result}function rest(array,callback,thisArg){if(typeof callback!="number"&&callback!=null){var n=0,index=-1,length=array?array.length:0;callback=lodash.createCallback(callback,thisArg,3);while(++index<length&&callback(array[index],index,array)){n++}}else{n=callback==null||thisArg?1:nativeMax(0,callback)}return slice(array,n)}function sortedIndex(array,value,callback,thisArg){var low=0,high=array?array.length:low;callback=callback?lodash.createCallback(callback,thisArg,1):identity;value=callback(value);while(low<high){var mid=low+high>>>1;callback(array[mid])<value?low=mid+1:high=mid}return low}function union(){return baseUniq(baseFlatten(arguments,true,true))}function uniq(array,isSorted,callback,thisArg){if(typeof isSorted!="boolean"&&isSorted!=null){thisArg=callback;callback=typeof isSorted!="function"&&thisArg&&thisArg[isSorted]===array?null:isSorted;isSorted=false}if(callback!=null){callback=lodash.createCallback(callback,thisArg,3)}return baseUniq(array,isSorted,callback)}function without(array){return baseDifference(array,slice(arguments,1))}function xor(){var index=-1,length=arguments.length;while(++index<length){var array=arguments[index];if(isArray(array)||isArguments(array)){var result=result?baseUniq(baseDifference(result,array).concat(baseDifference(array,result))):array}}return result||[]}function zip(){var array=arguments.length>1?arguments:arguments[0],index=-1,length=array?max(pluck(array,"length")):0,result=Array(length<0?0:length);while(++index<length){result[index]=pluck(array,index)}return result}function zipObject(keys,values){var index=-1,length=keys?keys.length:0,result={};if(!values&&length&&!isArray(keys[0])){values=[]}while(++index<length){var key=keys[index];if(values){result[key]=values[index]}else if(key){result[key[0]]=key[1]}}return result}function after(n,func){if(!isFunction(func)){throw new TypeError}return function(){if(--n<1){return func.apply(this,arguments)}}}function bind(func,thisArg){return arguments.length>2?createWrapper(func,17,slice(arguments,2),null,thisArg):createWrapper(func,1,null,null,thisArg)}function bindAll(object){var funcs=arguments.length>1?baseFlatten(arguments,true,false,1):functions(object),index=-1,length=funcs.length;while(++index<length){var key=funcs[index];object[key]=createWrapper(object[key],1,null,null,object)}return object}function bindKey(object,key){return arguments.length>2?createWrapper(key,19,slice(arguments,2),null,object):createWrapper(key,3,null,null,object)}function compose(){var funcs=arguments,length=funcs.length;while(length--){if(!isFunction(funcs[length])){throw new TypeError}}return function(){var args=arguments,length=funcs.length;while(length--){args=[funcs[length].apply(this,args)]}return args[0]}}function curry(func,arity){arity=typeof arity=="number"?arity:+arity||func.length;return createWrapper(func,4,null,null,null,arity)}function debounce(func,wait,options){var args,maxTimeoutId,result,stamp,thisArg,timeoutId,trailingCall,lastCalled=0,maxWait=false,trailing=true;if(!isFunction(func)){throw new TypeError}wait=nativeMax(0,wait)||0;if(options===true){var leading=true;trailing=false}else if(isObject(options)){leading=options.leading;maxWait="maxWait"in options&&(nativeMax(wait,options.maxWait)||0);trailing="trailing"in options?options.trailing:trailing}var delayed=function(){var remaining=wait-(now()-stamp);if(remaining<=0){if(maxTimeoutId){clearTimeout(maxTimeoutId)}var isCalled=trailingCall;maxTimeoutId=timeoutId=trailingCall=undefined;if(isCalled){lastCalled=now();result=func.apply(thisArg,args);if(!timeoutId&&!maxTimeoutId){args=thisArg=null}}}else{timeoutId=setTimeout(delayed,remaining)}};var maxDelayed=function(){if(timeoutId){clearTimeout(timeoutId)}maxTimeoutId=timeoutId=trailingCall=undefined;if(trailing||maxWait!==wait){lastCalled=now();result=func.apply(thisArg,args);if(!timeoutId&&!maxTimeoutId){args=thisArg=null}}};return function(){args=arguments;stamp=now();thisArg=this;trailingCall=trailing&&(timeoutId||!leading);if(maxWait===false){var leadingCall=leading&&!timeoutId}else{if(!maxTimeoutId&&!leading){lastCalled=stamp}var remaining=maxWait-(stamp-lastCalled),isCalled=remaining<=0;if(isCalled){if(maxTimeoutId){maxTimeoutId=clearTimeout(maxTimeoutId)}lastCalled=stamp;result=func.apply(thisArg,args)}else if(!maxTimeoutId){maxTimeoutId=setTimeout(maxDelayed,remaining)}}if(isCalled&&timeoutId){timeoutId=clearTimeout(timeoutId)}else if(!timeoutId&&wait!==maxWait){timeoutId=setTimeout(delayed,wait)}if(leadingCall){isCalled=true;result=func.apply(thisArg,args)}if(isCalled&&!timeoutId&&!maxTimeoutId){args=thisArg=null}return result}}function defer(func){if(!isFunction(func)){throw new TypeError}var args=slice(arguments,1);return setTimeout(function(){func.apply(undefined,args)},1)}function delay(func,wait){if(!isFunction(func)){throw new TypeError}var args=slice(arguments,2);return setTimeout(function(){func.apply(undefined,args)},wait)}function memoize(func,resolver){if(!isFunction(func)){throw new TypeError}var memoized=function(){var cache=memoized.cache,key=resolver?resolver.apply(this,arguments):keyPrefix+arguments[0];return hasOwnProperty.call(cache,key)?cache[key]:cache[key]=func.apply(this,arguments)};memoized.cache={};return memoized}function once(func){var ran,result;if(!isFunction(func)){throw new TypeError}return function(){if(ran){return result}ran=true;result=func.apply(this,arguments);func=null;return result}}function partial(func){return createWrapper(func,16,slice(arguments,1))}function partialRight(func){return createWrapper(func,32,null,slice(arguments,1))}function throttle(func,wait,options){var leading=true,trailing=true;if(!isFunction(func)){throw new TypeError}if(options===false){leading=false}else if(isObject(options)){leading="leading"in options?options.leading:leading;trailing="trailing"in options?options.trailing:trailing}debounceOptions.leading=leading;debounceOptions.maxWait=wait;debounceOptions.trailing=trailing;return debounce(func,wait,debounceOptions)}function wrap(value,wrapper){return createWrapper(wrapper,16,[value])}function constant(value){return function(){return value}}function createCallback(func,thisArg,argCount){var type=typeof func;if(func==null||type=="function"){return baseCreateCallback(func,thisArg,argCount)}if(type!="object"){return property(func)}var props=keys(func),key=props[0],a=func[key];if(props.length==1&&a===a&&!isObject(a)){return function(object){var b=object[key];return a===b&&(a!==0||1/a==1/b)}}return function(object){var length=props.length,result=false; | |
while(length--){if(!(result=baseIsEqual(object[props[length]],func[props[length]],null,true))){break}}return result}}function escape(string){return string==null?"":String(string).replace(reUnescapedHtml,escapeHtmlChar)}function identity(value){return value}function mixin(object,source,options){var chain=true,methodNames=source&&functions(source);if(!source||!options&&!methodNames.length){if(options==null){options=source}ctor=lodashWrapper;source=object;object=lodash;methodNames=functions(source)}if(options===false){chain=false}else if(isObject(options)&&"chain"in options){chain=options.chain}var ctor=object,isFunc=isFunction(ctor);forEach(methodNames,function(methodName){var func=object[methodName]=source[methodName];if(isFunc){ctor.prototype[methodName]=function(){var chainAll=this.__chain__,value=this.__wrapped__,args=[value];push.apply(args,arguments);var result=func.apply(object,args);if(chain||chainAll){if(value===result&&isObject(result)){return this}result=new ctor(result);result.__chain__=chainAll}return result}}})}function noConflict(){context._=oldDash;return this}function noop(){}var now=isNative(now=Date.now)&&now||function(){return(new Date).getTime()};var parseInt=nativeParseInt(whitespace+"08")==8?nativeParseInt:function(value,radix){return nativeParseInt(isString(value)?value.replace(reLeadingSpacesAndZeros,""):value,radix||0)};function property(key){return function(object){return object[key]}}function random(min,max,floating){var noMin=min==null,noMax=max==null;if(floating==null){if(typeof min=="boolean"&&noMax){floating=min;min=1}else if(!noMax&&typeof max=="boolean"){floating=max;noMax=true}}if(noMin&&noMax){max=1}min=+min||0;if(noMax){max=min;min=0}else{max=+max||0}if(floating||min%1||max%1){var rand=nativeRandom();return nativeMin(min+rand*(max-min+parseFloat("1e-"+((rand+"").length-1))),max)}return baseRandom(min,max)}function result(object,key){if(object){var value=object[key];return isFunction(value)?object[key]():value}}function template(text,data,options){var settings=lodash.templateSettings;text=String(text||"");options=defaults({},options,settings);var imports=defaults({},options.imports,settings.imports),importsKeys=keys(imports),importsValues=values(imports);var isEvaluating,index=0,interpolate=options.interpolate||reNoMatch,source="__p += '";var reDelimiters=RegExp((options.escape||reNoMatch).source+"|"+interpolate.source+"|"+(interpolate===reInterpolate?reEsTemplate:reNoMatch).source+"|"+(options.evaluate||reNoMatch).source+"|$","g");text.replace(reDelimiters,function(match,escapeValue,interpolateValue,esTemplateValue,evaluateValue,offset){interpolateValue||(interpolateValue=esTemplateValue);source+=text.slice(index,offset).replace(reUnescapedString,escapeStringChar);if(escapeValue){source+="' +\n__e("+escapeValue+") +\n'"}if(evaluateValue){isEvaluating=true;source+="';\n"+evaluateValue+";\n__p += '"}if(interpolateValue){source+="' +\n((__t = ("+interpolateValue+")) == null ? '' : __t) +\n'"}index=offset+match.length;return match});source+="';\n";var variable=options.variable,hasVariable=variable;if(!hasVariable){variable="obj";source="with ("+variable+") {\n"+source+"\n}\n"}source=(isEvaluating?source.replace(reEmptyStringLeading,""):source).replace(reEmptyStringMiddle,"$1").replace(reEmptyStringTrailing,"$1;");source="function("+variable+") {\n"+(hasVariable?"":variable+" || ("+variable+" = {});\n")+"var __t, __p = '', __e = _.escape"+(isEvaluating?", __j = Array.prototype.join;\n"+"function print() { __p += __j.call(arguments, '') }\n":";\n")+source+"return __p\n}";var sourceURL="\n/*\n//# sourceURL="+(options.sourceURL||"/lodash/template/source["+templateCounter++ +"]")+"\n*/";try{var result=Function(importsKeys,"return "+source+sourceURL).apply(undefined,importsValues)}catch(e){e.source=source;throw e}if(data){return result(data)}result.source=source;return result}function times(n,callback,thisArg){n=(n=+n)>-1?n:0;var index=-1,result=Array(n);callback=baseCreateCallback(callback,thisArg,1);while(++index<n){result[index]=callback(index)}return result}function unescape(string){return string==null?"":String(string).replace(reEscapedHtml,unescapeHtmlChar)}function uniqueId(prefix){var id=++idCounter;return String(prefix==null?"":prefix)+id}function chain(value){value=new lodashWrapper(value);value.__chain__=true;return value}function tap(value,interceptor){interceptor(value);return value}function wrapperChain(){this.__chain__=true;return this}function wrapperToString(){return String(this.__wrapped__)}function wrapperValueOf(){return this.__wrapped__}lodash.after=after;lodash.assign=assign;lodash.at=at;lodash.bind=bind;lodash.bindAll=bindAll;lodash.bindKey=bindKey;lodash.chain=chain;lodash.compact=compact;lodash.compose=compose;lodash.constant=constant;lodash.countBy=countBy;lodash.create=create;lodash.createCallback=createCallback;lodash.curry=curry;lodash.debounce=debounce;lodash.defaults=defaults;lodash.defer=defer;lodash.delay=delay;lodash.difference=difference;lodash.filter=filter;lodash.flatten=flatten;lodash.forEach=forEach;lodash.forEachRight=forEachRight;lodash.forIn=forIn;lodash.forInRight=forInRight;lodash.forOwn=forOwn;lodash.forOwnRight=forOwnRight;lodash.functions=functions;lodash.groupBy=groupBy;lodash.indexBy=indexBy;lodash.initial=initial;lodash.intersection=intersection;lodash.invert=invert;lodash.invoke=invoke;lodash.keys=keys;lodash.map=map;lodash.mapValues=mapValues;lodash.max=max;lodash.memoize=memoize;lodash.merge=merge;lodash.min=min;lodash.omit=omit;lodash.once=once;lodash.pairs=pairs;lodash.partial=partial;lodash.partialRight=partialRight;lodash.pick=pick;lodash.pluck=pluck;lodash.property=property;lodash.pull=pull;lodash.range=range;lodash.reject=reject;lodash.remove=remove;lodash.rest=rest;lodash.shuffle=shuffle;lodash.sortBy=sortBy;lodash.tap=tap;lodash.throttle=throttle;lodash.times=times;lodash.toArray=toArray;lodash.transform=transform;lodash.union=union;lodash.uniq=uniq;lodash.values=values;lodash.where=where;lodash.without=without;lodash.wrap=wrap;lodash.xor=xor;lodash.zip=zip;lodash.zipObject=zipObject;lodash.collect=map;lodash.drop=rest;lodash.each=forEach;lodash.eachRight=forEachRight;lodash.extend=assign;lodash.methods=functions;lodash.object=zipObject;lodash.select=filter;lodash.tail=rest;lodash.unique=uniq;lodash.unzip=zip;mixin(lodash);lodash.clone=clone;lodash.cloneDeep=cloneDeep;lodash.contains=contains;lodash.escape=escape;lodash.every=every;lodash.find=find;lodash.findIndex=findIndex;lodash.findKey=findKey;lodash.findLast=findLast;lodash.findLastIndex=findLastIndex;lodash.findLastKey=findLastKey;lodash.has=has;lodash.identity=identity;lodash.indexOf=indexOf;lodash.isArguments=isArguments;lodash.isArray=isArray;lodash.isBoolean=isBoolean;lodash.isDate=isDate;lodash.isElement=isElement;lodash.isEmpty=isEmpty;lodash.isEqual=isEqual;lodash.isFinite=isFinite;lodash.isFunction=isFunction;lodash.isNaN=isNaN;lodash.isNull=isNull;lodash.isNumber=isNumber;lodash.isObject=isObject;lodash.isPlainObject=isPlainObject;lodash.isRegExp=isRegExp;lodash.isString=isString;lodash.isUndefined=isUndefined;lodash.lastIndexOf=lastIndexOf;lodash.mixin=mixin;lodash.noConflict=noConflict;lodash.noop=noop;lodash.now=now;lodash.parseInt=parseInt;lodash.random=random;lodash.reduce=reduce;lodash.reduceRight=reduceRight;lodash.result=result;lodash.runInContext=runInContext;lodash.size=size;lodash.some=some;lodash.sortedIndex=sortedIndex;lodash.template=template;lodash.unescape=unescape;lodash.uniqueId=uniqueId;lodash.all=every;lodash.any=some;lodash.detect=find;lodash.findWhere=find;lodash.foldl=reduce;lodash.foldr=reduceRight;lodash.include=contains;lodash.inject=reduce;mixin(function(){var source={};forOwn(lodash,function(func,methodName){if(!lodash.prototype[methodName]){source[methodName]=func}});return source}(),false);lodash.first=first;lodash.last=last;lodash.sample=sample;lodash.take=first;lodash.head=first;forOwn(lodash,function(func,methodName){var callbackable=methodName!=="sample";if(!lodash.prototype[methodName]){lodash.prototype[methodName]=function(n,guard){var chainAll=this.__chain__,result=func(this.__wrapped__,n,guard);return!chainAll&&(n==null||guard&&!(callbackable&&typeof n=="function"))?result:new lodashWrapper(result,chainAll)}}});lodash.VERSION="2.4.2";lodash.prototype.chain=wrapperChain;lodash.prototype.toString=wrapperToString;lodash.prototype.value=wrapperValueOf;lodash.prototype.valueOf=wrapperValueOf;forEach(["join","pop","shift"],function(methodName){var func=arrayRef[methodName];lodash.prototype[methodName]=function(){var chainAll=this.__chain__,result=func.apply(this.__wrapped__,arguments);return chainAll?new lodashWrapper(result,chainAll):result}});forEach(["push","reverse","sort","unshift"],function(methodName){var func=arrayRef[methodName];lodash.prototype[methodName]=function(){func.apply(this.__wrapped__,arguments);return this}});forEach(["concat","slice","splice"],function(methodName){var func=arrayRef[methodName];lodash.prototype[methodName]=function(){return new lodashWrapper(func.apply(this.__wrapped__,arguments),this.__chain__)}});return lodash}var _=runInContext();if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){root._=_;define(function(){return _})}else if(freeExports&&freeModule){if(moduleExports){(freeModule.exports=_)._=_}else{freeExports._=_}}else{root._=_}}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],56:[function(require,module,exports){(function(){if(typeof module==="object"&&module.exports){module.exports=LRUCache}else{this.LRUCache=LRUCache}function hOP(obj,key){return Object.prototype.hasOwnProperty.call(obj,key)}function naiveLength(){return 1}function LRUCache(options){if(!(this instanceof LRUCache))return new LRUCache(options);if(typeof options==="number")options={max:options};if(!options)options={};this._max=options.max;if(!this._max||!(typeof this._max==="number")||this._max<=0)this._max=Infinity;this._lengthCalculator=options.length||naiveLength;if(typeof this._lengthCalculator!=="function")this._lengthCalculator=naiveLength;this._allowStale=options.stale||false;this._maxAge=options.maxAge||null;this._dispose=options.dispose;this.reset()}Object.defineProperty(LRUCache.prototype,"max",{set:function(mL){if(!mL||!(typeof mL==="number")||mL<=0)mL=Infinity;this._max=mL;if(this._length>this._max)trim(this)},get:function(){return this._max},enumerable:true});Object.defineProperty(LRUCache.prototype,"lengthCalculator",{set:function(lC){if(typeof lC!=="function"){this._lengthCalculator=naiveLength;this._length=this._itemCount;for(var key in this._cache){this._cache[key].length=1}}else{this._lengthCalculator=lC;this._length=0;for(var key in this._cache){this._cache[key].length=this._lengthCalculator(this._cache[key].value);this._length+=this._cache[key].length}}if(this._length>this._max)trim(this)},get:function(){return this._lengthCalculator},enumerable:true});Object.defineProperty(LRUCache.prototype,"length",{get:function(){return this._length},enumerable:true});Object.defineProperty(LRUCache.prototype,"itemCount",{get:function(){return this._itemCount},enumerable:true});LRUCache.prototype.forEach=function(fn,thisp){thisp=thisp||this;var i=0;for(var k=this._mru-1;k>=0&&i<this._itemCount;k--)if(this._lruList[k]){i++;var hit=this._lruList[k];if(this._maxAge&&Date.now()-hit.now>this._maxAge){del(this,hit);if(!this._allowStale)hit=undefined}if(hit){fn.call(thisp,hit.value,hit.key,this)}}};LRUCache.prototype.keys=function(){var keys=new Array(this._itemCount);var i=0;for(var k=this._mru-1;k>=0&&i<this._itemCount;k--)if(this._lruList[k]){var hit=this._lruList[k];keys[i++]=hit.key}return keys};LRUCache.prototype.values=function(){var values=new Array(this._itemCount);var i=0;for(var k=this._mru-1;k>=0&&i<this._itemCount;k--)if(this._lruList[k]){var hit=this._lruList[k];values[i++]=hit.value}return values};LRUCache.prototype.reset=function(){if(this._dispose&&this._cache){for(var k in this._cache){this._dispose(k,this._cache[k].value)}}this._cache=Object.create(null);this._lruList=Object.create(null);this._mru=0;this._lru=0;this._length=0;this._itemCount=0};LRUCache.prototype.dump=function(){return this._cache};LRUCache.prototype.dumpLru=function(){return this._lruList};LRUCache.prototype.set=function(key,value){if(hOP(this._cache,key)){if(this._dispose)this._dispose(key,this._cache[key].value);if(this._maxAge)this._cache[key].now=Date.now();this._cache[key].value=value;this.get(key);return true}var len=this._lengthCalculator(value);var age=this._maxAge?Date.now():0;var hit=new Entry(key,value,this._mru++,len,age);if(hit.length>this._max){if(this._dispose)this._dispose(key,value);return false}this._length+=hit.length;this._lruList[hit.lu]=this._cache[key]=hit;this._itemCount++;if(this._length>this._max)trim(this);return true};LRUCache.prototype.has=function(key){if(!hOP(this._cache,key))return false;var hit=this._cache[key];if(this._maxAge&&Date.now()-hit.now>this._maxAge){return false}return true};LRUCache.prototype.get=function(key){return get(this,key,true)};LRUCache.prototype.peek=function(key){return get(this,key,false)};LRUCache.prototype.pop=function(){var hit=this._lruList[this._lru];del(this,hit);return hit||null};LRUCache.prototype.del=function(key){del(this,this._cache[key])};function get(self,key,doUse){var hit=self._cache[key];if(hit){if(self._maxAge&&Date.now()-hit.now>self._maxAge){del(self,hit);if(!self._allowStale)hit=undefined}else{if(doUse)use(self,hit)}if(hit)hit=hit.value}return hit}function use(self,hit){shiftLU(self,hit);hit.lu=self._mru++;if(self._maxAge)hit.now=Date.now();self._lruList[hit.lu]=hit}function trim(self){while(self._lru<self._mru&&self._length>self._max)del(self,self._lruList[self._lru])}function shiftLU(self,hit){delete self._lruList[hit.lu];while(self._lru<self._mru&&!self._lruList[self._lru])self._lru++}function del(self,hit){if(hit){if(self._dispose)self._dispose(hit.key,hit.value);self._length-=hit.length;self._itemCount--;delete self._cache[hit.key];shiftLU(self,hit)}}function Entry(key,value,lu,length,now){this.key=key;this.value=value;this.lu=lu;this.length=length;this.now=now}})()},{}],57:[function(require,module,exports){var globalRequire=require;require=function(){};var exports=module.exports={Lexer:require("./lib/N3Lexer"),Parser:require("./lib/N3Parser"),Writer:require("./lib/N3Writer"),Store:require("./lib/N3Store"),StreamParser:require("./lib/N3StreamParser"),StreamWriter:require("./lib/N3StreamWriter"),Util:require("./lib/N3Util")};Object.keys(exports).forEach(function(submodule){Object.defineProperty(exports,submodule,{configurable:true,enumerable:true,get:function(){delete exports[submodule];return exports[submodule]=globalRequire("./lib/N3"+submodule)}})})},{"./lib/N3Lexer":58,"./lib/N3Parser":59,"./lib/N3Store":60,"./lib/N3StreamParser":61,"./lib/N3StreamWriter":62,"./lib/N3Util":63,"./lib/N3Writer":64}],58:[function(require,module,exports){var fromCharCode=String.fromCharCode;var immediately=typeof setImmediate==="function"?setImmediate:function setImmediate(func){setTimeout(func,0)};var escapeSequence=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\[uU]|\\(.)/g;var escapeReplacements={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"};var illegalIriChars=/[\x00-\x20<>\\"\{\}\|\^\`]/;function N3Lexer(options){if(!(this instanceof N3Lexer))return new N3Lexer(options);if(options&&options.lineMode){this._tripleQuotedString=this._number=this._boolean=/$0^/;var self=this;this._tokenize=this.tokenize;this.tokenize=function(input,callback){this._tokenize(input,function(error,token){if(!error&&/IRI|prefixed|literal|langcode|type|\.|eof/.test(token.type))callback&&callback(error,token);else callback&&callback(error||self._syntaxError(token.type,callback=null))})}}}N3Lexer.prototype={_iri:/^<((?:[^>\\]|\\[uU])+)>/,_unescapedIri:/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>/,_unescapedString:/^"[^"\\]+"(?=[^"\\])/,_singleQuotedString:/^"[^"\\]*(?:\\.[^"\\]*)*"(?=[^"\\])|^'[^'\\]*(?:\\.[^'\\]*)*'(?=[^'\\])/,_tripleQuotedString:/^""("[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*")""|^''('[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*')''/,_langcode:/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,_prefix:/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,_prefixed:/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?=\.?[,;\s#()\[\]\{\}"'<])/,_blank:/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=\.?[,;:\s#()\[\]\{\}"'<])/,_number:/^[\-+]?(?:\d+\.?\d*([eE](?:[\-\+])?\d+)|\d*\.?\d+)(?=[.,;:\s#()\[\]\{\}"'<])/,_boolean:/^(?:true|false)(?=[.,;:\s#()\[\]\{\}"'<])/,_keyword:/^@[a-z]+(?=[\s#<:])/,_sparqlKeyword:/^(?:PREFIX|BASE|GRAPH)(?=[\s#<:])/i,_shortPredicates:/^a(?=\s+|<)/,_newline:/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,_whitespace:/^[ \t]+/,_endOfFile:/^(?:#[^\n\r]*)?$/,_tokenizeToEnd:function(callback,inputFinished){var input=this._input;while(true){var whiteSpaceMatch;while(whiteSpaceMatch=this._newline.exec(input))input=input.substr(whiteSpaceMatch[0].length,input.length),this._line++;if(whiteSpaceMatch=this._whitespace.exec(input))input=input.substr(whiteSpaceMatch[0].length,input.length);if(this._endOfFile.test(input)){if(inputFinished)callback(input=null,{line:this._line,type:"eof",value:"",prefix:""});return this._input=input}var line=this._line,type="",value="",prefix="",firstChar=input[0],match=null,matchLength=0,unescaped,inconclusive=false;switch(firstChar){case"^":if(input.length===1)break;else if(input[1]!=="^")return reportSyntaxError(this);this._prevTokenType="^";input=input.substr(2);if(input[0]!=="<"){inconclusive=true;break}case"<":if(match=this._unescapedIri.exec(input)){type="IRI";value=match[1]}else if(match=this._iri.exec(input)){unescaped=this._unescape(match[1]);if(unescaped===null||illegalIriChars.test(unescaped))return reportSyntaxError(this);type="IRI";value=unescaped}break;case"_":if((match=this._blank.exec(input))||inputFinished&&(match=this._blank.exec(input+" "))){type="prefixed";prefix="_";value=match[1]}break;case'"':case"'":if(match=this._unescapedString.exec(input)){type="literal";value=match[0]}else if(match=this._singleQuotedString.exec(input)){unescaped=this._unescape(match[0]);if(unescaped===null)return reportSyntaxError(this);type="literal";value=unescaped.replace(/^'|'$/g,'"')}else if(match=this._tripleQuotedString.exec(input)){unescaped=match[1]||match[2];this._line+=unescaped.split(/\r\n|\r|\n/).length-1;unescaped=this._unescape(unescaped);if(unescaped===null)return reportSyntaxError(this);type="literal";value=unescaped.replace(/^'|'$/g,'"')}break;case"@":if(this._prevTokenType==="literal"&&(match=this._langcode.exec(input))){type="langcode";value=match[1]}else if(match=this._keyword.exec(input)){type=match[0]}break;case".":if(input.length===1?inputFinished:input[1]<"0"||input[1]>"9"){type=".";matchLength=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":if(match=this._number.exec(input)){type="literal";value='"'+match[0]+'"^^http://www.w3.org/2001/XMLSchema#'+(match[1]?"double":/^[+\-]?\d+$/.test(match[0])?"integer":"decimal")}break;case"B":case"b":case"p":case"P":case"G":case"g":if(match=this._sparqlKeyword.exec(input))type=match[0].toUpperCase();else inconclusive=true;break;case"f":case"t":if(match=this._boolean.exec(input)){type="literal";value='"'+match[0]+'"^^http://www.w3.org/2001/XMLSchema#boolean'}else inconclusive=true;break;case"a":if(match=this._shortPredicates.exec(input)){type="abbreviation";value="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"}else inconclusive=true;break;case",":case";":case"[":case"]":case"(":case")":case"{":case"}":matchLength=1;type=firstChar;break;default:inconclusive=true}if(inconclusive){if((this._prevTokenType==="@prefix"||this._prevTokenType==="PREFIX")&&(match=this._prefix.exec(input))){type="prefix";value=match[1]||""}else if((match=this._prefixed.exec(input))||inputFinished&&(match=this._prefixed.exec(input+" "))){type="prefixed";prefix=match[1]||"";value=this._unescape(match[2])}}if(this._prevTokenType==="^")type=type==="IRI"||type==="prefixed"?"type":"";if(!type){if(inputFinished||!/^'''|^"""/.test(input)&&/\n|\r/.test(input))return reportSyntaxError(this);else return this._input=input}callback(null,{line:line,type:type,value:value,prefix:prefix});this._prevTokenType=type;input=input.substr(matchLength||match[0].length,input.length)}function reportSyntaxError(self){callback(self._syntaxError(/^\S*/.exec(input)[0]))}},_unescape:function(item){try{return item.replace(escapeSequence,function(sequence,unicode4,unicode8,escapedChar){var charCode;if(unicode4){charCode=parseInt(unicode4,16);if(isNaN(charCode))throw new Error;return fromCharCode(charCode)}else if(unicode8){charCode=parseInt(unicode8,16);if(isNaN(charCode))throw new Error;if(charCode<=65535)return fromCharCode(charCode);return fromCharCode(55296+(charCode-=65536)/1024,56320+(charCode&1023))}else{var replacement=escapeReplacements[escapedChar];if(!replacement)throw new Error;return replacement}})}catch(error){return null}},_syntaxError:function(issue){this._input=null;return new Error('Syntax error: unexpected "'+issue+'" on line '+this._line+".")},tokenize:function(input,callback){var self=this;this._line=1;if(typeof input==="string"){this._input=input;immediately(function(){self._tokenizeToEnd(callback,true)})}else{this._input="";if(!input||typeof input==="function"){this.addChunk=addChunk;this.end=end;if(!callback)callback=input}else{if(typeof input.setEncoding==="function")input.setEncoding("utf8");input.on("data",addChunk);input.on("end",end)}}function addChunk(data){if(self._input!==null){self._input+=data;self._tokenizeToEnd(callback,false)}}function end(){if(self._input!==null){self._tokenizeToEnd(callback,true)}}}};module.exports=N3Lexer},{}],59:[function(require,module,exports){var N3Lexer=require("./N3Lexer");var RDF_PREFIX="http://www.w3.org/1999/02/22-rdf-syntax-ns#",RDF_NIL=RDF_PREFIX+"nil",RDF_FIRST=RDF_PREFIX+"first",RDF_REST=RDF_PREFIX+"rest";var absoluteIRI=/:/,documentPart=/[^\/]*$/,rootIRI=/^(?:[^:]+:\/*)?[^\/]*/;var blankNodePrefix=0,blankNodeCount=0;function N3Parser(options){if(!(this instanceof N3Parser))return new N3Parser(options);this._tripleStack=[];this._graph=null;options=options||{};if(!options.documentIRI){this._baseIRI=null;this._baseIRIPath=null}else{if(options.documentIRI.indexOf("#")>0)throw new Error("Invalid document IRI");this._baseIRI=options.documentIRI;this._baseIRIPath=this._baseIRI.replace(documentPart,"");this._baseIRIRoot=this._baseIRI.match(rootIRI)[0]}var format=typeof options.format==="string"&&options.format.match(/\w*$/)[0].toLowerCase(),isTurtle=format==="turtle",isTriG=format==="trig",isNTriples=/triple/.test(format),isNQuads=/quad/.test(format),isLineMode=isNTriples||isNQuads;if(!(this._supportsNamedGraphs=!isTurtle))this._readPredicateOrNamedGraph=this._readPredicate;this._supportsQuads=!(isTurtle||isTriG||isNTriples);if(isLineMode){this._baseIRI="";this._resolveIRI=function(token){this._error("Disallowed relative IRI",token);return this._callback=noop,this._subject=null}}this._blankNodePrefix=typeof options.blankNodePrefix!=="string"?"":"_:"+options.blankNodePrefix.replace(/^_:/,"");this._lexer=options.lexer||new N3Lexer({lineMode:isLineMode})}N3Parser._resetBlankNodeIds=function(){blankNodePrefix=blankNodeCount=0};N3Parser.prototype={_readInTopContext:function(token){switch(token.type){case"eof":if(this._graph!==null)return this._error("Unclosed graph",token);delete this._prefixes._;return this._callback(null,null,this._prefixes);case"@prefix":this._sparqlStyle=false;return this._readPrefix;case"PREFIX":this._sparqlStyle=true;return this._readPrefix;case"@base":this._sparqlStyle=false;return this._readBaseIRI;case"BASE":this._sparqlStyle=true;return this._readBaseIRI;case"{":if(this._supportsNamedGraphs){this._graph="";this._subject=null;return this._readSubject}case"GRAPH":if(this._supportsNamedGraphs){return this._readNamedGraphLabel}default:return this._readSubject(token)}},_readSubject:function(token){this._predicate=null;switch(token.type){case"IRI":if(this._baseIRI===null||absoluteIRI.test(token.value))this._subject=token.value;else this._subject=this._resolveIRI(token);break;case"prefixed":var prefix=this._prefixes[token.prefix];if(prefix===undefined)return this._error('Undefined prefix "'+token.prefix+':"',token);this._subject=prefix+token.value;break;case"[":this._subject="_:b"+blankNodeCount++;this._tripleStack.push({subject:this._subject,predicate:null,object:null,type:"blank"});return this._readBlankNodeHead;case"(":this._tripleStack.push({subject:RDF_NIL,predicate:null,object:null,type:"list"});this._subject=null;return this._readListItem;case"}":return this._readPunctuation(token);default:return this._error("Expected subject but got "+token.type,token)}return this._readPredicateOrNamedGraph},_readPredicate:function(token){var type=token.type;switch(type){case"IRI":case"abbreviation":if(this._baseIRI===null||absoluteIRI.test(token.value))this._predicate=token.value;else this._predicate=this._resolveIRI(token);break;case"prefixed":if(token.prefix==="_"){return this._error("Disallowed blank node as predicate",token)}else{var prefix=this._prefixes[token.prefix];if(prefix===undefined)return this._error('Undefined prefix "'+token.prefix+':"',token);this._predicate=prefix+token.value}break;case".":case"]":case"}":if(this._predicate===null)return this._error("Unexpected "+type,token);this._subject=null;return type==="]"?this._readBlankNodeTail(token):this._readPunctuation(token);case";":return this._readPredicate;default:return this._error('Expected predicate to follow "'+this._subject+'"',token)}return this._readObject},_readObject:function(token){switch(token.type){case"IRI":if(this._baseIRI===null||absoluteIRI.test(token.value))this._object=token.value;else this._object=this._resolveIRI(token);break;case"prefixed":var prefix=this._prefixes[token.prefix];if(prefix===undefined)return this._error('Undefined prefix "'+token.prefix+':"',token);this._object=prefix+token.value;break;case"literal":this._object=token.value;return this._readDataTypeOrLang;case"[":var blank="_:b"+blankNodeCount++;this._tripleStack.push({subject:this._subject,predicate:this._predicate,object:blank,type:"blank"});this._subject=blank;return this._readBlankNodeHead;case"(":this._tripleStack.push({subject:this._subject,predicate:this._predicate,object:RDF_NIL,type:"list"});this._subject=null;return this._readListItem;default:return this._error('Expected object to follow "'+this._predicate+'"',token)}return this._getTripleEndReader()},_readPredicateOrNamedGraph:function(token){return token.type==="{"?this._readGraph(token):this._readPredicate(token)},_readGraph:function(token){if(token.type!=="{")return this._error("Expected graph but got "+token.type,token);this._graph=this._subject,this._subject=null;return this._readSubject},_readBlankNodeHead:function(token){if(token.type==="]"){this._subject=null;return this._readBlankNodeTail(token)}this._predicate=null;return this._readPredicate(token)},_readBlankNodeTail:function(token){if(token.type!=="]")return this._readBlankNodePunctuation(token);if(this._subject!==null)this._callback(null,{subject:this._subject,predicate:this._predicate,object:this._object,graph:this._graph||""});var triple=this._tripleStack.pop();this._subject=triple.subject;if(triple.object!==null){this._predicate=triple.predicate;this._object=triple.object;return this._getTripleEndReader()}return this._predicate!==null?this._readPredicate:this._readPredicateOrNamedGraph},_readDataTypeOrLang:function(token){switch(token.type){case"type":var value;if(token.prefix===""){if(this._baseIRI===null||absoluteIRI.test(token.value))value=token.value;else value=this._resolveIRI(token)}else{var prefix=this._prefixes[token.prefix];if(prefix===undefined)return this._error('Undefined prefix "'+token.prefix+':"',token);value=prefix+token.value}this._object+="^^"+value;return this._getTripleEndReader();case"langcode":this._object+="@"+token.value.toLowerCase();return this._getTripleEndReader();default:return this._getTripleEndReader().call(this,token)}},_readListItem:function(token){var item=null,itemHead=null,prevItemHead=this._subject,stack=this._tripleStack,parentTriple=stack[stack.length-1],next=this._readListItem;switch(token.type){case"IRI":item=token.value;break;case"prefixed":var prefix=this._prefixes[token.prefix];if(prefix===undefined)return this._error('Undefined prefix "'+token.prefix+':"',token);item=prefix+token.value;break;case"literal":item=token.value;next=this._readDataTypeOrLang;break;case"[":itemHead="_:b"+blankNodeCount++;item="_:b"+blankNodeCount++;stack.push({subject:itemHead,predicate:RDF_FIRST,object:item,type:"blank"});this._subject=item;next=this._readBlankNodeHead;break;case"(":itemHead="_:b"+blankNodeCount++;stack.push({subject:itemHead,predicate:RDF_FIRST,object:RDF_NIL,type:"list"});this._subject=null;next=this._readListItem;break;case")":stack.pop();if(stack.length!==0&&stack[stack.length-1].type==="list")this._callback(null,{subject:parentTriple.subject,predicate:parentTriple.predicate,object:parentTriple.object,graph:this._graph||""});this._subject=parentTriple.subject;if(parentTriple.predicate===null){next=this._readPredicate;if(parentTriple.subject===RDF_NIL)return next}else{this._predicate=parentTriple.predicate;this._object=parentTriple.object;next=this._getTripleEndReader();if(parentTriple.object===RDF_NIL)return next}itemHead=RDF_NIL;break;default:return this._error('Expected list item instead of "'+token.type+'"',token)}if(itemHead===null)this._subject=itemHead="_:b"+blankNodeCount++;if(prevItemHead===null){if(parentTriple.object===RDF_NIL)parentTriple.object=itemHead;else parentTriple.subject=itemHead}else{this._callback(null,{subject:prevItemHead,predicate:RDF_REST,object:itemHead,graph:this._graph||""})}if(item!==null)this._callback(null,{subject:itemHead,predicate:RDF_FIRST,object:item,graph:this._graph||""});return next},_readPunctuation:function(token){var next,subject=this._subject,graph=this._graph;switch(token.type){case"}":if(this._graph===null)return this._error("Unexpected graph closing",token);this._graph=null;case".":this._subject=null; | |
next=this._readInTopContext;break;case";":next=this._readPredicate;break;case",":next=this._readObject;break;case"IRI":if(this._supportsQuads&&this._graph===null){if(this._baseIRI===null||absoluteIRI.test(token.value))graph=token.value;else graph=this._resolveIRI(token);subject=this._subject;next=this._readQuadPunctuation;break}case"prefixed":if(this._supportsQuads&&this._graph===null){var prefix=this._prefixes[token.prefix];if(prefix===undefined)return this._error('Undefined prefix "'+token.prefix+':"',token);graph=prefix+token.value;next=this._readQuadPunctuation;break}default:return this._error('Expected punctuation to follow "'+this._object+'"',token)}if(subject!==null)this._callback(null,{subject:subject,predicate:this._predicate,object:this._object,graph:graph||""});return next},_readBlankNodePunctuation:function(token){var next;switch(token.type){case";":next=this._readPredicate;break;case",":next=this._readObject;break;default:return this._error('Expected punctuation to follow "'+this._object+'"',token)}this._callback(null,{subject:this._subject,predicate:this._predicate,object:this._object,graph:this._graph||""});return next},_readQuadPunctuation:function(token){if(token.type!==".")return this._error("Expected dot to follow quad",token);return this._readInTopContext},_readPrefix:function(token){if(token.type!=="prefix")return this._error("Expected prefix to follow @prefix",token);this._prefix=token.value;return this._readPrefixIRI},_readPrefixIRI:function(token){if(token.type!=="IRI")return this._error('Expected IRI to follow prefix "'+this._prefix+':"',token);var prefixIRI;if(this._baseIRI===null||absoluteIRI.test(token.value))prefixIRI=token.value;else prefixIRI=this._resolveIRI(token);this._prefixes[this._prefix]=prefixIRI;this._prefixCallback(this._prefix,prefixIRI);return this._readDeclarationPunctuation},_readBaseIRI:function(token){if(token.type!=="IRI")return this._error("Expected IRI to follow base declaration",token);if(token.value.indexOf("#")>0)return this._error("Invalid base IRI",token);if(this._baseIRI===null||absoluteIRI.test(token.value))this._baseIRI=token.value;else this._baseIRI=this._resolveIRI(token);this._baseIRIPath=this._baseIRI.replace(documentPart,"");this._baseIRIRoot=this._baseIRI.match(rootIRI)[0];return this._readDeclarationPunctuation},_readNamedGraphLabel:function(token){switch(token.type){case"IRI":case"prefixed":return this._readSubject(token),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",token)}},_readNamedGraphBlankLabel:function(token){if(token.type!=="]")return this._error("Invalid graph label",token);this._subject="_:b"+blankNodeCount++;return this._readGraph},_readDeclarationPunctuation:function(token){if(this._sparqlStyle)return this._readInTopContext(token);if(token.type!==".")return this._error("Expected declaration to end with a dot",token);return this._readInTopContext},_getTripleEndReader:function(){var stack=this._tripleStack;if(stack.length===0)return this._readPunctuation;switch(stack[stack.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem}},_error:function(message,token){this._callback(new Error(message+" at line "+token.line+"."))},_resolveIRI:function(token){var iri=token.value;switch(iri[0]){case undefined:return this._baseIRI;case"#":return this._baseIRI+iri;case"?":return this._baseIRI.replace(/(?:\?.*)?$/,iri);case"/":return this._baseIRIRoot+iri;default:return this._baseIRIPath+iri}},parse:function(input,tripleCallback,prefixCallback){this._readCallback=this._readInTopContext;this._prefixes=Object.create(null);this._prefixes._=this._blankNodePrefix||"_:b"+blankNodePrefix++ +"_";if(typeof input==="function")prefixCallback=tripleCallback,tripleCallback=input,input=null;this._callback=tripleCallback||noop;this._prefixCallback=prefixCallback||noop;var self=this;this._lexer.tokenize(input,function(error,token){if(error!==null)self._callback(error),self._callback=noop;else if(self._readCallback!==undefined)self._readCallback=self._readCallback(token)});if(!input){this.addChunk=this._lexer.addChunk;this.end=this._lexer.end}}};function noop(){}module.exports=N3Parser},{"./N3Lexer":58}],60:[function(require,module,exports){var expandPrefixedName=require("./N3Util").expandPrefixedName;function N3Store(triples,options){if(!(this instanceof N3Store))return new N3Store(triples,options);this._size=0;this._graphs=Object.create(null);this._entities=Object.create(null);this._entities["><"]=0;this._entityCount=0;this._blankNodeIndex=0;if(!options&&triples&&!triples[0])options=triples,triples=null;this._prefixes=Object.create(null);if(options&&options.prefixes)this.addPrefixes(options.prefixes);if(triples)this.addTriples(triples)}N3Store.prototype={get size(){var size=this._size;if(size!==null)return size;var graphs=this._graphs,subjects,subject;for(var graphKey in graphs)for(var subjectKey in subjects=graphs[graphKey].subjects)for(var predicateKey in subject=subjects[subjectKey])size+=Object.keys(subject[predicateKey]).length;return this._size=size},_addToIndex:function(index0,key0,key1,key2){var index1=index0[key0]||(index0[key0]={});var index2=index1[key1]||(index1[key1]={});index2[key2]=null},_removeFromIndex:function(index0,key0,key1,key2){var index1=index0[key0],index2=index1[key1],key;delete index2[key2];for(key in index2)return;delete index1[key1];for(key in index1)return;delete index0[key0]},_findInIndex:function(index0,key0,key1,key2,name0,name1,name2,graph){var results=[],entityKeys=Object.keys(this._entities),tmp,index1,index2;if(key0)(tmp=index0,index0={})[key0]=tmp[key0];for(var value0 in index0){var entity0=entityKeys[value0];if(index1=index0[value0]){if(key1)(tmp=index1,index1={})[key1]=tmp[key1];for(var value1 in index1){var entity1=entityKeys[value1];if(index2=index1[value1]){var values=key2?key2 in index2?[key2]:[]:Object.keys(index2);for(var l=values.length-1;l>=0;l--){var result={subject:"",predicate:"",object:"",graph:graph};result[name0]=entity0;result[name1]=entity1;result[name2]=entityKeys[values[l]];results.push(result)}}}}}return results},_countInIndex:function(index0,key0,key1,key2){var count=0,tmp,index1,index2;if(key0)(tmp=index0,index0={})[key0]=tmp[key0];for(var value0 in index0){if(index1=index0[value0]){if(key1)(tmp=index1,index1={})[key1]=tmp[key1];for(var value1 in index1){if(index2=index1[value1]){if(key2)key2 in index2&&count++;else count+=Object.keys(index2).length}}}}return count},addTriple:function(subject,predicate,object,graph){if(!predicate)graph=subject.graph,object=subject.object,predicate=subject.predicate,subject=subject.subject;graph=graph||"";var graphItem=this._graphs[graph];if(!graphItem){graphItem=this._graphs[graph]={subjects:{},predicates:{},objects:{}};Object.freeze(graphItem)}var entities=this._entities;subject=entities[subject]||(entities[subject]=++this._entityCount);predicate=entities[predicate]||(entities[predicate]=++this._entityCount);object=entities[object]||(entities[object]=++this._entityCount);this._addToIndex(graphItem.subjects,subject,predicate,object);this._addToIndex(graphItem.predicates,predicate,object,subject);this._addToIndex(graphItem.objects,object,subject,predicate);this._size=null},addTriples:function(triples){for(var i=triples.length-1;i>=0;i--)this.addTriple(triples[i])},addPrefix:function(prefix,iri){this._prefixes[prefix]=iri},addPrefixes:function(prefixes){for(var prefix in prefixes)this.addPrefix(prefix,prefixes[prefix])},removeTriple:function(subject,predicate,object,graph){if(!predicate)graph=subject.graph,object=subject.object,predicate=subject.predicate,subject=subject.subject;graph=graph||"";var graphItem,entities=this._entities,graphs=this._graphs;if(!(subject=entities[subject]))return;if(!(predicate=entities[predicate]))return;if(!(object=entities[object]))return;if(!(graphItem=graphs[graph]))return;var subjects,predicates;if(!(subjects=graphItem.subjects[subject]))return;if(!(predicates=subjects[predicate]))return;if(!(object in predicates))return;this._removeFromIndex(graphItem.subjects,subject,predicate,object);this._removeFromIndex(graphItem.predicates,predicate,object,subject);this._removeFromIndex(graphItem.objects,object,subject,predicate);if(this._size!==null)this._size--;for(subject in graphItem.subjects)return;delete graphs[graph]},removeTriples:function(triples){for(var i=triples.length-1;i>=0;i--)this.removeTriple(triples[i])},find:function(subject,predicate,object,graph){var prefixes=this._prefixes;return this.findByIRI(expandPrefixedName(subject,prefixes),expandPrefixedName(predicate,prefixes),expandPrefixedName(object,prefixes),expandPrefixedName(graph,prefixes))},findByIRI:function(subject,predicate,object,graph){graph=graph||"";var graphItem=this._graphs[graph],entities=this._entities;if(!graphItem)return[];if(subject&&!(subject=entities[subject]))return[];if(predicate&&!(predicate=entities[predicate]))return[];if(object&&!(object=entities[object]))return[];if(subject){if(object)return this._findInIndex(graphItem.objects,object,subject,predicate,"object","subject","predicate",graph);else return this._findInIndex(graphItem.subjects,subject,predicate,null,"subject","predicate","object",graph)}else if(predicate)return this._findInIndex(graphItem.predicates,predicate,object,null,"predicate","object","subject",graph);else if(object)return this._findInIndex(graphItem.objects,object,null,null,"object","subject","predicate",graph);else return this._findInIndex(graphItem.subjects,null,null,null,"subject","predicate","object",graph)},count:function(subject,predicate,object,graph){var prefixes=this._prefixes;return this.countByIRI(expandPrefixedName(subject,prefixes),expandPrefixedName(predicate,prefixes),expandPrefixedName(object,prefixes),expandPrefixedName(graph,prefixes))},countByIRI:function(subject,predicate,object,graph){graph=graph||"";var graphItem=this._graphs[graph],entities=this._entities;if(!graphItem)return 0;if(subject&&!(subject=entities[subject]))return 0;if(predicate&&!(predicate=entities[predicate]))return 0;if(object&&!(object=entities[object]))return 0;if(subject){if(object)return this._countInIndex(graphItem.objects,object,subject,predicate);else return this._countInIndex(graphItem.subjects,subject,predicate,object)}else if(predicate){return this._countInIndex(graphItem.predicates,predicate,object,subject)}else{return this._countInIndex(graphItem.objects,object,subject,predicate)}},createBlankNode:function(suggestedName){var name;if(suggestedName){name=suggestedName="_:"+suggestedName;var index=1;while(this._entities[name])name=suggestedName+index++}else{do{name="_:b"+this._blankNodeIndex++}while(this._entities[name])}this._entities[name]=this._entityCount++;return name}};module.exports=N3Store},{"./N3Util":63}],61:[function(require,module,exports){var Transform=require("stream").Transform,util=require("util"),N3Parser=require("./N3Parser.js");function N3StreamParser(options){if(!(this instanceof N3StreamParser))return new N3StreamParser(options);Transform.call(this,{decodeStrings:true});this._readableState.objectMode=true;var self=this,parser=new N3Parser(options);parser.parse(function(error,triple){triple&&self.push(triple)||error&&self.emit("error",error)},this.emit.bind(this,"prefix"));this._transform=function(chunk,encoding,done){parser.addChunk(chunk);done()};this._flush=function(done){parser.end();done()}}util.inherits(N3StreamParser,Transform);module.exports=N3StreamParser},{"./N3Parser.js":59,stream:24,util:27}],62:[function(require,module,exports){var Transform=require("stream").Transform,util=require("util"),N3Writer=require("./N3Writer.js");function N3StreamWriter(options){if(!(this instanceof N3StreamWriter))return new N3StreamWriter(options);Transform.call(this,{encoding:"utf8"});this._writableState.objectMode=true;var self=this;var writer=new N3Writer({write:function(chunk,encoding,callback){self.push(chunk);callback&&callback()},end:function(callback){self.push(null);callback&&callback()}},options);this._transform=function(triple,encoding,done){writer.addTriple(triple,done)};this._flush=function(done){writer.end(done)}}util.inherits(N3StreamWriter,Transform);module.exports=N3StreamWriter},{"./N3Writer.js":64,stream:24,util:27}],63:[function(require,module,exports){var Xsd="http://www.w3.org/2001/XMLSchema#";var XsdString=Xsd+"string";var XsdInteger=Xsd+"integer";var XsdDecimal=Xsd+"decimal";var XsdBoolean=Xsd+"boolean";var RdfLangString="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString";var N3Util={isIRI:function(entity){if(!entity)return entity;var firstChar=entity[0];return firstChar!=='"'&&firstChar!=="_"},isLiteral:function(entity){return entity&&entity[0]==='"'},isBlank:function(entity){return entity&&entity.substr(0,2)==="_:"},getLiteralValue:function(literal){var match=/^"([^]*)"/.exec(literal);if(!match)throw new Error(literal+" is not a literal");return match[1]},getLiteralType:function(literal){var match=/^"[^]*"(?:\^\^([^"]+)|(@)[^@"]+)?$/.exec(literal);if(!match)throw new Error(literal+" is not a literal");return match[1]||(match[2]?RdfLangString:XsdString)},getLiteralLanguage:function(literal){var match=/^"[^]*"(?:@([^@"]+)|\^\^[^"]+)?$/.exec(literal);if(!match)throw new Error(literal+" is not a literal");return match[1]?match[1].toLowerCase():""},isPrefixedName:function(entity){return entity&&/^[^:\/"']*:[^:\/"']+$/.test(entity)},expandPrefixedName:function(prefixedName,prefixes){var match=/(?:^|"\^\^)([^:\/#"'\^_]*):[^\/]*$/.exec(prefixedName),prefix,base,index;if(match)prefix=match[1],base=prefixes[prefix],index=match.index;if(base===undefined)return prefixedName;return index===0?base+prefixedName.substr(prefix.length+1):prefixedName.substr(0,index+3)+base+prefixedName.substr(index+prefix.length+4)},createIRI:function(iri){return iri&&iri[0]==='"'?N3Util.getLiteralValue(iri):iri},createLiteral:function(value,modifier){if(!modifier){switch(typeof value){case"boolean":modifier=XsdBoolean;break;case"number":if(isFinite(value)){modifier=value%1===0?XsdInteger:XsdDecimal;break}default:return'"'+value+'"'}}return'"'+value+(/^[a-z]+(-[a-z0-9]+)*$/i.test(modifier)?'"@'+modifier.toLowerCase():'"^^'+modifier)}};function AddN3Util(parent,toPrototype){for(var name in N3Util)if(!toPrototype)parent[name]=N3Util[name];else parent.prototype[name]=ApplyToThis(N3Util[name]);return parent}function ApplyToThis(f){return function(a){return f(this,a)}}module.exports=AddN3Util(AddN3Util)},{}],64:[function(require,module,exports){var N3LiteralMatcher=/^"([^]*)"(?:\^\^(.+)|@([\-a-z]+))?$/i;var RDF_PREFIX="http://www.w3.org/1999/02/22-rdf-syntax-ns#",RDF_TYPE=RDF_PREFIX+"type";var escape=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,escapeAll=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,escapeReplacements={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};function N3Writer(outputStream,options){if(!(this instanceof N3Writer))return new N3Writer(outputStream,options);if(outputStream&&typeof outputStream.write!=="function")options=outputStream,outputStream=null;options=options||{};if(!outputStream){var output="";this._outputStream={write:function(chunk,encoding,done){output+=chunk;done&&done()},end:function(done){done&&done(null,output)}};this._endStream=true}else{this._outputStream=outputStream;this._endStream=options.end===undefined?true:!!options.end}this._subject=null;if(!/triple|quad/i.test(options.format)){this._graph="";this._prefixIRIs=Object.create(null);options.prefixes&&this.addPrefixes(options.prefixes)}else{this._writeTriple=this._writeTripleLine}}N3Writer.prototype={_write:function(string,callback){this._outputStream.write(string,"utf8",callback)},_writeTriple:function(subject,predicate,object,graph,done){try{if(this._graph!==graph){this._write((this._subject===null?"":this._graph?"\n}\n":".\n")+(graph?this._encodeIriOrBlankNode(graph)+" {\n":""));this._graph=graph,this._subject=null}if(this._subject===subject){if(this._predicate===predicate)this._write(", "+this._encodeObject(object),done);else this._write(";\n "+this._encodePredicate(this._predicate=predicate)+" "+this._encodeObject(object),done)}else this._write((this._subject===null?"":".\n")+this._encodeSubject(this._subject=subject)+" "+this._encodePredicate(this._predicate=predicate)+" "+this._encodeObject(object),done)}catch(error){done&&done(error)}},_writeTripleLine:function(subject,predicate,object,graph,done){delete this._prefixMatch;try{this._write(this._encodeIriOrBlankNode(subject)+" "+this._encodeIriOrBlankNode(predicate)+" "+this._encodeObject(object)+(graph?" "+this._encodeIriOrBlankNode(graph)+".\n":".\n"),done)}catch(error){done&&done(error)}},_encodeIriOrBlankNode:function(iri){if(iri[0]==="_"&&iri[1]===":")return iri;if(escape.test(iri))iri=iri.replace(escapeAll,characterReplacer);var prefixMatch=this._prefixRegex.exec(iri);return!prefixMatch?"<"+iri+">":!prefixMatch[1]?iri:this._prefixIRIs[prefixMatch[1]]+prefixMatch[2]},_encodeLiteral:function(value,type,language){if(escape.test(value))value=value.replace(escapeAll,characterReplacer);if(language)return'"'+value+'"@'+language;else if(type)return'"'+value+'"^^'+this._encodeIriOrBlankNode(type);else return'"'+value+'"'},_encodeSubject:function(subject){if(subject[0]==='"')throw new Error("A literal as subject is not allowed: "+subject);return this._encodeIriOrBlankNode(subject)},_encodePredicate:function(predicate){if(predicate[0]==='"')throw new Error("A literal as predicate is not allowed: "+predicate);return predicate===RDF_TYPE?"a":this._encodeIriOrBlankNode(predicate)},_encodeObject:function(object){if(object[0]!=='"')return this._encodeIriOrBlankNode(object);var match=N3LiteralMatcher.exec(object);if(!match)throw new Error("Invalid literal: "+object);return this._encodeLiteral(match[1],match[2],match[3])},_blockedWrite:function(){throw new Error("Cannot write because the writer has been closed.")},addTriple:function(subject,predicate,object,graph,done){if(typeof object!=="string")this._writeTriple(subject.subject,subject.predicate,subject.object,subject.graph||"",predicate);else if(typeof graph!=="string")this._writeTriple(subject,predicate,object,"",graph);else this._writeTriple(subject,predicate,object,graph,done)},addTriples:function(triples){for(var i=0;i<triples.length;i++)this.addTriple(triples[i])},addPrefix:function(prefix,iri,done){var prefixes={};prefixes[prefix]=iri;this.addPrefixes(prefixes,done)},addPrefixes:function(prefixes,done){var prefixIRIs=this._prefixIRIs,hasPrefixes=false;for(var prefix in prefixes){var iri=prefixes[prefix];if(/[#\/]$/.test(iri)&&prefixIRIs[iri]!==(prefix+=":")){hasPrefixes=true;prefixIRIs[iri]=prefix;if(this._subject!==null){this._write(this._graph?"\n}\n":".\n");this._subject=null,this._graph=""}this._write("@prefix "+prefix+" <"+iri+">.\n")}}if(hasPrefixes){var IRIlist="",prefixList="";for(var prefixIRI in prefixIRIs){IRIlist+=IRIlist?"|"+prefixIRI:prefixIRI;prefixList+=(prefixList?"|":"")+prefixIRIs[prefixIRI]}IRIlist=IRIlist.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&");this._prefixRegex=new RegExp("^(?:"+prefixList+")[^/]*$|"+"^("+IRIlist+")([a-zA-Z][\\-_a-zA-Z0-9]*)$")}this._write(hasPrefixes?"\n":"",done)},_prefixRegex:/$0^/,end:function(done){if(this._subject!==null){this._write(this._graph?"\n}\n":".\n");this._subject=null}this._write=this._blockedWrite;var singleDone=done&&function(error,result){singleDone=null,done(error,result)};if(this._endStream){try{return this._outputStream.end(singleDone)}catch(error){}}singleDone&&singleDone()}};function characterReplacer(character){var result=escapeReplacements[character];if(result===undefined){if(character.length===1){result=character.charCodeAt(0).toString(16);result="\\u0000".substr(0,6-result.length)+result}else{result=((character.charCodeAt(0)-55296)*1024+character.charCodeAt(1)+9216).toString(16);result="\\U00000000".substr(0,10-result.length)+result}}return result}module.exports=N3Writer},{}],65:[function(require,module,exports){(function(process){(function(global,undefined){"use strict";if(global.setImmediate){return}var nextHandle=1;var tasksByHandle={};var currentlyRunningATask=false;var doc=global.document;var setImmediate;function addFromSetImmediateArguments(args){tasksByHandle[nextHandle]=partiallyApplied.apply(undefined,args);return nextHandle++}function partiallyApplied(handler){var args=[].slice.call(arguments,1);return function(){if(typeof handler==="function"){handler.apply(undefined,args)}else{new Function(""+handler)()}}}function runIfPresent(handle){if(currentlyRunningATask){setTimeout(partiallyApplied(runIfPresent,handle),0)}else{var task=tasksByHandle[handle];if(task){currentlyRunningATask=true;try{task()}finally{clearImmediate(handle);currentlyRunningATask=false}}}}function clearImmediate(handle){delete tasksByHandle[handle]}function installNextTickImplementation(){setImmediate=function(){var handle=addFromSetImmediateArguments(arguments);process.nextTick(partiallyApplied(runIfPresent,handle));return handle}}function canUsePostMessage(){if(global.postMessage&&!global.importScripts){var postMessageIsAsynchronous=true;var oldOnMessage=global.onmessage;global.onmessage=function(){postMessageIsAsynchronous=false};global.postMessage("","*");global.onmessage=oldOnMessage;return postMessageIsAsynchronous}}function installPostMessageImplementation(){var messagePrefix="setImmediate$"+Math.random()+"$";var onGlobalMessage=function(event){if(event.source===global&&typeof event.data==="string"&&event.data.indexOf(messagePrefix)===0){runIfPresent(+event.data.slice(messagePrefix.length))}};if(global.addEventListener){global.addEventListener("message",onGlobalMessage,false)}else{global.attachEvent("onmessage",onGlobalMessage)}setImmediate=function(){var handle=addFromSetImmediateArguments(arguments);global.postMessage(messagePrefix+handle,"*");return handle}}function installMessageChannelImplementation(){var channel=new MessageChannel;channel.port1.onmessage=function(event){var handle=event.data;runIfPresent(handle)};setImmediate=function(){var handle=addFromSetImmediateArguments(arguments);channel.port2.postMessage(handle);return handle}}function installReadyStateChangeImplementation(){var html=doc.documentElement;setImmediate=function(){var handle=addFromSetImmediateArguments(arguments);var script=doc.createElement("script");script.onreadystatechange=function(){runIfPresent(handle);script.onreadystatechange=null;html.removeChild(script);script=null};html.appendChild(script);return handle}}function installSetTimeoutImplementation(){setImmediate=function(){var handle=addFromSetImmediateArguments(arguments);setTimeout(partiallyApplied(runIfPresent,handle),0);return handle}}var attachTo=Object.getPrototypeOf&&Object.getPrototypeOf(global);attachTo=attachTo&&attachTo.setTimeout?attachTo:global;if({}.toString.call(global.process)==="[object process]"){installNextTickImplementation()}else if(canUsePostMessage()){installPostMessageImplementation()}else if(global.MessageChannel){installMessageChannelImplementation()}else if(doc&&"onreadystatechange"in doc.createElement("script")){installReadyStateChangeImplementation()}else{installSetTimeoutImplementation()}attachTo.setImmediate=setImmediate;attachTo.clearImmediate=clearImmediate})(new Function("return this")())}).call(this,require("_process"))},{_process:12}],66:[function(require,module,exports){var XSD_INTEGER="http://www.w3.org/2001/XMLSchema#integer";module.exports=function SparqlGenerator(){return{stringify:toQuery}};function toQuery(q){var query="";for(var key in q.prefixes)query+="PREFIX "+key+": <"+q.prefixes[key]+">\n";if(q.queryType)query+=q.queryType.toUpperCase()+" ";if(q.reduced)query+="REDUCED ";if(q.distinct)query+="DISTINCT ";if(q.variables)query+=mapJoin(q.variables,function(variable){return isString(variable)?toEntity(variable):"("+toExpression(variable.expression)+" AS "+variable.variable+")"})+" ";else if(q.template)query+=patterns.group(q.template,true)+"\n";if(q.from)query+=mapJoin(q.from.default||[],function(g){return"FROM "+toEntity(g)+"\n"},"")+mapJoin(q.from.named||[],function(g){return"FROM NAMED "+toEntity(g)+"\n"},"");if(q.where)query+="WHERE "+patterns.group(q.where,true)+"\n";if(q.updates)query+=mapJoin(q.updates,toUpdate,";\n");else if(q.values)query+=patterns.values(q);if(q.group)query+="GROUP BY "+mapJoin(q.group,function(it){return isString(it.expression)?it.expression:"("+toExpression(it.expression)+")"})+"\n";if(q.having)query+="HAVING ("+mapJoin(q.having,toExpression)+")\n";if(q.order)query+="ORDER BY "+mapJoin(q.order,function(it){var expr=toExpression(it.expression);return!it.descending?expr:"DESC("+expr+")"})+"\n";if(q.offset)query+="OFFSET "+q.offset+"\n";if(q.limit)query+="LIMIT "+q.limit+"\n";return query.trim()}function toPattern(pattern){var type=pattern.type||pattern instanceof Array&&"array"||(pattern.subject&&pattern.predicate&&pattern.object?"triple":"");if(!(type in patterns))throw new Error("Unknown entry type: "+type);return patterns[type](pattern)}var patterns={triple:function(t){return toEntity(t.subject)+" "+toEntity(t.predicate)+" "+toEntity(t.object)+"."},array:function(items){return mapJoin(items,toPattern,"\n")},bgp:function(bgp){return mapJoin(bgp.triples,patterns.triple,"\n")},graph:function(graph){return"GRAPH "+toEntity(graph.name)+" "+patterns.group(graph)},group:function(group,inline){group=inline!==true?patterns.array(group.patterns||group.triples):toPattern(group.type!=="group"?group:group.patterns);return group.indexOf("\n")===-1?"{ "+group+" }":"{\n"+indent(group)+"\n}"},query:function(query){return"{\n"+indent(toQuery(query))+"\n}"},filter:function(filter){return"FILTER("+toExpression(filter.expression)+")"},bind:function(bind){return"BIND("+toExpression(bind.expression)+" AS "+bind.variable+")"},optional:function(optional){return"OPTIONAL "+patterns.group(optional)},union:function(union){return mapJoin(union.patterns,function(p){return patterns.group(p,true)},"\nUNION\n")},minus:function(minus){return"MINUS "+patterns.group(minus)},values:function(valuesList){var keys=Object.keys(valuesList.values.reduce(function(keyHash,values){for(var key in values)keyHash[key]=true;return keyHash},{}));return"VALUES ("+keys.join(" ")+") {\n"+mapJoin(valuesList.values,function(values){return" ("+mapJoin(keys,function(key){return values[key]!==undefined?toEntity(values[key]):"UNDEF"})+")"},"\n")+"\n}"},service:function(service){return"SERVICE "+(service.silent?"SILENT ":"")+toEntity(service.name)+" "+patterns.group(service)}};function toExpression(expr){if(isString(expr))return toEntity(expr);switch(expr.type.toLowerCase()){case"aggregate":return expr.aggregation.toUpperCase()+"("+(expr.distinct?"DISTINCT ":"")+toExpression(expr.expression)+(expr.separator?"; SEPARATOR = "+toEntity('"'+expr.separator+'"'):"")+")";case"functioncall":return toEntity(expr.function)+"("+mapJoin(expr.args,toExpression,", ")+")";case"operation":var operator=expr.operator.toUpperCase(),args=expr.args||[],arg=args[0];switch(expr.operator.toLowerCase()){case"<":case">":case">=":case"<=":case"&&":case"||":case"=":case"!=":case"+":case"-":case"*":case"/":return mapJoin(args,function(arg){return isString(arg)?toEntity(arg):"("+toExpression(arg)+")"}," "+operator+" ");case"!":return"!"+toExpression(arg);case"notin":operator="NOT IN";case"in":return toExpression(arg)+" "+operator+"("+(isString(arg=args[1])?arg:mapJoin(arg,toExpression,", "))+")";case"notexists":operator="NOT EXISTS";case"exists":return operator+" "+patterns.group(arg,true);default:return operator+"("+mapJoin(args,toExpression,", ")+")"}default:throw new Error("Unknown expression type: "+expr.type)}}function toEntity(value){if(isString(value)){switch(value[0]){case"?":case"$":case"*":case"_":return value;case'"':var match=value.match(/^"(.*)"(?:(@.+)|\^\^(.+))?$/)||{},lexical=match[1]||"",language=match[2]||"",datatype=match[3];value='"'+lexical.replace(escape,escapeReplacer)+'"'+language;if(datatype){if(datatype===XSD_INTEGER&&/^\d+$/.test(lexical))return lexical;value+="^^<"+datatype+">"}return value;default:return"<"+value+">"}}else{var items=value.items.map(toEntity),path=value.pathType;switch(path){case"^":case"!":return path+items[0];case"*":case"+":case"?":return items[0]+path;default:return"("+items.join(path)+")"}}}var escape=/["\\\t\n\r\b\f]/g,escapeReplacer=function(c){return escapeReplacements[c]},escapeReplacements={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};function toUpdate(update){switch(update.type||update.updateType){case"load":return"LOAD"+(update.source?" "+toEntity(update.source):"")+(update.destination?" INTO GRAPH "+toEntity(update.destination):"");case"insert":return"INSERT DATA "+patterns.group(update.insert,true);case"delete":return"DELETE DATA "+patterns.group(update.delete,true);case"deletewhere":return"DELETE WHERE "+patterns.group(update.delete,true);case"insertdelete":return(update.graph?"WITH "+toEntity(update.graph)+"\n":"")+(update.delete.length?"DELETE "+patterns.group(update.delete,true)+"\n":"")+(update.insert.length?"INSERT "+patterns.group(update.insert,true)+"\n":"")+"WHERE "+patterns.group(update.where,true);case"add":case"copy":case"move":return update.type.toUpperCase()+(update.source.default?" DEFAULT ":" ")+"TO "+toEntity(update.destination.name);default:throw new Error("Unknown update query type: "+update.type)}}function isString(object){return typeof object==="string"}function mapJoin(array,func,sep){return array.map(func).join(isString(sep)?sep:" ")}function indent(text){return text.replace(/^/gm," ")}},{}],67:[function(require,module,exports){(function(process){var parser=function(){var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[11,14,23,33,42,47,95,105,108,110,111,120,121,126,288,289,290,291,292],$V1=[95,105,108,110,111,120,121,126,288,289,290,291,292],$V2=[1,21],$V3=[1,25],$V4=[6,82],$V5=[37,38,50],$V6=[37,50],$V7=[1,55],$V8=[1,57],$V9=[1,53],$Va=[1,56],$Vb=[27,28,283],$Vc=[12,15,277],$Vd=[107,129,286,293],$Ve=[12,15,107,129,277],$Vf=[1,76],$Vg=[1,80],$Vh=[1,82],$Vi=[107,129,286,287,293],$Vj=[12,15,107,129,277,287],$Vk=[1,89],$Vl=[2,229],$Vm=[1,88],$Vn=[12,15,27,28,79,163,210,213,214,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277],$Vo=[6,37,38,50,60,67,70,78,80,82],$Vp=[6,12,15,27,37,38,50,60,67,70,78,80,82,277],$Vq=[6,12,15,27,28,30,31,37,38,40,50,60,67,70,78,79,80,82,89,104,107,120,121,123,128,155,156,158,161,162,163,181,192,203,208,210,211,213,214,222,237,242,259,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,283,294,297,298,300,301,302,303,304,305,306,307,308,309],$Vr=[1,104],$Vs=[1,105],$Vt=[6,12,15,27,28,38,40,79,82,107,155,156,158,161,162,163,210,213,214,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,294],$Vu=[27,31],$Vv=[2,284],$Vw=[1,118],$Vx=[1,116],$Vy=[6,192],$Vz=[2,301],$VA=[2,289],$VB=[37,123],$VC=[6,40,67,70,78,80,82],$VD=[2,231],$VE=[1,132],$VF=[1,134],$VG=[1,144],$VH=[1,150],$VI=[1,153],$VJ=[1,149],$VK=[1,151],$VL=[1,147],$VM=[1,148],$VN=[1,154],$VO=[1,155],$VP=[1,158],$VQ=[1,159],$VR=[1,160],$VS=[1,161],$VT=[1,162],$VU=[1,163],$VV=[1,164],$VW=[1,165],$VX=[1,166],$VY=[1,167],$VZ=[1,168],$V_=[1,169],$V$=[6,60,67,70,78,80,82],$V01=[27,28,37,38,50],$V11=[12,15,27,28,79,203,237,239,240,241,243,245,246,248,249,252,254,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,301,309,310,311,312,313,314],$V21=[2,374],$V31=[12,15,40,79,89,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277],$V41=[6,104,192],$V51=[40,107],$V61=[6,40,70,78,80,82],$V71=[2,313],$V81=[2,305],$V91=[12,15,27,181,277],$Va1=[2,341],$Vb1=[2,337],$Vc1=[12,15,27,28,31,38,40,79,82,107,155,156,158,161,162,163,181,192,203,208,210,211,213,214,242,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,294],$Vd1=[12,15,27,28,30,31,38,40,79,82,89,107,155,156,158,161,162,163,181,192,203,208,210,211,213,214,222,237,242,259,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,283,294,298,301,302,303,304,305,306,307,308,309],$Ve1=[12,15,27,28,30,31,38,40,79,82,89,107,155,156,158,161,162,163,181,192,203,208,210,211,213,214,222,237,242,259,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,283,294,298,301,302,303,304,305,306,307,308,309],$Vf1=[1,227],$Vg1=[1,238],$Vh1=[6,40,78,80,82],$Vi1=[1,249],$Vj1=[1,251],$Vk1=[1,252],$Vl1=[1,253],$Vm1=[1,254],$Vn1=[1,256],$Vo1=[1,257],$Vp1=[2,405],$Vq1=[1,260],$Vr1=[1,261],$Vs1=[1,262],$Vt1=[1,268],$Vu1=[1,263],$Vv1=[1,264],$Vw1=[1,265],$Vx1=[1,266],$Vy1=[1,267],$Vz1=[1,274],$VA1=[1,273],$VB1=[38,40,82,107,155,156,158,161,162],$VC1=[1,282],$VD1=[1,283],$VE1=[40,107,294],$VF1=[12,15,27,28,31,79,163,210,213,214,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277],$VG1=[12,15,27,28,31,38,40,79,82,107,155,156,158,161,162,163,192,210,211,213,214,242,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,294],$VH1=[12,15,27,28,79,239,240,241,243,245,246,248,249,252,254,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,309,310,311,312,313,314],$VI1=[2,398],$VJ1=[1,301],$VK1=[1,302],$VL1=[1,303],$VM1=[12,15,31,40,79,89,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277],$VN1=[28,40],$VO1=[2,304],$VP1=[6,40,82],$VQ1=[6,12,15,28,40,70,78,80,82,239,240,241,243,245,246,248,249,252,254,277,309,310,311,312,313,314],$VR1=[6,12,15,27,28,38,40,70,73,75,78,79,80,82,107,155,156,158,161,162,163,210,213,214,239,240,241,243,245,246,248,249,252,254,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,294,309,310,311,312,313,314],$VS1=[6,12,15,27,28,30,31,38,40,67,70,73,75,78,79,80,82,107,155,156,158,161,162,163,192,210,213,214,222,237,239,240,241,242,243,245,246,248,249,252,254,259,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,283,294,298,301,302,303,304,305,306,307,308,309,310,311,312,313,314],$VT1=[1,326],$VU1=[1,325],$VV1=[1,332],$VW1=[1,331],$VX1=[28,163],$VY1=[6,12,15,27,28,40,67,70,78,80,82,239,240,241,243,245,246,248,249,252,254,277,309,310,311,312,313,314],$VZ1=[6,12,15,27,28,30,31,38,40,60,67,70,73,75,78,79,80,82,107,155,156,158,161,162,163,192,210,213,214,222,237,239,240,241,242,243,245,246,248,249,252,254,259,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,283,294,295,298,301,302,303,304,305,306,307,308,309,310,311,312,313,314],$V_1=[12,15,28,181,203,208,277],$V$1=[2,355],$V02=[1,354],$V12=[38,40,82,107,155,156,158,161,162,294],$V22=[2,343],$V32=[12,15,27,28,31,38,40,79,82,107,155,156,158,161,162,163,181,192,210,211,213,214,242,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,294],$V42=[30,31,192,242,302,303],$V52=[30,31,192,222,237,242,259,271,272,273,274,275,276,301,302,303,304,305,306,307,308,309],$V62=[30,31,192,222,237,242,259,271,272,273,274,275,276,283,298,301,302,303,304,305,306,307,308,309],$V72=[1,387],$V82=[1,402],$V92=[1,399],$Va2=[1,400],$Vb2=[12,15,27,28,79,203,237,239,240,241,243,245,246,248,249,252,254,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,283,301,309,310,311,312,313,314],$Vc2=[12,15,27,28,38,40,79,82,107,155,156,158,161,162,163,210,213,214,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277],$Vd2=[12,15,27,277],$Ve2=[12,15,27,28,38,40,79,82,107,155,156,158,161,162,163,210,213,214,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,294],$Vf2=[2,316],$Vg2=[12,15,27,181,192,277],$Vh2=[1,453],$Vi2=[1,454],$Vj2=[12,15,31,79,89,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277],$Vk2=[6,12,15,27,28,40,73,75,78,80,82,239,240,241,243,245,246,248,249,252,254,277,309,310,311,312,313,314],$Vl2=[2,311],$Vm2=[12,15,28,181,203,277],$Vn2=[38,40,82,107,155,156,158,161,162,192,211,294],$Vo2=[12,15,27,28,40,79,107,163,210,213,214,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277],$Vp2=[12,15,27,28,31,79,163,210,213,214,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,297,298],$Vq2=[12,15,27,28,31,79,163,210,213,214,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,283,297,298,300,301],$Vr2=[1,545],$Vs2=[1,546],$Vt2=[2,299],$Vu2=[12,15,31,181,208,277]; | |
var parser={trace:function trace(){},yy:{},symbols_:{error:2,QueryOrUpdateUnit:3,QueryOrUpdateUnit_repetition0:4,QueryOrUpdateUnit_group0:5,EOF:6,Query:7,Query_group0:8,Query_option0:9,BaseDecl:10,BASE:11,IRIREF:12,PrefixDecl:13,PREFIX:14,PNAME_NS:15,SelectQuery:16,SelectClause:17,SelectQuery_repetition0:18,WhereClause:19,SolutionModifier:20,SubSelect:21,SubSelect_option0:22,SELECT:23,SelectClause_option0:24,SelectClause_group0:25,SelectClauseItem:26,VAR:27,"(":28,Expression:29,AS:30,")":31,ConstructQuery:32,CONSTRUCT:33,ConstructTemplate:34,ConstructQuery_repetition0:35,ConstructQuery_repetition1:36,WHERE:37,"{":38,ConstructQuery_option0:39,"}":40,DescribeQuery:41,DESCRIBE:42,DescribeQuery_group0:43,DescribeQuery_repetition0:44,DescribeQuery_option0:45,AskQuery:46,ASK:47,AskQuery_repetition0:48,DatasetClause:49,FROM:50,DatasetClause_option0:51,iri:52,WhereClause_option0:53,GroupGraphPattern:54,SolutionModifier_option0:55,SolutionModifier_option1:56,SolutionModifier_option2:57,SolutionModifier_option3:58,GroupClause:59,GROUP:60,BY:61,GroupClause_repetition_plus0:62,GroupCondition:63,BuiltInCall:64,FunctionCall:65,HavingClause:66,HAVING:67,HavingClause_repetition_plus0:68,OrderClause:69,ORDER:70,OrderClause_repetition_plus0:71,OrderCondition:72,ASC:73,BrackettedExpression:74,DESC:75,Constraint:76,LimitOffsetClauses:77,LIMIT:78,INTEGER:79,OFFSET:80,ValuesClause:81,VALUES:82,InlineData:83,InlineData_repetition0:84,InlineData_repetition1:85,InlineData_repetition2:86,DataBlockValue:87,Literal:88,UNDEF:89,DataBlockValueList:90,DataBlockValueList_repetition0:91,Update:92,Update_repetition0:93,Update1:94,LOAD:95,Update1_option0:96,Update1_option1:97,Update1_group0:98,Update1_option2:99,GraphRefAll:100,Update1_group1:101,Update1_option3:102,GraphOrDefault:103,TO:104,CREATE:105,Update1_option4:106,GRAPH:107,INSERTDATA:108,QuadPattern:109,DELETEDATA:110,DELETEWHERE:111,Update1_option5:112,InsertClause:113,Update1_option6:114,Update1_repetition0:115,Update1_option7:116,DeleteClause:117,Update1_option8:118,Update1_repetition1:119,DELETE:120,INSERT:121,UsingClause:122,USING:123,UsingClause_option0:124,WithClause:125,WITH:126,IntoGraphClause:127,INTO:128,DEFAULT:129,GraphOrDefault_option0:130,GraphRefAll_group0:131,QuadPattern_option0:132,QuadPattern_repetition0:133,QuadsNotTriples:134,QuadsNotTriples_group0:135,QuadsNotTriples_option0:136,QuadsNotTriples_option1:137,QuadsNotTriples_option2:138,TriplesTemplate:139,TriplesTemplate_repetition0:140,TriplesSameSubject:141,TriplesTemplate_option0:142,GroupGraphPatternSub:143,GroupGraphPatternSub_option0:144,GroupGraphPatternSub_repetition0:145,GroupGraphPatternSubTail:146,GraphPatternNotTriples:147,GroupGraphPatternSubTail_option0:148,GroupGraphPatternSubTail_option1:149,TriplesBlock:150,TriplesBlock_repetition0:151,TriplesSameSubjectPath:152,TriplesBlock_option0:153,GraphPatternNotTriples_repetition0:154,OPTIONAL:155,MINUS:156,GraphPatternNotTriples_group0:157,SERVICE:158,GraphPatternNotTriples_option0:159,GraphPatternNotTriples_group1:160,FILTER:161,BIND:162,NIL:163,FunctionCall_option0:164,FunctionCall_repetition0:165,ExpressionList:166,ExpressionList_repetition0:167,ConstructTemplate_option0:168,ConstructTriples:169,ConstructTriples_repetition0:170,ConstructTriples_option0:171,VarOrTerm:172,PropertyListNotEmpty:173,TriplesNode:174,PropertyList:175,PropertyList_option0:176,PropertyListNotEmpty_repetition0:177,VerbObjectList:178,Verb:179,ObjectList:180,a:181,ObjectList_repetition0:182,GraphNode:183,PropertyListPathNotEmpty:184,TriplesNodePath:185,TriplesSameSubjectPath_option0:186,PropertyListPathNotEmpty_group0:187,PropertyListPathNotEmpty_repetition0:188,GraphNodePath:189,PropertyListPathNotEmpty_repetition1:190,PropertyListPathNotEmptyTail:191,";":192,PropertyListPathNotEmptyTail_group0:193,Path:194,Path_repetition0:195,PathSequence:196,PathSequence_repetition0:197,PathEltOrInverse:198,PathElt:199,PathPrimary:200,PathElt_option0:201,PathEltOrInverse_option0:202,"!":203,PathNegatedPropertySet:204,PathOneInPropertySet:205,PathNegatedPropertySet_repetition0:206,PathNegatedPropertySet_option0:207,"^":208,TriplesNode_repetition_plus0:209,"[":210,"]":211,TriplesNodePath_repetition_plus0:212,BLANK_NODE_LABEL:213,ANON:214,Expression_repetition0:215,ConditionalAndExpression:216,ConditionalAndExpression_repetition0:217,RelationalExpression:218,AdditiveExpression:219,RelationalExpression_group0:220,RelationalExpression_option0:221,IN:222,MultiplicativeExpression:223,AdditiveExpression_repetition0:224,AdditiveExpressionTail:225,AdditiveExpressionTail_group0:226,NumericLiteralPositive:227,AdditiveExpressionTail_repetition0:228,NumericLiteralNegative:229,AdditiveExpressionTail_repetition1:230,UnaryExpression:231,MultiplicativeExpression_repetition0:232,MultiplicativeExpressionTail:233,MultiplicativeExpressionTail_group0:234,UnaryExpression_option0:235,PrimaryExpression:236,"-":237,Aggregate:238,FUNC_ARITY0:239,FUNC_ARITY1:240,FUNC_ARITY2:241,",":242,IF:243,BuiltInCall_group0:244,BOUND:245,BNODE:246,BuiltInCall_option0:247,EXISTS:248,COUNT:249,Aggregate_option0:250,Aggregate_group0:251,FUNC_AGGREGATE:252,Aggregate_option1:253,GROUP_CONCAT:254,Aggregate_option2:255,Aggregate_option3:256,GroupConcatSeparator:257,SEPARATOR:258,"=":259,String:260,LANGTAG:261,"^^":262,DECIMAL:263,DOUBLE:264,"true":265,"false":266,STRING_LITERAL1:267,STRING_LITERAL2:268,STRING_LITERAL_LONG1:269,STRING_LITERAL_LONG2:270,INTEGER_POSITIVE:271,DECIMAL_POSITIVE:272,DOUBLE_POSITIVE:273,INTEGER_NEGATIVE:274,DECIMAL_NEGATIVE:275,DOUBLE_NEGATIVE:276,PNAME_LN:277,QueryOrUpdateUnit_repetition0_group0:278,SelectClause_option0_group0:279,DISTINCT:280,REDUCED:281,SelectClause_group0_repetition_plus0:282,"*":283,DescribeQuery_group0_repetition_plus0_group0:284,DescribeQuery_group0_repetition_plus0:285,NAMED:286,SILENT:287,CLEAR:288,DROP:289,ADD:290,MOVE:291,COPY:292,ALL:293,".":294,UNION:295,PropertyListNotEmpty_repetition0_repetition_plus0:296,"|":297,"/":298,PathElt_option0_group0:299,"?":300,"+":301,"||":302,"&&":303,"!=":304,"<":305,">":306,"<=":307,">=":308,NOT:309,CONCAT:310,COALESCE:311,SUBSTR:312,REGEX:313,REPLACE:314,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",11:"BASE",12:"IRIREF",14:"PREFIX",15:"PNAME_NS",23:"SELECT",27:"VAR",28:"(",30:"AS",31:")",33:"CONSTRUCT",37:"WHERE",38:"{",40:"}",42:"DESCRIBE",47:"ASK",50:"FROM",60:"GROUP",61:"BY",67:"HAVING",70:"ORDER",73:"ASC",75:"DESC",78:"LIMIT",79:"INTEGER",80:"OFFSET",82:"VALUES",89:"UNDEF",95:"LOAD",104:"TO",105:"CREATE",107:"GRAPH",108:"INSERTDATA",110:"DELETEDATA",111:"DELETEWHERE",120:"DELETE",121:"INSERT",123:"USING",126:"WITH",128:"INTO",129:"DEFAULT",155:"OPTIONAL",156:"MINUS",158:"SERVICE",161:"FILTER",162:"BIND",163:"NIL",181:"a",192:";",203:"!",208:"^",210:"[",211:"]",213:"BLANK_NODE_LABEL",214:"ANON",222:"IN",237:"-",239:"FUNC_ARITY0",240:"FUNC_ARITY1",241:"FUNC_ARITY2",242:",",243:"IF",245:"BOUND",246:"BNODE",248:"EXISTS",249:"COUNT",252:"FUNC_AGGREGATE",254:"GROUP_CONCAT",258:"SEPARATOR",259:"=",261:"LANGTAG",262:"^^",263:"DECIMAL",264:"DOUBLE",265:"true",266:"false",267:"STRING_LITERAL1",268:"STRING_LITERAL2",269:"STRING_LITERAL_LONG1",270:"STRING_LITERAL_LONG2",271:"INTEGER_POSITIVE",272:"DECIMAL_POSITIVE",273:"DOUBLE_POSITIVE",274:"INTEGER_NEGATIVE",275:"DECIMAL_NEGATIVE",276:"DOUBLE_NEGATIVE",277:"PNAME_LN",280:"DISTINCT",281:"REDUCED",283:"*",286:"NAMED",287:"SILENT",288:"CLEAR",289:"DROP",290:"ADD",291:"MOVE",292:"COPY",293:"ALL",294:".",295:"UNION",297:"|",298:"/",300:"?",301:"+",302:"||",303:"&&",304:"!=",305:"<",306:">",307:"<=",308:">=",309:"NOT",310:"CONCAT",311:"COALESCE",312:"SUBSTR",313:"REGEX",314:"REPLACE"},productions_:[0,[3,3],[7,2],[10,2],[13,3],[16,4],[21,4],[17,3],[26,1],[26,5],[32,5],[32,7],[41,5],[46,4],[49,3],[19,2],[20,4],[59,3],[63,1],[63,1],[63,3],[63,5],[63,1],[66,2],[69,3],[72,2],[72,2],[72,1],[72,1],[77,2],[77,2],[77,4],[77,4],[81,2],[83,4],[83,6],[87,1],[87,1],[87,1],[90,3],[92,2],[94,4],[94,3],[94,5],[94,4],[94,2],[94,2],[94,2],[94,6],[94,6],[117,2],[113,2],[122,3],[125,2],[127,3],[103,1],[103,2],[100,2],[100,1],[109,4],[134,7],[139,3],[54,3],[54,3],[143,2],[146,3],[150,3],[147,2],[147,2],[147,2],[147,3],[147,4],[147,2],[147,6],[147,1],[76,1],[76,1],[76,1],[65,2],[65,6],[166,1],[166,4],[34,3],[169,3],[141,2],[141,2],[175,1],[173,2],[178,2],[179,1],[179,1],[179,1],[180,2],[152,2],[152,2],[184,4],[191,1],[191,3],[194,2],[196,2],[199,2],[198,2],[200,1],[200,1],[200,2],[200,3],[204,1],[204,1],[204,4],[205,1],[205,1],[205,2],[205,2],[174,3],[174,3],[185,3],[185,3],[183,1],[183,1],[189,1],[189,1],[172,1],[172,1],[172,1],[172,1],[172,1],[172,1],[29,2],[216,2],[218,1],[218,3],[218,4],[219,2],[225,2],[225,2],[225,2],[223,2],[233,2],[231,2],[231,2],[231,2],[236,1],[236,1],[236,1],[236,1],[236,1],[236,1],[74,3],[64,1],[64,2],[64,4],[64,6],[64,8],[64,2],[64,4],[64,2],[64,4],[64,3],[238,5],[238,5],[238,6],[257,4],[88,1],[88,2],[88,3],[88,1],[88,1],[88,1],[88,1],[88,1],[88,1],[88,1],[260,1],[260,1],[260,1],[260,1],[227,1],[227,1],[227,1],[229,1],[229,1],[229,1],[52,1],[52,1],[52,1],[278,1],[278,1],[4,0],[4,2],[5,1],[5,1],[8,1],[8,1],[8,1],[8,1],[9,0],[9,1],[18,0],[18,2],[22,0],[22,1],[279,1],[279,1],[24,0],[24,1],[282,1],[282,2],[25,1],[25,1],[35,0],[35,2],[36,0],[36,2],[39,0],[39,1],[284,1],[284,1],[285,1],[285,2],[43,1],[43,1],[44,0],[44,2],[45,0],[45,1],[48,0],[48,2],[51,0],[51,1],[53,0],[53,1],[55,0],[55,1],[56,0],[56,1],[57,0],[57,1],[58,0],[58,1],[62,1],[62,2],[68,1],[68,2],[71,1],[71,2],[84,0],[84,2],[85,0],[85,2],[86,0],[86,2],[91,0],[91,2],[93,0],[93,3],[96,0],[96,1],[97,0],[97,1],[98,1],[98,1],[99,0],[99,1],[101,1],[101,1],[101,1],[102,0],[102,1],[106,0],[106,1],[112,0],[112,1],[114,0],[114,1],[115,0],[115,2],[116,0],[116,1],[118,0],[118,1],[119,0],[119,2],[124,0],[124,1],[130,0],[130,1],[131,1],[131,1],[131,1],[132,0],[132,1],[133,0],[133,2],[135,1],[135,1],[136,0],[136,1],[137,0],[137,1],[138,0],[138,1],[140,0],[140,3],[142,0],[142,1],[144,0],[144,1],[145,0],[145,2],[148,0],[148,1],[149,0],[149,1],[151,0],[151,3],[153,0],[153,1],[154,0],[154,3],[157,1],[157,1],[159,0],[159,1],[160,1],[160,1],[164,0],[164,1],[165,0],[165,3],[167,0],[167,3],[168,0],[168,1],[170,0],[170,3],[171,0],[171,1],[176,0],[176,1],[296,1],[296,2],[177,0],[177,3],[182,0],[182,3],[186,0],[186,1],[187,1],[187,1],[188,0],[188,3],[190,0],[190,2],[193,1],[193,1],[195,0],[195,3],[197,0],[197,3],[299,1],[299,1],[299,1],[201,0],[201,1],[202,0],[202,1],[206,0],[206,3],[207,0],[207,1],[209,1],[209,2],[212,1],[212,2],[215,0],[215,3],[217,0],[217,3],[220,1],[220,1],[220,1],[220,1],[220,1],[220,1],[221,0],[221,1],[224,0],[224,2],[226,1],[226,1],[228,0],[228,2],[230,0],[230,2],[232,0],[232,2],[234,1],[234,1],[235,0],[235,1],[244,1],[244,1],[244,1],[244,1],[244,1],[247,0],[247,1],[250,0],[250,1],[251,1],[251,1],[253,0],[253,1],[255,0],[255,1],[256,0],[256,1]],performAction:function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$){var $0=$$.length-1;switch(yystate){case 1:$$[$0-1].prefixes=Parser.prefixes;Parser.prefixes=null;base=basePath=baseRoot="";return $$[$0-1];break;case 2:this.$=extend({type:"query"},$$[$0-1],$$[$0]);break;case 3:base=resolveIRI($$[$0]);basePath=base.replace(/[^\/]*$/,"");baseRoot=base.match(/^(?:[a-z]+:\/*)?[^\/]*/)[0];break;case 4:if(!Parser.prefixes)Parser.prefixes={};$$[$0-1]=$$[$0-1].substr(0,$$[$0-1].length-1);$$[$0]=resolveIRI($$[$0]);Parser.prefixes[$$[$0-1]]=$$[$0];break;case 5:this.$=extend($$[$0-3],groupDatasets($$[$0-2]),$$[$0-1],$$[$0]);break;case 6:this.$=extend({type:"query"},$$[$0-3],$$[$0-2],$$[$0-1],$$[$0]);break;case 7:this.$=extend({queryType:"SELECT",variables:$$[$0]==="*"?["*"]:$$[$0]},$$[$0-1]&&($$[$0-2]=lowercase($$[$0-1]),$$[$0-1]={},$$[$0-1][$$[$0-2]]=true,$$[$0-1]));break;case 8:case 89:case 121:case 146:this.$=toVar($$[$0]);break;case 9:case 21:this.$=expression($$[$0-3],{variable:toVar($$[$0-1])});break;case 10:this.$=extend({queryType:"CONSTRUCT",template:$$[$0-3]},groupDatasets($$[$0-2]),$$[$0-1],$$[$0]);break;case 11:this.$=extend({queryType:"CONSTRUCT",template:$$[$0-2]=$$[$0-2]?$$[$0-2].triples:[]},groupDatasets($$[$0-5]),{where:[{type:"bgp",triples:appendAllTo([],$$[$0-2])}]},$$[$0]);break;case 12:this.$=extend({queryType:"DESCRIBE",variables:$$[$0-3]==="*"?["*"]:$$[$0-3].map(toVar)},groupDatasets($$[$0-2]),$$[$0-1],$$[$0]);break;case 13:this.$=extend({queryType:"ASK"},groupDatasets($$[$0-2]),$$[$0-1],$$[$0]);break;case 14:case 52:this.$={iri:$$[$0],named:!!$$[$0-1]};break;case 15:this.$={where:$$[$0].patterns};break;case 16:this.$=extend($$[$0-3],$$[$0-2],$$[$0-1],$$[$0]);break;case 17:this.$={group:$$[$0]};break;case 18:case 19:case 25:case 27:this.$=expression($$[$0]);break;case 20:this.$=expression($$[$0-1]);break;case 22:case 28:this.$=expression(toVar($$[$0]));break;case 23:this.$={having:$$[$0]};break;case 24:this.$={order:$$[$0]};break;case 26:this.$=expression($$[$0],{descending:true});break;case 29:this.$={limit:toInt($$[$0])};break;case 30:this.$={offset:toInt($$[$0])};break;case 31:this.$={limit:toInt($$[$0-2]),offset:toInt($$[$0])};break;case 32:this.$={limit:toInt($$[$0]),offset:toInt($$[$0-2])};break;case 33:this.$={type:"values",values:$$[$0]};break;case 34:$$[$0-3]=toVar($$[$0-3]);this.$=$$[$0-1].map(function(v){var o={};o[$$[$0-3]]=v;return o});break;case 35:var length=$$[$0-4].length;$$[$0-4]=$$[$0-4].map(toVar);this.$=$$[$0-1].map(function(values){if(values.length!==length)throw Error("Inconsistent VALUES length");var valuesObject={};for(var i=0;i<length;i++)valuesObject[$$[$0-4][i]]=values[i];return valuesObject});break;case 38:this.$=undefined;break;case 39:case 62:case 82:case 105:case 147:this.$=$$[$0-1];break;case 40:this.$={type:"update",updates:appendTo($$[$0-1],$$[$0])};break;case 41:this.$=extend({type:"load",silent:!!$$[$0-2],source:$$[$0-1]},$$[$0]&&{destination:$$[$0]});break;case 42:this.$={type:lowercase($$[$0-2]),silent:!!$$[$0-1],graph:$$[$0]};break;case 43:this.$={type:lowercase($$[$0-4]),silent:!!$$[$0-3],source:$$[$0-2],destination:$$[$0]};break;case 44:this.$={type:"create",silent:!!$$[$0-2],graph:$$[$0-1]};break;case 45:this.$={updateType:"insert",insert:$$[$0]};break;case 46:this.$={updateType:"delete","delete":$$[$0]};break;case 47:this.$={updateType:"deletewhere","delete":$$[$0]};break;case 48:this.$=extend({updateType:"insertdelete"},$$[$0-5],{insert:$$[$0-4]||[]},{"delete":$$[$0-3]||[]},groupDatasets($$[$0-2]),{where:$$[$0].patterns});break;case 49:this.$=extend({updateType:"insertdelete"},$$[$0-5],{"delete":$$[$0-4]||[]},{insert:$$[$0-3]||[]},groupDatasets($$[$0-2]),{where:$$[$0].patterns});break;case 50:case 51:case 54:case 138:this.$=$$[$0];break;case 53:this.$={graph:$$[$0]};break;case 55:this.$={type:"graph","default":true};break;case 56:case 57:this.$={type:"graph",name:$$[$0]};break;case 58:this.$={};this.$[lowercase($$[$0])]=true;break;case 59:this.$=$$[$0-2]?unionAll($$[$0-1],[$$[$0-2]]):unionAll($$[$0-1]);break;case 60:var graph=extend($$[$0-3]||{triples:[]},{type:"graph",name:toVar($$[$0-5])});this.$=$$[$0]?[graph,$$[$0]]:[graph];break;case 61:case 66:this.$={type:"bgp",triples:unionAll($$[$0-2],[$$[$0-1]])};break;case 63:if($$[$0-1].length>1){var groups=[],currentBgp,filters=[];for(var i=0,group;group=$$[$0-1][i];i++){switch(group.type){case"bgp":if(group.triples.length){if(!currentBgp)appendTo(groups,currentBgp=group);else appendAllTo(currentBgp.triples,group.triples)}break;case"filter":appendTo(filters,group);break;default:if(!group.patterns||group.patterns.length>0){appendTo(groups,group);currentBgp=null}}}$$[$0-1]=appendAllTo(groups,filters)}this.$={type:"group",patterns:$$[$0-1]};break;case 64:this.$=$$[$0-1]?unionAll([$$[$0-1]],$$[$0]):unionAll($$[$0]);break;case 65:this.$=$$[$0]?[$$[$0-2],$$[$0]]:$$[$0-2];break;case 67:this.$=$$[$0-1].length?{type:"union",patterns:unionAll($$[$0-1].map(degroupSingle),[degroupSingle($$[$0])])}:degroupSingle($$[$0]);break;case 68:this.$=extend($$[$0],{type:"optional"});break;case 69:this.$=extend($$[$0],{type:"minus"});break;case 70:this.$=extend($$[$0],{type:"graph",name:toVar($$[$0-1])});break;case 71:this.$=extend($$[$0],{type:"service",name:toVar($$[$0-1]),silent:!!$$[$0-2]});break;case 72:this.$={type:"filter",expression:$$[$0]};break;case 73:this.$={type:"bind",variable:toVar($$[$0-1]),expression:$$[$0-3]};break;case 78:this.$={type:"functionCall","function":$$[$0-1],args:[]};break;case 79:this.$={type:"functionCall","function":$$[$0-5],args:appendTo($$[$0-2],$$[$0-1]),distinct:!!$$[$0-3]};break;case 80:case 96:case 107:case 187:case 197:case 209:case 211:case 221:case 225:case 245:case 247:case 249:case 251:case 253:case 274:case 280:case 291:case 301:case 307:case 313:case 317:case 327:case 329:case 333:case 341:case 343:case 349:case 351:case 355:case 357:case 366:case 374:case 376:case 386:case 390:case 392:case 394:this.$=[];break;case 81:this.$=appendTo($$[$0-2],$$[$0-1]);break;case 83:this.$=unionAll($$[$0-2],[$$[$0-1]]);break;case 84:case 93:this.$=$$[$0].map(function(t){return extend(triple($$[$0-1]),t)});break;case 85:this.$=appendAllTo($$[$0].map(function(t){return extend(triple($$[$0-1].entity),t)}),$$[$0-1].triples);break;case 87:this.$=unionAll($$[$0-1],[$$[$0]]);break;case 88:this.$=objectListToTriples($$[$0-1],$$[$0]);break;case 91:case 103:case 110:this.$=RDF_TYPE;break;case 92:this.$=appendTo($$[$0-1],$$[$0]);break;case 94:this.$=!$$[$0]?$$[$0-1].triples:appendAllTo($$[$0].map(function(t){return extend(triple($$[$0-1].entity),t)}),$$[$0-1].triples);break;case 95:this.$=objectListToTriples(toVar($$[$0-3]),appendTo($$[$0-2],$$[$0-1]),$$[$0]);break;case 97:this.$=objectListToTriples(toVar($$[$0-1]),$$[$0]);break;case 98:this.$=$$[$0-1].length?path("|",appendTo($$[$0-1],$$[$0])):$$[$0];break;case 99:this.$=$$[$0-1].length?path("/",appendTo($$[$0-1],$$[$0])):$$[$0];break;case 100:this.$=$$[$0]?path($$[$0],[$$[$0-1]]):$$[$0-1];break;case 101:this.$=$$[$0-1]?path($$[$0-1],[$$[$0]]):$$[$0];break;case 104:case 111:this.$=path($$[$0-1],[$$[$0]]);break;case 108:this.$=path("|",appendTo($$[$0-2],$$[$0-1]));break;case 112:this.$=path($$[$0-1],[RDF_TYPE]);break;case 113:case 115:this.$=createList($$[$0-1]);break;case 114:case 116:this.$=createAnonymousObject($$[$0-1]);break;case 117:this.$={entity:$$[$0],triples:[]};break;case 119:this.$={entity:$$[$0],triples:[]};break;case 125:this.$=blank();break;case 126:this.$=RDF_NIL;break;case 127:this.$=$$[$0-1].length?operation("||",appendTo($$[$0-1],$$[$0])):$$[$0];break;case 128:this.$=$$[$0-1].length?operation("&&",appendTo($$[$0-1],$$[$0])):$$[$0];break;case 130:this.$=operation($$[$0-1],[$$[$0-2],$$[$0]]);break;case 131:this.$=operation($$[$0-2]?"notin":"in",[$$[$0-3],$$[$0]]);break;case 132:case 136:this.$=createOperationTree($$[$0-1],$$[$0]);break;case 133:case 137:this.$=[$$[$0-1],$$[$0]];break;case 134:this.$=["+",createOperationTree($$[$0-1],$$[$0])];break;case 135:this.$=["-",createOperationTree($$[$0-1].replace("-",""),$$[$0])];break;case 139:this.$=operation($$[$0-1],[$$[$0]]);break;case 140:this.$=operation("UMINUS",[$$[$0]]);break;case 149:this.$=operation(lowercase($$[$0-1]));break;case 150:this.$=operation(lowercase($$[$0-3]),[$$[$0-1]]);break;case 151:this.$=operation(lowercase($$[$0-5]),[$$[$0-3],$$[$0-1]]);break;case 152:this.$=operation(lowercase($$[$0-7]),[$$[$0-5],$$[$0-3],$$[$0-1]]);break;case 153:this.$=operation(lowercase($$[$0-1]),$$[$0]);break;case 154:this.$=operation("bound",[toVar($$[$0-1])]);break;case 155:this.$=operation($$[$0-1],[]);break;case 156:this.$=operation($$[$0-3],[$$[$0-1]]);break;case 157:this.$=operation($$[$0-2]?"notexists":"exists",[degroupSingle($$[$0])]);break;case 158:case 159:this.$=expression($$[$0-1],{type:"aggregate",aggregation:lowercase($$[$0-4]),distinct:!!$$[$0-2]});break;case 160:this.$=expression($$[$0-2],{type:"aggregate",aggregation:lowercase($$[$0-5]),distinct:!!$$[$0-3],separator:$$[$0-1]||" "});break;case 161:this.$=$$[$0].substr(1,$$[$0].length-2);break;case 163:this.$=$$[$0-1]+lowercase($$[$0]);break;case 164:this.$=$$[$0-2]+"^^"+$$[$0];break;case 165:case 179:this.$=createLiteral($$[$0],XSD_INTEGER);break;case 166:case 180:this.$=createLiteral($$[$0],XSD_DECIMAL);break;case 167:case 181:this.$=createLiteral(lowercase($$[$0]),XSD_DOUBLE);break;case 170:this.$=XSD_TRUE;break;case 171:this.$=XSD_FALSE;break;case 172:case 173:this.$=unescapeString($$[$0],1);break;case 174:case 175:this.$=unescapeString($$[$0],3);break;case 176:this.$=createLiteral($$[$0].substr(1),XSD_INTEGER);break;case 177:this.$=createLiteral($$[$0].substr(1),XSD_DECIMAL);break;case 178:this.$=createLiteral($$[$0].substr(1).toLowerCase(),XSD_DOUBLE);break;case 182:this.$=resolveIRI($$[$0]);break;case 183:var namePos=$$[$0].indexOf(":"),prefix=$$[$0].substr(0,namePos),expansion=Parser.prefixes[prefix];if(!expansion)throw new Error("Unknown prefix: "+prefix);this.$=resolveIRI(expansion+$$[$0].substr(namePos+1));break;case 184:$$[$0]=$$[$0].substr(0,$$[$0].length-1);if(!($$[$0]in Parser.prefixes))throw new Error("Unknown prefix: "+$$[$0]);this.$=resolveIRI(Parser.prefixes[$$[$0]]);break;case 188:case 198:case 206:case 210:case 212:case 218:case 222:case 226:case 240:case 242:case 244:case 246:case 248:case 250:case 252:case 275:case 281:case 292:case 308:case 340:case 352:case 371:case 373:case 387:case 391:case 393:case 395:$$[$0-1].push($$[$0]);break;case 205:case 217:case 239:case 241:case 243:case 339:case 370:case 372:this.$=[$$[$0]];break;case 254:case 302:case 314:case 318:case 328:case 330:case 334:case 342:case 344:case 350:case 356:case 358:case 367:case 375:case 377:$$[$0-2].push($$[$0-1]);break}},table:[o($V0,[2,187],{3:1,4:2}),{1:[3]},o($V1,[2,253],{5:3,278:4,7:5,92:6,10:7,13:8,8:9,93:10,16:13,32:14,41:15,46:16,17:17,11:[1,11],14:[1,12],23:$V2,33:[1,18],42:[1,19],47:[1,20]}),{6:[1,22]},o($V0,[2,188]),{6:[2,189]},{6:[2,190]},o($V0,[2,185]),o($V0,[2,186]),{6:[2,195],9:23,81:24,82:$V3},{94:26,95:[1,27],98:28,101:29,105:[1,30],108:[1,31],110:[1,32],111:[1,33],112:34,116:35,120:[2,276],121:[2,270],125:41,126:[1,42],288:[1,36],289:[1,37],290:[1,38],291:[1,39],292:[1,40]},{12:[1,43]},{15:[1,44]},o($V4,[2,191]),o($V4,[2,192]),o($V4,[2,193]),o($V4,[2,194]),o($V5,[2,197],{18:45}),o($V6,[2,211],{34:46,36:47,38:[1,48]}),{12:$V7,15:$V8,27:$V9,43:49,52:54,277:$Va,283:[1,51],284:52,285:50},o($V5,[2,225],{48:58}),o($Vb,[2,203],{24:59,279:60,280:[1,61],281:[1,62]}),{1:[2,1]},{6:[2,2]},{6:[2,196]},{27:[1,64],28:[1,65],83:63},{6:[2,40],192:[1,66]},o($Vc,[2,255],{96:67,287:[1,68]}),o($Vd,[2,261],{99:69,287:[1,70]}),o($Ve,[2,266],{102:71,287:[1,72]}),{106:73,107:[2,268],287:[1,74]},{38:$Vf,109:75},{38:$Vf,109:77},{38:$Vf,109:78},{113:79,121:$Vg},{117:81,120:$Vh},o($Vi,[2,259]),o($Vi,[2,260]),o($Vj,[2,263]),o($Vj,[2,264]),o($Vj,[2,265]),{120:[2,277],121:[2,271]},{12:$V7,15:$V8,52:83,277:$Va},o($V0,[2,3]),{12:[1,84]},{19:85,37:$Vk,38:$Vl,49:86,50:$Vm,53:87},o($V5,[2,209],{35:90}),{37:[1,91],49:92,50:$Vm},o($Vn,[2,333],{168:93,169:94,170:95,40:[2,331]}),o($Vo,[2,221],{44:96}),o($Vo,[2,219],{52:54,284:97,12:$V7,15:$V8,27:$V9,277:$Va}),o($Vo,[2,220]),o($Vp,[2,217]),o($Vp,[2,215]),o($Vp,[2,216]),o($Vq,[2,182]),o($Vq,[2,183]),o($Vq,[2,184]),{19:98,37:$Vk,38:$Vl,49:99,50:$Vm,53:87},{25:100,26:103,27:$Vr,28:$Vs,282:101,283:[1,102]},o($Vb,[2,204]),o($Vb,[2,201]),o($Vb,[2,202]),o($Vt,[2,33]),{38:[1,106]},o($Vu,[2,247],{85:107}),o($V1,[2,254]),{12:$V7,15:$V8,52:108,277:$Va},o($Vc,[2,256]),{100:109,107:[1,110],129:[1,112],131:111,286:[1,113],293:[1,114]},o($Vd,[2,262]),o($Vc,$Vv,{103:115,130:117,107:$Vw,129:$Vx}),o($Ve,[2,267]),{107:[1,119]},{107:[2,269]},o($Vy,[2,45]),o($Vn,$Vz,{132:120,139:121,140:122,40:$VA,107:$VA}),o($Vy,[2,46]),o($Vy,[2,47]),o($VB,[2,272],{114:123,117:124,120:$Vh}),{38:$Vf,109:125},o($VB,[2,278],{118:126,113:127,121:$Vg}),{38:$Vf,109:128},o([120,121],[2,53]),o($V0,[2,4]),o($VC,$VD,{20:129,55:130,59:131,60:$VE}),o($V5,[2,198]),{38:$VF,54:133},o($Vc,[2,227],{51:135,286:[1,136]}),{38:[2,230]},{19:137,37:$Vk,38:$Vl,49:138,50:$Vm,53:87},{38:[1,139]},o($V6,[2,212]),{40:[1,140]},{40:[2,332]},{12:$V7,15:$V8,27:$VG,28:$VH,52:145,79:$VI,88:146,141:141,163:$VJ,172:142,174:143,210:$VK,213:$VL,214:$VM,227:156,229:157,260:152,263:$VN,264:$VO,265:$VP,266:$VQ,267:$VR,268:$VS,269:$VT,270:$VU,271:$VV,272:$VW,273:$VX,274:$VY,275:$VZ,276:$V_,277:$Va},o($V$,[2,223],{53:87,45:170,49:171,19:172,37:$Vk,38:$Vl,50:$Vm}),o($Vp,[2,218]),o($VC,$VD,{55:130,59:131,20:173,60:$VE}),o($V5,[2,226]),o($V5,[2,7]),o($V5,[2,207],{26:174,27:$Vr,28:$Vs}),o($V5,[2,208]),o($V01,[2,205]),o($V01,[2,8]),o($V11,$V21,{29:175,215:176}),o($V31,[2,245],{84:177}),{27:[1,179],31:[1,178]},o($Vy,[2,257],{97:180,127:181,128:[1,182]}),o($Vy,[2,42]),{12:$V7,15:$V8,52:183,277:$Va},o($Vy,[2,58]),o($Vy,[2,286]),o($Vy,[2,287]),o($Vy,[2,288]),{104:[1,184]},o($V41,[2,55]),{12:$V7,15:$V8,52:185,277:$Va},o($Vc,[2,285]),{12:$V7,15:$V8,52:186,277:$Va},o($V51,[2,291],{133:187}),o($V51,[2,290]),{12:$V7,15:$V8,27:$VG,28:$VH,52:145,79:$VI,88:146,141:188,163:$VJ,172:142,174:143,210:$VK,213:$VL,214:$VM,227:156,229:157,260:152,263:$VN,264:$VO,265:$VP,266:$VQ,267:$VR,268:$VS,269:$VT,270:$VU,271:$VV,272:$VW,273:$VX,274:$VY,275:$VZ,276:$V_,277:$Va},o($VB,[2,274],{115:189}),o($VB,[2,273]),o([37,120,123],[2,51]),o($VB,[2,280],{119:190}),o($VB,[2,279]),o([37,121,123],[2,50]),o($V4,[2,5]),o($V61,[2,233],{56:191,66:192,67:[1,193]}),o($VC,[2,232]),{61:[1,194]},o([6,40,60,67,70,78,80,82],[2,15]),o($Vn,$V71,{21:195,143:196,17:197,144:198,150:199,151:200,23:$V2,38:$V81,40:$V81,82:$V81,107:$V81,155:$V81,156:$V81,158:$V81,161:$V81,162:$V81}),{12:$V7,15:$V8,52:201,277:$Va},o($Vc,[2,228]),o($VC,$VD,{55:130,59:131,20:202,60:$VE}),o($V5,[2,210]),o($Vn,$Vz,{140:122,39:203,139:204,40:[2,213]}),o($V5,[2,82]),{40:[2,335],171:205,294:[1,206]},o($V91,$Va1,{173:207,177:208}),o($V91,$Va1,{177:208,175:209,176:210,173:211,40:$Vb1,107:$Vb1,294:$Vb1}),o($Vc1,[2,121]),o($Vc1,[2,122]),o($Vc1,[2,123]),o($Vc1,[2,124]),o($Vc1,[2,125]),o($Vc1,[2,126]),{12:$V7,15:$V8,27:$VG,28:$VH,52:145,79:$VI,88:146,163:$VJ,172:214,174:215,183:213,209:212,210:$VK,213:$VL,214:$VM,227:156,229:157,260:152,263:$VN,264:$VO,265:$VP,266:$VQ,267:$VR,268:$VS,269:$VT,270:$VU,271:$VV,272:$VW,273:$VX,274:$VY,275:$VZ,276:$V_,277:$Va},o($V91,$Va1,{177:208,173:216}),o($Vd1,[2,162],{261:[1,217],262:[1,218]}),o($Vd1,[2,165]),o($Vd1,[2,166]),o($Vd1,[2,167]),o($Vd1,[2,168]),o($Vd1,[2,169]),o($Vd1,[2,170]),o($Vd1,[2,171]),o($Ve1,[2,172]),o($Ve1,[2,173]),o($Ve1,[2,174]),o($Ve1,[2,175]),o($Vd1,[2,176]),o($Vd1,[2,177]),o($Vd1,[2,178]),o($Vd1,[2,179]),o($Vd1,[2,180]),o($Vd1,[2,181]),o($VC,$VD,{55:130,59:131,20:219,60:$VE}),o($Vo,[2,222]),o($V$,[2,224]),o($V4,[2,13]),o($V01,[2,206]),{30:[1,220]},o($V11,[2,376],{216:221,217:222}),{12:$V7,15:$V8,40:[1,223],52:225,79:$VI,87:224,88:226,89:$Vf1,227:156,229:157,260:152,263:$VN,264:$VO,265:$VP,266:$VQ,267:$VR,268:$VS,269:$VT,270:$VU,271:$VV,272:$VW,273:$VX,274:$VY,275:$VZ,276:$V_,277:$Va},{38:[1,228]},o($Vu,[2,248]),o($Vy,[2,41]),o($Vy,[2,258]),{107:[1,229]},o($Vy,[2,57]),o($Vc,$Vv,{130:117,103:230,107:$Vw,129:$Vx}),o($V41,[2,56]),o($Vy,[2,44]),{40:[1,231],107:[1,233],134:232},o($V51,[2,303],{142:234,294:[1,235]}),{37:[1,236],122:237,123:$Vg1},{37:[1,239],122:240,123:$Vg1},o($Vh1,[2,235],{57:241,69:242,70:[1,243]}),o($V61,[2,234]),{12:$V7,15:$V8,28:$Vi1,52:259,64:247,65:248,68:244,74:246,76:245,238:250,239:$Vj1,240:$Vk1,241:$Vl1,243:$Vm1,244:255,245:$Vn1,246:$Vo1,247:258,248:$Vp1,249:$Vq1,252:$Vr1,254:$Vs1,277:$Va,309:$Vt1,310:$Vu1,311:$Vv1,312:$Vw1,313:$Vx1,314:$Vy1},{12:$V7,15:$V8,27:$Vz1,28:$VA1,52:259,62:269,63:270,64:271,65:272,238:250,239:$Vj1,240:$Vk1,241:$Vl1,243:$Vm1,244:255,245:$Vn1,246:$Vo1,247:258,248:$Vp1,249:$Vq1,252:$Vr1,254:$Vs1,277:$Va,309:$Vt1,310:$Vu1,311:$Vv1,312:$Vw1,313:$Vx1,314:$Vy1},{40:[1,275]},{40:[1,276]},{19:277,37:$Vk,38:$Vl,53:87},o($VB1,[2,307],{145:278}),o($VB1,[2,306]),{12:$V7,15:$V8,27:$VG,28:$VC1,52:145,79:$VI,88:146,152:279,163:$VJ,172:280,185:281,210:$VD1,213:$VL,214:$VM,227:156,229:157,260:152,263:$VN,264:$VO,265:$VP,266:$VQ,267:$VR,268:$VS,269:$VT,270:$VU,271:$VV,272:$VW,273:$VX,274:$VY,275:$VZ,276:$V_,277:$Va},o($Vo,[2,14]),o($V4,[2,10]),{40:[1,284]},{40:[2,214]},{40:[2,83]},o($Vn,[2,334],{40:[2,336]}),o($VE1,[2,84]),{12:$V7,15:$V8,27:[1,287],52:288,178:285,179:286,181:[1,289],277:$Va},o($VE1,[2,85]),o($VE1,[2,86]),o($VE1,[2,338]),{12:$V7,15:$V8,27:$VG,28:$VH,31:[1,290],52:145,79:$VI,88:146,163:$VJ,172:214,174:215,183:291,210:$VK,213:$VL,214:$VM,227:156,229:157,260:152,263:$VN,264:$VO,265:$VP,266:$VQ,267:$VR,268:$VS,269:$VT,270:$VU,271:$VV,272:$VW,273:$VX,274:$VY,275:$VZ,276:$V_,277:$Va},o($VF1,[2,370]),o($VG1,[2,117]),o($VG1,[2,118]),{211:[1,292]},o($Vd1,[2,163]),{12:$V7,15:$V8,52:293,277:$Va},o($V4,[2,12]),{27:[1,294]},o([30,31,192,242],[2,127],{302:[1,295]}),o($VH1,$VI1,{218:296,219:297,223:298,231:299,235:300,203:$VJ1,237:$VK1,301:$VL1}),o($Vt,[2,34]),o($V31,[2,246]),o($VM1,[2,36]),o($VM1,[2,37]),o($VM1,[2,38]),o($VN1,[2,249],{86:304}),{12:$V7,15:$V8,52:305,277:$Va},o($Vy,[2,43]),o([6,37,120,121,123,192],[2,59]),o($V51,[2,292]),{12:$V7,15:$V8,27:[1,307],52:308,135:306,277:$Va},o($V51,[2,61]),o($Vn,[2,302],{40:$VO1,107:$VO1}),{38:$VF,54:309},o($VB,[2,275]),o($Vc,[2,282],{124:310,286:[1,311]}),{38:$VF,54:312},o($VB,[2,281]),o($VP1,[2,237],{58:313,77:314,78:[1,315],80:[1,316]}),o($Vh1,[2,236]),{61:[1,317]},o($V61,[2,23],{74:246,64:247,65:248,238:250,244:255,247:258,52:259,76:318,12:$V7,15:$V8,28:$Vi1,239:$Vj1,240:$Vk1,241:$Vl1,243:$Vm1,245:$Vn1,246:$Vo1,248:$Vp1,249:$Vq1,252:$Vr1,254:$Vs1,277:$Va,309:$Vt1,310:$Vu1,311:$Vv1,312:$Vw1,313:$Vx1,314:$Vy1}),o($VQ1,[2,241]),o($VR1,[2,75]),o($VR1,[2,76]),o($VR1,[2,77]),o($V11,$V21,{215:176,29:319}),o($VS1,[2,148]),{163:[1,320]},{28:[1,321]},{28:[1,322]},{28:[1,323]},{28:$VT1,163:$VU1,166:324},{28:[1,327]},{28:[1,329],163:[1,328]},{248:[1,330]},{28:$VV1,163:$VW1},{28:[1,333]},{28:[1,334]},{28:[1,335]},o($VX1,[2,400]),o($VX1,[2,401]),o($VX1,[2,402]),o($VX1,[2,403]),o($VX1,[2,404]),{248:[2,406]},o($VC,[2,17],{238:250,244:255,247:258,52:259,64:271,65:272,63:336,12:$V7,15:$V8,27:$Vz1,28:$VA1,239:$Vj1,240:$Vk1,241:$Vl1,243:$Vm1,245:$Vn1,246:$Vo1,248:$Vp1,249:$Vq1,252:$Vr1,254:$Vs1,277:$Va,309:$Vt1,310:$Vu1,311:$Vv1,312:$Vw1,313:$Vx1,314:$Vy1}),o($VY1,[2,239]),o($VY1,[2,18]),o($VY1,[2,19]),o($V11,$V21,{215:176,29:337}),o($VY1,[2,22]),o($VZ1,[2,62]),o($VZ1,[2,63]),o($VC,$VD,{55:130,59:131,20:338,60:$VE}),{38:[2,317],40:[2,64],81:348,82:$V3,107:[1,344],146:339,147:340,154:341,155:[1,342],156:[1,343],158:[1,345],161:[1,346],162:[1,347]},o($VB1,[2,315],{153:349,294:[1,350]}),o($V_1,$V$1,{184:351,187:352,194:353,195:355,27:$V02}),o($V12,[2,345],{187:352,194:353,195:355,186:356,184:357,12:$V$1,15:$V$1,28:$V$1,181:$V$1,203:$V$1,208:$V$1,277:$V$1,27:$V02}),{12:$V7,15:$V8,27:$VG,28:$VC1,52:145,79:$VI,88:146,163:$VJ,172:360,185:361,189:359,210:$VD1,212:358,213:$VL,214:$VM,227:156,229:157,260:152,263:$VN,264:$VO,265:$VP,266:$VQ,267:$VR,268:$VS,269:$VT,270:$VU,271:$VV,272:$VW,273:$VX,274:$VY,275:$VZ,276:$V_,277:$Va},o($V_1,$V$1,{187:352,194:353,195:355,184:362,27:$V02}),o($VC,$VD,{55:130,59:131,20:363,60:$VE}),o([40,107,211,294],[2,87],{296:364,192:[1,365]}),o($Vn,$V22,{180:366,182:367}),o($Vn,[2,89]),o($Vn,[2,90]),o($Vn,[2,91]),o($V32,[2,113]),o($VF1,[2,371]),o($V32,[2,114]),o($Vd1,[2,164]),{31:[1,368]},o($V11,[2,375]),o([30,31,192,242,302],[2,128],{303:[1,369]}),o($V42,[2,129],{220:370,221:371,222:[2,384],259:[1,372],304:[1,373],305:[1,374],306:[1,375],307:[1,376],308:[1,377],309:[1,378]}),o($V52,[2,386],{224:379}),o($V62,[2,394],{232:380}),{12:$V7,15:$V8,27:$V72,28:$Vi1,52:384,64:383,65:385,74:382,79:$VI,88:386,227:156,229:157,236:381,238:250,239:$Vj1,240:$Vk1,241:$Vl1,243:$Vm1,244:255,245:$Vn1,246:$Vo1,247:258,248:$Vp1,249:$Vq1,252:$Vr1,254:$Vs1,260:152,263:$VN,264:$VO,265:$VP,266:$VQ,267:$VR,268:$VS,269:$VT,270:$VU,271:$VV,272:$VW,273:$VX,274:$VY,275:$VZ,276:$V_,277:$Va,309:$Vt1,310:$Vu1,311:$Vv1,312:$Vw1,313:$Vx1,314:$Vy1},{12:$V7,15:$V8,27:$V72,28:$Vi1,52:384,64:383,65:385,74:382,79:$VI,88:386,227:156,229:157,236:388,238:250,239:$Vj1,240:$Vk1,241:$Vl1,243:$Vm1,244:255,245:$Vn1,246:$Vo1,247:258,248:$Vp1,249:$Vq1,252:$Vr1,254:$Vs1,260:152, | |
263:$VN,264:$VO,265:$VP,266:$VQ,267:$VR,268:$VS,269:$VT,270:$VU,271:$VV,272:$VW,273:$VX,274:$VY,275:$VZ,276:$V_,277:$Va,309:$Vt1,310:$Vu1,311:$Vv1,312:$Vw1,313:$Vx1,314:$Vy1},{12:$V7,15:$V8,27:$V72,28:$Vi1,52:384,64:383,65:385,74:382,79:$VI,88:386,227:156,229:157,236:389,238:250,239:$Vj1,240:$Vk1,241:$Vl1,243:$Vm1,244:255,245:$Vn1,246:$Vo1,247:258,248:$Vp1,249:$Vq1,252:$Vr1,254:$Vs1,260:152,263:$VN,264:$VO,265:$VP,266:$VQ,267:$VR,268:$VS,269:$VT,270:$VU,271:$VV,272:$VW,273:$VX,274:$VY,275:$VZ,276:$V_,277:$Va,309:$Vt1,310:$Vu1,311:$Vv1,312:$Vw1,313:$Vx1,314:$Vy1},o($VH1,[2,399]),{28:[1,392],40:[1,390],90:391},o($Vy,[2,54]),{38:[1,393]},{38:[2,293]},{38:[2,294]},o($Vy,[2,48]),{12:$V7,15:$V8,52:394,277:$Va},o($Vc,[2,283]),o($Vy,[2,49]),o($VP1,[2,16]),o($VP1,[2,238]),{79:[1,395]},{79:[1,396]},{12:$V7,15:$V8,27:$V82,28:$Vi1,52:259,64:247,65:248,71:397,72:398,73:$V92,74:246,75:$Va2,76:401,238:250,239:$Vj1,240:$Vk1,241:$Vl1,243:$Vm1,244:255,245:$Vn1,246:$Vo1,247:258,248:$Vp1,249:$Vq1,252:$Vr1,254:$Vs1,277:$Va,309:$Vt1,310:$Vu1,311:$Vv1,312:$Vw1,313:$Vx1,314:$Vy1},o($VQ1,[2,242]),{31:[1,403]},o($VS1,[2,149]),o($V11,$V21,{215:176,29:404}),o($V11,$V21,{215:176,29:405}),o($V11,$V21,{215:176,29:406}),o($VS1,[2,153]),o($VS1,[2,80]),o($V11,[2,329],{167:407}),{27:[1,408]},o($VS1,[2,155]),o($V11,$V21,{215:176,29:409}),{38:$VF,54:410},o($VS1,[2,78]),o($V11,[2,325],{164:411,280:[1,412]}),o($Vb2,[2,407],{250:413,280:[1,414]}),o($V11,[2,411],{253:415,280:[1,416]}),o($V11,[2,413],{255:417,280:[1,418]}),o($VY1,[2,240]),{30:[1,420],31:[1,419]},{22:421,40:[2,199],81:422,82:$V3},o($VB1,[2,308]),o($Vc2,[2,309],{148:423,294:[1,424]}),{38:$VF,54:425},{38:$VF,54:426},{38:$VF,54:427},{12:$V7,15:$V8,27:[1,429],52:430,157:428,277:$Va},o($Vd2,[2,321],{159:431,287:[1,432]}),{12:$V7,15:$V8,28:$Vi1,52:259,64:247,65:248,74:246,76:433,238:250,239:$Vj1,240:$Vk1,241:$Vl1,243:$Vm1,244:255,245:$Vn1,246:$Vo1,247:258,248:$Vp1,249:$Vq1,252:$Vr1,254:$Vs1,277:$Va,309:$Vt1,310:$Vu1,311:$Vv1,312:$Vw1,313:$Vx1,314:$Vy1},{28:[1,434]},o($Ve2,[2,74]),o($VB1,[2,66]),o($Vn,[2,314],{38:$Vf2,40:$Vf2,82:$Vf2,107:$Vf2,155:$Vf2,156:$Vf2,158:$Vf2,161:$Vf2,162:$Vf2}),o($V12,[2,93]),o($Vn,[2,349],{188:435}),o($Vn,[2,347]),o($Vn,[2,348]),o($V_1,[2,357],{196:436,197:437}),o($V12,[2,94]),o($V12,[2,346]),{12:$V7,15:$V8,27:$VG,28:$VC1,31:[1,438],52:145,79:$VI,88:146,163:$VJ,172:360,185:361,189:439,210:$VD1,213:$VL,214:$VM,227:156,229:157,260:152,263:$VN,264:$VO,265:$VP,266:$VQ,267:$VR,268:$VS,269:$VT,270:$VU,271:$VV,272:$VW,273:$VX,274:$VY,275:$VZ,276:$V_,277:$Va},o($VF1,[2,372]),o($VG1,[2,119]),o($VG1,[2,120]),{211:[1,440]},o($V4,[2,11]),o($V91,[2,342],{192:[1,441]}),o($Vg2,[2,339]),o([40,107,192,211,294],[2,88]),{12:$V7,15:$V8,27:$VG,28:$VH,52:145,79:$VI,88:146,163:$VJ,172:214,174:215,183:442,210:$VK,213:$VL,214:$VM,227:156,229:157,260:152,263:$VN,264:$VO,265:$VP,266:$VQ,267:$VR,268:$VS,269:$VT,270:$VU,271:$VV,272:$VW,273:$VX,274:$VY,275:$VZ,276:$V_,277:$Va},o($V01,[2,9]),o($V11,[2,377]),o($VH1,$VI1,{223:298,231:299,235:300,219:443,203:$VJ1,237:$VK1,301:$VL1}),{222:[1,444]},o($V11,[2,378]),o($V11,[2,379]),o($V11,[2,380]),o($V11,[2,381]),o($V11,[2,382]),o($V11,[2,383]),{222:[2,385]},o([30,31,192,222,242,259,302,303,304,305,306,307,308,309],[2,132],{225:445,226:446,227:447,229:448,237:[1,450],271:$VV,272:$VW,273:$VX,274:$VY,275:$VZ,276:$V_,301:[1,449]}),o($V52,[2,136],{233:451,234:452,283:$Vh2,298:$Vi2}),o($V62,[2,138]),o($V62,[2,141]),o($V62,[2,142]),o($V62,[2,143],{28:$VV1,163:$VW1}),o($V62,[2,144]),o($V62,[2,145]),o($V62,[2,146]),o($V62,[2,139]),o($V62,[2,140]),o($Vt,[2,35]),o($VN1,[2,250]),o($Vj2,[2,251],{91:455}),o($Vn,$Vz,{140:122,136:456,139:457,40:[2,295]}),o($VB,[2,52]),o($VP1,[2,29],{80:[1,458]}),o($VP1,[2,30],{78:[1,459]}),o($Vh1,[2,24],{74:246,64:247,65:248,238:250,244:255,247:258,52:259,76:401,72:460,12:$V7,15:$V8,27:$V82,28:$Vi1,73:$V92,75:$Va2,239:$Vj1,240:$Vk1,241:$Vl1,243:$Vm1,245:$Vn1,246:$Vo1,248:$Vp1,249:$Vq1,252:$Vr1,254:$Vs1,277:$Va,309:$Vt1,310:$Vu1,311:$Vv1,312:$Vw1,313:$Vx1,314:$Vy1}),o($Vk2,[2,243]),{28:$Vi1,74:461},{28:$Vi1,74:462},o($Vk2,[2,27]),o($Vk2,[2,28]),o([6,12,15,27,28,30,31,38,40,70,73,75,78,79,80,82,107,155,156,158,161,162,163,192,210,213,214,222,237,239,240,241,242,243,245,246,248,249,252,254,259,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,283,294,298,301,302,303,304,305,306,307,308,309,310,311,312,313,314],[2,147]),{31:[1,463]},{242:[1,464]},{242:[1,465]},o($V11,$V21,{215:176,29:466}),{31:[1,467]},{31:[1,468]},o($VS1,[2,157]),o($V11,[2,327],{165:469}),o($V11,[2,326]),o($V11,$V21,{215:176,251:470,29:472,283:[1,471]}),o($Vb2,[2,408]),o($V11,$V21,{215:176,29:473}),o($V11,[2,412]),o($V11,$V21,{215:176,29:474}),o($V11,[2,414]),o($VY1,[2,20]),{27:[1,475]},{40:[2,6]},{40:[2,200]},o($Vn,$V71,{151:200,149:476,150:477,38:$Vl2,40:$Vl2,82:$Vl2,107:$Vl2,155:$Vl2,156:$Vl2,158:$Vl2,161:$Vl2,162:$Vl2}),o($Vc2,[2,310]),o($Ve2,[2,67],{295:[1,478]}),o($Ve2,[2,68]),o($Ve2,[2,69]),{38:$VF,54:479},{38:[2,319]},{38:[2,320]},{12:$V7,15:$V8,27:[1,481],52:482,160:480,277:$Va},o($Vd2,[2,322]),o($Ve2,[2,72]),o($V11,$V21,{215:176,29:483}),{12:$V7,15:$V8,27:$VG,28:$VC1,52:145,79:$VI,88:146,163:$VJ,172:360,185:361,189:484,210:$VD1,213:$VL,214:$VM,227:156,229:157,260:152,263:$VN,264:$VO,265:$VP,266:$VQ,267:$VR,268:$VS,269:$VT,270:$VU,271:$VV,272:$VW,273:$VX,274:$VY,275:$VZ,276:$V_,277:$Va},o($VF1,[2,98],{297:[1,485]}),o($Vm2,[2,364],{198:486,202:487,208:[1,488]}),o($Vc1,[2,115]),o($VF1,[2,373]),o($Vc1,[2,116]),o($Vg2,[2,340]),o($Vn2,[2,92],{242:[1,489]}),o($V42,[2,130]),{28:$VT1,163:$VU1,166:490},o($V52,[2,387]),o($VH1,$VI1,{231:299,235:300,223:491,203:$VJ1,237:$VK1,301:$VL1}),o($V62,[2,390],{228:492}),o($V62,[2,392],{230:493}),o($V11,[2,388]),o($V11,[2,389]),o($V62,[2,395]),o($VH1,$VI1,{235:300,231:494,203:$VJ1,237:$VK1,301:$VL1}),o($V11,[2,396]),o($V11,[2,397]),{12:$V7,15:$V8,31:[1,495],52:225,79:$VI,87:496,88:226,89:$Vf1,227:156,229:157,260:152,263:$VN,264:$VO,265:$VP,266:$VQ,267:$VR,268:$VS,269:$VT,270:$VU,271:$VV,272:$VW,273:$VX,274:$VY,275:$VZ,276:$V_,277:$Va},{40:[1,497]},{40:[2,296]},{79:[1,498]},{79:[1,499]},o($Vk2,[2,244]),o($Vk2,[2,25]),o($Vk2,[2,26]),o($VS1,[2,150]),o($V11,$V21,{215:176,29:500}),o($V11,$V21,{215:176,29:501}),{31:[1,502],242:[1,503]},o($VS1,[2,154]),o($VS1,[2,156]),o($V11,$V21,{215:176,29:504}),{31:[1,505]},{31:[2,409]},{31:[2,410]},{31:[1,506]},{31:[2,415],192:[1,509],256:507,257:508},{31:[1,510]},o($VB1,[2,65]),o($VB1,[2,312]),{38:[2,318]},o($Ve2,[2,70]),{38:$VF,54:511},{38:[2,323]},{38:[2,324]},{30:[1,512]},o($Vn2,[2,351],{190:513,242:[1,514]}),o($V_1,[2,356]),o([12,15,27,28,31,79,163,210,213,214,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,297],[2,99],{298:[1,515]}),{12:$V7,15:$V8,28:[1,521],52:518,181:[1,519],199:516,200:517,203:[1,520],277:$Va},o($Vm2,[2,365]),o($Vn,[2,344]),o($V42,[2,131]),o($V52,[2,133]),o($V52,[2,134],{234:452,233:522,283:$Vh2,298:$Vi2}),o($V52,[2,135],{234:452,233:523,283:$Vh2,298:$Vi2}),o($V62,[2,137]),o($VN1,[2,39]),o($Vj2,[2,252]),o($Vo2,[2,297],{137:524,294:[1,525]}),o($VP1,[2,31]),o($VP1,[2,32]),{31:[1,526]},{242:[1,527]},o($VS1,[2,81]),o($V11,[2,330]),{31:[1,528],242:[1,529]},o($VS1,[2,158]),o($VS1,[2,159]),{31:[1,530]},{31:[2,416]},{258:[1,531]},o($VY1,[2,21]),o($Ve2,[2,71]),{27:[1,532]},o([38,40,82,107,155,156,158,161,162,211,294],[2,95],{191:533,192:[1,534]}),o($Vn,[2,350]),o($V_1,[2,358]),o($Vp2,[2,101]),o($Vp2,[2,362],{201:535,299:536,283:[1,538],300:[1,537],301:[1,539]}),o($Vq2,[2,102]),o($Vq2,[2,103]),{12:$V7,15:$V8,28:[1,543],52:544,163:[1,542],181:$Vr2,204:540,205:541,208:$Vs2,277:$Va},o($V_1,$V$1,{195:355,194:547}),o($V62,[2,391]),o($V62,[2,393]),o($Vn,$Vz,{140:122,138:548,139:549,40:$Vt2,107:$Vt2}),o($Vo2,[2,298]),o($VS1,[2,151]),o($V11,$V21,{215:176,29:550}),o($VS1,[2,79]),o($V11,[2,328]),o($VS1,[2,160]),{259:[1,551]},{31:[1,552]},o($Vn2,[2,352]),o($Vn2,[2,96],{195:355,193:553,194:554,12:$V$1,15:$V$1,28:$V$1,181:$V$1,203:$V$1,208:$V$1,277:$V$1,27:[1,555]}),o($Vp2,[2,100]),o($Vp2,[2,363]),o($Vp2,[2,359]),o($Vp2,[2,360]),o($Vp2,[2,361]),o($Vq2,[2,104]),o($Vq2,[2,106]),o($Vq2,[2,107]),o($Vu2,[2,366],{206:556}),o($Vq2,[2,109]),o($Vq2,[2,110]),{12:$V7,15:$V8,52:557,181:[1,558],277:$Va},{31:[1,559]},o($V51,[2,60]),o($V51,[2,300]),{31:[1,560]},{260:561,267:$VR,268:$VS,269:$VT,270:$VU},o($Ve2,[2,73]),o($Vn,$V22,{182:367,180:562}),o($Vn,[2,353]),o($Vn,[2,354]),{12:$V7,15:$V8,31:[2,368],52:544,181:$Vr2,205:564,207:563,208:$Vs2,277:$Va},o($Vq2,[2,111]),o($Vq2,[2,112]),o($Vq2,[2,105]),o($VS1,[2,152]),{31:[2,161]},o($Vn2,[2,97]),{31:[1,565]},{31:[2,369],297:[1,566]},o($Vq2,[2,108]),o($Vu2,[2,367])],defaultActions:{5:[2,189],6:[2,190],22:[2,1],23:[2,2],24:[2,196],74:[2,269],89:[2,230],94:[2,332],204:[2,214],205:[2,83],268:[2,406],307:[2,293],308:[2,294],378:[2,385],421:[2,6],422:[2,200],429:[2,319],430:[2,320],457:[2,296],471:[2,409],472:[2,410],478:[2,318],481:[2,323],482:[2,324],508:[2,416],561:[2,161]},parseError:function parseError(str,hash){if(hash.recoverable){this.trace(str)}else{throw new Error(str)}},parse:function parse(input){var self=this,stack=[0],tstack=[],vstack=[null],lstack=[],table=this.table,yytext="",yylineno=0,yyleng=0,recovering=0,TERROR=2,EOF=1;var args=lstack.slice.call(arguments,1);var lexer=Object.create(this.lexer);var sharedState={yy:{}};for(var k in this.yy){if(Object.prototype.hasOwnProperty.call(this.yy,k)){sharedState.yy[k]=this.yy[k]}}lexer.setInput(input,sharedState.yy);sharedState.yy.lexer=lexer;sharedState.yy.parser=this;if(typeof lexer.yylloc=="undefined"){lexer.yylloc={}}var yyloc=lexer.yylloc;lstack.push(yyloc);var ranges=lexer.options&&lexer.options.ranges;if(typeof sharedState.yy.parseError==="function"){this.parseError=sharedState.yy.parseError}else{this.parseError=Object.getPrototypeOf(this).parseError}function popStack(n){stack.length=stack.length-2*n;vstack.length=vstack.length-n;lstack.length=lstack.length-n}_token_stack:function lex(){var token;token=lexer.lex()||EOF;if(typeof token!=="number"){token=self.symbols_[token]||token}return token}var symbol,preErrorSymbol,state,action,a,r,yyval={},p,len,newState,expected;while(true){state=stack[stack.length-1];if(this.defaultActions[state]){action=this.defaultActions[state]}else{if(symbol===null||typeof symbol=="undefined"){symbol=lex()}action=table[state]&&table[state][symbol]}if(typeof action==="undefined"||!action.length||!action[0]){var errStr="";expected=[];for(p in table[state]){if(this.terminals_[p]&&p>TERROR){expected.push("'"+this.terminals_[p]+"'")}}if(lexer.showPosition){errStr="Parse error on line "+(yylineno+1)+":\n"+lexer.showPosition()+"\nExpecting "+expected.join(", ")+", got '"+(this.terminals_[symbol]||symbol)+"'"}else{errStr="Parse error on line "+(yylineno+1)+": Unexpected "+(symbol==EOF?"end of input":"'"+(this.terminals_[symbol]||symbol)+"'")}this.parseError(errStr,{text:lexer.match,token:this.terminals_[symbol]||symbol,line:lexer.yylineno,loc:yyloc,expected:expected})}if(action[0]instanceof Array&&action.length>1){throw new Error("Parse Error: multiple actions possible at state: "+state+", token: "+symbol)}switch(action[0]){case 1:stack.push(symbol);vstack.push(lexer.yytext);lstack.push(lexer.yylloc);stack.push(action[1]);symbol=null;if(!preErrorSymbol){yyleng=lexer.yyleng;yytext=lexer.yytext;yylineno=lexer.yylineno;yyloc=lexer.yylloc;if(recovering>0){recovering--}}else{symbol=preErrorSymbol;preErrorSymbol=null}break;case 2:len=this.productions_[action[1]][1];yyval.$=vstack[vstack.length-len];yyval._$={first_line:lstack[lstack.length-(len||1)].first_line,last_line:lstack[lstack.length-1].last_line,first_column:lstack[lstack.length-(len||1)].first_column,last_column:lstack[lstack.length-1].last_column};if(ranges){yyval._$.range=[lstack[lstack.length-(len||1)].range[0],lstack[lstack.length-1].range[1]]}r=this.performAction.apply(yyval,[yytext,yyleng,yylineno,sharedState.yy,action[1],vstack,lstack].concat(args));if(typeof r!=="undefined"){return r}if(len){stack=stack.slice(0,-1*len*2);vstack=vstack.slice(0,-1*len);lstack=lstack.slice(0,-1*len)}stack.push(this.productions_[action[1]][0]);vstack.push(yyval.$);lstack.push(yyval._$);newState=table[stack[stack.length-2]][stack[stack.length-1]];stack.push(newState);break;case 3:return true}}return true}};var RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#",RDF_TYPE=RDF+"type",RDF_FIRST=RDF+"first",RDF_REST=RDF+"rest",RDF_NIL=RDF+"nil",XSD="http://www.w3.org/2001/XMLSchema#",XSD_INTEGER=XSD+"integer",XSD_DECIMAL=XSD+"decimal",XSD_DOUBLE=XSD+"double",XSD_BOOLEAN=XSD+"boolean",XSD_TRUE='"true"^^'+XSD_BOOLEAN,XSD_FALSE='"false"^^'+XSD_BOOLEAN;var base="",basePath="",baseRoot="";function lowercase(string){return string.toLowerCase()}function appendTo(array,item){return array.push(item),array}function appendAllTo(array,items){return array.push.apply(array,items),array}function extend(base){if(!base)base={};for(var i=1,l=arguments.length,arg;i<l&&(arg=arguments[i]||{});i++)for(var name in arg)base[name]=arg[name];return base}function unionAll(){var union=[];for(var i=0,l=arguments.length;i<l;i++)union=union.concat.apply(union,arguments[i]);return union}function resolveIRI(iri){if(iri[0]==="<")iri=iri.substring(1,iri.length-1);switch(iri[0]){case undefined:return base;case"#":return base+iri;case"?":return base.replace(/(?:\?.*)?$/,iri);case"/":return baseRoot+iri;default:return/^[a-z]+:/.test(iri)?iri:basePath+iri}}function toVar(variable){if(variable){var first=variable[0];if(first==="?")return variable;if(first==="$")return"?"+variable.substr(1)}return variable}function operation(operatorName,args){return{type:"operation",operator:operatorName,args:args||[]}}function expression(expr,attr){var expression={expression:expr};if(attr)for(var a in attr)expression[a]=attr[a];return expression}function path(type,items){return{type:"path",pathType:type,items:items}}function createOperationTree(initialExpression,operationList){for(var i=0,l=operationList.length,item;i<l&&(item=operationList[i]);i++)initialExpression=operation(item[0],[initialExpression,item[1]]);return initialExpression}function groupDatasets(fromClauses){var defaults=[],named=[],l=fromClauses.length,fromClause;for(var i=0;i<l&&(fromClause=fromClauses[i]);i++)(fromClause.named?named:defaults).push(fromClause.iri);return l?{from:{"default":defaults,named:named}}:null}function toInt(string){return parseInt(string,10)}function degroupSingle(group){return group.type==="group"&&group.patterns.length===1?group.patterns[0]:group}function createLiteral(value,type){return'"'+value+'"^^'+type}function triple(subject,predicate,object){var triple={};if(subject!=null)triple.subject=subject;if(predicate!=null)triple.predicate=predicate;if(object!=null)triple.object=object;return triple}function blank(){return"_:b"+blankId++}var blankId=0;Parser._resetBlanks=function(){blankId=0};var escapeSequence=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\(.)/g,escapeReplacements={"\\":"\\","'":"'",'"':'"',t:" ",b:"\b",n:"\n",r:"\r",f:"\f"},fromCharCode=String.fromCharCode;function unescapeString(string,trimLength){string=string.substring(trimLength,string.length-trimLength);try{string=string.replace(escapeSequence,function(sequence,unicode4,unicode8,escapedChar){var charCode;if(unicode4){charCode=parseInt(unicode4,16);if(isNaN(charCode))throw new Error;return fromCharCode(charCode)}else if(unicode8){charCode=parseInt(unicode8,16);if(isNaN(charCode))throw new Error;if(charCode<65535)return fromCharCode(charCode);return fromCharCode(55296+((charCode-=65536)>>10),56320+(charCode&1023))}else{var replacement=escapeReplacements[escapedChar];if(!replacement)throw new Error;return replacement}})}catch(error){return""}return'"'+string+'"'}function createList(objects){var list=blank(),head=list,listItems=[],listTriples,triples=[];objects.forEach(function(o){listItems.push(o.entity);appendAllTo(triples,o.triples)});for(var i=0,j=0,l=listItems.length,listTriples=Array(l*2);i<l;)listTriples[j++]=triple(head,RDF_FIRST,listItems[i]),listTriples[j++]=triple(head,RDF_REST,head=++i<l?blank():RDF_NIL);return{entity:list,triples:appendAllTo(listTriples,triples)}}function createAnonymousObject(propertyList){var entity=blank();return{entity:entity,triples:propertyList.map(function(t){return extend(triple(entity),t)})}}function objectListToTriples(predicate,objectList,otherTriples){var objects=[],triples=[];objectList.forEach(function(l){objects.push(triple(null,predicate,l.entity));appendAllTo(triples,l.triples)});return unionAll(objects,otherTriples||[],triples)}var lexer=function(){var lexer={EOF:1,parseError:function parseError(str,hash){if(this.yy.parser){this.yy.parser.parseError(str,hash)}else{throw new Error(str)}},setInput:function(input,yy){this.yy=yy||this.yy||{};this._input=input;this._more=this._backtrack=this.done=false;this.yylineno=this.yyleng=0;this.yytext=this.matched=this.match="";this.conditionStack=["INITIAL"];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};if(this.options.ranges){this.yylloc.range=[0,0]}this.offset=0;return this},input:function(){var ch=this._input[0];this.yytext+=ch;this.yyleng++;this.offset++;this.match+=ch;this.matched+=ch;var lines=ch.match(/(?:\r\n?|\n).*/g);if(lines){this.yylineno++;this.yylloc.last_line++}else{this.yylloc.last_column++}if(this.options.ranges){this.yylloc.range[1]++}this._input=this._input.slice(1);return ch},unput:function(ch){var len=ch.length;var lines=ch.split(/(?:\r\n?|\n)/g);this._input=ch+this._input;this.yytext=this.yytext.substr(0,this.yytext.length-len);this.offset-=len;var oldLines=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1);this.matched=this.matched.substr(0,this.matched.length-1);if(lines.length-1){this.yylineno-=lines.length-1}var r=this.yylloc.range;this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:lines?(lines.length===oldLines.length?this.yylloc.first_column:0)+oldLines[oldLines.length-lines.length].length-lines[0].length:this.yylloc.first_column-len};if(this.options.ranges){this.yylloc.range=[r[0],r[0]+this.yyleng-len]}this.yyleng=this.yytext.length;return this},more:function(){this._more=true;return this},reject:function(){if(this.options.backtrack_lexer){this._backtrack=true}else{return this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}return this},less:function(n){this.unput(this.match.slice(n))},pastInput:function(){var past=this.matched.substr(0,this.matched.length-this.match.length);return(past.length>20?"...":"")+past.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var next=this.match;if(next.length<20){next+=this._input.substr(0,20-next.length)}return(next.substr(0,20)+(next.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var pre=this.pastInput();var c=new Array(pre.length+1).join("-");return pre+this.upcomingInput()+"\n"+c+"^"},test_match:function(match,indexed_rule){var token,lines,backup;if(this.options.backtrack_lexer){backup={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done};if(this.options.ranges){backup.yylloc.range=this.yylloc.range.slice(0)}}lines=match[0].match(/(?:\r\n?|\n).*/g);if(lines){this.yylineno+=lines.length}this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:lines?lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+match[0].length};this.yytext+=match[0];this.match+=match[0];this.matches=match;this.yyleng=this.yytext.length;if(this.options.ranges){this.yylloc.range=[this.offset,this.offset+=this.yyleng]}this._more=false;this._backtrack=false;this._input=this._input.slice(match[0].length);this.matched+=match[0];token=this.performAction.call(this,this.yy,this,indexed_rule,this.conditionStack[this.conditionStack.length-1]);if(this.done&&this._input){this.done=false}if(token){return token}else if(this._backtrack){for(var k in backup){this[k]=backup[k]}return false}return false},next:function(){if(this.done){return this.EOF}if(!this._input){this.done=true}var token,match,tempMatch,index;if(!this._more){this.yytext="";this.match=""}var rules=this._currentRules();for(var i=0;i<rules.length;i++){tempMatch=this._input.match(this.rules[rules[i]]);if(tempMatch&&(!match||tempMatch[0].length>match[0].length)){match=tempMatch;index=i;if(this.options.backtrack_lexer){token=this.test_match(tempMatch,rules[i]);if(token!==false){return token}else if(this._backtrack){match=false;continue}else{return false}}else if(!this.options.flex){break}}}if(match){token=this.test_match(match,rules[index]);if(token!==false){return token}return false}if(this._input===""){return this.EOF}else{return this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}},lex:function lex(){var r=this.next();if(r){return r}else{return this.lex()}},begin:function begin(condition){this.conditionStack.push(condition)},popState:function popState(){var n=this.conditionStack.length-1;if(n>0){return this.conditionStack.pop()}else{return this.conditionStack[0]}},_currentRules:function _currentRules(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules}else{return this.conditions["INITIAL"].rules}},topState:function topState(n){n=this.conditionStack.length-1-Math.abs(n||0);if(n>=0){return this.conditionStack[n]}else{return"INITIAL"}},pushState:function pushState(condition){this.begin(condition)},stateStackSize:function stateStackSize(){return this.conditionStack.length},options:{flex:true,"case-insensitive":true},performAction:function anonymous(yy,yy_,$avoiding_name_collisions,YY_START){var YYSTATE=YY_START;switch($avoiding_name_collisions){case 0:break;case 1:return 11;break;case 2:return 14;break;case 3:return 23;break;case 4:return 280;break;case 5:return 281;break;case 6:return 28;break;case 7:return 30;break;case 8:return 31;break;case 9:return 283;break;case 10:return 33;break;case 11:return 37;break;case 12:return 38;break;case 13:return 40;break;case 14:return 42;break;case 15:return 47;break;case 16:return 50;break;case 17:return 286;break;case 18:return 60;break;case 19:return 61;break;case 20:return 67;break;case 21:return 70;break;case 22:return 73;break;case 23:return 75;break;case 24:return 78;break;case 25:return 80;break;case 26:return 82;break;case 27:return 192;break;case 28:return 95;break;case 29:return 287;break;case 30:return 128;break;case 31:return 288;break;case 32:return 289;break;case 33:return 105;break;case 34:return 290;break;case 35:return 104;break;case 36:return 291;break;case 37:return 292;break;case 38:return 108;break;case 39:return 110;break;case 40:return 111;break;case 41:return 126;break;case 42:return 120;break;case 43:return 121;break;case 44:return 123;break;case 45:return 129;break;case 46:return 107;break;case 47:return 293;break;case 48:return 294;break;case 49:return 155;break;case 50:return 158;break;case 51:return 162;break;case 52:return 89;break;case 53:return 156;break;case 54:return 295;break;case 55:return 161;break;case 56:return 242;break;case 57:return 181;break;case 58:return 297;break;case 59:return 298;break;case 60:return 208;break;case 61:return 300;break;case 62:return 301;break;case 63:return 203;break;case 64:return 210;break;case 65:return 211;break;case 66:return 302;break;case 67:return 303;break;case 68:return 259;break;case 69:return 304;break;case 70:return 305;break;case 71:return 306;break;case 72:return 307;break;case 73:return 308;break;case 74:return 222;break;case 75:return 309;break;case 76:return 237;break;case 77:return 245;break;case 78:return 246;break;case 79:return 239;break;case 80:return 240;break;case 81:return 241;break;case 82:return 310;break;case 83:return 311;break;case 84:return 243;break;case 85:return 313;break;case 86:return 312;break;case 87:return 314;break;case 88:return 248;break;case 89:return 249;break;case 90:return 252;break;case 91:return 254;break;case 92:return 258;break;case 93:return 262;break;case 94:return 265;break;case 95:return 266;break;case 96:return 12;break;case 97:return 15;break;case 98:return 277;break;case 99:return 213;break;case 100:return 27;break;case 101:return 261;break;case 102:return 79;break;case 103:return 263;break;case 104:return 264;break;case 105:return 271;break;case 106:return 272;break;case 107:return 273;break;case 108:return 274;break;case 109:return 275;break;case 110:return 276;break;case 111:return"EXPONENT";break;case 112:return 267;break;case 113:return 268;break;case 114:return 269;break;case 115:return 270;break;case 116:return 163;break;case 117:return 214;break;case 118:return 6;break;case 119:return"INVALID";break;case 120:console.log(yy_.yytext);break}},rules:[/^(?:\s+|#[^\n\r]*)/i,/^(?:BASE)/i,/^(?:PREFIX)/i,/^(?:SELECT)/i,/^(?:DISTINCT)/i,/^(?:REDUCED)/i,/^(?:\()/i,/^(?:AS)/i,/^(?:\))/i,/^(?:\*)/i,/^(?:CONSTRUCT)/i,/^(?:WHERE)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:DESCRIBE)/i,/^(?:ASK)/i,/^(?:FROM)/i,/^(?:NAMED)/i,/^(?:GROUP)/i,/^(?:BY)/i,/^(?:HAVING)/i,/^(?:ORDER)/i,/^(?:ASC)/i,/^(?:DESC)/i,/^(?:LIMIT)/i,/^(?:OFFSET)/i,/^(?:VALUES)/i,/^(?:;)/i,/^(?:LOAD)/i,/^(?:SILENT)/i,/^(?:INTO)/i,/^(?:CLEAR)/i,/^(?:DROP)/i,/^(?:CREATE)/i,/^(?:ADD)/i,/^(?:TO)/i,/^(?:MOVE)/i,/^(?:COPY)/i,/^(?:INSERT\s+DATA)/i,/^(?:DELETE\s+DATA)/i,/^(?:DELETE\s+WHERE)/i,/^(?:WITH)/i,/^(?:DELETE)/i,/^(?:INSERT)/i,/^(?:USING)/i,/^(?:DEFAULT)/i,/^(?:GRAPH)/i,/^(?:ALL)/i,/^(?:\.)/i,/^(?:OPTIONAL)/i,/^(?:SERVICE)/i,/^(?:BIND)/i,/^(?:UNDEF)/i,/^(?:MINUS)/i,/^(?:UNION)/i,/^(?:FILTER)/i,/^(?:,)/i,/^(?:a)/i,/^(?:\|)/i,/^(?:\/)/i,/^(?:\^)/i,/^(?:\?)/i,/^(?:\+)/i,/^(?:!)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:\|\|)/i,/^(?:&&)/i,/^(?:=)/i,/^(?:!=)/i,/^(?:<)/i,/^(?:>)/i,/^(?:<=)/i,/^(?:>=)/i,/^(?:IN)/i,/^(?:NOT)/i,/^(?:-)/i,/^(?:BOUND)/i,/^(?:BNODE)/i,/^(?:(RAND|NOW|UUID|STUUID))/i,/^(?:(LANG|DATATYPE|IRI|URI|ABS|CEIL|FLOOR|ROUND|STRLEN|STR|UCASE|LCASE|ENCODE_FOR_URI|YEAR|MONTH|DAY|HOURS|MINUTES|SECONDS|TIMEZONE|TZ|MD5|SHA1|SHA256|SHA384|SHA512|isIRI|isURI|isBLANK|isLITERAL|isNUMERIC))/i,/^(?:(LANGMATCHES|CONTAINS|STRSTARTS|STRENDS|STRBEFORE|STRAFTER|STRLANG|STRDT|sameTerm))/i,/^(?:CONCAT)/i,/^(?:COALESCE)/i,/^(?:IF)/i,/^(?:REGEX)/i,/^(?:SUBSTR)/i,/^(?:REPLACE)/i,/^(?:EXISTS)/i,/^(?:COUNT)/i,/^(?:SUM|MIN|MAX|AVG|SAMPLE)/i,/^(?:GROUP_CONCAT)/i,/^(?:SEPARATOR)/i,/^(?:\^\^)/i,/^(?:true)/i,/^(?:false)/i,/^(?:(<([^<>\"\{\}\|\^`\\\u0000-\u0020])*>))/i,/^(?:((([A-Z]|[a-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(((((?:([A-Z]|[a-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F]|[\u203F-\u2040])|\.)*(((?:([A-Z]|[a-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F]|[\u203F-\u2040]))?)?:))/i,/^(?:(((([A-Z]|[a-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(((((?:([A-Z]|[a-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F]|[\u203F-\u2040])|\.)*(((?:([A-Z]|[a-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F]|[\u203F-\u2040]))?)?:)((((?:([A-Z]|[a-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|:|[0-9]|((%([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))(((((?:([A-Z]|[a-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F]|[\u203F-\u2040])|\.|:|((%([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))*((((?:([A-Z]|[a-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F]|[\u203F-\u2040])|:|((%([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%)))))?)))/i,/^(?:(_:(((?:([A-Z]|[a-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(((((?:([A-Z]|[a-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F]|[\u203F-\u2040])|\.)*(((?:([A-Z]|[a-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F]|[\u203F-\u2040]))?))/i,/^(?:([\?\$]((((?:([A-Z]|[a-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(((?:([A-Z]|[a-z]|[\u00C0-\u00D6]|[\u00D8-\u00F6]|[\u00F8-\u02FF]|[\u0370-\u037D]|[\u037F-\u1FFF]|[\u200C-\u200D]|[\u2070-\u218F]|[\u2C00-\u2FEF]|[\u3001-\uD7FF]|[\uF900-\uFDCF]|[\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9]|\u00B7|[\u0300-\u036F]|[\u203F-\u2040])*)))/i,/^(?:(@[a-zA-Z]+(-[a-zA-Z0-9]+)*))/i,/^(?:([0-9]+))/i,/^(?:([0-9]*\.[0-9]+))/i,/^(?:([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+)))/i,/^(?:(\+([0-9]+)))/i,/^(?:(\+([0-9]*\.[0-9]+)))/i,/^(?:(\+([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:(-([0-9]+)))/i,/^(?:(-([0-9]*\.[0-9]+)))/i,/^(?:(-([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:([eE][+-]?[0-9]+))/i,/^(?:('(([^\u0027\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])|\\U([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])))*'))/i,/^(?:("(([^\u0022\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])|\\U([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])))*"))/i,/^(?:('''(('|'')?([^'\\]|(\\[tbnrf\\\"']|\\u([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])|\\U([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f]))))*'''))/i,/^(?:("""(("|"")?([^\"\\]|(\\[tbnrf\\\"']|\\u([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])|\\U([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f]))))*"""))/i,/^(?:(\((\u0020|\u0009|\u000D|\u000A)*\)))/i,/^(?:(\[(\u0020|\u0009|\u000D|\u000A)*\]))/i,/^(?:$)/i,/^(?:.)/i,/^(?:.)/i], | |
conditions:{INITIAL:{rules:[0,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],inclusive:true}}};return lexer}();parser.lexer=lexer;function Parser(){this.yy={}}Parser.prototype=parser;parser.Parser=Parser;return new Parser}();if(typeof require!=="undefined"&&typeof exports!=="undefined"){exports.parser=parser;exports.Parser=parser.Parser;exports.parse=function(){return parser.parse.apply(parser,arguments)};exports.main=function commonjsMain(args){if(!args[1]){console.log("Usage: "+args[0]+" FILE");process.exit(1)}var source=require("fs").readFileSync(require("path").normalize(args[1]),"utf8");return exports.parser.parse(source)};if(typeof module!=="undefined"&&require.main===module){exports.main(process.argv.slice(1))}}}).call(this,require("_process"))},{_process:12,fs:1,path:11}],68:[function(require,module,exports){var Parser=require("./lib/SparqlParser").Parser;var Generator=require("./lib/SparqlGenerator");module.exports={Parser:function(prefixes){var prefixesCopy={};for(var prefix in prefixes||{})prefixesCopy[prefix]=prefixes[prefix];var parser=new Parser;parser.parse=function(){Parser.prefixes=Object.create(prefixesCopy);return Parser.prototype.parse.apply(parser,arguments)};parser._resetBlanks=Parser._resetBlanks;return parser},Generator:Generator}},{"./lib/SparqlGenerator":66,"./lib/SparqlParser":67}],69:[function(require,module,exports){(function(global){(function(exportCallback){"use strict";var UriTemplateError=function(){function UriTemplateError(options){this.options=options}UriTemplateError.prototype.toString=function(){if(JSON&&JSON.stringify){return JSON.stringify(this.options)}else{return this.options}};return UriTemplateError}();var objectHelper=function(){function isArray(value){return Object.prototype.toString.apply(value)==="[object Array]"}function isString(value){return Object.prototype.toString.apply(value)==="[object String]"}function isNumber(value){return Object.prototype.toString.apply(value)==="[object Number]"}function isBoolean(value){return Object.prototype.toString.apply(value)==="[object Boolean]"}function join(arr,separator){var result="",first=true,index;for(index=0;index<arr.length;index+=1){if(first){first=false}else{result+=separator}result+=arr[index]}return result}function map(arr,mapper){var result=[],index=0;for(;index<arr.length;index+=1){result.push(mapper(arr[index]))}return result}function filter(arr,predicate){var result=[],index=0;for(;index<arr.length;index+=1){if(predicate(arr[index])){result.push(arr[index])}}return result}function deepFreezeUsingObjectFreeze(object){if(typeof object!=="object"||object===null){return object}Object.freeze(object);var property,propertyName;for(propertyName in object){if(object.hasOwnProperty(propertyName)){property=object[propertyName];if(typeof property==="object"){deepFreeze(property)}}}return object}function deepFreeze(object){if(typeof Object.freeze==="function"){return deepFreezeUsingObjectFreeze(object)}return object}return{isArray:isArray,isString:isString,isNumber:isNumber,isBoolean:isBoolean,join:join,map:map,filter:filter,deepFreeze:deepFreeze}}();var charHelper=function(){function isAlpha(chr){return chr>="a"&&chr<="z"||chr>="A"&&chr<="Z"}function isDigit(chr){return chr>="0"&&chr<="9"}function isHexDigit(chr){return isDigit(chr)||chr>="a"&&chr<="f"||chr>="A"&&chr<="F"}return{isAlpha:isAlpha,isDigit:isDigit,isHexDigit:isHexDigit}}();var pctEncoder=function(){var utf8={encode:function(chr){return unescape(encodeURIComponent(chr))},numBytes:function(firstCharCode){if(firstCharCode<=127){return 1}else if(194<=firstCharCode&&firstCharCode<=223){return 2}else if(224<=firstCharCode&&firstCharCode<=239){return 3}else if(240<=firstCharCode&&firstCharCode<=244){return 4}return 0},isValidFollowingCharCode:function(charCode){return 128<=charCode&&charCode<=191}};function encodeCharacter(chr){var result="",octets=utf8.encode(chr),octet,index;for(index=0;index<octets.length;index+=1){octet=octets.charCodeAt(index);result+="%"+(octet<16?"0":"")+octet.toString(16).toUpperCase()}return result}function isPercentDigitDigit(text,start){return text.charAt(start)==="%"&&charHelper.isHexDigit(text.charAt(start+1))&&charHelper.isHexDigit(text.charAt(start+2))}function parseHex2(text,start){return parseInt(text.substr(start,2),16)}function isPctEncoded(chr){if(!isPercentDigitDigit(chr,0)){return false}var firstCharCode=parseHex2(chr,1);var numBytes=utf8.numBytes(firstCharCode);if(numBytes===0){return false}for(var byteNumber=1;byteNumber<numBytes;byteNumber+=1){if(!isPercentDigitDigit(chr,3*byteNumber)||!utf8.isValidFollowingCharCode(parseHex2(chr,3*byteNumber+1))){return false}}return true}function pctCharAt(text,startIndex){var chr=text.charAt(startIndex);if(!isPercentDigitDigit(text,startIndex)){return chr}var utf8CharCode=parseHex2(text,startIndex+1);var numBytes=utf8.numBytes(utf8CharCode);if(numBytes===0){return chr}for(var byteNumber=1;byteNumber<numBytes;byteNumber+=1){if(!isPercentDigitDigit(text,startIndex+3*byteNumber)||!utf8.isValidFollowingCharCode(parseHex2(text,startIndex+3*byteNumber+1))){return chr}}return text.substr(startIndex,3*numBytes)}return{encodeCharacter:encodeCharacter,isPctEncoded:isPctEncoded,pctCharAt:pctCharAt}}();var rfcCharHelper=function(){function isVarchar(chr){return charHelper.isAlpha(chr)||charHelper.isDigit(chr)||chr==="_"||pctEncoder.isPctEncoded(chr)}function isUnreserved(chr){return charHelper.isAlpha(chr)||charHelper.isDigit(chr)||chr==="-"||chr==="."||chr==="_"||chr==="~"}function isReserved(chr){return chr===":"||chr==="/"||chr==="?"||chr==="#"||chr==="["||chr==="]"||chr==="@"||chr==="!"||chr==="$"||chr==="&"||chr==="("||chr===")"||chr==="*"||chr==="+"||chr===","||chr===";"||chr==="="||chr==="'"}return{isVarchar:isVarchar,isUnreserved:isUnreserved,isReserved:isReserved}}();var encodingHelper=function(){function encode(text,passReserved){var result="",index,chr="";if(typeof text==="number"||typeof text==="boolean"){text=text.toString()}for(index=0;index<text.length;index+=chr.length){chr=text.charAt(index);result+=rfcCharHelper.isUnreserved(chr)||passReserved&&rfcCharHelper.isReserved(chr)?chr:pctEncoder.encodeCharacter(chr)}return result}function encodePassReserved(text){return encode(text,true)}function encodeLiteralCharacter(literal,index){var chr=pctEncoder.pctCharAt(literal,index);if(chr.length>1){return chr}else{return rfcCharHelper.isReserved(chr)||rfcCharHelper.isUnreserved(chr)?chr:pctEncoder.encodeCharacter(chr)}}function encodeLiteral(literal){var result="",index,chr="";for(index=0;index<literal.length;index+=chr.length){chr=pctEncoder.pctCharAt(literal,index);if(chr.length>1){result+=chr}else{result+=rfcCharHelper.isReserved(chr)||rfcCharHelper.isUnreserved(chr)?chr:pctEncoder.encodeCharacter(chr)}}return result}return{encode:encode,encodePassReserved:encodePassReserved,encodeLiteral:encodeLiteral,encodeLiteralCharacter:encodeLiteralCharacter}}();var operators=function(){var bySymbol={};function create(symbol){bySymbol[symbol]={symbol:symbol,separator:symbol==="?"?"&":symbol===""||symbol==="+"||symbol==="#"?",":symbol,named:symbol===";"||symbol==="&"||symbol==="?",ifEmpty:symbol==="&"||symbol==="?"?"=":"",first:symbol==="+"?"":symbol,encode:symbol==="+"||symbol==="#"?encodingHelper.encodePassReserved:encodingHelper.encode,toString:function(){return this.symbol}}}create("");create("+");create("#");create(".");create("/");create(";");create("?");create("&");return{valueOf:function(chr){if(bySymbol[chr]){return bySymbol[chr]}if("=,!@|".indexOf(chr)>=0){return null}return bySymbol[""]}}}();function isDefined(object){var propertyName;if(object===null||object===undefined){return false}if(objectHelper.isArray(object)){return object.length>0}if(typeof object==="string"||typeof object==="number"||typeof object==="boolean"){return true}for(propertyName in object){if(object.hasOwnProperty(propertyName)&&isDefined(object[propertyName])){return true}}return false}var LiteralExpression=function(){function LiteralExpression(literal){this.literal=encodingHelper.encodeLiteral(literal)}LiteralExpression.prototype.expand=function(){return this.literal};LiteralExpression.prototype.toString=LiteralExpression.prototype.expand;return LiteralExpression}();var parse=function(){function parseExpression(expressionText){var operator,varspecs=[],varspec=null,varnameStart=null,maxLengthStart=null,index,chr="";function closeVarname(){var varname=expressionText.substring(varnameStart,index);if(varname.length===0){throw new UriTemplateError({expressionText:expressionText,message:"a varname must be specified",position:index})}varspec={varname:varname,exploded:false,maxLength:null};varnameStart=null}function closeMaxLength(){if(maxLengthStart===index){throw new UriTemplateError({expressionText:expressionText,message:"after a ':' you have to specify the length",position:index})}varspec.maxLength=parseInt(expressionText.substring(maxLengthStart,index),10);maxLengthStart=null}operator=function(operatorText){var op=operators.valueOf(operatorText);if(op===null){throw new UriTemplateError({expressionText:expressionText,message:"illegal use of reserved operator",position:index,operator:operatorText})}return op}(expressionText.charAt(0));index=operator.symbol.length;varnameStart=index;for(;index<expressionText.length;index+=chr.length){chr=pctEncoder.pctCharAt(expressionText,index);if(varnameStart!==null){if(chr==="."){if(varnameStart===index){throw new UriTemplateError({expressionText:expressionText,message:"a varname MUST NOT start with a dot",position:index})}continue}if(rfcCharHelper.isVarchar(chr)){continue}closeVarname()}if(maxLengthStart!==null){if(index===maxLengthStart&&chr==="0"){throw new UriTemplateError({expressionText:expressionText,message:"A :prefix must not start with digit 0",position:index})}if(charHelper.isDigit(chr)){if(index-maxLengthStart>=4){throw new UriTemplateError({expressionText:expressionText,message:"A :prefix must have max 4 digits",position:index})}continue}closeMaxLength()}if(chr===":"){if(varspec.maxLength!==null){throw new UriTemplateError({expressionText:expressionText,message:"only one :maxLength is allowed per varspec",position:index})}if(varspec.exploded){throw new UriTemplateError({expressionText:expressionText,message:"an exploeded varspec MUST NOT be varspeced",position:index})}maxLengthStart=index+1;continue}if(chr==="*"){if(varspec===null){throw new UriTemplateError({expressionText:expressionText,message:"exploded without varspec",position:index})}if(varspec.exploded){throw new UriTemplateError({expressionText:expressionText,message:"exploded twice",position:index})}if(varspec.maxLength){throw new UriTemplateError({expressionText:expressionText,message:"an explode (*) MUST NOT follow to a prefix",position:index})}varspec.exploded=true;continue}if(chr===","){varspecs.push(varspec);varspec=null;varnameStart=index+1;continue}throw new UriTemplateError({expressionText:expressionText,message:"illegal character",character:chr,position:index})}if(varnameStart!==null){closeVarname()}if(maxLengthStart!==null){closeMaxLength()}varspecs.push(varspec);return new VariableExpression(expressionText,operator,varspecs)}function parse(uriTemplateText){var index,chr,expressions=[],braceOpenIndex=null,literalStart=0;for(index=0;index<uriTemplateText.length;index+=1){chr=uriTemplateText.charAt(index);if(literalStart!==null){if(chr==="}"){throw new UriTemplateError({templateText:uriTemplateText,message:"unopened brace closed",position:index})}if(chr==="{"){if(literalStart<index){expressions.push(new LiteralExpression(uriTemplateText.substring(literalStart,index)))}literalStart=null;braceOpenIndex=index}continue}if(braceOpenIndex!==null){if(chr==="{"){throw new UriTemplateError({templateText:uriTemplateText,message:"brace already opened",position:index})}if(chr==="}"){if(braceOpenIndex+1===index){throw new UriTemplateError({templateText:uriTemplateText,message:"empty braces",position:braceOpenIndex})}try{expressions.push(parseExpression(uriTemplateText.substring(braceOpenIndex+1,index)))}catch(error){if(error.prototype===UriTemplateError.prototype){throw new UriTemplateError({templateText:uriTemplateText,message:error.options.message,position:braceOpenIndex+error.options.position,details:error.options})}throw error}braceOpenIndex=null;literalStart=index+1}continue}throw new Error("reached unreachable code")}if(braceOpenIndex!==null){throw new UriTemplateError({templateText:uriTemplateText,message:"unclosed brace",position:braceOpenIndex})}if(literalStart<uriTemplateText.length){expressions.push(new LiteralExpression(uriTemplateText.substr(literalStart)))}return new UriTemplate(uriTemplateText,expressions)}return parse}();var VariableExpression=function(){function prettyPrint(value){return JSON&&JSON.stringify?JSON.stringify(value):value}function isEmpty(value){if(!isDefined(value)){return true}if(objectHelper.isString(value)){return value===""}if(objectHelper.isNumber(value)||objectHelper.isBoolean(value)){return false}if(objectHelper.isArray(value)){return value.length===0}for(var propertyName in value){if(value.hasOwnProperty(propertyName)){return false}}return true}function propertyArray(object){var result=[],propertyName;for(propertyName in object){if(object.hasOwnProperty(propertyName)){result.push({name:propertyName,value:object[propertyName]})}}return result}function VariableExpression(templateText,operator,varspecs){this.templateText=templateText;this.operator=operator;this.varspecs=varspecs}VariableExpression.prototype.toString=function(){return this.templateText};function expandSimpleValue(varspec,operator,value){var result="";value=value.toString();if(operator.named){result+=encodingHelper.encodeLiteral(varspec.varname);if(value===""){result+=operator.ifEmpty;return result}result+="="}if(varspec.maxLength!==null){value=value.substr(0,varspec.maxLength)}result+=operator.encode(value);return result}function valueDefined(nameValue){return isDefined(nameValue.value)}function expandNotExploded(varspec,operator,value){var arr=[],result="";if(operator.named){result+=encodingHelper.encodeLiteral(varspec.varname);if(isEmpty(value)){result+=operator.ifEmpty;return result}result+="="}if(objectHelper.isArray(value)){arr=value;arr=objectHelper.filter(arr,isDefined);arr=objectHelper.map(arr,operator.encode);result+=objectHelper.join(arr,",")}else{arr=propertyArray(value);arr=objectHelper.filter(arr,valueDefined);arr=objectHelper.map(arr,function(nameValue){return operator.encode(nameValue.name)+","+operator.encode(nameValue.value)});result+=objectHelper.join(arr,",")}return result}function expandExplodedNamed(varspec,operator,value){var isArray=objectHelper.isArray(value),arr=[];if(isArray){arr=value;arr=objectHelper.filter(arr,isDefined);arr=objectHelper.map(arr,function(listElement){var tmp=encodingHelper.encodeLiteral(varspec.varname);if(isEmpty(listElement)){tmp+=operator.ifEmpty}else{tmp+="="+operator.encode(listElement)}return tmp})}else{arr=propertyArray(value);arr=objectHelper.filter(arr,valueDefined);arr=objectHelper.map(arr,function(nameValue){var tmp=encodingHelper.encodeLiteral(nameValue.name);if(isEmpty(nameValue.value)){tmp+=operator.ifEmpty}else{tmp+="="+operator.encode(nameValue.value)}return tmp})}return objectHelper.join(arr,operator.separator)}function expandExplodedUnnamed(operator,value){var arr=[],result="";if(objectHelper.isArray(value)){arr=value;arr=objectHelper.filter(arr,isDefined);arr=objectHelper.map(arr,operator.encode);result+=objectHelper.join(arr,operator.separator)}else{arr=propertyArray(value);arr=objectHelper.filter(arr,function(nameValue){return isDefined(nameValue.value)});arr=objectHelper.map(arr,function(nameValue){return operator.encode(nameValue.name)+"="+operator.encode(nameValue.value)});result+=objectHelper.join(arr,operator.separator)}return result}VariableExpression.prototype.expand=function(variables){var expanded=[],index,varspec,value,valueIsArr,oneExploded=false,operator=this.operator;for(index=0;index<this.varspecs.length;index+=1){varspec=this.varspecs[index];value=variables[varspec.varname];if(value===null||value===undefined){continue}if(varspec.exploded){oneExploded=true}valueIsArr=objectHelper.isArray(value);if(typeof value==="string"||typeof value==="number"||typeof value==="boolean"){expanded.push(expandSimpleValue(varspec,operator,value))}else if(varspec.maxLength&&isDefined(value)){throw new Error("Prefix modifiers are not applicable to variables that have composite values. You tried to expand "+this+" with "+prettyPrint(value))}else if(!varspec.exploded){if(operator.named||!isEmpty(value)){expanded.push(expandNotExploded(varspec,operator,value))}}else if(isDefined(value)){if(operator.named){expanded.push(expandExplodedNamed(varspec,operator,value))}else{expanded.push(expandExplodedUnnamed(operator,value))}}}if(expanded.length===0){return""}else{return operator.first+objectHelper.join(expanded,operator.separator)}};return VariableExpression}();var UriTemplate=function(){function UriTemplate(templateText,expressions){this.templateText=templateText;this.expressions=expressions;objectHelper.deepFreeze(this)}UriTemplate.prototype.toString=function(){return this.templateText};UriTemplate.prototype.expand=function(variables){var index,result="";for(index=0;index<this.expressions.length;index+=1){result+=this.expressions[index].expand(variables)}return result};UriTemplate.parse=parse;UriTemplate.UriTemplateError=UriTemplateError;return UriTemplate}();exportCallback(UriTemplate)})(function(UriTemplate){"use strict";if(typeof module!=="undefined"){module.exports=UriTemplate}else if(typeof define==="function"){define([],function(){return UriTemplate})}else if(typeof window!=="undefined"){window.UriTemplate=UriTemplate}else{global.UriTemplate=UriTemplate}})}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],"ldf-client":[function(require,module,exports){var globalRequire=require;require=function(path){return function(){return require(path)}};var exports=module.exports={SparqlIterator:require("./lib/triple-pattern-fragments/SparqlIterator.js"),FragmentsClient:require("./lib/triple-pattern-fragments/federated/FederatedFragmentsClient"),Logger:require("./lib/util/Logger"),HttpClient:require("./lib/util/HttpClient"),SparqlResultWriter:function(){var SparqlResultWriter=require("./lib/writers/SparqlResultWriter");SparqlResultWriter.register("application/json","./JSONResultWriter");SparqlResultWriter.register("application/sparql-results+json","./SparqlJSONResultWriter");SparqlResultWriter.register("application/sparql-results+xml","./SparqlXMLResultWriter");return SparqlResultWriter}};Object.keys(exports).forEach(function(submodule){var loadSubmodule=exports[submodule];Object.defineProperty(exports,submodule,{configurable:true,enumerable:true,get:function(){delete exports[submodule];return exports[submodule]=loadSubmodule()}})});require=globalRequire},{"./lib/triple-pattern-fragments/SparqlIterator.js":41,"./lib/triple-pattern-fragments/federated/FederatedFragmentsClient":45,"./lib/util/HttpClient":48,"./lib/util/Logger":49,"./lib/writers/SparqlResultWriter":54}]},{},[]);var ldf=require("ldf-client");var fragmentsClient=new ldf.FragmentsClient("http://fragments.dbpedia.org/2014/en");var query="SELECT * { ?s ?p <http://dbpedia.org/resource/Belgium>. ?s ?p ?o } LIMIT 10",results=new ldf.SparqlIterator(query,{fragmentsClient:fragmentsClient});results.on("data",function(data){window.alert(JSON.stringify(data))}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "requirebin-sketch", | |
"version": "1.0.0", | |
"dependencies": { | |
"ldf-client": "1.3.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- contents of this file will be placed inside the <body> --> | |
<div id="test"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- contents of this file will be placed inside the <head> --> | |
<script src="https://code.jquery.com/jquery-2.1.4.min.js"/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment