Skip to content

Commit

Permalink
Merge pull request #292 from Arquisoft/laura
Browse files Browse the repository at this point in the history
aumento limit queries + no generacion respuestas que comienzan con http
  • Loading branch information
uo285427 authored Apr 16, 2024
2 parents 4181949 + eacd909 commit 4fa2603
Showing 1 changed file with 33 additions and 34 deletions.
67 changes: 33 additions & 34 deletions questions/createservice/create-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,33 @@ mongoose.connect(mongoUri);
const questionTypes = {
pais_capital: {
query: `
SELECT ?country ?countryLabel ?capital ?capitalLabel
WHERE {
?country wdt:P31 wd:Q6256.
?country wdt:P36 ?capital.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es".
}
SELECT ?country ?countryLabel ?capital ?capitalLabel
WHERE {
?country wdt:P31 wd:Q6256.
?country wdt:P36 ?capital.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es".
}
ORDER BY RAND()
LIMIT 30
}
ORDER BY RAND()
LIMIT 60
`,
questionLabel: 'countryLabel',
answerLabel: 'capitalLabel'
},
pais_poblacion: {
query: `
SELECT DISTINCT ?countryLabel ?population
{
?country wdt:P31 wd:Q6256 ;
wdt:P1082 ?population .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es"
}
SELECT DISTINCT ?countryLabel ?population
{
?country wdt:P31 wd:Q6256 ;
wdt:P1082 ?population .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es"
}
GROUP BY ?population ?countryLabel
ORDER BY RAND()
LIMIT 30
}
GROUP BY ?population ?countryLabel
ORDER BY RAND()
LIMIT 60
`,
questionLabel: 'countryLabel',
answerLabel: 'population'
Expand Down Expand Up @@ -76,7 +76,7 @@ const questionTypes = {
}
}
ORDER BY RAND()
LIMIT 30
LIMIT 60
`,
questionLabel: 'countryLabel',
answerLabel: 'currencyLabel'
Expand All @@ -90,7 +90,7 @@ const questionTypes = {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". }
}
ORDER BY RAND()
LIMIT 30
LIMIT 35
`,
questionLabel: 'libroLabel',
answerLabel: 'autorLabel'
Expand All @@ -104,7 +104,7 @@ WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". }
}
ORDER BY RAND()
LIMIT 30
LIMIT 40
`,
questionLabel: 'libroLabel',
answerLabel: 'generoLabel'
Expand Down Expand Up @@ -132,7 +132,6 @@ WHERE {
wdt:P2044 ?altura. # P2044 es la propiedad para altura
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". }
}
ORDER BY RAND()
LIMIT 30
`,
questionLabel: 'montanaLabel',
Expand All @@ -147,7 +146,7 @@ WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". }
}
ORDER BY RAND()
LIMIT 30
LIMIT 50
`,
questionLabel: 'cancionLabel',
answerLabel: 'cantanteLabel'
Expand Down Expand Up @@ -176,7 +175,7 @@ WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". }
}
ORDER BY RAND()
LIMIT 30
LIMIT 35
`,
questionLabel: 'cancionLabel',
answerLabel: 'anio_publicacion'
Expand All @@ -190,7 +189,7 @@ WHERE {
BIND(YEAR(?fechaNacimiento) AS ?anioNacimiento)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". }
}
LIMIT 30
LIMIT 50
`,
questionLabel: 'cantanteLabel',
answerLabel: 'anioNacimiento'
Expand Down Expand Up @@ -218,7 +217,7 @@ WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". }
}
ORDER BY RAND()
LIMIT 50
LIMIT 60
`,
questionLabel: 'estadioLabel',
answerLabel: 'capacidad'
Expand Down Expand Up @@ -246,7 +245,7 @@ WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". }
}
ORDER BY RAND()
LIMIT 30
LIMIT 60
`,
questionLabel: 'countryLabel',
answerLabel: 'languageLabel'
Expand All @@ -260,7 +259,7 @@ WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". }
}
ORDER BY RAND()
LIMIT 30
LIMIT 50
`,
questionLabel: 'equipoLabel',
answerLabel: 'deporteLabel'
Expand All @@ -276,7 +275,7 @@ WHERE {
}
ORDER BY RAND()
LIMIT 30
LIMIT 60
`,
questionLabel: 'sportLabel',
answerLabel: 'inception'
Expand All @@ -291,7 +290,7 @@ WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". }
}
ORDER BY RAND()
LIMIT 30
LIMIT 60
`,
questionLabel: 'deportistaLabel',
answerLabel: 'inicioDeporte'
Expand All @@ -305,7 +304,7 @@ WHERE {
wdt:P17 ?pais. # Propiedad: país
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". }
}
LIMIT 30
LIMIT 50
`,
questionLabel: 'rioLabel',
answerLabel: 'paisLabel'
Expand All @@ -320,7 +319,7 @@ WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". }
}
LIMIT 30
LIMIT 70
`,
questionLabel: 'lagoLabel',
answerLabel: 'paisLabel'
Expand Down Expand Up @@ -367,7 +366,7 @@ app.get('/getFullQuestion', async (req, res) => {
resultCorrecta = data.results.bindings[indexCorrecta];
informacionWikidata = resultCorrecta[questionLabel].value + '?';
respuestaCorrecta = resultCorrecta[answerLabel].value;
} while (informacionWikidata.startsWith('Q') || respuestaCorrecta.startsWith('Q')); // Solo se aceptan respuestas que no comienzan con 'Q'
} while (informacionWikidata.startsWith('Q') || respuestaCorrecta.startsWith('Q') || respuestaCorrecta.startsWith('http')); // Solo se aceptan respuestas que no comienzan con 'Q'

const respuestasFalsas = [];
while (respuestasFalsas.length < 3) {
Expand Down

0 comments on commit 4fa2603

Please sign in to comment.