diff --git a/question/question_template.json b/question/question_template.json index 6050d7fc..34ba4b8e 100644 --- a/question/question_template.json +++ b/question/question_template.json @@ -1,104 +1,323 @@ [ { "question": "¿A qué país pertenece esta bandera?", - "selector": "", - "topics": ["flag"], - "query": "SELECT ?name ?image WHERE { ?country wdt:P31 wd:Q6256. ?country wdt:P41 ?image. SERVICE wikibase:label { bd:serviceParam wikibase:language \"[AUTO_LANGUAGE],es\". ?country rdfs:label ?name. } } LIMIT 1 OFFSET ", - "imageurl": "" + "selector": "", + "topics": ["geographyy"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q6256. ?entity wdt:P41 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'es') }", + "imageurl": "", + "lang": "es" }, + { + "question": "To which country does this flag belong?", + "selector": "", + "topics": ["geographyy"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q6256. ?entity wdt:P41 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'en') }", + "imageurl": "", + "lang": "en" + }, + { "question": "¿A qué país pertenece este contorno?", - "selector": "", - "topics": ["geography", "map"], - "query": "SELECT ?name ?image WHERE { ?country wdt:P31 wd:Q6256. ?country wdt:P18 ?image. SERVICE wikibase:label { bd:serviceParam wikibase:language \"[AUTO_LANGUAGE],es\". ?country rdfs:label ?name. } } LIMIT 1 OFFSET ", - "imageurl": "" + "selector": "", + "topics": ["geography"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q6256. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'es') }", + "imageurl": "", + "lang": "es" }, + { + "question": "To which country does this contour belong?", + "selector": "", + "topics": ["geography"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q6256. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'en') }", + "imageurl": "", + "lang": "en" + }, + + { "question": "¿Cuál es la capital de este país?", - "selector": "", - "topics": ["geography", "image"], - "query": "SELECT ?name ?image WHERE { ?country wdt:P31 wd:Q6256. ?country wdt:P36 ?capital. ?capital wdt:P18 ?image. SERVICE wikibase:label { bd:serviceParam wikibase:language \"[AUTO_LANGUAGE],es\". ?capital rdfs:label ?name. } } LIMIT 1 OFFSET ", - "imageurl": "" + "selector": "", + "topics": ["geography"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q6256. ?entity wdt:P36 ?capital. ?capital wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'es') }", + "imageurl": "", + "lang": "es" + }, + { + "question": "What is the capital of this country?", + "selector": "", + "topics": ["geography"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q6256. ?entity wdt:P36 ?capital. ?capital wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'en') }", + "imageurl": "", + "lang": "en" }, + { - "question": "¿Quién es la persona histórica que aparece en esta foto?", - "selector": "", + "question": "¿En qué sitio arqueológico fue tomada esta imagen?", + "selector": "", "topics": ["history"], - "query": "SELECT ?name ?image WHERE { ?person wdt:P31 wd:Q5. ?person wdt:P570 ?deathDate. ?person wdt:P18 ?image. SERVICE wikibase:label { bd:serviceParam wikibase:language \"[AUTO_LANGUAGE],es\". ?person rdfs:label ?name. } } LIMIT 1 OFFSET ", - "imageurl": "" + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q839954. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'es') } ", + "imageurl": "", + "lang": "es" }, { - "question": "¿En qué fecha ocurrió este acontecimiento histórico?", - "selector": "", - "topics": ["history", "image"], - "query": "SELECT ?name ?image WHERE { ?event wdt:P31 wd:Q1190554. ?event wdt:P585 ?date. ?event wdt:P18 ?image. SERVICE wikibase:label { bd:serviceParam wikibase:language \"[AUTO_LANGUAGE],es\". ?event rdfs:label ?name. } } LIMIT 1 OFFSET ", - "imageurl": "" + "question": "At what archaeological site was this image taken?", + "selector": "", + "topics": ["history"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q839954. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'en') } ", + "imageurl": "", + "lang": "en" }, + { - "question": "¿Dónde ocurrió este acontecimiento histórico?", - "selector": "", - "topics": ["history", "location", "image"], - "query": "SELECT ?name ?image WHERE { ?event wdt:P31 wd:Q1190554. ?event wdt:P276 ?location. ?event wdt:P18 ?image. SERVICE wikibase:label { bd:serviceParam wikibase:language \"[AUTO_LANGUAGE],es\". ?event rdfs:label ?name. } } LIMIT 1 OFFSET ", - "imageurl": "" + "question": "¿Quién es esta persona histórica?", + "selector": "", + "topics": ["history"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q5. ?entity wdt:P18 ?image. ?entity wdt:P106 ?occupation. ?occupation wdt:P279* wd:Q82955. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'es') } ", + "imageurl": "", + "lang": "es" }, { - "question": "¿Cuál es el nombre del animal?", - "selector": "", - "topics": ["science", "image"], - "query": "SELECT ?name ?image WHERE { ?animal wdt:P225 ?name. ?animal wdt:P171 ?taxon. ?animal wdt:P18 ?image.} LIMIT 1 OFFSET ", - "imageurl": "" + "question": "Who is this historical person?", + "selector": "", + "topics": ["history"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q5. ?entity wdt:P18 ?image. ?entity wdt:P106 ?occupation. ?occupation wdt:P279* wd:Q82955. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'en') } ", + "imageurl": "", + "lang": "en" }, + { - "question": "¿Cuál es el nombre del deporte?", - "selector": "", - "topics": ["sports", "image"], - "query": "SELECT ?name ?image WHERE { ?deporte wdt:P31 wd:Q349. ?deporte wdt:P18 ?image. SERVICE wikibase:label { bd:serviceParam wikibase:language 'es,en'. ?deporte rdfs:label ?name. } } LIMIT 1 OFFSET ", - "imageurl": "" + "question": "¿A qué monumento histórico pertenece esta imagen?", + "selector": "", + "topics": ["history"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q4989906. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'es') } ", + "imageurl": "", + "lang": "es" }, + { + "question": "To which historical monument does this image belong?", + "selector": "", + "topics": ["history"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q4989906. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'en') } ", + "imageurl": "", + "lang": "en" + }, + + + { + "question": "¿Qué museo histórico es este?", + "selector": "", + "topics": ["history"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q33506. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'es') } ", + "imageurl": "", + "lang": "es" + }, + { + "question": "What historical museum is this?", + "selector": "", + "topics": ["history"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q33506. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'en') } ", + "imageurl": "", + "lang": "en" + }, + + + { + "question": "¿Cuál es el nombre del animal?", + "selector": "", + "topics": ["science"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P225 ?nombre_cientifico. ?entity wdt:P171 ?taxon. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'es') }", + "imageurl": "", + "lang": "es" + }, + { + "question": "What is the name of the animal?", + "selector": "", + "topics": ["science"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P225 ?nombre_cientifico. ?entity wdt:P171 ?taxon. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'en') }", + "imageurl": "", + "lang": "en" + }, + + { "question": "¿Cuál es el nombre de la planta?", - "selector": "", - "topics": ["science", "image"], - "query": "SELECT ?name ?image WHERE { ?planta wdt:P225 ?name. ?planta wdt:P18 ?image. ?planta wdt:P5037 ?value.} LIMIT 1 OFFSET ", - "imageurl": "" + "selector": "", + "topics": ["science"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P225 ?nombre_cientifico. ?entity wdt:P18 ?image. ?entity wdt:P5037 ?value. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'es') }", + "imageurl": "", + "lang": "es" + }, + { + "question": "What is the name of the plant?", + "selector": "", + "topics": ["science"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P225 ?nombre_cientifico. ?entity wdt:P18 ?image. ?entity wdt:P5037 ?value. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'en') }", + "imageurl": "", + "lang": "en" + }, + + + { + "question": "¿Qué alimento es este?", + "selector": "", + "topics": ["science"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q2095. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'es')}", + "imageurl": "", + "lang": "es" + }, + { + "question": "What food is this?", + "selector": "", + "topics": ["science"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q2095. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'en')}", + "imageurl": "", + "lang": "en" }, + + + { + "question": "¿Qué equipo de fútbol es este?", + "selector": "", + "topics": ["sports"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q476028; wdt:P154 ?image. ?entity wdt:P18 ?imagen. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'es')}", + "imageurl": "", + "lang": "es" + }, + { + "question": "What football team is this?", + "selector": "", + "topics": ["sports"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q476028; wdt:P154 ?image. ?entity wdt:P18 ?imagen. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'en')}", + "imageurl": "", + "lang": "en" + }, + + + { + "question": "¿Quién es el jugador de fútbol en esta imagen?", + "selector": "", + "topics": ["sports"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q5; wdt:P106 wd:Q937857. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'es')}", + "imageurl": "", + "lang": "es" + }, + { + "question": "Who is the football player in this picture?", + "selector": "", + "topics": ["sports"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q5; wdt:P106 wd:Q937857. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'en')}", + "imageurl": "", + "lang": "en" + }, + + + { + "question": "¿En qué estadio deportivo fue tomada esta imagen?", + "selector": "", + "topics": ["sports"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q483110. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'es')}", + "imageurl": "", + "lang": "es" + }, + { + "question": "In which sports stadium was this image taken?", + "selector": "", + "topics": ["sports"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q483110. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'en')}", + "imageurl": "", + "lang": "en" + }, + + { "question": "¿Cuál es el autor de este libro?", - "selector": "", - "topics": ["literature1", "image"], - "query": "SELECT ?name ?image WHERE { ?libro wdt:P31 wd:Q571. ?libro wdt:P50 ?author. ?libro wdt:P18 ?image. SERVICE wikibase:label { bd:serviceParam wikibase:language \"[AUTO_LANGUAGE],es\". ?author rdfs:label ?name. } } LIMIT 1 OFFSET 0", - "imageurl": "" + "selector": "", + "topics": ["literature"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q571. ?entity wdt:P50 ?author. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'es')}", + "imageurl": "", + "lang": "es" + }, + { + "question": "Who is the author of this book?", + "selector": "", + "topics": ["literature"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q571. ?entity wdt:P50 ?author. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'en')}", + "imageurl": "", + "lang": "en" }, + + { "question": "¿Cuál es el género literario del libro?", - "selector": "", - "topics": ["literature", "image"], - "query": "SELECT ?name ?image WHERE { ?libro wdt:P31 wd:Q571. ?libro wdt:P136 ?genre. ?libro wdt:P18 ?image. SERVICE wikibase:label { bd:serviceParam wikibase:language \"[AUTO_LANGUAGE],es\". ?genre rdfs:label ?name. } } LIMIT 1 OFFSET 0", - "imageurl": "" + "selector": "", + "topics": ["literature"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q571. ?entity wdt:P136 ?genre. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'es')}", + "imageurl": "", + "lang": "es" }, + { + "question": "What is the literary genre of the book?", + "selector": "", + "topics": ["literature"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q571. ?entity wdt:P136 ?genre. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'en')}", + "imageurl": "", + "lang": "en" + }, + { "question": "¿Cuál es el nombre del cuadro?", - "selector": "", - "topics": ["art", "image"], - "query": "SELECT ?name ?image WHERE { ?cuadro wdt:P31 wd:Q3305213. ?cuadro wdt:P18 ?image. SERVICE wikibase:label { bd:serviceParam wikibase:language \"[AUTO_LANGUAGE],es\". ?cuadro rdfs:label ?name. } } LIMIT 1 OFFSET 0", - "imageurl": "" + "selector": "", + "topics": ["art"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q3305213. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'es')}", + "imageurl": "", + "lang": "es" }, + { + "question": "What is the name of the painting?", + "selector": "", + "topics": ["art"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q3305213. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'en')}", + "imageurl": "", + "lang": "en" + }, + + { "question": "¿Cuál es el nombre del pintor?", - "selector": "", - "topics": ["art", "image"], - "query": "SELECT ?name ?image WHERE { ?cuadro wdt:P31 wd:Q3305213. ?cuadro wdt:P170 ?painter. ?cuadro wdt:P18 ?image. SERVICE wikibase:label { bd:serviceParam wikibase:language \"[AUTO_LANGUAGE],es\". ?painter rdfs:label ?name. } } LIMIT 1 OFFSET 0", - "imageurl": "" + "selector": "", + "topics": ["art"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q3305213. ?entity wdt:P170 ?painter. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'es')}", + "imageurl": "", + "lang": "es" + }, + { + "question": "What is the name of the painter?", + "selector": "", + "topics": ["art"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q3305213. ?entity wdt:P170 ?painter. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'en')}", + "imageurl": "", + "lang": "en" }, + + { "question": "¿Cuál es el estilo artístico del cuadro?", - "selector": "", - "topics": ["art", "image"], - "query": "SELECT ?name ?image WHERE { ?cuadro wdt:P31 wd:Q3305213. ?cuadro wdt:P149 ?style. ?cuadro wdt:P18 ?image. SERVICE wikibase:label { bd:serviceParam wikibase:language \"[AUTO_LANGUAGE],es\". ?style rdfs:label ?name. } } LIMIT 1 OFFSET 0", - "imageurl": "" + "selector": "", + "topics": ["art"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q3305213. ?entity wdt:P149 ?style. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'es')}", + "imageurl": "", + "lang": "es" + }, + { + "question": "What is the artistic style of the painting?", + "selector": "", + "topics": ["art"], + "query": "SELECT DISTINCT ?entity ?label ?image WHERE { ?entity wdt:P31 wd:Q3305213. ?entity wdt:P149 ?style. ?entity wdt:P18 ?image. ?entity rdfs:label ?label. FILTER(LANG(?label) = 'en')}", + "imageurl": "", + "lang": "en" } ] diff --git a/question/wikidata.js b/question/wikidata.js index ba8fdfee..33c0eb40 100644 --- a/question/wikidata.js +++ b/question/wikidata.js @@ -4,45 +4,24 @@ import path from 'path'; const url = "https://query.wikidata.org/sparql"; -// Función para cargar el archivo JSON de plantillas -function loadQuestionTemplates() { - // Construimos la ruta de manera explícita - const filePath = path.resolve('question', 'question_template.json'); - // Mostramos la ruta para depurar - console.log("Ruta al archivo JSON:", filePath); - - try { - const data = fs.readFileSync(filePath, 'utf-8'); - return JSON.parse(data); - } catch (error) { - console.error("Error al leer el archivo JSON:", error); - throw error; - } -} - -function loadQuestionTemplatesWithTopic(topic) { - // Construimos la ruta de manera explícita +function loadQuestionTemplatesWithTopic(topics) { const filePath = path.resolve('question', 'question_template.json'); - // Mostramos la ruta para depurar - console.log("Ruta al archivo JSON:", filePath); + const data = fs.readFileSync(filePath, 'utf-8'); + const templates = JSON.parse(data); - try { - const data = fs.readFileSync(filePath, 'utf-8'); - const templates = JSON.parse(data); + const topicsArray = Array.isArray(topics) ? topics : [topics]; - // Filtrar las plantillas que contienen el topic proporcionado - const filteredTemplates = templates.filter(template => template.topics.includes(topic)); - return filteredTemplates; - } catch (error) { - console.error("Error al leer el archivo JSON:", error); - throw error; - } + const filteredTemplates = templates.filter(template => + topicsArray.some(topic => template.topics.includes(topic)) + ); + return filteredTemplates; } + async function executeQuery(query) { const offset = Math.floor(Math.random() * 100); - query += offset; + const finalQuery = query + ` LIMIT 100 OFFSET ${offset}`; const response = await fetch(url, { method: "POST", @@ -50,33 +29,66 @@ async function executeQuery(query) { "Content-Type": "application/sparql-query", "Accept": "application/json" }, - body: query + body: finalQuery }); - if (!response.ok) { - throw new Error(`Error en la consulta SPARQL: ${response.statusText}`); - } - const data = await response.json(); - return data.results.bindings; + //label representa los resultados que van a aparecer en las opciones -> no puede ser iguales + //filtro para asegurarme que no se repitan bajo ninguna circunstancia + return filterUnique(data.results.bindings, "label", 4); } -async function main(topic) { - try { - const templates = loadQuestionTemplatesWithTopic(topic) //cogemos solo las plantillas que pasen por el filtrado de topic +function filterUnique(results, label, limit) { + const uniqueResults = []; + const seenValues = new Set(); + + for (const result of results) { + if (result[label]?.value && !seenValues.has(result[label].value)) { + seenValues.add(result[label].value); + uniqueResults.push(result); + } + if (uniqueResults.length === limit) break; + } + return uniqueResults; +} +//intercambiar por la de andrea y meter lo del lang para que admita los idiomas +async function takeOptions(topics) { + const templates = loadQuestionTemplatesWithTopic(topics); + const randomTemplate = templates[Math.floor(Math.random() * templates.length)]; + + const query = randomTemplate.query; + const results = await executeQuery(query); - const randomTemplate = templates[Math.floor(Math.random() * templates.length)]; //seleccionamos una plantilla aleatoria - console.log(`Plantilla seleccionada: ${randomTemplate.question}`); + if (results.length > 0) { - const query = randomTemplate.query; //obtenemos la consulta SPARQL de la plantilla seleccionada + const filteredResults = allInfo(results, "label", "image", randomTemplate); + console.log("Resultados finales:"); + console.log(JSON.stringify(filteredResults, null, 2)); - const results = await executeQuery(query); - results.forEach((item) => { - console.log(`Datos obtenidos: ${JSON.stringify(item, null, 2)}`); - }); - } catch (error) { - console.error("Error ejecutando el script:", error); + return filteredResults; } + //para evitar errores en tiempo de ejecucion -> quitarlo en un futuro + return []; +} + +function allInfo(results, labelKey, imageKey, randomTemplate) { + const specialIndex = Math.floor(Math.random() * results.length); + + const question = randomTemplate.question; + const correct = results[specialIndex][labelKey]?.value || null; + const image = results[specialIndex][imageKey]?.value || null; + const options = results + .map(result => result[labelKey]?.value || null) + .filter((option, index) => index !== specialIndex); + + return { + question, + correct, + image, + options + }; } -main("art").catch(console.error); +takeOptions(["geography", "history"]) + .then(filteredResults => console.log("Resultados finales procesados:", filteredResults)) + .catch(console.error);