MediaWiki:Common.js

From Semantic Lab
Revision as of 01:53, 19 July 2024 by Matt (talk | contribs)
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
if (document.querySelector("#P200")){
  var p200Container = document.querySelector("#P200");
	var p200Container = document.querySelector("#P200");
	var aLinks = p200Container.querySelectorAll("a");
	var urls = [];
	for (var el = 0; el < aLinks.length; el++) {
		if (aLinks[el].getAttribute('href') && (aLinks[el].getAttribute('href').toLowerCase().endsWith('.png') || aLinks[el].getAttribute('href').toLowerCase().endsWith('.jpg') || aLinks[el].getAttribute('href').toLowerCase().endsWith('.jpeg') ) ){
			urls.push(aLinks[el].getAttribute('href'));
		}
	}

	var imageContainer = document.createElement('div');
	imageContainer.classList.add('wikibase-statementgroupview');
	imageContainer.innerHTML = "";

	for (var url in urls){
		var img = document.createElement('img');
		img.style.width = "95%";
		img.style.height = "auto";
		img.style.marginTop="0.2em";
		img.style.marginBottom="0.2em";
		img.setAttribute('src',urls[url]);
		var a = document.createElement('a');
		a.setAttribute('href',urls[url]);
		a.setAttribute('target','_blank');
		a.appendChild(img);
		imageContainer.appendChild(a);

	}
	//imageContainer.style.border = "1px solid #c8ccd1"
	imageContainer.style.borderBottom = "none";
	imageContainer.style.marginBottom = 0;
	imageContainer.style.textAlign = 'center';
	imageContainer.style.width = '100%';
	imageContainer.style.backgroundColor = '#eaecf0';
	//document.querySelector(".wikibase-listview").insertBefore(imageContainer, p200Container);
    window.setTimeout(function(){
    p200Container.parentNode.insertBefore(imageContainer, p200Container);
},500)


}

// ---------------
if (document.querySelector("#P20")){

	var downloadBlockText = function(){

		var p20Container = document.querySelector("#P20")

		var aLinks = p20Container.querySelectorAll("a")
		
		var urls = []
		for (var i = 0; i < aLinks.length; i++) {


			if (aLinks[i].getAttribute('href') && aLinks[i].getAttribute('href').indexOf('semlab.s3.amazonaws.com/texts/') >-1){
				urls.push(aLinks[i].getAttribute('href'))
			}
		}

		var textContainer = document.createElement('div')
		textContainer.classList.add('wikibase-statementgroupview')
		textContainer.innerHTML = ""

		var request = new XMLHttpRequest();
		request.open('GET', urls[0], true);

		request.onload = function () {
		  if (this.status >= 200 && this.status < 400) {
		    // Success!
			document.querySelector("#P19").remove()
			var text = this.response
			var textBlock = document.createElement('pre')
			textBlock.style.marginBottom=0
			textBlock.innerText = text				
			textBlock.style.marginTop = 0
			textContainer.appendChild(textBlock)
			textContainer.style.marginBottom = 0
			textContainer.style.borderBottom = "none"				
            window.setTimeout(function(){
  			  document.querySelector(".wikibase-listview").insertBefore(textContainer, p20Container);
            },500);
		  } else {
		    // We reached our target server, but it returned an error
		  }
		};
		request.onerror = function () {
		  // There was a connection error of some sort
		};
		request.send();
	}
	downloadBlockText()
}





// ---------
if (document.querySelector("#P7")){
	var P7Container = document.querySelector("#P7");
	var lj_slug = P7Container.querySelector(".wikibase-snakview-value");
	if (lj_slug){
		lj_slug = lj_slug.innerText

		var insertBefore = document.querySelector("#toc")

		var a = document.createElement('a');
	    a.style.fontSize = '1.25em'

  		var icon = document.createElement("div")
        		icon.innerHTML = '<svg fill="#333333" width="100pt" height="100pt" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="m86 76c-1.582 0.003906-3.1406 0.36719-4.5586 1.0586l-16.223-16.059c0.75391-1.0938 1.3867-2.2617 1.8906-3.4883l9.5195-0.67969v-0.003906c3.0664 4.0703 8.6133 5.3477 13.148 3.0312s6.7539-7.5586 5.2578-12.426c-1.5-4.8672-6.2773-7.957-11.332-7.3242s-8.9219 4.8047-9.1719 9.8906l-6 0.42969c-0.03125-3.9258-1.3047-7.7383-3.6406-10.895-2.3359-3.1523-5.6133-5.4844-9.3594-6.6562l-0.62891-10h-0.003906c4.5117-2.3789 6.6562-7.6602 5.082-12.516-1.5742-4.8516-6.4102-7.8672-11.461-7.1445s-8.8477 4.9727-9 10.07c-0.15625 5.0977 3.3828 9.5664 8.3789 10.59l0.51953 8.2891 0.003906 0.003906c-2.9609 0.24609-5.8164 1.2109-8.3203 2.8086l-16.66-16.922c2.2461-4.6133 0.83984-10.18-3.332-13.172-4.1719-2.9961-9.8906-2.5469-13.547 1.0547-3.6562 3.6055-4.1836 9.3203-1.2461 13.531 2.9336 4.2148 8.4766 5.6992 13.125 3.5156l16.559 16.703c-2.2031 3.0391-3.4258 6.6797-3.5 10.434s1 7.4414 3.0781 10.566l-16.207 16.309c-4.6602-2.1641-10.203-0.65234-13.117 3.5781-2.918 4.2305-2.3594 9.9453 1.3242 13.531 3.6797 3.5859 9.4102 3.9961 13.562 0.96875s5.5156-8.6055 3.2305-13.207l16.141-16.152c3.0352 2.1055 6.6367 3.2461 10.332 3.2773 3.6914 0.035156 7.3125-1.0469 10.387-3.0977l16.281 16.102c-2 4.2188-0.96875 9.25 2.5234 12.344 3.4961 3.0938 8.6172 3.5078 12.562 1.0117 3.9453-2.4922 5.7656-7.293 4.4688-11.777s-5.3984-7.5742-10.066-7.5781z" fill="#333333"/></svg><span>View in the Linked Jazz Network Visualization</span>'
		var infoSvg = icon.firstChild

		infoSvg.style.height = '25px'
		infoSvg.style.width = 'auto'
		infoSvg.style.marginRight = '5px'

        infoSvg.style.verticalAlign = 'top';

        a.appendChild(icon)


		a.setAttribute('href',"https://linkedjazz.org/network/?person=" + lj_slug);
        

  	document.querySelector(".wikibase-entityview-main").insertBefore(a,insertBefore);


	}

}



if (document.querySelector("#P17")){
	var P17Container = document.querySelector("#P17");
	var localId = P17Container.querySelector(".wikibase-snakview-value");
	if (localId){
		localId = localId.innerText

		if (localId.indexOf('EB') == 0){

			var insertBefore = document.querySelector("#toc")

			var a = document.createElement('a');
			a.style.fontSize = '1.25em'

			var qid = document.querySelector('.wikibase-title-id').innerText.replace("(",'').replace(")",'')
			a.setAttribute('href',"https://semlab.io/eat-bibliography/#/document/" + qid);

  		    var icon = document.createElement("div")
        		icon.innerHTML = '<svg fill="#333333" width="100pt" height="100pt" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="m72.301 3.8984h-44.602c-13.898 0-25.199 11.301-25.199 25.203v22.898c0 13.898 11.301 25.199 25.199 25.199h6.3008l8.6992 14.699c3.3008 5.6016 11.301 5.6016 14.602 0l8.6992-14.598h6.1992c14 0 25.301-11.301 25.301-25.301v-22.898c0-13.902-11.301-25.203-25.199-25.203zm-31.801 47.602c-1.3008 2.1016-2.8008 4-4.3008 5.6992-0.5 0.60156-1.3984 0.60156-2 0l-3.6016-3.8008c-0.5-0.5-0.5-1.3008 0-1.8008 0.30078-0.39844 0.60156-0.69922 0.89844-1.1016 1.6992-2.1992 3.3984-5.5 3.8008-8.6016-2.1992-0.10156-4.8008-0.5-6.3984-2.5-1.6016-1.8984-2.3984-4.1016-2.3984-6.3984 0-2.5 1-4.6992 2.8984-6.6016 1.8984-1.8984 4.1992-2.8984 6.8008-2.8984 2.6016 0 4.8008 1 6.8008 3.1016 1.8984 2 2.8984 4.6992 2.8984 8-0.097657 5.7031-1.8984 11.301-5.3984 16.902zm27.801 0c-1.3008 2.1016-2.8008 4-4.3008 5.6992-0.5 0.60156-1.3984 0.60156-2 0l-3.6016-3.8008c-0.5-0.5-0.5-1.3008 0-1.8008 0.30078-0.39844 0.60156-0.69922 0.89844-1.1016 1.6992-2.1992 3.3984-5.5 3.8008-8.6016-2.1992-0.10156-4.8008-0.5-6.3984-2.5-1.6016-1.8984-2.3984-4.1016-2.3984-6.3984 0-2.5 1-4.6992 2.8984-6.6016 1.8984-1.8984 4.1992-2.8984 6.8008-2.8984s4.8008 1 6.8008 3.1016c1.8984 2 2.8984 4.6992 2.8984 8-0.097657 5.7031-1.8984 11.301-5.3984 16.902z"/></svg><span>View in the E.A.T Bibliography Tool</span>'
		    var infoSvg = icon.firstChild

		    infoSvg.style.height = '25px'
		    infoSvg.style.width = 'auto'
		    infoSvg.style.marginRight = '5px'

            infoSvg.style.verticalAlign = 'top';

            a.appendChild(icon)



	  	document.querySelector(".wikibase-entityview-main").insertBefore(a,insertBefore);
	  }

	}

}



// ---------------------

if (document.querySelector("#P3")){	
	var instanceOf = []

	if (document.querySelector("#P1")){
		var els = document.querySelector("#P1").querySelectorAll("a")
		for (var i = 0; i < els.length; i++) {


			if (els[i].getAttribute('href') && (els[i].getAttribute('href').indexOf('wiki/Item') >-1 ) ){
				instanceOf.push(els[i].getAttribute('href').split(":")[1])
			}
		}
	}

	var P3Container = document.querySelector("#P3")

	var aLinks = P3Container.querySelectorAll("a")
	var urls = []

	for (var i = 0; i < aLinks.length; i++) {
		if (aLinks[i].getAttribute('href') && (aLinks[i].getAttribute('href').toLowerCase().endsWith('.png') || aLinks[i].getAttribute('href').toLowerCase().endsWith('.jpg') || aLinks[i].getAttribute('href').toLowerCase().endsWith('.jpeg') ) ){
			urls.push(aLinks[i].getAttribute('href'))
		}
	}
	if (urls.length>0){
		var thumbnailContainer = document.createElement('div')
		thumbnailContainer.style.width ='100%'
		thumbnailContainer.style.textAlign ='center'
		var thumbImg = document.createElement('img')
		thumbImg.setAttribute('src',urls[0])
		thumbImg.style.maxHeight = '250px'
		thumbImg.style.objectFit = 'contain'
        thumbImg.style.marginBottom = '2em'

		thumbImg.style.border = "1px solid #c8ccd1"

		if (instanceOf.indexOf('Q1')>-1){
			thumbImg.style.borderRadius = '15em'
		}
		thumbnailContainer.appendChild(thumbImg)

		var hr = document.createElement('hr')
		hr.style.marginTop = "0.5em"
		hr.style.marginBottom = "0.5em"
		// hr.style.backgroundColor = '#eaecf0'
		// thumbnailContainer.appendChild(hr)
		document.querySelector(".wikibase-entityview-side").appendChild(thumbnailContainer)

	}

}

// ---------------------


	var qid = document.querySelector('.wikibase-title-id').innerText.replace("(",'').replace(")",'')

	var buildInverse = function(){

		var inversePropertiesSPARQL = ''		
		inversePropertiesSPARQL = inversePropertiesSPARQL + 'select ?s ?sLabel ?p ?propLabel  WHERE{ '
		inversePropertiesSPARQL = inversePropertiesSPARQL + '	  ?s ?p wd:' + qid + '.'
		inversePropertiesSPARQL = inversePropertiesSPARQL + '	  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }'
		inversePropertiesSPARQL = inversePropertiesSPARQL + '	  FILTER (?p != <http://base.semlab.io/prop/direct/P22> && ?p != <http://base.semlab.io/prop/direct/P21> && ?p != <http://base.semlab.io/prop/direct/P23> )'
		inversePropertiesSPARQL = inversePropertiesSPARQL + '	  ?prop wikibase:directClaim ?p .'
		inversePropertiesSPARQL = inversePropertiesSPARQL + '	}'
 
		inversePropertiesSPARQL = encodeURIComponent(inversePropertiesSPARQL)

		// var req = await fetch(, {
		//   "headers": {
		//     "accept": "application/sparql-results+json",
		//   },
		//   "method": "GET",
		// });

		var request = new XMLHttpRequest();
		request.open('GET', 'https://query.semlab.io/proxy/wdqs/bigdata/namespace/wdq/sparql?query=' + inversePropertiesSPARQL, true);
		request.setRequestHeader("accept", "application/sparql-results+json");



		var infoSvgTMP = document.createElement("div")
		infoSvgTMP.innerHTML = '<svg fill="#202122" width="100pt" height="100pt" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="m50 94c24.301 0 44-19.699 44-44s-19.699-44-44-44-44 19.699-44 44 19.699 44 44 44zm0-8c19.883 0 36-16.117 36-36s-16.117-36-36-36-36 16.117-36 36 16.117 36 36 36zm-5-36.996c0-2.7617 2.2461-5.0039 5-5.0039 2.7617 0 5 2.2305 5 5.0039v19.992c0 2.7617-2.2461 5.0039-5 5.0039-2.7617 0-5-2.2305-5-5.0039zm-1-17.004c0-3.3125 2.6914-6 6-6 3.3125 0 6 2.6914 6 6 0 3.3125-2.6914 6-6 6-3.3125 0-6-2.6914-6-6z" fill-rule="evenodd"/></svg>'
		var infoSvg = infoSvgTMP.firstChild
		infoSvg.style.verticalAlign = 'text-top'
		infoSvg.style.height = '16px'
		infoSvg.style.width = 'auto'
		infoSvg.setAttribute('title','Click for explanation')
		infoSvg.setAttribute('alt','Click for explanation')



		request.onload = function () {
		  if (this.status >= 200 && this.status < 400) {
		    // Success!
		    var data = JSON.parse(this.response);

			var parsedData = {}

			for (var i = 0; i < data.results.bindings.length; i++) {
				var stmt = data.results.bindings[i]
				var sKey = stmt.s.value
				if (!parsedData[sKey]){
					parsedData[sKey] = {
						name: stmt.sLabel.value,
						qid: stmt.s.value.split('/').slice(-1)[0],
						stmts: []
					}
				}
				parsedData[sKey].stmts.push(stmt)
			}

			if (Object.keys(parsedData).length>0){
				var inverseRelationShipsDiv = document.createElement('div')

				var titleInfo = document.createElement('div')
				titleInfo.innerHTML = "Inverse Relationships "
				titleInfo.style.fontWeight = 'bold'
				titleInfo.style.marginBottom = "0.75em"
				var info = document.createElement('a')
				//info.innerText = "(?)"
				info.setAttribute('title','Click for explanation')
				//info.style.fontWeight= 'normal'
				
				info.appendChild(infoSvg)


				info.addEventListener('click',function(){
					document.querySelector('#inverse-relationships-explain').style.display='block'

				})
				titleInfo.appendChild(info)


				var explain = document.createElement('div')
				explain.innerHTML = "Statements from other entities that<br>point to " + document.querySelector('.wikibase-title-label').innerText
				explain.style.fontStyle= 'italic'
				explain.style.marginBottom= '2em'

				explain.style.fontSize= '90%'
				explain.style.display= 'none'
				explain.setAttribute('id','inverse-relationships-explain')



				inverseRelationShipsDiv.appendChild(titleInfo)
				inverseRelationShipsDiv.appendChild(explain)


				for (var k in parsedData){

					var irEntitiy = document.createElement('div')
					// irEntitiy.style.backgroundColor= "#eaecf0"
					irEntitiy.style.borderBottom= "solid 1px #eaecf0"
					irEntitiy.style.paddingLeft = "2.5px"
					irEntitiy.style.fontSize = "90%"
					var irEntitiyA = document.createElement('a')
					irEntitiyA.innerText = parsedData[k].name
                    irEntitiyA.title = parsedData[k].name
                    if (parsedData[k].name.length > 30){
                      irEntitiyA.innerText = parsedData[k].name.substring(0,30) +'...'
                    }
                    if (parsedData[k].qid.indexOf('Q')>-1){
                         irEntitiyA.setAttribute('href','/wiki/Item:'+parsedData[k].qid)
                    }else{
                         irEntitiyA.setAttribute('href','/wiki/Property:'+parsedData[k].qid)

                    }
					irEntitiyA.setAttribute('target','_blank')
					irEntitiy.appendChild(irEntitiyA)
					inverseRelationShipsDiv.appendChild(irEntitiy)


					for (var i = 0; i < parsedData[k].stmts.length; i++) {

						var s = parsedData[k].stmts[i]
						var irStmt = document.createElement('div')
						irStmt.style.fontSize = "80%"
						var irStmtA = document.createElement('a')
						irStmt.style.textAlign = "right"
						irStmtA.innerText = s.propLabel.value
						irStmtA.setAttribute('href','/wiki/Item:'+parsedData[k].qid+'#'+s.p.value.split('/').slice(-1)[0])
						irStmtA.setAttribute('target','_blank')

						irStmt.appendChild(irStmtA)

						inverseRelationShipsDiv.appendChild(irStmt)
					}
				}
				var hr = document.createElement('hr')
				hr.style.marginTop = "0.5em"
				hr.style.marginBottom = "0.5em"
				// inverseRelationShipsDiv.appendChild(hr)
				document.querySelector(".wikibase-entityview-side").appendChild(inverseRelationShipsDiv)
				buildMentions()
			}else{
              buildMentions()
            }

		  } else {
		    // We reached our target server, but it returned an error
		  }
		};

		request.onerror = function () {
		  // There was a connection error of some sort
		};

		request.send();



	}

	var buildMentions = function(){

		var mentionsSPARQL = ''
		mentionsSPARQL = mentionsSPARQL + 'select ?s ?doc ?docLabel ?localId  WHERE{   '
		mentionsSPARQL = mentionsSPARQL + '	  ?s wdt:P21 wd:' + qid + '.'
		mentionsSPARQL = mentionsSPARQL + '	  ?s wdt:P24 ?doc.'
		mentionsSPARQL = mentionsSPARQL + '	  ?s wdt:P17 ?localId. '
		mentionsSPARQL = mentionsSPARQL + '	  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }'
		mentionsSPARQL = mentionsSPARQL + '	}'
		
		mentionsSPARQL = encodeURIComponent(mentionsSPARQL)


		var request = new XMLHttpRequest();
		request.open('GET', 'https://query.semlab.io/proxy/wdqs/bigdata/namespace/wdq/sparql?query=' + mentionsSPARQL, true);
		request.setRequestHeader("accept", "application/sparql-results+json");


		var infoSvgTMP = document.createElement("div")
		infoSvgTMP.innerHTML = '<svg fill="#202122" width="100pt" height="100pt" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="m50 94c24.301 0 44-19.699 44-44s-19.699-44-44-44-44 19.699-44 44 19.699 44 44 44zm0-8c19.883 0 36-16.117 36-36s-16.117-36-36-36-36 16.117-36 36 16.117 36 36 36zm-5-36.996c0-2.7617 2.2461-5.0039 5-5.0039 2.7617 0 5 2.2305 5 5.0039v19.992c0 2.7617-2.2461 5.0039-5 5.0039-2.7617 0-5-2.2305-5-5.0039zm-1-17.004c0-3.3125 2.6914-6 6-6 3.3125 0 6 2.6914 6 6 0 3.3125-2.6914 6-6 6-3.3125 0-6-2.6914-6-6z" fill-rule="evenodd"/></svg>'
		var infoSvg = infoSvgTMP.firstChild
		infoSvg.style.verticalAlign = 'text-top'
		infoSvg.style.height = '16px'
		infoSvg.style.width = 'auto'
		infoSvg.setAttribute('title','Click for explanation')
		infoSvg.setAttribute('alt','Click for explanation')



		request.onload = function () {
		  if (this.status >= 200 && this.status < 400) {
		    // Success!
		    var data = JSON.parse(this.response);

			var parsedData = {}


			for (var i = 0; i < data.results.bindings.length; i++) {
				var stmt = data.results.bindings[i]
				var sKey = stmt.doc.value
				if (!parsedData[sKey]){
					parsedData[sKey] = {
						name: stmt.docLabel.value,
						qid: sKey.split('/').slice(-1)[0],
						stmts: []
					}
				}
				parsedData[sKey].stmts.push(stmt)
			}


			if (Object.keys(parsedData).length>0){
				var mentionsDiv = document.createElement('div')

				var titleInfo = document.createElement('div')
				titleInfo.innerHTML = "Block Mentions "
				titleInfo.style.fontWeight = 'bold'
				titleInfo.style.marginBottom = "0.75em"
				var info = document.createElement('a')
				//info.innerText = "(?)"
				info.setAttribute('title','Click for explanation')
				//info.style.fontWeight= 'normal'
				info.appendChild(infoSvg)

				info.addEventListener('click',function(){
					document.querySelector('#mentions-explain').style.display='block'

				})
				titleInfo.appendChild(info)


				var explain = document.createElement('div')
				explain.innerHTML = "Blocks that have mentions<br>of " + document.querySelector('.wikibase-title-label').innerText
				explain.style.fontStyle= 'italic'
				explain.style.fontSize= '90%'
                explain.style.marginBottom= '2em'
				explain.style.display= 'none'
				explain.setAttribute('id','mentions-explain')



				mentionsDiv.appendChild(titleInfo)
				mentionsDiv.appendChild(explain)


				for (var k in parsedData){

					var irEntitiy = document.createElement('div')
					// irEntitiy.style.backgroundColor= "#eaecf0"
					irEntitiy.style.borderBottom= "solid 1px #eaecf0"
					irEntitiy.style.paddingLeft = "2.5px"
					irEntitiy.style.fontSize = "90%"
					var irEntitiyA = document.createElement('a')
					irEntitiyA.innerText = parsedData[k].name
                    irEntitiyA.title = parsedData[k].name
                    if (parsedData[k].name.length > 30){
                      irEntitiyA.innerText = parsedData[k].name.substring(0,30) +'...'
                    }
					irEntitiyA.setAttribute('href','/wiki/Item:'+parsedData[k].qid)
					irEntitiyA.setAttribute('target','_blank')
					irEntitiy.appendChild(irEntitiyA)
					mentionsDiv.appendChild(irEntitiy)
					var irStmt = document.createElement('div')
                    irStmt.style.textAlign = "right"
                    irStmt.style.fontSize = "80%"

					for (var i = 0; i < parsedData[k].stmts.length; i++) {
						var s = parsedData[k].stmts[i]
						
						var irStmtA = document.createElement('a')
						
						irStmtA.innerText = s.localId.value
						//irStmtA.style.paddingLeft = "0.5em"
                        irStmtA.style.display = "inline"
						irStmtA.setAttribute('href','/wiki/Item:'+s.s.value.split('/').slice(-1)[0])
						irStmtA.setAttribute('target','_blank')
                        
                        
						irStmt.appendChild(irStmtA)
                        var space = document.createElement('span')
                        space.innerText = " "
                        irStmt.appendChild(space)
                        if (irStmt.children.length>=10){
                          mentionsDiv.appendChild(irStmt)
                          var irStmt = document.createElement('div')
                          irStmt.style.textAlign = "right"
                          irStmt.style.fontSize = "80%"

                          
                        }


					}
                    mentionsDiv.appendChild(irStmt)	



				}
				var hr = document.createElement('hr')
				hr.style.marginTop = "0.5em"
				hr.style.marginBottom = "0.5em"
				// mentionsDiv.appendChild(hr)
				document.querySelector(".wikibase-entityview-side").appendChild(mentionsDiv)
			}








		  } else {
		    // We reached our target server, but it returned an error
		  }
		};

		request.onerror = function () {
		  // There was a connection error of some sort
		};

		request.send();



	}







	buildInverse()