A Trivia like Mobile Game with Autonomous Content That Uses Wikipedia Based Ontologies

The mobile devices are everywhere and the gaming industry has an important market share on this field. This paper aims to present a new approach of game which generates autonomous its content, without human intervention, by using existing facts from the semantic version of Wikipedia, called DBpedia. At the beginning a short introduction of the studied field and of the used terms and technologies is presented. There are also remembered similar approaches and different struggles from this domain. In the middle part the architecture and the logic of the system are shown. The paper ends with some conclusions and future plans.


Introduction
The mobile industry is literally huge.In the US, 55% of the adult population owns a smart phone and it is predicted that by the end of 2016 we will have 1.4 smart devices per person on the planet.Even if the market is so big, its granularity is still high from an OS point of view.The leader is the Android OS, closely followed by the iOS.Another players are the Blackberry OS, Windows OS and the last but not to ignore, the recent launched Firefox OS.A mobile device owner uses in average 26.8 apps per month and 57% of these people use their apps daily.The most used apps are from the "Search, Portal & Social" category (with 10 hours and 56 minutes spent per month per user), closely followed by the "Entertainment" apps which are used 10 hours and 34 minutes monthly per user [12].Unfortunately the most apps from the Entertainment category, which the games are part of, involve a whole team of developers for the engine of the game at the beginning and then, for developing the content.With investments that sometimes overtake the budgets of many movies, the games consume more and more money.But what if we can use an automatic way of providing the content?Robots that write press articles already exist [10], so why not developing a game that uses a semantic web approach in providing its content in general, or to be more specific, general knowledge questions in particular.The path for semantic answering questions in a gaming environment was paved since February 2011 when the Watson Question Answering system built by the IBM Research team challenged two human champions in the American TV quiz show Jeopardy!and bested them.However, the questions being played for the quiz had been created by human authors.The information used to solve these questions came from the Linked Open Data (LOD) and analysis of large amount of documents like newspaper articles.Even though Watson has won the quiz show, the knowledge that can be drawn automatically from the LOD cloud is far from being perfect [8].But this thing doesn't mean it can't be used for entertainment purposes like question source for a trivia like game.In fact its correctness can be adjusted by players.If more players report a question as being incorrect then the system can consider that most probably it is and ignore it from future shows.Maybe it is a better approach to have an almost infinite number of possible question with an accepted error ratio, than to have a limited number of 100% correct questions that will repeat themselves.

Technologies Used
As we saw in the previous section, right now there isn't a unique approach in developing a native mobile application.Each platform and operating system has its own development environment and its own programming language for writing apps.But, even so, there is an alternative in the name of hybrid apps.They are usually responsive web applications that run in a native web browser control.There are multiple platforms for developing this kind of apps, but the most important is PhoneGap.PhoneGap is a platform based on HTML and JavaScript which can be used for developing hybrid mobile applications (Figure 1).

Basically
a PhoneGap application implements platform specific webView like controls which run JavaScript code in order to access specific elements of the mobile device like network connectivity, contacts, file system, multimedia or camera.The graphic interface is defined exclusively by using HTML5 and CSS3 and, in order to display it on a mobile device, the browser features are used.This approach unfortunately makes the PhoneGap apps slower than similar native apps, but the advantages of writing code just once and knowing just one programming language make it a reliable solution [2].

Fig. 1. Example of a PhoneGap application design
Node.js, called sometimes simply -Node, is a server-side JavaScript environment that is based on Google's runtime implementation -the aptly named "V8" engine.V8 and Node are mostly implemented in C and C++, focusing on performance and low memory consumption.But, whereas V8 supports mainly JavaScript in the browser (most notably, Google Chrome), Node aims to support long-running server processes.Unlike in most other modern environments, a Node process doesn't rely on multithreading to support concurrent execution of business logic; it's based on an asynchronous I/O event model (Figure 2).Think of the Node server process as a single-threaded daemon that embeds the JavaScript engine to support customization.This is different from most event systems for other programming languages, which come in the form of libraries: Node supports the event model at the language level.JavaScript is an excellent fit for this approach because it supports event callbacks.For example, when a browser completely loads a document, a user clicks a button, or an Ajax request is fulfilled, an event triggers a callback.JavaScript's functional nature makes it extremely easy to create anonymous function objects that you can register as event handlers [9].

Fig. 2. Node.js processing model
Express is a web application framework for Node.js.It is minimal, flexible and great for building web APIs.Express extends Node and has a robust set of features for web and mobile applications.It can be installed via npm package manager.For details about Express.js and npm please see [14] and [15].Angular.js is a client-side JavaScript framework for adding interactivity to HTML pages.It is maintained by Google and a community of individual developers and corporations to address many of the challenges encountered in developing singlepage applications.Its goal is to simplify both development and testing of such applications by providing a framework for client-side model-view-whatever (MVW) architecture, along with components commonly used in rich internet applications.The library works by first reading the HTML page, which has embedded into it additional custom tag attributes.Those attributes are interpreted as directives telling Angular to bind input or output parts of the page to a model that is represented by standard JavaScript variables.The values of those JavaScript variables can be manually set within the code, or retrieved from static or dynamic JSON resources.For more information about Angular please consult [16].
MongoDB is an open-source document database written in C++ and the leading NoSQL database.NoSQL refers to nonrelational databases promising to handle large volumes of structured and unstructured data.Unlike relational databases the NoSQL databases do not require schemas to be defined beforehand.These fits perfectly fine with the agile technologies as each time a new feature is developed, the schema of the database is needed to be changed.The datastructure of non-relational database is not fixed.This allows the insertion of data without a predefined schema.This ultimately proves helpful in making significant changes in applications in real-time, with no interruption in service, leading to faster development, reliable code integration and lessens the amount of time by database administrators.NoSQL also referred as "Not only SQL" to emphasize that these also support SQL like queries.Its architecture is based on a set of collections that hold each a set of documents.A document further is a set of key-value pairs.These documents have a dynamic schema which means that documents in the same collection do not need to have the same set of fields or structure.DOI: 10.12948/issn14531305/19.1.2015.02 The key feature for which MongoDB is used is its flexibility which is understood as that the data is stored in JSON documents [3].JSON will be in fact the keyword in the presented paperwork.
An analogy between the leading SQL database (MySQL) and MongoDB from a query point of view is presented in Figure 3.For more details about MongoDB please visit [17].

Fig. 3. Running a query in a SQL environment (MySQL) vs running the same query in a
NoSQL environment (MongoDB) The last but not the least technology used is Linked Open Data.It is also the most important part of the system, the feature that makes the designed architecture to work autonomous.The Linked Data is the process of applying the general architecture of the World Wide Web to the task of sharing structured data on a global scale [1].It uses the architecture of the classic document Web with Uniform Resource Identifiers (URIs) as globally unique identification mechanism, the Hypertext Transfer Protocol (HTTP) as universal access mechanism and different XML or JSON derived formats for presenting or formatting the data, like RDF, OWL or JSON-LD [11].When the data that is presented is publicly available we call it Linked Open Data (LOD).
There is a graphical representation of how URIs in the LOD link to each other provided by [4], named the LOD cloud diagram (Figure 4).As we can see there, the nucleus of LOD on this moment is DBpedia, the data source chosen for this system.RDF (Resource Description Framework) is a standard model for data interchange on the Web.RDF has features that facilitate data merging even if the underlying schemas differ, and it specifically supports the evolution of schemas over time without requiring all the data consumers to be changed.RDF extends the linking structure of the Web to use URIs to name the DOI: 10.12948/issn14531305/19. 1.2015.02relationship between things as well as the two ends of the link (this is usually referred to as a subject-predicate-object "triple") [13].Using this simple model, it allows structured and semi-structured data to be mixed, exposed, and shared across different applications.SPARQL for RDF [18] is a query language that can be used to retrieve information across diverse data sources, whether the data is stored natively as RDF or viewed as RDF via middleware.SPARQL contains capabilities for querying required and optional graph patterns along with their conjunctions and disjunctions.SPARQL also supports extensible value testing and constraining queries by source RDF graph.The results of SPARQL queries can be results sets or RDF graphs.

Fig. 4. LOD cloud diagram
DBpedia is the semantic version of Wikipedia, the largest encyclopedia ever, which was constructed by a very large open community.It uses the information from Wikipedia's info boxes and makes it available for machines in ontological formats like RDF and OWL.It also makes the structured data queryable against a SPARQL endpoint.DBpedia contains all the RDF specific elements like RDF Subject, RDF Property and RDF Object, elements that we need for the proposed system.

The Trivia Like Mobile Game
The designed game aims to involve smart device users from around the world in testing their general knowledge in 1 vs 1 battles in order to gain points and respect of their friends.The application uses gamification techniques and social features to increase the users' commitment.As [7] show the social network users are concerned about what their friends do and care about what their friends think about them.Thus the application will recommend the players to login with their Facebook account so they can be able to compete with their social network friends in the pursuit for points (Figure 5 left side).
The system provides the users with simple questions that begin with one of the four "W"s ("What is…?", "Who is…?", "When was…?" and "Where is…?") continued by a single term and 4 possible answers (each one composed from a word or more that represent together a single entity).Based on their answer speed and the accuracy of their choices a score is computed.The main screen shows the picture of the player (if available), DOI: 10.12948/issn14531305/19.1.2015.02his overall score and his abilities together with the win/loss ratio (Figure 5 right side).The game itself consists in a 1 minute battle between two random selected players for answering as many question as they can.The players are selected by the server based on their overall points so the match can be balanced.The winner will be the player who answers the most question in the given time (Figure 6 left side).If both players report the same question as being incorrect or strange, then the app ignores it when counting the score.If the user logins with a facebook account then he has access to a scoreboard that contains all his friends who are playing the game together with their scores (Figure 6 right side).If almost all the services presented above are self-explanatory, the most interesting ones are findSimilarPlayer and getPackOfQuestions.For finding a similar available player y for the one that requests the challenge -x, the following formula is applied: y = min(|Px -Py|), where Px is the score of the player x.Other formulas used on the server are: , where S is the player's speed, q is the number of questions asked in a game by that player and n the total numbered of questions asked in that game or max(q1, q2) and Ax = ∑  ∑ , where Ax is the player's accuracy and r is the number of correct answers.Regarding the other service, the one that gives a pack of questions, things are a little bit more complicated.First of all, why a pack a question and not a single one?Because the game is time based and no human player could answer more than 100 questions in 1 minute.Thus for optimization purposes the server gives to the client application a set of 100 questions not a single one.This thing ensures that no service calls are made during the game so it can be as smooth as possible.One might ask now, how the questions are automatically and autonomous computed?The server calls the DBpedia SPARQL endpoint, running queries in search for RDF object, RDF specific properties and RDF subjects.If the properties are aprioristically known (they are given by the four types of questions), the subject is selected randomly together with the correspondent object(s).In case of more objects, the answer will be the one that is more precise (lower in class hierarchy) and in case of more possible items in this situation, it will be selected randomly.After that a new call is being made that request 3 random object from the same class as the correct object, that don't share the same property with the object.Let's take the question "Who is/was George Emil Palade?" as an example.So the server selected randomly that the next question will be of type "Who is…?".This means that the queried property will be rdf:type and the object will be of type dbpedia-owl:Person.Now the first call is made to the SPARQL endpoint with the following query (where the offset number is generated randomly by the server):

Fig. 5 .Fig. 6 .
Fig. 5.The user interface: the login screen (left side) and the main screen (right side)