# Chatots for Cultural Venues: A Topic-Based Approach
## 2 Materials and Methods
### Mapping of Structured Information to Google DialogFlow Elements
The automation of chatbot creation speeds up the creation or update of chatbot engines and removes the risk of human errors, including omissions of paths or exhibits, erroneous linking or missing and misplaced textual, visual resources, etc., in the process of mapping the informational model to chatbot constructs. It is noted though that chatbots still need to be tested before deployment to ascertain that itineraries are correctly modeled and presented since when checking at information model-level, some errors may evade detection. #### 2.3.1 Data Extraction from the Information Repository

In Section 2.1, ontology excerpts for the representation of the information model used for the creation of the chatbot are presented. Currently, RDF triple stores are the predominant systems for storing and managing semantically annotated data, and, typically, information is retrieved from these systems using the SPARQL query language [44; 45]. In this subsection, we present how different information elements are extracted using SPARQL queries. Firstly, the reflective topics modeled by the museum curators need to be extracted. Reflective topics are instances of the 'ReflectiveTopic' class; hence, the relevant SPARQL query retrieves all instance of the 'ReflectiveTopic' class, as illustrated in Listing 2. ```
PREFIXrdfs:<[[http://www.w3.org/2000/01/rdf-schema#](http://www.w3.org/2000/01/rdf-schema#)]([http://www.w3.org/2000/01/rdf-schema#](http://www.w3.org/2000/01/rdf-schema#))> PREFIXrdf:<[[http://www.w3.org/1999/02/22-rdf-syntax-ns#](http://www.w3.org/1999/02/22-rdf-syntax-ns#)]([http://www.w3.org/1999/02/22-rdf-syntax-ns#](http://www.w3.org/1999/02/22-rdf-syntax-ns#))> PREFIXcc:<[[http://www.crosscscult.eu/KB#](http://www.crosscscult.eu/KB#)]([http://www.crosscscult.eu/KB#](http://www.crosscscult.eu/KB#))> PREFIXcrm:<[[http://erlangen-crm.org/current/](http://erlangen-crm.org/current/)]([http://erlangen-crm.org/current/](http://erlangen-crm.org/current/))> SELECT?iri?name?description?firstElement?lastElement WHERE{{?iri?rdf:typecc:ReflectiveTopic}. {?irirdfs:label?name. {?iricrm:P3_has_note?description}. {?iricc:isNarratedBy?narrrationAxis}. {?narrationAxis cc::isRealizedBy?navigationPath}. {?navigationPath cc::hasFirst?firstElement}. {?navigationPath cc::hasLast?lastElement} }
```
Similar queries can be used to retrieve elements of other navigation paths, e.g., historic periods or locations of discovery. Note that the 'iri' element returned by the query (the firstvariable in the select list) is effectively the unique identifier of the reflective topic. The fields 'firstElement' and 'lastElement' returned by the query will be used for ordering the exhibits participating in the itinerary in the following steps. It is also possible that all narration axes are retrieved from the knowledge base, exploiting the modeling property that each narration axes that should be realized by the chatbot is linked with a 'narrates' relation (an inverse of the 'isNarratedBy' relation, omitted from Figure 2 to avoid clutter). This is accomplished using the SPARQL query illustrated in Listing 3. SPARQL query for retrieving all concepts having an associated narration axis. ```
PREFIXrdfs:<[[http://www.w3.org/2000/01/rdf-schema#](http://www.w3.org/2000/01/rdf-schema#)]([http://www.w3.org/2000/01/rdf-schema#](http://www.w3.org/2000/01/rdf-schema#))> PREFIXrdf:<[[http://www.w3.org/1999/02/22-rdf-syntax-ns#](http://www.w3.org/1999/02/22-rdf-syntax-ns#)]([http://www.w3.org/1999/02/22-rdf-syntax-ns#](http://www.w3.org/1999/02/22-rdf-syntax-ns#))> PREFIXcc:<[[http://www.crosscult.eu/KB#](http://www.crosscult.eu/KB#)]([http://www.crosscult.eu/KB#](http://www.crosscult.eu/KB#))> PREFIXcrm:<[[http://erlangen-crm.org/current/](http://erlangen-crm.org/current/)]([http://erlangen-crm.org/current/](http://erlangen-crm.org/current/))> SELECT?narAxisTri?conceptIri?conceptName?conceptDescription?firstElement?lastElement WHERE{{?narAxisTrirdf:typecc:NarrationAxis}. {?narAxisTricc:narrates?conceptIri}. {?conceptIrirdfs:label?name. {?conceptIricrm:P3 has_note?description}.