Research on Extension of SPARQL Ontology Query Language Considering the Computation of Indoor Spatial Relations

: A method suitable for indoor complex semantic query considering the computation of indoor spatial relations is provided According to the characteristics of indoor space. This paper designs ontology model describing the space related information of humans, events and Indoor space objects(e.g. Storey and Room) as well as their relations to meet the indoor semantic query . The ontology concepts are used in IndoorSPARQL query language which extends SPARQL syntax for representing and querying indoor space. And four types specific primitives for indoor query, “Adjacent”, “Opposite”, “Vertical” and “Contain”, are defined as query functions in IndoorSPARQL used to support quantitative spatial computations. Also a method is proposed to analysis the query language. Finally this paper adopts this method to realize indoor semantic query on the study area through constructing the ontology model for the study building. The experimental results show that the method proposed in this paper can effectively support complex indoor space semantic query.


Introduction
Recently, human activities have expanded from outdoor to indoor space (Lee K et al., 2013).Since the building construction is becoming more and more complex, to better support indoor activities, there is urgent need to implement query services of indoor space.Based on geometric model and symbolic model, the current indoor query services focus on geometric and simple semantic query, such as range query and k nearest neighbor query.A lattice-based semantic location model (LSLM) for the indoor environment was proposed which can better support semantic navigation and the nearest neighbor query for indoor space (Li D et al., 2008).Also, methodologies on range query (Yang B et al., 2009) and k nearest neighbor query (Yang B et al., 2010) for indoor space were carried out.However, all models above are still not enough to support complicate semantic query of indoor space, e.g."professor whose office is in the opposite of professor Zhu's office".There are three reasons as follow.
1.Both geometric and symbolic coordinates are difficult to represent rich semantics of indoor space, such as space properties, space related information of humans and events.
2. Some spatial relations widely and specially used in the i ndoor space have been ignored, such as "opposite", "upstairs", "downstairs", etc.

It is difficult to model all relations between different indoor
regions in advance, which may lead to failure of space query.
The semantic model of indoor space can describe the attributes of different indoor structures as well as their relations which provide the basis for complex semantic query.This modeling method is usually associated with ontology.However, nowadays few research focuses on ontology query language for standard OWL(Ontology Web Language), and most focuses on the standard query language for RDF( Resource Description Framework) which is the basis of OWL.SPARQL is a kind of query language for RDF to query and access any data resources that can be mapped to RDF model.The GeoSPARQL syntax works within SPARQL's extensibility framework, providing the expression of geometry and geometric query functions, such as "ogc:equals", "ogc:touches", and "ogc:overlaps".With GeoSPARQL query language, topological relations between instances can be queried.However, the relations expressed by the geometric query functions are limited to basic topological relations, and some spatial relations widely and specially used in the indoor space have been ignored, such as "opposite", "upstairs" and "downstairs".
Aiming at these shortcomings, this paper proposes an ontology model to support semantic query of indoor space.The ontology concepts are used in IndoorSPARQL query language which extends SPARQL syntax for representing and querying indoor space.We also design four types specific primitives for indoor query, "Adjacent", "Opposite", "Vertical" and "Contain", which are defined as query functions in IndoorSPARQL used to support quantitative spatial computations.Finally, a method is proposed to analysis the query language.

Methodology
The core part of this research is divided into three sections as shown in Figure 1.First, an ontology model is designed to support semantic query of indoor space.Second, specific primitives for indoor query are proposed, and the basic calculation method is carried out.Third, IndoorSPARQL query language is designed for representing and querying indoor space, also a method is proposed to analysis the query language.

Ontology Model
An ontology is an explicit specification of concepts and describable relationships in the knowledge of a domain (Gruber, T. R.,1995).Indoor space can be abstracted as a set of ontology concepts, such as "Building", "Storage", "Passage", etc. Space semantics like properties, relations can be easily defined as data properties and object properties of ontology concept.Figure 2 shows the ontology concepts based on the cognition of indoor space.The concept "Thing" labelled in blue ellipse is the basic class.It contains four subclasses labelled in yellow ellipses, including "Portal", "Obstacle", "Container" and "Agent".This paper designs four types specific primitives for indoor query: "Opposite", "Vertical", "Adjacent" and "Contain".These four primitives separately express the "opposite relation", "upstairs-downstairs relation", "adjacency relation" and "containing relation" between indoor structures.These primitives are defined in IndoorSPARQL query language as query functions used to support quantitative spatial computations.In this part, we take "opposite relation" for example to introduce its definition and the method of computation for different ontology concepts.
The "opposite relation": Based on the building ontology model, the relation is defined and calculated under some constraints:


The objects of calculation must belong to the same floor of the building.


The "opposite relation" is only be calculated on those sides of the function areas where there are entrances.


There must exit a function area as a reference object to define the 'opposite relation' between the objects of calculation.
For the third constraint, this paper takes the "HorizontalPassage" which is the sub-class of 'Passage' in the building ontology as the reference object.That is, the computational model employs the function areas, such as "corridor", "lobby" to judge the existence of "opposite relation" between objects.
The ontology concepts which are suitable for the constraints of "opposite relation" are: "Room" class, "VerticalPassage" class, "BuildingDoor" class as well as their sub-classes.Different

IndoorSPARQL Query Language
This paper extends SPARQL syntax to design IndoorSPARQL query language by defining ontology concepts as well as data and object properties as vocabularies for representing indoor spatial information and by defining specific primitives as query functions used to support quantitative spatial computations.
Figure 4 shows an example of semantic query of indoor space.
The basic grammar of the query language is introduced as follow based on this example.

Syntax for Literals
The general syntax for literals can be a string, a decimal number or a bool variable.

 Syntax for Query Variables
A query variable is marked by the use of either "?" or "$"; the "?" or "$" is not part of the variable name.

Syntax for Triples
Triple Patterns are written as "subject", "predicate" and "object".Variables can be found in the subject or object part, and the predicate part represents a relationship between subject and object.

 Syntax for Filters
A constraint, expressed by the keyword "FILTER", is a restriction on solutions over the whole group in which the filter appears.Logical operator like "&&" or "||" and the specific primitives can be used to constraint the relationship between instances.

Analysis of Query Language
The process of parsing the query language is shown in Figure 5.
First, grammar for this query language is designed, and a tool named ANTLR is used to generate the lexical and syntax parser, through which a query expression can be determined whether it conforms to the grammar or not.Then, the query expression will be transformed into an abstract syntax tree by the parser.Finally, code production walks syntax tree and obtains information from ontology instances of indoor space to complete the query process.

Experiment
For the experiment, the study area is LIESMARS building.
Based on the ontology model this paper designs, instances for the indoor space are constructed by the software named Proté gé .
Two examples of indoor semantic query which use IndoorSPARQL query language are provided with their results visualized in the two-dimensional map of this building.

Conclusion
According to the characteristics of indoor space, query language IndoorSPARQL expanding the SPARQL syntax is designed to support the indoor semantic query considering the computation of indoor spatial relations.The proposed method can effectively meet rich indoor activities.This method has the following advantages:(1)The ontology model provides a complete and clear expression for indoor space and the space related information of humans, events and Indoor space objects(e.g.Storey and Room) as well as their relations, providing the basis for complex semantic query;(2) Specific primitives for indoor query, "Adjacent", "Opposite", "Vertical" and "Contain", defined as query functions in IndoorSPARQL can support quantitative spatial computations semantic query in the indoor;(3)This paper also designs query language IndoorSPARQL to support the proposed method of indoor semantic query.However, there are also some shortcomings in the work ,our future research will focus on:(1) Improving the Figure 2. Ontology Concepts of Indoor Space computational models are developed according to different ontologies for "opposite relation".Forthe 'Room' class: A room of a building will have a door as an entrance.The entrance, as an auxiliary object of calculation, can make the calculation meet the second constraint.Firstly, for a specific room of a building, we can get the candidate rooms that may have 'opposite relation'with it through the reference object, such as corridor or lobby based on the set of instances.The second step is to calculate the angle to judge whether there exists "opposite relation" or its sub-relation between them.For the "VerticalPassage" class: The "VerticalPassege" class includes the "Elevator", "Escalator", "Stairway" subclasses.For this opening function areas, there is an ontology class named "VirtualDoor" owning the similar meaning to the "Door" class that represents the connection areas between function areas of the building.Therefore, for the "VerticalPassage" class, the "VirtualDoor" class can help calculation to meet the second constraint of "class to judge whether there exists a kind of "opposite relation" or its sub-relation The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XL-4/W5, 2015 Indoor-Outdoor Seamless Modelling, Mapping and Navigation, 21-22 May 2015, Tokyo, Japan

Figure 4 .
Figure 4. Example Query: Find teacher whose office is in the opposite of teacher Zhu's office  Syntax for IRIs The "PREFIX" keyword associates a prefix label with an IRI(Internationalized Resource Identifiers).A prefixed name is mapped to an IRI by concatenating the IRI associated with the prefix and the local part.

Figure 5 .
Figure 5.The Process of Parsing IndoorSPARQL Language

Figure 8 .
Figure 8.The Results of Example Query 2 structure and function of the query language IndoorSPARQL;(2) Improving the calculation model of indoor spatial relations;(3) Optimizing the Analysis of the query language to improve the query efficiency 5. References Lee, K. and Kang, H. and Lee, J., 2013.Topological Analysis in Indoor Shopping Mall using Ontology.Journal of the Korean Society of Surveying, Geodesy, Photogrammetry and Cartography, 31(6-2), pp.512-520 The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XL-4/W5, 2015Indoor-Outdoor Seamless Modelling, Mapping and Navigation, 21-22 May 2015, Tokyo, Japan The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XL-4/W5, 2015Indoor-Outdoor Seamless Modelling, Mapping and Navigation, 21-22 May 2015, Tokyo, Japan This contribution has been peer-reviewed.doi:10.5194/isprsarchives-XL-4-W5-67-2015