Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfcb44a2

Browse files
authored
SPARQL formatting improvements in view-all-items.js
1 parentb6a15b0 commitfcb44a2

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

‎src/components/view-all-items.js‎

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -323,17 +323,17 @@ viewallitems = Vue.component('view-all-items', {
323323
}
324324
varsparqlQuery="SELECT DISTINCT ?value ?valueLabel WHERE {\n"+
325325
"VALUES ?value { "+classlessFiltersString+" }\n"+
326-
"SERVICE wikibase:label { bd:serviceParam wikibase:language \""+lang+"\". }\n"+
326+
"SERVICE wikibase:label { bd:serviceParam wikibase:language \""+lang+"\". }\n"+
327327
"}";
328328
}else{
329329
// Check available filters and exclude ones with distinct type value constraint.
330330
varsparqlQuery="SELECT DISTINCT ?value ?valueLabel ?property WHERE {\n"+
331-
"wd:"+this.classValue+" wdt:"+propertiesForThisType+" ?value.\n"+
332-
"?value wikibase:propertyType ?property.\n";
331+
"wd:"+this.classValue+" wdt:"+propertiesForThisType+" ?value.\n"+
332+
"?value wikibase:propertyType ?property.\n";
333333
if(propertyConstraint&&distinctValuesConstraint){
334334
sparqlQuery+="FILTER(NOT EXISTS {\n"+
335-
"?value p:"+propertyConstraint+" ?constraint_statement.\n"+
336-
"?constraint_statement ps:"+propertyConstraint+" wd:"+distinctValuesConstraint+".\n"+
335+
"?value p:"+propertyConstraint+" ?constraint_statement.\n"+
336+
"?constraint_statement ps:"+propertyConstraint+" wd:"+distinctValuesConstraint+".\n"+
337337
"})\n";
338338
}
339339
sparqlQuery+="FILTER (?property in (wikibase:Time, wikibase:Quantity, wikibase:WikibaseItem, wikibase:String)) .\n"+
@@ -366,10 +366,10 @@ viewallitems = Vue.component('view-all-items', {
366366
"} UNION {\n"+
367367
" ?value wdt:"+instanceOf+" ?subclass .\n"+
368368
" ?subclass wdt:"+subclassOf+" wd:"+this.classValue+"\n"+
369-
"}";
369+
"}\n";
370370
}
371371
if(showThumbnails){
372-
this.classSelector+="?value schema:url ?file";
372+
this.classSelector+="?value schema:url ?file\n";
373373
}
374374

375375
if(mainPageText&&this.appliedFilters.length==0&&this.appliedRanges.length==0&&this.appliedQuantities.length==0){
@@ -392,19 +392,19 @@ viewallitems = Vue.component('view-all-items', {
392392
}else{
393393
filterString+="{#filter "+i+"\n"+
394394
"?value wdt:"+this.appliedFilters[i].parentFilterValue+" ?temp"+i+" .\n"+
395-
"?temp"+i+" wdt:"+this.appliedFilters[i].filterValue+" wd:"+this.appliedFilters[i].value+".\n"+
395+
"?temp"+i+" wdt:"+this.appliedFilters[i].filterValue+" wd:"+this.appliedFilters[i].value+".\n"+
396396
"}\n";
397397
}
398398
}
399399
elseif(this.appliedFilters[i].value=="novalue"){
400-
noValueString+="{#filter "+i+"\n FILTER(NOT EXISTS { ?value wdt:"+this.appliedFilters[i].filterValue+" ?no. }).\n}"
400+
noValueString+="{#filter "+i+"\n FILTER(NOT EXISTS { ?value wdt:"+this.appliedFilters[i].filterValue+" ?no. }).\n}"
401401
}
402402
elseif(this.appliedFilters[i].value.match(/^Q\d+$/)==null){
403403
// String type
404404
filterString+="{#filter "+i+"\n?value wdt:"+this.appliedFilters[i].filterValue+" '"+this.appliedFilters[i].value+"' .\n}";
405405
}
406406
else{
407-
filterString+="{#filter "+i+"\n?value wdt:"+this.appliedFilters[i].filterValue+" wd:"+this.appliedFilters[i].value+".\n}";
407+
filterString+="{#filter "+i+"\n?value wdt:"+this.appliedFilters[i].filterValue+" wd:"+this.appliedFilters[i].value+".\n}";
408408
}
409409
}
410410
if(parentFilterString!=''){
@@ -413,72 +413,72 @@ viewallitems = Vue.component('view-all-items', {
413413
letfilterRanges="",maxString="",constraintString="";
414414
for(leti=0;i<this.appliedRanges.length;i++){
415415
if(this.appliedRanges[i].valueLL=="novalue"){
416-
noValueString+="{#date range "+i+"\n FILTER(NOT EXISTS { ?value wdt:"+this.appliedRanges[i].filterValue+" ?no. }).\n}"
416+
noValueString+="{#date range "+i+"\n FILTER(NOT EXISTS { ?value wdt:"+this.appliedRanges[i].filterValue+" ?no. }).\n}"
417417
}
418418
elseif(this.appliedRanges[i].parentFilterValue){
419419
timePrecision=getTimePrecision(this.appliedRanges[i].valueLL,this.appliedRanges[i].valueUL)
420-
filterRanges+="{#date range "+i+"\n?value wdt:"+this.appliedRanges[i].parentFilterValue+" ?temp"+i+".\n"+
420+
filterRanges+="{#date range "+i+"\n?value wdt:"+this.appliedRanges[i].parentFilterValue+" ?temp"+i+".\n"+
421421
"?temp"+i+" (p:"+this.appliedRanges[i].filterValue+"/psv:"+this.appliedRanges[i].filterValue+") ?timenode"+i+".\n"+
422-
"?timenode"+i+" wikibase:timeValue ?time"+i+".\n"+
422+
"?timenode"+i+" wikibase:timeValue ?time"+i+".\n"+
423423
"?timenode"+i+" wikibase:timePrecision ?timeprecision"+i+" .\n"+
424424
(centralSPARQLService ?"}\n" :'')+
425425
"FILTER(?timeprecision"+i+">="+timePrecision+")\n}";
426-
constraintString+="FILTER('"+this.appliedRanges[i].valueLL+"'^^xsd:dateTime <= ?tim"+i+" && ?tim"+i+" < '"+this.appliedRanges[i].valueUL+"'^^xsd:dateTime).\n";
426+
constraintString+="FILTER('"+this.appliedRanges[i].valueLL+"'^^xsd:dateTime <= ?tim"+i+" && ?tim"+i+" < '"+this.appliedRanges[i].valueUL+"'^^xsd:dateTime).\n";
427427
maxString+="(MAX(?time"+i+") AS ?tim"+i+") ";
428428

429429
}
430430
else{
431431
timePrecision=getTimePrecision(this.appliedRanges[i].valueLL,this.appliedRanges[i].valueUL)
432-
filterRanges+="{#date range "+i+"\n?value (p:"+this.appliedRanges[i].filterValue+"/psv:"+this.appliedRanges[i].filterValue+") ?timenode"+i+".\n"+
433-
"?timenode"+i+" wikibase:timeValue ?time"+i+".\n"+
434-
"?timenode"+i+" wikibase:timePrecision ?timeprecision"+i+".\n"+
432+
filterRanges+="{#date range "+i+"\n?value (p:"+this.appliedRanges[i].filterValue+"/psv:"+this.appliedRanges[i].filterValue+") ?timenode"+i+".\n"+
433+
"?timenode"+i+" wikibase:timeValue ?time"+i+".\n"+
434+
"?timenode"+i+" wikibase:timePrecision ?timeprecision"+i+".\n"+
435435
"FILTER(?timeprecision"+i+">="+timePrecision+") .\n"+
436436
"FILTER('"+this.appliedRanges[i].valueLL+"'^^xsd:dateTime <= ?time"+i+" && ?time"+i+" < '"+this.appliedRanges[i].valueUL+"'^^xsd:dateTime). \n"+
437437
"}\n";
438438
// It would probably be better to group by date here, but unfortunately that makes
439439
// the queries too slow in some cases.
440-
// constraintString += "FILTER('" + this.appliedRanges[i].valueLL + "'^^xsd:dateTime <= ?tim" + i + " && ?tim" + i + " < '" + this.appliedRanges[i].valueUL + "'^^xsd:dateTime).\n";
440+
// constraintString += "FILTER('" + this.appliedRanges[i].valueLL + "'^^xsd:dateTime <= ?tim" + i + " && ?tim" + i + " < '" + this.appliedRanges[i].valueUL + "'^^xsd:dateTime).\n";
441441
// maxString += "(MAX(?time" + i + ") AS ?tim" + i + ") ";
442442
}
443443
}
444444
letfilterQuantities="";
445445
for(leti=0;i<this.appliedQuantities.length;i++){
446446
if(this.appliedQuantities[i].parentFilterValue){
447447
if(this.appliedQuantities[i].valueLL=="novalue"){
448-
noValueString+="{#quantity range "+i+"\n FILTER(NOT EXISTS { ?value wdt:"+this.appliedQuantities[i].filterValue+" ?no. }).\n}"
448+
noValueString+="{#quantity range "+i+"\n FILTER(NOT EXISTS { ?value wdt:"+this.appliedQuantities[i].filterValue+" ?no. }).\n}"
449449
}
450450
elseif(this.appliedQuantities[i].unit==""){
451-
filterQuantities+="{#quantity range "+i+"\n?value wdt:"+this.appliedQuantities[i].parentFilterValue+" ?temp"+i+".\n"+
451+
filterQuantities+="{#quantity range "+i+"\n?value wdt:"+this.appliedQuantities[i].parentFilterValue+" ?temp"+i+".\n"+
452452
(centralSPARQLService ?"SERVICE <"+centralSPARQLService+"> {\n" :'')+
453-
"?temp"+i+" (p:"+this.appliedQuantities[i].filterValue+"/psv:"+this.appliedQuantities[i].filterValue+") ?amount"+i+".\n"+
453+
"?temp"+i+" (p:"+this.appliedQuantities[i].filterValue+"/psv:"+this.appliedQuantities[i].filterValue+") ?amount"+i+".\n"+
454454
" ?amount"+i+" wikibase:quantityAmount ?amountValue"+i+" .\n}"+
455455
(centralSPARQLService ?"}\n" :'');
456456
constraintString+="FILTER("+this.appliedQuantities[i].valueUL+" >= ?qua"+i+" && ?qua"+i+" >="+this.appliedQuantities[i].valueLL+")\n";
457457
maxString+="(MAX(?amountValue"+i+") AS ?qua"+i+") ";
458458
}
459459
else{
460-
filterQuantities+="{#quantity range "+i+"\n?value wdt:"+this.appliedQuantities[i].parentFilterValue+" ?temp"+i+".\n"+
460+
filterQuantities+="{#quantity range "+i+"\n?value wdt:"+this.appliedQuantities[i].parentFilterValue+" ?temp"+i+".\n"+
461461
(centralSPARQLService ?"SERVICE <"+centralSPARQLService+"> {\n" :'')+
462-
"?temp"+i+" (p:"+this.appliedQuantities[i].filterValue+"/psn:"+this.appliedQuantities[i].filterValue+") ?amount"+i+".\n"+
463-
" ?amount"+i+" wikibase:quantityAmount ?amountValue"+i+".\n}"+
462+
"?temp"+i+" (p:"+this.appliedQuantities[i].filterValue+"/psn:"+this.appliedQuantities[i].filterValue+") ?amount"+i+".\n"+
463+
" ?amount"+i+" wikibase:quantityAmount ?amountValue"+i+".\n}"+
464464
(centralSPARQLService ?"}\n" :'');
465465
constraintString+="FILTER("+this.appliedQuantities[i].valueUL+" >= ?qua"+i+" && ?qua"+i+" >="+this.appliedQuantities[i].valueLL+")\n";
466466
maxString+="(MAX(?amountValue"+i+") AS ?qua"+i+") ";
467467
}
468468
}
469469
else{
470470
if(this.appliedQuantities[i].valueLL=="novalue"){
471-
noValueString+="{#quantity range "+i+"\n FILTER(NOT EXISTS { ?value wdt:"+this.appliedQuantities[i].filterValue+" ?no. }).\n}"
471+
noValueString+="{#quantity range "+i+"\n FILTER(NOT EXISTS { ?value wdt:"+this.appliedQuantities[i].filterValue+" ?no. }).\n}"
472472
}
473473
elseif(this.appliedQuantities[i].unit==""){
474-
filterQuantities+="{#quantity range "+i+"\n?value (p:"+this.appliedQuantities[i].filterValue+"/psv:"+this.appliedQuantities[i].filterValue+") ?amount"+i+".\n"+
475-
" ?amount"+i+" wikibase:quantityAmount ?amountValue"+i+".\n}";
474+
filterQuantities+="{#quantity range "+i+"\n?value (p:"+this.appliedQuantities[i].filterValue+"/psv:"+this.appliedQuantities[i].filterValue+") ?amount"+i+".\n"+
475+
" ?amount"+i+" wikibase:quantityAmount ?amountValue"+i+".\n}";
476476
constraintString+="FILTER("+this.appliedQuantities[i].valueUL+" >= ?qua"+i+" && ?qua"+i+" >="+this.appliedQuantities[i].valueLL+")\n";
477477
maxString+="(MAX(?amountValue"+i+") AS ?qua"+i+") ";
478478
}
479479
else{
480-
filterQuantities+="{#quantity range "+i+"\n?value (p:"+this.appliedQuantities[i].filterValue+"/psn:"+this.appliedQuantities[i].filterValue+") ?amount"+i+".\n"+
481-
" ?amount"+i+" wikibase:quantityAmount ?amountValue"+i+".\n}";
480+
filterQuantities+="{#quantity range "+i+"\n?value (p:"+this.appliedQuantities[i].filterValue+"/psn:"+this.appliedQuantities[i].filterValue+") ?amount"+i+".\n"+
481+
" ?amount"+i+" wikibase:quantityAmount ?amountValue"+i+".\n}";
482482
constraintString+="FILTER("+this.appliedQuantities[i].valueUL+">=?qua"+i+" && ?qua"+i+">="+this.appliedQuantities[i].valueLL+")\n";
483483
maxString+="(MAX(?amountValue"+i+") AS ?qua"+i+") ";
484484
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp