Difference between revisions of "User:Abel/experimental.js"

From Wikibase Personal data
Jump to navigation Jump to search
m
m
Line 9: Line 9:
 
language = "en",
 
language = "en",
  
wbEStruct = {
+
wbEStructure = {
 
subclassOfRelations: 'claims.P4', // location of P4 relations in wbEntity
 
subclassOfRelations: 'claims.P4', // location of P4 relations in wbEntity
 
defaultValRelation: 'claims.P108',
 
defaultValRelation: 'claims.P108',
Line 21: Line 21:
  
 
relational_id_list = {  
 
relational_id_list = {  
controller_id: [ wbEStruct['instanceOfRelations'], wbEStruct['IDPropLoc'], wbEStruct['IDName'], 96 ],
+
controller_id: [ wbEStructure['instanceOfRelations'], wbEStructure['IDPropLoc'], wbEStructure['IDName'], 96 ],
personal_data_id: [ wbEStruct['subclassOfRelations'], wbEStruct['IDPropLoc'], wbEStruct['IDName'], 421 ],
+
personal_data_id: [ wbEStructure['subclassOfRelations'], wbEStructure['IDPropLoc'], wbEStructure['IDName'], 421 ],
interface_button_id: [ wbEStruct ['instanceOfRelations'], wbEStruct['IDPropLoc'], wbEStruct['IDName'], 487 ]
+
interface_button_id: [ wbEStructure ['instanceOfRelations'], wbEStructure['IDPropLoc'], wbEStructure['IDName'], 487 ]
 
},
 
},
 
wbproc,
 
wbproc,

Revision as of 22:56, 19 May 2019

// License: GPL
// Experimental Main
console.log("'⌣'");

var mwEStruct = {
		wbXntity: 'config.values.wbEntity'
	},

	language = "en",

	wbEStructure = {
		subclassOfRelations: 'claims.P4', // location of P4 relations in wbEntity
		defaultValRelation: 'claims.P108',
		concernsRelation: 'claims.P110',
		instanceOfRelations: 'claims.P3',
		IDPropLoc: 'mainsnak.datavalue.value', // location of ID properties in related entity
		IDName: 'numeric-id', // ID property name which checked 
		qIDPropName: 'id',
		standardValue: 'labels' + '.' + language + '.' + 'value'
	},

	relational_id_list = { 
			controller_id: [ wbEStructure['instanceOfRelations'], wbEStructure['IDPropLoc'], wbEStructure['IDName'], 96 ],
			personal_data_id: [ wbEStructure['subclassOfRelations'], wbEStructure['IDPropLoc'], wbEStructure['IDName'], 421 ],
			interface_button_id: [ wbEStructure ['instanceOfRelations'], wbEStructure['IDPropLoc'], wbEStructure['IDName'], 487 ]
	},
	wbproc,
	current_entity,
	pdxdb;

$.when(
    $.getScript( "//wiki.personaldata.io/w/index.php?title=User:Abel/WbProcessor.js&action=raw&ctype=text/javascript" ),
    $.getScript( "//wiki.personaldata.io/w/index.php?title=MediaWiki:Gadget-personaldata.js&action=raw&ctype=text/javascript" ),
    $.getScript( "//wiki.personaldata.io/w/index.php?title=MediaWiki:Gadget-pdooui.js&action=raw&ctype=text/javascript" ),
    $.Deferred( function( deferred ){
        $( deferred.resolve );
    })
).done( function(){

	console.log('Reporting in');

	wbproc = new wbContainer(mw, mwEStruct['wbXntity']);

	// Check whether the current page is in a relation of interest to an id of interest
	current_entity = wbproc.checkentity( relational_id_list );
	// This should return an object of relations and ids

	console.log("test: ")
	console.log(current_entity);

	pdxdb = new idxdbContainer( mw );
	pdxdb.EnqueuePDIO('update record', Date.now(), Date.now());

});