Newer
Older
chrome-lod / jquery.rdfquery.core.min-1.0.js
(function(c){var d={},a=/^(([a-z][\-a-z0-9+\.]*):)?(\/\/([^\/?#]+))?([^?#]*)?(\?([^#]*))?(#(.*))?$/i,g,b=function(i){var h=i.match(a);if(h===null){throw"Malformed URI: "+i}return{scheme:h[1]?h[2].toLowerCase():undefined,authority:h[3]?h[4]:undefined,path:h[5]||"",query:h[6]?h[7]:undefined,fragment:h[8]?h[9]:undefined}},f=function(i){var j="",h=[];if(/\./.test(i)){while(i!==undefined&&i!==""){if(i==="."||i===".."){i=""}else{if(/^\.\.\//.test(i)){i=i.substring(3)}else{if(/^\.\//.test(i)){i=i.substring(2)}else{if(/^\/\.(\/|$)/.test(i)){i="/"+i.substring(3)}else{if(/^\/\.\.(\/|$)/.test(i)){i="/"+i.substring(4);j=j.replace(/\/?[^\/]+$/,"")}else{h=i.match(/^(\/?[^\/]*)(\/.*)?$/);i=h[2];j=j+h[1]}}}}}}return j}else{return i}},e=function(h,i){if(h.authority!==""&&(h.path===undefined||h.path==="")){return"/"+i}else{return h.path.replace(/[^\/]+$/,"")+i}};c.uri=function(j,i){var h;j=j||"";if(d[j]){return d[j]}i=i||c.uri.base();if(typeof i==="string"){i=c.uri.absolute(i)}h=new c.uri.fn.init(j,i);if(d[h]){return d[h]}else{d[h]=h;return h}};c.uri.fn=c.uri.prototype={scheme:undefined,authority:undefined,path:undefined,query:undefined,fragment:undefined,init:function(j,i){var h={};i=i||{};c.extend(this,b(j));if(this.scheme===undefined){this.scheme=i.scheme;if(this.authority!==undefined){this.path=f(this.path)}else{this.authority=i.authority;if(this.path===""){this.path=i.path;if(this.query===undefined){this.query=i.query}}else{if(!/^\//.test(this.path)){this.path=e(i,this.path)}this.path=f(this.path)}}}if(this.scheme===undefined){throw"Malformed URI: URI is not an absolute URI and no base supplied: "+j}return this},resolve:function(h){return c.uri(h,this)},relative:function(p){var n,o,m=0,k,l=[],h="";if(typeof p==="string"){p=c.uri(p,{})}if(p.scheme!==this.scheme||p.authority!==this.authority){return p.toString()}if(p.path!==this.path){n=p.path.split("/");o=this.path.split("/");if(n[1]!==o[1]){h=p.path}else{while(n[m]===o[m]){m+=1}k=m;for(;m<o.length-1;m+=1){l.push("..")}for(;k<n.length;k+=1){l.push(n[k])}h=l.join("/")}h=p.query===undefined?h:h+"?"+p.query;h=p.fragment===undefined?h:h+"#"+p.fragment;return h}if(p.query!==undefined&&p.query!==this.query){return"?"+p.query+(p.fragment===undefined?"":"#"+p.fragment)}if(p.fragment!==undefined&&p.fragment!==this.fragment){return"#"+p.fragment}return""},toString:function(){var h="";if(this._string){return this._string}else{h=this.scheme===undefined?h:(h+this.scheme+":");h=this.authority===undefined?h:(h+"//"+this.authority);h=h+this.path;h=this.query===undefined?h:(h+"?"+this.query);h=this.fragment===undefined?h:(h+"#"+this.fragment);this._string=h;return h}}};c.uri.fn.init.prototype=c.uri.fn;c.uri.absolute=function(h){return c.uri(h,{})};c.uri.resolve=function(i,h){return c.uri(i,h)};c.uri.relative=function(i,h){return c.uri(h,{}).relative(i)};c.uri.base=function(){return c(document).base()};c.fn.base=function(){var h=c(this).parents().andSelf().find("base").attr("href"),i=c(this)[0].ownerDocument||document,j=c.uri.absolute(i.location===null?document.location.href:i.location.href);return h===undefined?j:c.uri(h,j)}})(jQuery);(function(b){var a=/\sxmlns(?::([^ =]+))?\s*=\s*(?:"([^"]*)"|'([^']*)')/g;b.fn.xmlns=function(h,d,j){var f=this.eq(0),m=f.data("xmlns"),k=f[0],n,c,g,l=h?"xmlns:"+h:"xmlns",o,r,q=false;if(d===undefined){if(h===undefined){if(m===undefined){m={};if(k.attributes&&k.attributes.getNamedItemNS){for(g=0;g<k.attributes.length;g+=1){n=k.attributes[g];if(/^xmlns(:(.+))?$/.test(n.nodeName)){h=/^xmlns(:(.+))?$/.exec(n.nodeName)[2]||"";o=n.nodeValue;if(h===""||o!==""){m[h]=b.uri(n.nodeValue);q=true}}}}else{r=/<[^>]+>/.exec(k.outerHTML);n=a.exec(r);while(n!==null){h=n[1]||"";o=n[2]||n[3];if(h===""||o!==""){m[h]=b.uri(n[2]||n[3]);q=true}n=a.exec(r)}a.lastIndex=0}j=j||(k.parentNode.nodeType===1?f.parent().xmlns():{});m=q?b.extend({},j,m):j;f.data("xmlns",m)}return m}else{if(typeof h==="object"){for(c in h){if(typeof h[c]==="string"){this.xmlns(c,h[c])}}this.find("*").andSelf().removeData("xmlns");return this}else{if(m===undefined){m=f.xmlns()}return m[h]}}}else{this.find("*").andSelf().removeData("xmlns");return this.attr(l,d)}};b.fn.removeXmlns=function(e){var c,f,d;if(typeof e==="object"){if(e.length===undefined){for(f in e){if(typeof e[f]==="string"){this.removeXmlns(f)}}}else{for(d=0;d<e.length;d+=1){this.removeXmlns(e[d])}}}else{c=e?"xmlns:"+e:"xmlns";this.removeAttr(c)}this.find("*").andSelf().removeData("xmlns");return this};b.fn.qname=function(d){var c,f,e;if(d===undefined){if(this[0].outerHTML===undefined){d=this[0].nodeName.toLowerCase()}else{d=/<([^ >]+)/.exec(this[0].outerHTML)[1].toLowerCase()}}if(d==="?xml:namespace"){throw"XMLinHTML: Unable to get the prefix to resolve the name of this element"}c=/^(([^:]+):)?([^:]+)$/.exec(d);f=c[2]||"";e=this.xmlns(f);if(e===undefined&&f!==""){throw"MalformedQName: The prefix "+f+" is not declared"}return{namespace:e,localPart:c[3],prefix:f,name:d}}})(jQuery);(function(b){var a=function(c){return c.replace(/[ \t\n\r]+/," ").replace(/^ +/,"").replace(/ +$/,"")};b.typedValue=function(d,c){return b.typedValue.fn.init(d,c)};b.typedValue.fn=b.typedValue.prototype={representation:undefined,value:undefined,datatype:undefined,init:function(e,c){var f;if(b.typedValue.valid(e,c)){f=b.typedValue.types[c];this.representation=e;this.datatype=c;this.value=f.value(f.strip?a(e):e);return this}else{throw {name:"InvalidValue",message:e+" is not a valid "+c+" value"}}}};b.typedValue.fn.init.prototype=b.typedValue.fn;b.typedValue.types={};b.typedValue.types["http://www.w3.org/2001/XMLSchema#string"]={regex:/^.*$/,strip:false,value:function(c){return c}};b.typedValue.types["http://www.w3.org/2001/XMLSchema#boolean"]={regex:/^(?:true|false|1|0)$/,strip:true,value:function(c){return c==="true"||c==="1"}};b.typedValue.types["http://www.w3.org/2001/XMLSchema#decimal"]={regex:/^[\-\+]?(?:[0-9]+\.[0-9]*|\.[0-9]+|[0-9]+)$/,strip:true,value:function(c){return c}};b.typedValue.types["http://www.w3.org/2001/XMLSchema#integer"]={regex:/^[\-\+]?[0-9]+$/,strip:true,value:function(c){return parseInt(c,10)}};b.typedValue.types["http://www.w3.org/2001/XMLSchema#int"]={regex:/^[\-\+]?[0-9]+$/,strip:true,value:function(c){return parseInt(c,10)}};b.typedValue.types["http://www.w3.org/2001/XMLSchema#float"]={regex:/^(?:[\-\+]?(?:[0-9]+\.[0-9]*|\.[0-9]+|[0-9]+)(?:[eE][\-\+]?[0-9]+)?|[\-\+]?INF|NaN)$/,strip:true,value:function(c){if(c==="-INF"){return -1/0}else{if(c==="INF"||c==="+INF"){return 1/0}else{return parseFloat(c)}}}};b.typedValue.types["http://www.w3.org/2001/XMLSchema#double"]={regex:b.typedValue.types["http://www.w3.org/2001/XMLSchema#float"].regex,strip:true,value:b.typedValue.types["http://www.w3.org/2001/XMLSchema#float"].value};b.typedValue.types["http://www.w3.org/2001/XMLSchema#duration"]={regex:/^([\-\+])?P(?:([0-9]+)Y)?(?:([0-9]+)M)?(?:([0-9]+)D)?(?:T(?:([0-9]+)H)?(?:([0-9]+)M)?(?:([0-9]+(?:\.[0-9]+))?S)?)$/,validate:function(d){var c=this.regex.exec(d);return c[2]||c[3]||c[4]||c[5]||c[6]||c[7]},strip:true,value:function(c){return c}};b.typedValue.types["http://www.w3.org/2001/XMLSchema#dateTime"]={regex:/^(-?[0-9]{4,})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):(([0-9]{2})(\.([0-9]+))?)((?:[\-\+]([0-9]{2}):([0-9]{2}))|Z)?$/,validate:function(d){var c=this.regex.exec(d),g=parseInt(c[1],10),i=c[10]===undefined||c[10]==="Z"?"+0000":c[10].replace(/:/,""),f;if(g===0||parseInt(i,10)<-1400||parseInt(i,10)>1400){return false}try{g=g<100?Math.abs(g)+1000:g;month=parseInt(c[2],10);day=parseInt(c[3],10);if(day>31){return false}else{if(day>30&&!(month===1||month===3||month===5||month===7||month===8||month===10||month===12)){return false}else{if(month===2){if(day>29){return false}else{if(day===29&&(g%4!==0||(g%100===0&&g%400!==0))){return false}}}}}f=""+g+"/"+c[2]+"/"+c[3]+" "+c[4]+":"+c[5]+":"+c[7]+" "+i;f=new Date(f);return true}catch(h){return false}},strip:true,value:function(c){return c}};b.typedValue.types["http://www.w3.org/2001/XMLSchema#date"]={regex:/^(-?[0-9]{4,})-([0-9]{2})-([0-9]{2})((?:[\-\+]([0-9]{2}):([0-9]{2}))|Z)?$/,validate:function(e){var c=this.regex.exec(e),f=parseInt(c[1],10),g=parseInt(c[2],10),d=parseInt(c[3],10),h=c[10]===undefined||c[10]==="Z"?"+0000":c[10].replace(/:/,"");if(f===0||g>12||d>31||parseInt(h,10)<-1400||parseInt(h,10)>1400){return false}else{return true}},strip:true,value:function(c){return c}};b.typedValue.types["http://www.w3.org/2001/XMLSchema#gMonthDay"]={regex:/^--([0-9]{2})-([0-9]{2})((?:[\-\+]([0-9]{2}):([0-9]{2}))|Z)?$/,validate:function(e){var c=this.regex.exec(e),f=parseInt(c[1],10),d=parseInt(c[2],10),g=c[3]===undefined||c[3]==="Z"?"+0000":c[3].replace(/:/,"");if(f>12||d>31||parseInt(g,10)<-1400||parseInt(g,10)>1400){return false}else{if(f===2&&d>29){return false}else{if((f===4||f===6||f===9||f===11)&&d>30){return false}else{return true}}}},strip:true,value:function(c){return c}};b.typedValue.types["http://www.w3.org/2001/XMLSchema#anyURI"]={regex:/^.*$/,strip:true,value:function(c,d){var e=b.extend({},b.typedValue.defaults,d);return b.uri.resolve(c,e.base)}};b.typedValue.defaults={base:b.uri.base(),namespaces:{}};b.typedValue.valid=function(e,c){var f=b.typedValue.types[c];if(f===undefined){throw"InvalidDatatype: The datatype "+c+" can't be recognised"}else{e=f.strip?a(e):e;if(f.regex.test(e)){return f.validate===undefined?true:f.validate(e)}else{return false}}}})(jQuery);(function(a){a.curie=function(f,c){var g=a.extend({},a.curie.defaults,c||{}),b=/^(([^:]*):)?(.+)$/.exec(f),h=b[2],d=b[3],e=g.namespaces[h];if(/^:.+/.test(f)){if(g.reservedNamespace===undefined||g.reservedNamespace===null){throw"Malformed CURIE: No prefix and no default namespace for unprefixed CURIE "+f}else{e=g.reservedNamespace}}else{if(h){if(e===undefined){throw"Malformed CURIE: No namespace binding for "+h+" in CURIE "+f}}else{if(g.charcase==="lower"){f=f.toLowerCase()}else{if(g.charcase==="upper"){f=f.toUpperCase()}}if(g.reserved.length&&a.inArray(f,g.reserved)>=0){e=g.reservedNamespace;d=f}else{if(g.defaultNamespace===undefined||g.defaultNamespace===null){throw"Malformed CURIE: No prefix and no default namespace for unprefixed CURIE "+f}else{e=g.defaultNamespace}}}}return a.uri(e+d)};a.curie.defaults={namespaces:{},reserved:[],reservedNamespace:undefined,defaultNamespace:undefined,charcase:"preserve"};a.safeCurie=function(d,c){var b=/^\[([^\]]+)\]$/.exec(d);return b?a.curie(b[1],c):a.uri(d)};a.createCurie=function(f,b){var e=a.extend({},a.curie.defaults,b||{}),d=e.namespaces,c;f=a.uri(f).toString();if(e.reservedNamespace!==undefined&&f.substring(0,e.reservedNamespace.toString().length)===e.reservedNamespace.toString()){c=f.substring(e.reservedNamespace.toString().length);if(a.inArray(c,e.reserved)===-1){c=":"+c}}else{a.each(d,function(h,g){if(f.substring(0,g.toString().length)===g.toString()){c=h+":"+f.substring(g.toString().length);return null}})}if(c===undefined){throw"No Namespace Binding: There's no appropriate namespace binding for generating a CURIE from "+f}else{return c}};a.fn.curie=function(c,b){var d=a.extend({},a.fn.curie.defaults,{namespaces:this.xmlns()},b||{});return a.curie(c,d)};a.fn.safeCurie=function(d,b){var c=a.extend({},a.fn.curie.defaults,{namespaces:this.xmlns()},b||{});return a.safeCurie(d,c)};a.fn.createCurie=function(d,b){var c=a.extend({},a.fn.curie.defaults,{namespaces:this.xmlns()},b||{});return a.createCurie(d,c)};a.fn.curie.defaults={reserved:["alternate","appendix","bookmark","cite","chapter","contents","copyright","first","glossary","help","icon","index","last","license","meta","next","p3pv1","prev","role","section","stylesheet","subsection","start","top","up"],reservedNamespace:"http://www.w3.org/1999/xhtml/vocab#",defaultNamespace:undefined,charcase:"lower"}})(jQuery);(function(E){var f={},c={},s={},B={},q={},i="http://www.w3.org/2001/XMLSchema#",v="http://www.w3.org/1999/02/22-rdf-syntax-ns#",u="http://www.w3.org/2000/01/rdf-schema#",y=/^<(([^>]|\\>)*)>$/,S=/^("""((\\"|[^"])*)"""|"((\\"|[^"])*)")(@([a-z]+(-[a-z0-9]+)*)|\^\^(.+))?$/,g=/(("""((\\"|[^"])*)""")|("(\\"|[^"]|)*")|(<(\\>|[^>])*>)|\S)+/g,w=databankSeed=new Date().getTime()%1000,j=function(){w+=1;return"b"+w.toString(16)},J=function(){databankSeed+=1;return"data"+databankSeed.toString(16)},k=function(W,X){if(typeof W==="string"){try{return E.rdf.resource(W,X)}catch(Z){try{return E.rdf.blank(W,X)}catch(Y){throw"Bad Triple: Subject "+W+" is not a resource: "+Y}}}else{return W}},Q=function(X,W){if(X==="a"){return E.rdf.type}else{if(typeof X==="string"){try{return E.rdf.resource(X,W)}catch(Y){throw"Bad Triple: Property "+X+" is not a resource: "+Y}}else{return X}}},M=function(W,Y){if(typeof W==="string"){try{return E.rdf.resource(W,Y)}catch(aa){try{return E.rdf.blank(W,Y)}catch(Z){try{return E.rdf.literal(W,Y)}catch(X){throw"Bad Triple: Object "+W+" is not a resource or a literal "+X}}}}else{return W}},a=function(Z,X,Y){var W;if(typeof X==="string"){W=X.substring(1);if(Y[W]&&Y[W]!==Z){return null}else{Y[W]=Z;return Y}}else{if(X===Z){return Y}else{return null}}},T=function(X,W){return E.map(X,function(Y){var Z=W.exec(Y);return Z===null?null:{bindings:Z,triples:[Y]}})},p=function(W,Y,X){return E.map(W,function(ab,Z){var aa=E.map(Y,function(ac){var ad=true;E.each(ac.bindings,function(af,ae){if(!(ab.bindings[af]===undefined||ab.bindings[af]===ae)){ad=false;return false}});return ad?ac:null});if(aa.length>0){return E.map(aa,function(ac){return{bindings:E.extend({},ab.bindings,ac.bindings),triples:E.unique(ab.triples.concat(ac.triples))}})}else{return X?ab:null}})},U=function(W,Y){var X,Z,aa;if(Y.filterExp!==undefined&&!E.isFunction(Y.filterExp)){if(W.union===undefined){X=typeof Y.filterExp.subject==="string"?"":Y.filterExp.subject;Z=typeof Y.filterExp.property==="string"?"":Y.filterExp.property;aa=typeof Y.filterExp.object==="string"?"":Y.filterExp.object;if(W.queries[X]===undefined){W.queries[X]={}}if(W.queries[X][Z]===undefined){W.queries[X][Z]={}}if(W.queries[X][Z][aa]===undefined){W.queries[X][Z][aa]=[]}W.queries[X][Z][aa].push(Y)}else{E.each(W.union,function(ac,ab){U(ab,Y)})}}},z=function(W){W.length=0;W.matches=[];E.each(W.children,function(X,Y){z(Y)});E.each(W.partOf,function(X,Y){z(Y)})},G=function(X,W){if(W.length>0){E.each(X.children,function(Y,Z){I(Z,W)});E.each(X.partOf,function(Y,Z){G(Z,W)});E.each(W,function(Z,Y){X.matches.push(Y);Array.prototype.push.call(X,Y.bindings)})}},I=function(Y,X){var W;if(Y.union===undefined){if(Y.top||Y.parent.top){W=Y.alphaMemory}else{X=X||Y.parent.matches;if(E.isFunction(Y.filterExp)){W=E.map(X,function(Z,aa){return Y.filterExp.call(Z.bindings,aa,Z.bindings,Z.triples)?Z:null})}else{W=p(X,Y.alphaMemory,Y.filterExp.optional)}}}else{W=E.map(Y.union,function(Z){return Z.matches})}G(Y,W)},o=function(Y,X){var W;if(Y.filterExp.optional){z(Y);I(Y)}else{if(Y.top||Y.parent.top){W=[X]}else{W=p(Y.parent.matches,[X],false)}G(Y,W)}},O=function(X,Y){var W,Z=X.filterExp.exec(Y);if(Z!==null){W={triples:[Y],bindings:Z};X.alphaMemory.push(W);o(X,W)}},d=function(W,X){W.alphaMemory.splice(E.inArray(X,W.alphaMemory),1);z(W);I(W)},A=function(W,X){E.each(W,function(Y,Z){O(Z,X)})},l=function(W,X){E.each(W,function(Y,Z){d(Z,X)})},e=function(W,aa){var X=aa.subject,Y=aa.property,Z=aa.object;if(W.union===undefined){if(W.queries[X]!==undefined){if(W.queries[X][Y]!==undefined){if(W.queries[X][Y][Z]!==undefined){A(W.queries[X][Y][Z],aa)}if(W.queries[X][Y][""]!==undefined){A(W.queries[X][Y][""],aa)}}if(W.queries[X][""]!==undefined){if(W.queries[X][""][Z]!==undefined){A(W.queries[X][""][Z],aa)}if(W.queries[X][""][""]!==undefined){A(W.queries[X][""][""],aa)}}}if(W.queries[""]!==undefined){if(W.queries[""][Y]!==undefined){if(W.queries[""][Y][Z]!==undefined){A(W.queries[""][Y][Z],aa)}if(W.queries[""][Y][""]!==undefined){A(W.queries[""][Y][""],aa)}}if(W.queries[""][""]!==undefined){if(W.queries[""][""][Z]!==undefined){A(W.queries[""][""][Z],aa)}if(W.queries[""][""][""]!==undefined){A(W.queries[""][""][""],aa)}}}}else{E.each(W.union,function(ac,ab){e(ab,aa)})}},r=function(W,aa){var X=aa.subject,Y=aa.property,Z=aa.object;if(W.union===undefined){if(W.queries[X]!==undefined){if(W.queries[X][Y]!==undefined){if(W.queries[X][Y][Z]!==undefined){l(W.queries[X][Y][Z],aa)}if(W.queries[X][Y][""]!==undefined){l(W.queries[X][Y][""],aa)}}if(W.queries[X][""]!==undefined){if(W.queries[X][""][Z]!==undefined){l(W.queries[X][""][Z],aa)}if(W.queries[X][""][""]!==undefined){l(W.queries[X][""][""],aa)}}}if(W.queries[""]!==undefined){if(W.queries[""][Y]!==undefined){if(W.queries[""][Y][Z]!==undefined){l(W.queries[""][Y][Z],aa)}if(W.queries[""][Y][""]!==undefined){l(W.queries[""][Y][""],aa)}}if(W.queries[""][""]!==undefined){if(W.queries[""][""][Z]!==undefined){l(W.queries[""][""][Z],aa)}if(W.queries[""][""][""]!==undefined){l(W.queries[""][""][""],aa)}}}}else{E.each(W.union,function(ac,ab){r(ab,aa)})}},m=function(ab){var aa={},X,W,Y,Z;for(X=0;X<ab.length;X+=1){W=ab[X];Y=W.subject.value.toString();Z=W.property.value.toString();if(aa[Y]===undefined){aa[Y]={}}if(aa[Y][Z]===undefined){aa[Y][Z]=[]}aa[Y][Z].push(W.object.dump())}return aa},V=function(aa){var af,ac,X,ad,Y,Z,ab,W,ae=[];for(af in aa){ac=(af.substring(0,2)==="_:")?E.rdf.blank(af):E.rdf.resource("<"+af+">");for(X in aa[af]){ad=E.rdf.resource("<"+X+">");for(ab=0;ab<aa[af][X].length;ab+=1){Y=aa[af][X][ab];if(Y.type==="uri"){Z=E.rdf.resource("<"+Y.value+">")}else{if(Y.type==="bnode"){Z=E.rdf.blank(Y.value)}else{if(Y.datatype!==undefined){Z=E.rdf.literal(Y.value,{datatype:Y.datatype})}else{W={};if(Y.lang!==undefined){W.lang=Y.lang}Z=E.rdf.literal('"'+Y.value+'"',W)}}}ae.push(E.rdf.triple(ac,ad,Z))}}}return ae},D=function(Z,Y,X,aa){var ab=Z.ownerDocument,W;if(Y!==undefined&&Y!==null){if(ab.createAttributeNS){W=ab.createAttributeNS(Y,X);W.nodeValue=aa;Z.attributes.setNamedItemNS(W)}else{W=ab.createNode(2,X,Y);W.nodeValue=aa;Z.attributes.setNamedItem(W)}}else{W=ab.createAttribute(X);W.nodeValue=aa;Z.attributes.setNamedItem(W)}return Z},x=function(X,W,Y){if(Y){D(X,"http://www.w3.org/2000/xmlns/","xmlns:"+Y,W)}else{D(X,undefined,"xmlns",W)}return X},C=function(Y,W){var aa,ab="",Z,X=false;if(Y!==undefined&&Y!==null){if(/:/.test(W)){Z=/([^:]+):/.exec(W)[1]}X=true}if(document.implementation&&document.implementation.createDocument){aa=document.implementation.createDocument(Y,W,null);if(X){x(aa.documentElement,Y,Z)}return aa}else{aa=new ActiveXObject("Microsoft.XMLDOM");aa.async="false";if(Z===undefined){ab=' xmlns="'+Y+'"'}else{ab=" xmlns:"+Z+'="'+Y+'"'}aa.loadXML("<"+W+ab+"/>");return aa}},h=function(Y,X,W){var aa=Y.ownerDocument,Z;if(X!==undefined&&X!==null){Z=aa.createElementNS?aa.createElementNS(X,W):aa.createNode(1,W,X)}else{Z=aa.createElement(W)}Y.appendChild(Z);return Z},L=function(X,Z){var Y=X.ownerDocument,W;W=Y.createTextNode(Z);X.appendChild(W);return X},t=function(Y,W){var ac,aa,X,ab;try{aa=new ActiveXObject("Microsoft.XMLDOM");aa.async="false";aa.loadXML("<temp>"+W+"</temp>")}catch(Z){ac=new DOMParser();aa=ac.parseFromString("<temp>"+W+"</temp>","text/xml")}for(X=0;X<aa.documentElement.childNodes.length;X+=1){Y.appendChild(aa.documentElement.childNodes[X].cloneNode(true))}return Y},K=function(aj,al){var ah=C(v,"rdf:RDF"),ac=m(aj),X=al.namespaces||{},Y,ak,ad,W,ae,aa,ai,Z,ag,af,ab;for(Y in X){x(ah.documentElement,X[Y],Y)}for(ak in ac){if(ac[ak][E.rdf.type.value]!==undefined){Z=/(.+[#\/])([^#\/]+)/.exec(ac[ak][E.rdf.type.value][0].value);af=Z[1];ag=Z[2];for(Y in X){if(X[Y]===af){ab=Y;break}}ad=h(ah.documentElement,af,ab+":"+ag)}else{ad=h(ah.documentElement,v,"rdf:Description")}if(/^_:/.test(ak)){D(ad,v,"rdf:nodeID",ak.substring(2))}else{D(ad,v,"rdf:about",ak)}for(W in ac[ak]){if(W!==E.rdf.type.value.toString()||ac[ak][W].length>1){Z=/(.+[#\/])([^#\/]+)/.exec(W);af=Z[1];ag=Z[2];for(Y in X){if(X[Y]===af){ab=Y;break}}for(aa=(W===E.rdf.type.value.toString()?1:0);aa<ac[ak][W].length;aa+=1){ai=ac[ak][W][aa];ae=h(ad,af,ab+":"+ag);if(ai.type==="uri"){D(ae,v,"rdf:resource",ai.value)}else{if(ai.type==="literal"){if(ai.datatype!==undefined){if(ai.datatype==="http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"){D(ae,v,"rdf:parseType","Literal");t(ae,ai.value)}else{D(ae,v,"rdf:datatype",ai.datatype);L(ae,ai.value)}}else{if(ai.lang!==undefined){D(ae,"http://www.w3.org/XML/1998/namespace","xml:lang",ai.lang);L(ae,ai.value)}else{L(ae,ai.value)}}}else{D(ae,v,"rdf:nodeID",ai.value.substring(2))}}}}}}return ah},R=function(W){switch(W){case"http://www.w3.org/1999/02/22-rdf-syntax-ns":return"rdf";case"http://www.w3.org/XML/1998/namespace":return"xml";case"http://www.w3.org/2000/xmlns/":return"xmlns";default:throw ("No default prefix mapped for namespace "+W)}},b=function(Y,X,W){var aa;if(Y.hasAttributeNS){return Y.hasAttributeNS(X,W)}else{try{aa=/:/.test(W)?/:(.+)$/.exec(W)[1]:W;return Y.attributes.getQualifiedItem(aa,X)!==null}catch(Z){return Y.getAttribute(R(X)+":"+W)!==null}}},F=function(Y,X,W){var aa;if(Y.getAttributeNS){return Y.getAttributeNS(X,W)}else{try{aa=/:/.test(W)?/:(.+)$/.exec(W)[1]:W;return Y.attributes.getQualifiedItem(aa,X).nodeValue}catch(Z){return Y.getAttribute(R(X)+":"+W)}}},H=function(W){return W.localName||W.baseName},n=function(Y,Z){var X,W;if(b(Y,v,"about")){X=F(Y,v,"about");W=E.rdf.resource("<"+X+">",{base:Z})}else{if(b(Y,v,"ID")){X=F(Y,v,"ID");W=E.rdf.resource("<#"+X+">",{base:Z})}else{if(b(Y,v,"nodeID")){X=F(Y,v,"nodeID");W=E.rdf.blank("_:"+X)}else{W=E.rdf.blank("[]")}}}return W},N=function(ao,Y,Z,at){var ab,ae,ac,af,ap,aj,at,ai,ah,ad=1,ar,aq,al,W=[],aa,an,ak={},X,ag=[];at=F(ao,"http://www.w3.org/XML/1998/namespace","lang")||at;Z=F(ao,"http://www.w3.org/XML/1998/namespace","base")||Z;if(at!==null&&at!==undefined&&at!==""){ak={lang:at}}ab=n(ao,Z);if(Y&&(ao.namespaceURI!==v||H(ao)!=="Description")){ac=E.rdf.type;ap=E.rdf.resource("<"+ao.namespaceURI+H(ao)+">");ag.push(E.rdf.triple(ab,ac,ap))}for(ai=0;ai<ao.attributes.length;ai+=1){ae=ao.attributes.item(ai);if(ae.namespaceURI!==undefined&&ae.namespaceURI!=="http://www.w3.org/2000/xmlns/"&&ae.namespaceURI!=="http://www.w3.org/XML/1998/namespace"&&ae.prefix!=="xmlns"&&ae.prefix!=="xml"){if(ae.namespaceURI!==v){ac=E.rdf.resource("<"+ae.namespaceURI+H(ae)+">");ap=E.rdf.literal('"'+ae.nodeValue+'"',ak);ag.push(E.rdf.triple(ab,ac,ap))}else{if(H(ae)==="type"){ac=E.rdf.type;ap=E.rdf.resource("<"+ae.nodeValue+">",{base:Z});ag.push(E.rdf.triple(ab,ac,ap))}}}}for(ai=0;ai<ao.childNodes.length;ai+=1){ae=ao.childNodes[ai];if(ae.nodeType===1){if(ae.namespaceURI===v&&H(ae)==="li"){ac=E.rdf.resource("<"+v+"_"+ad+">");ad+=1}else{ac=E.rdf.resource("<"+ae.namespaceURI+H(ae)+">")}at=F(ae,"http://www.w3.org/XML/1998/namespace","lang")||at;if(at!==null&&at!==undefined&&at!==""){ak={lang:at}}if(b(ae,v,"resource")){af=F(ae,v,"resource");ap=E.rdf.resource("<"+af+">",{base:Z})}else{if(b(ae,v,"nodeID")){af=F(ae,v,"nodeID");ap=E.rdf.blank("_:"+af)}else{if(b(ae,v,"parseType")){aa=F(ae,v,"parseType");if(aa==="Literal"){try{an=new XMLSerializer();af=an.serializeToString(ae.getElementsByTagName("*")[0])}catch(am){af="";for(ah=0;ah<ae.childNodes.length;ah+=1){af+=ae.childNodes[ah].xml}}ap=E.rdf.literal(af,{datatype:v+"XMLLiteral"})}else{if(aa==="Resource"){X=N(ae,false,Z,at);if(X.length>0){ap=X[X.length-1].subject;ag=ag.concat(X)}else{ap=E.rdf.blank("[]")}}else{if(aa==="Collection"){if(ae.getElementsByTagName("*").length>0){for(ah=0;ah<ae.childNodes.length;ah+=1){af=ae.childNodes[ah];if(af.nodeType===1){W.push(af)}}ar=E.rdf.blank("[]");ap=ar;for(ah=0;ah<W.length;ah+=1){af=W[ah];X=N(af,true,Z,at);if(X.length>0){al=X[X.length-1].subject;ag=ag.concat(X)}else{al=n(af)}ag.push(E.rdf.triple(ar,E.rdf.first,al));if(ah===W.length-1){ag.push(E.rdf.triple(ar,E.rdf.rest,E.rdf.nil))}else{aq=E.rdf.blank("[]");ag.push(E.rdf.triple(ar,E.rdf.rest,aq));ar=aq}}}else{ap=E.rdf.nil}}}}}else{if(b(ae,v,"datatype")){af=ae.childNodes[0].nodeValue;ap=E.rdf.literal(af,{datatype:F(ae,v,"datatype")})}else{if(ae.getElementsByTagName("*").length>0){for(ah=0;ah<ae.childNodes.length;ah+=1){af=ae.childNodes[ah];if(af.nodeType===1){X=N(af,true,Z,at);if(X.length>0){ap=X[X.length-1].subject;ag=ag.concat(X)}else{ap=n(af)}}}}else{if(ae.childNodes.length>0){af=ae.childNodes[0].nodeValue;ap=E.rdf.literal('"'+af+'"',ak)}else{X=N(ae,false,Z,at);if(X.length>0){ap=X[X.length-1].subject;ag=ag.concat(X)}else{ap=E.rdf.blank("[]")}}}}}}}ag.push(E.rdf.triple(ab,ac,ap));if(b(ae,v,"ID")){aj=E.rdf.resource("<#"+F(ae,v,"ID")+">",{base:Z});ag.push(E.rdf.triple(aj,E.rdf.subject,ab));ag.push(E.rdf.triple(aj,E.rdf.property,ac));ag.push(E.rdf.triple(aj,E.rdf.object,ap))}}}return ag},P=function(X){var W,Z,Y,aa=[];if(X.documentElement.namespaceURI===v&&H(X.documentElement)==="RDF"){Z=F(X.documentElement,"http://www.w3.org/XML/1998/namespace","lang");base=F(X.documentElement,"http://www.w3.org/XML/1998/namespace","base")||E.uri.base();for(W=0;W<X.documentElement.childNodes.length;W+=1){Y=X.documentElement.childNodes[W];if(Y.nodeType===1){aa=aa.concat(N(Y,true,base,Z))}}}else{aa=N(X.documentElement,true)}return aa};E.typedValue.types["http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"]={regex:/^.*$/m,strip:false,value:function(W){return W}};E.rdf=function(W){return new E.rdf.fn.init(W)};E.rdf.fn=E.rdf.prototype={rdfquery:"0.9",init:function(W){var X;W=W||{};this.parent=W.parent;this.union=W.union;this.top=this.parent===undefined&&this.union===undefined;if(this.union===undefined){if(W.databank===undefined){this.databank=this.parent===undefined?E.rdf.databank(W.triples,W):this.parent.databank}else{this.databank=W.databank}}else{X=E.map(this.union,function(Y){return Y.databank});X=E.unique(X);if(X[1]!==undefined){this.databank=E.rdf.databank(undefined,{union:X})}else{this.databank=X[0]}}this.children=[];this.partOf=[];this.filterExp=W.filter;this.alphaMemory=[];this.matches=[];this.length=0;if(this.filterExp!==undefined){if(!E.isFunction(this.filterExp)){U(this.databank,this);this.alphaMemory=T(this.databank.triples(),this.filterExp)}}I(this);return this},base:function(W){if(W===undefined){return this.databank.base()}else{this.databank.base(W);return this}},prefix:function(X,W){if(W===undefined){return this.databank.prefix(X)}else{this.databank.prefix(X,W);return this}},add:function(Z,X){var Y,W;if(Z.rdfquery!==undefined){if(Z.top){W=this.databank.add(Z.databank);Y=E.rdf({parent:this.parent,databank:W});return Y}else{if(this.top){W=Z.databank.add(this.databank);Y=E.rdf({parent:Z.parent,databank:W});return Y}else{if(this.union===undefined){Y=E.rdf({union:[this,Z]});this.partOf.push(Y);Z.partOf.push(Y);return Y}else{this.union.push(Z);Z.partOf.push(this)}}}}else{if(typeof Z==="string"){X=E.extend({},{base:this.base(),namespaces:this.prefix(),source:Z},X);Z=E.rdf.pattern(Z,X)}if(Z.isFixed()){this.databank.add(Z.triple(),X)}else{Y=this;this.each(function(ab,ac){var aa=Z.triple(ac);if(aa!==null){Y.databank.add(aa,X)}})}}return this},remove:function(X,W){if(typeof X==="string"){W=E.extend({},{base:this.base(),namespaces:this.prefix()},W);X=E.rdf.pattern(X,W)}if(X.isFixed()){this.databank.remove(X.triple(),W)}else{query=this;this.each(function(Z,aa){var Y=X.triple(aa);if(Y!==null){query.databank.remove(Y,W)}})}return this},load:function(X,W){this.databank.load(X,W);return this},except:function(W){return E.rdf({databank:this.databank.except(W.databank)})},where:function(Y,X){var ab,aa,Z,W;X=X||{};if(typeof Y==="string"){aa=X.base||this.base();Z=E.extend({},this.prefix(),X.namespaces||{});W=X.optional||false;Y=E.rdf.pattern(Y,{namespaces:Z,base:aa,optional:W})}ab=E.rdf(E.extend({},X,{parent:this,filter:Y}));this.children.push(ab);return ab},optional:function(X,W){return this.where(X,E.extend({},W||{},{optional:true}))},about:function(X,W){return this.where(X+" ?property ?value",W)},filter:function(Y,Z){var W,X;if(typeof Y==="string"){if(Z.constructor===RegExp){W=function(){return Z.test(this[Y].value)}}else{W=function(){return this[Y].type==="literal"?this[Y].value===Z:this[Y]===Z}}}else{W=Y}X=E.rdf({parent:this,filter:W});this.children.push(X);return X},select:function(Z){var Y=[],X,W;for(X=0;X<this.length;X+=1){if(Z===undefined){Y[X]=this[X]}else{Y[X]={};for(W=0;W<Z.length;W+=1){Y[X][Z[W]]=this[X][Z[W]]}}}return Y},describe:function(aa){var X,W,Z,Y=[];for(X=0;X<aa.length;X+=1){Z=aa[X];if(Z.substring(0,1)==="?"){Z=Z.substring(1);for(W=0;W<this.length;W+=1){Y.push(this[W][Z])}}else{Y.push(Z)}}return this.databank.describe(Y)},eq:function(W){return this.filter(function(X){return X===W})},reset:function(){var W=this;while(W.parent!==undefined){W=W.parent}return W},end:function(){return this.parent},size:function(){return this.length},sources:function(){return E(E.map(this.matches,function(W){return[W.triples]}))},dump:function(W){var X=E.map(this.matches,function(Y){return Y.triples});W=E.extend({namespaces:this.databank.namespaces,base:this.databank.base},W||{});return E.rdf.dump(X,W)},get:function(W){return(W===undefined)?E.makeArray(this):this[W]},each:function(W){E.each(this.matches,function(Y,X){W.call(X.bindings,Y,X.bindings,X.triples)});return this},map:function(W){return E(E.map(this.matches,function(X,Y){return W.call(X.bindings,Y,X.bindings,X.triples)}))},jquery:function(){return E(this)}};E.rdf.fn.init.prototype=E.rdf.fn;E.rdf.gleaners=[];E.rdf.dump=function(ab,W){var Y=E.extend({},E.rdf.dump.defaults,W||{}),aa=Y.format,X=Y.serialize,Z;if(aa==="application/json"){Z=m(ab,Y);return X?E.toJSON(Z):Z}else{if(aa==="application/rdf+xml"){Z=K(ab,Y);if(X){if(Z.xml){return Z.xml.replace(/\s+$/,"")}else{serializer=new XMLSerializer();return serializer.serializeToString(Z)}}else{return Z}}else{throw"Unrecognised dump format: "+aa+". Expected application/json or application/rdf+xml."}}};E.rdf.dump.defaults={format:"application/json",serialize:false,namespaces:{}};E.fn.rdf=function(){var W=[];if(E(this)[0]&&E(this)[0].nodeType===9){return E(this).children("*").rdf()}else{if(E(this).length>0){W=E(this).map(function(X,Y){return E.map(E.rdf.gleaners,function(Z){return Z.call(E(Y))})});return E.rdf({triples:W,namespaces:E(this).xmlns()})}else{return E.rdf()}}};E.extend(E.expr[":"],{about:function(X,Z,W){var Y=E(X),ab=W[3]?Y.safeCurie(W[3]):null,aa=false;E.each(E.rdf.gleaners,function(ac,ad){aa=ad.call(Y,{about:ab});if(aa){return null}});return aa},type:function(X,Z,W){var Y=E(X),aa=W[3]?Y.curie(W[3]):null,ab=false;E.each(E.rdf.gleaners,function(ac,ad){if(ad.call(Y,{type:aa})){ab=true;return null}});return ab}});E.rdf.databank=function(X,W){return new E.rdf.databank.fn.init(X,W)};E.rdf.databank.fn=E.rdf.databank.prototype={init:function(Y,W){var X;Y=Y||[];W=W||{};this.id=J();if(W.union===undefined){this.queries={};this.tripleStore={};this.objectStore={};this.baseURI=W.base||E.uri.base();this.namespaces=E.extend({},W.namespaces||{});for(X=0;X<Y.length;X+=1){this.add(Y[X])}}else{this.union=W.union}return this},base:function(W){if(this.union===undefined){if(W===undefined){return this.baseURI}else{this.baseURI=W;return this}}else{if(W===undefined){return this.union[0].base()}else{E.each(this.union,function(Y,X){X.base(W)});return this}}},prefix:function(Y,W){var X={};if(this.union===undefined){if(Y===undefined){return this.namespaces}else{if(W===undefined){return this.namespaces[Y]}else{this.namespaces[Y]=W;return this}}}else{if(W===undefined){E.each(this.union,function(aa,Z){E.extend(X,Z.prefix())});if(Y===undefined){return X}else{return X[Y]}}else{E.each(this.union,function(aa,Z){Z.prefix(Y,W)});return this}}},add:function(aa,X){var Z=(X&&X.base)||this.base(),Y=E.extend({},this.prefix(),(X&&X.namespaces)||{}),W;if(aa===this){return this}else{if(aa.tripleStore!==undefined){if(this.union===undefined){W=E.rdf.databank(undefined,{union:[this,aa]});return W}else{this.union.push(aa);return this}}else{if(typeof aa==="string"){aa=E.rdf.triple(aa,{namespaces:Y,base:Z,source:aa})}if(this.union===undefined){if(this.tripleStore[aa.subject]===undefined){this.tripleStore[aa.subject]=[]}if(E.inArray(aa,this.tripleStore[aa.subject])===-1){this.tripleStore[aa.subject].push(aa);if(aa.object.type==="uri"||aa.object.type==="bnode"){if(this.objectStore[aa.object]===undefined){this.objectStore[aa.object]=[]}this.objectStore[aa.object].push(aa)}e(this,aa)}}else{E.each(this.union,function(ac,ab){ab.add(aa)})}return this}}},remove:function(ab,Y){var aa=(Y&&Y.base)||this.base(),Z=E.extend({},this.prefix(),(Y&&Y.namespaces)||{}),ac,W,X;if(typeof ab==="string"){ab=E.rdf.triple(ab,{namespaces:Z,base:aa,source:ab})}ac=this.tripleStore[ab.subject];if(ac!==undefined){ac.splice(E.inArray(ab,ac),1)}if(ab.object.type==="uri"||ab.object.type==="bnode"){W=this.objectStore[ab.object];if(W!==undefined){W.splice(E.inArray(ab,W),1)}}r(this,ab);return this},except:function(X){var W=X.tripleStore,Y=[];E.each(this.tripleStore,function(aa,ab){var Z=W[aa];if(Z===undefined){Y=Y.concat(ab)}else{E.each(ab,function(ad,ac){if(E.inArray(ac,Z)===-1){Y.push(ac)}})}});return E.rdf.databank(Y)},triples:function(){var W=[];if(this.union===undefined){E.each(this.tripleStore,function(Y,X){W=W.concat(X)})}else{E.each(this.union,function(Y,X){W=W.concat(X.triples().get())});W=E.unique(W)}return E(W)},size:function(){return this.triples().length},describe:function(Z){var X,Y,W,ab={},aa=[];while(Z.length>0){Y=Z.pop();if(ab[Y]===undefined){if(Y.value===undefined){Y=E.rdf.resource(Y)}if(this.tripleStore[Y]!==undefined){for(X=0;X<this.tripleStore[Y].length;X+=1){W=this.tripleStore[Y][X];aa.push(W);if(W.object.type==="bnode"){Z.push(W.object)}}}if(this.objectStore[Y]!==undefined){for(X=0;X<this.objectStore[Y].length;X+=1){W=this.objectStore[Y][X];aa.push(W);if(W.subject.type==="bnode"){Z.push(W.subject)}}}ab[Y]=true}}return E.unique(aa)},dump:function(W){W=E.extend({namespaces:this.namespaces,base:this.base},W||{});return E.rdf.dump(this.triples(),W)},load:function(X){var W,Y;if(X.ownerDocument!==undefined){Y=P(X)}else{Y=V(X)}for(W=0;W<Y.length;W+=1){this.add(Y[W])}return this},toString:function(){return"[Databank with "+this.size()+" triples]"}};E.rdf.databank.fn.init.prototype=E.rdf.databank.fn;E.rdf.pattern=function(aa,ac,Z,Y){var ab,W,X;if(Z===undefined){Y=ac||{};W=E.trim(aa).match(g);if(W.length===3||(W.length===4&&W[3]===".")){aa=W[0];ac=W[1];Z=W[2]}else{throw"Bad Pattern: Couldn't parse string "+aa}X=(Y.optional===undefined)?E.rdf.pattern.defaults.optional:Y.optional}if(q[aa]&&q[aa][ac]&&q[aa][ac][Z]&&q[aa][ac][Z][X]){return q[aa][ac][Z][X]}ab=new E.rdf.pattern.fn.init(aa,ac,Z,Y);if(q[ab.subject]&&q[ab.subject][ab.property]&&q[ab.subject][ab.property][ab.object]&&q[ab.subject][ab.property][ab.object][ab.optional]){return q[ab.subject][ab.property][ab.object][ab.optional]}else{if(q[ab.subject]===undefined){q[ab.subject]={}}if(q[ab.subject][ab.property]===undefined){q[ab.subject][ab.property]={}}if(q[ab.subject][ab.property][ab.object]===undefined){q[ab.subject][ab.property][ab.object]={}}q[ab.subject][ab.property][ab.object][ab.optional]=ab;return ab}};E.rdf.pattern.fn=E.rdf.pattern.prototype={init:function(X,Z,aa,W){var Y=E.extend({},E.rdf.pattern.defaults,W);this.subject=X.toString().substring(0,1)==="?"?X:k(X,Y);this.property=Z.toString().substring(0,1)==="?"?Z:Q(Z,Y);this.object=aa.toString().substring(0,1)==="?"?aa:M(aa,Y);this.optional=Y.optional;return this},fill:function(Z){var W=this.subject,X=this.property,Y=this.object;if(typeof W==="string"&&Z[W.substring(1)]){W=Z[W.substring(1)]}if(typeof X==="string"&&Z[X.substring(1)]){X=Z[X.substring(1)]}if(typeof Y==="string"&&Z[Y.substring(1)]){Y=Z[Y.substring(1)]}return E.rdf.pattern(W,X,Y,{optional:this.optional})},exec:function(X){var W={};W=a(X.subject,this.subject,W);if(W===null){return null}W=a(X.property,this.property,W);if(W===null){return null}W=a(X.object,this.object,W);return W},isFixed:function(){return typeof this.subject!=="string"&&typeof this.property!=="string"&&typeof this.object!=="string"},triple:function(X){var W=this;if(!this.isFixed()){W=this.fill(X)}if(W.isFixed()){return E.rdf.triple(W.subject,W.property,W.object,{source:this.toString()})}else{return null}},toString:function(){return this.subject+" "+this.property+" "+this.object}};E.rdf.pattern.fn.init.prototype=E.rdf.pattern.fn;E.rdf.pattern.defaults={base:E.uri.base(),namespaces:{},optional:false};E.rdf.triple=function(Z,ab,Y,X){var ac,aa,W;if(Y===undefined){X=ab;W=E.trim(Z).match(g);if(W.length===3||(W.length===4&&W[3]===".")){Z=W[0];ab=W[1];Y=W[2]}else{throw"Bad Triple: Couldn't parse string "+Z}}aa=(X&&X.graph)||"";if(B[aa]&&B[aa][Z]&&B[aa][Z][ab]&&B[aa][Z][ab][Y]){return B[aa][Z][ab][Y]}ac=new E.rdf.triple.fn.init(Z,ab,Y,X);aa=ac.graph||"";if(B[aa]&&B[aa][ac.subject]&&B[aa][ac.subject][ac.property]&&B[aa][ac.subject][ac.property][ac.object]){return B[aa][ac.subject][ac.property][ac.object]}else{if(B[aa]===undefined){B[aa]={}}if(B[aa][ac.subject]===undefined){B[aa][ac.subject]={}}if(B[aa][ac.subject][ac.property]===undefined){B[aa][ac.subject][ac.property]={}}B[aa][ac.subject][ac.property][ac.object]=ac;return ac}};E.rdf.triple.fn=E.rdf.triple.prototype={init:function(X,Z,aa,W){var Y;Y=E.extend({},E.rdf.triple.defaults,W);this.subject=k(X,Y);this.property=Q(Z,Y);this.object=M(aa,Y);this.graph=Y.graph===undefined?undefined:k(Y.graph,Y);this.source=Y.source;return this},isFixed:function(){return true},triple:function(W){return this},dump:function(){var Y={},W=this.subject.value.toString(),X=this.property.value.toString();Y[W]={};Y[W][X]=this.object.dump();return Y},toString:function(){return this.subject+" "+this.property+" "+this.object+" ."}};E.rdf.triple.fn.init.prototype=E.rdf.triple.fn;E.rdf.triple.defaults={base:E.uri.base(),source:[document],namespaces:{}};E.rdf.resource=function(Y,W){var X;if(f[Y]){return f[Y]}X=new E.rdf.resource.fn.init(Y,W);if(f[X]){return f[X]}else{f[X]=X;return X}};E.rdf.resource.fn=E.rdf.resource.prototype={type:"uri",value:undefined,init:function(ab,X){var W,aa,Z,Y;if(typeof ab==="string"){W=y.exec(ab);Y=E.extend({},E.rdf.resource.defaults,X);if(W!==null){this.value=E.uri.resolve(W[1].replace(/\\>/g,">"),Y.base)}else{if(ab.substring(0,1)===":"){Z=Y.namespaces[""];if(Z===undefined){throw"Malformed Resource: No namespace binding for default namespace in "+ab}else{this.value=E.uri.resolve(Z+ab.substring(1))}}else{if(ab.substring(ab.length-1)===":"){aa=ab.substring(0,ab.length-1);Z=Y.namespaces[aa];if(Z===undefined){throw"Malformed Resource: No namespace binding for prefix "+aa+" in "+ab}else{this.value=E.uri.resolve(Z)}}else{try{this.value=E.curie(ab,{namespaces:Y.namespaces})}catch(ac){throw"Malformed Resource: Bad format for resource "+ac}}}}}else{this.value=ab}return this},dump:function(){return{type:"uri",value:this.value.toString()}},toString:function(){return"<"+this.value+">"}};E.rdf.resource.fn.init.prototype=E.rdf.resource.fn;E.rdf.resource.defaults={base:E.uri.base(),namespaces:{}};E.rdf.type=E.rdf.resource("<"+v+"type>");E.rdf.label=E.rdf.resource("<"+u+"label>");E.rdf.first=E.rdf.resource("<"+v+"first>");E.rdf.rest=E.rdf.resource("<"+v+"rest>");E.rdf.nil=E.rdf.resource("<"+v+"nil>");E.rdf.subject=E.rdf.resource("<"+v+"subject>");E.rdf.property=E.rdf.resource("<"+v+"property>");E.rdf.object=E.rdf.resource("<"+v+"object>");E.rdf.blank=function(W){var X;if(c[W]){return c[W]}X=new E.rdf.blank.fn.init(W);if(c[X]){return c[X]}else{c[X]=X;return X}};E.rdf.blank.fn=E.rdf.blank.prototype={type:"bnode",value:undefined,id:undefined,init:function(W){if(W==="[]"){this.id=j();this.value="_:"+this.id}else{if(W.substring(0,2)==="_:"){this.id=W.substring(2);this.value=W}else{throw"Malformed Blank Node: "+W+" is not a legal format for a blank node"}}return this},dump:function(){return{type:"bnode",value:this.value}},toString:function(){return this.value}};E.rdf.blank.fn.init.prototype=E.rdf.blank.fn;E.rdf.literal=function(Y,W){var X;if(s[Y]){return s[Y]}X=new E.rdf.literal.fn.init(Y,W);if(s[X]){return s[X]}else{s[X]=X;return X}};E.rdf.literal.fn=E.rdf.literal.prototype={type:"literal",value:undefined,lang:undefined,datatype:undefined,init:function(aa,X){var W,Y,Z=E.extend({},E.rdf.literal.defaults,X);if(Z.lang!==undefined&&Z.datatype!==undefined){throw"Malformed Literal: Cannot define both a language and a datatype for a literal ("+aa+")"}if(Z.datatype!==undefined){Y=E.safeCurie(Z.datatype,{namespaces:Z.namespaces});E.extend(this,E.typedValue(aa.toString(),Y))}else{if(Z.lang!==undefined){this.value=aa.toString();this.lang=Z.lang}else{if(typeof aa==="boolean"){E.extend(this,E.typedValue(aa.toString(),i+"boolean"))}else{if(typeof aa==="number"){E.extend(this,E.typedValue(aa.toString(),i+"double"))}else{if(aa==="true"||aa==="false"){E.extend(this,E.typedValue(aa,i+"boolean"))}else{if(E.typedValue.valid(aa,i+"integer")){E.extend(this,E.typedValue(aa,i+"integer"))}else{if(E.typedValue.valid(aa,i+"decimal")){E.extend(this,E.typedValue(aa,i+"decimal"))}else{if(E.typedValue.valid(aa,i+"double")&&!/^\s*([\-\+]?INF|NaN)\s*$/.test(aa)){E.extend(this,E.typedValue(aa,i+"double"))}else{W=S.exec(aa);if(W!==null){this.value=(W[2]||W[4]).replace(/\\"/g,'"');if(W[9]){Y=E.rdf.resource(W[9],Z);E.extend(this,E.typedValue(this.value,Y.value))}else{if(W[7]){this.lang=W[7]}}}else{throw"Malformed Literal: Couldn't recognise the value "+aa}}}}}}}}}return this},dump:function(){var W={type:"literal",value:this.value.toString()};if(this.lang!==undefined){W.lang=this.lang}else{if(this.datatype!==undefined){W.datatype=this.datatype.toString()}}return W},toString:function(){var W='"'+this.value+'"';if(this.lang!==undefined){W+="@"+this.lang}else{if(this.datatype!==undefined){W+="^^<"+this.datatype+">"}}return W}};E.rdf.literal.fn.init.prototype=E.rdf.literal.fn;E.rdf.literal.defaults={base:E.uri.base(),namespaces:{},datatype:undefined,lang:undefined}})(jQuery);