A Design Framework For Context-Aware Access To Heterogeneous Resources
A Design Framework For Context-Aware Access To Heterogeneous Resources
to Heterogeneous Resources?
1 Introduction
In the last decades, the pervasive introduction of ICT technologies in our society
has changed the way people access information. Traditional data management
systems have left the place to sophisticated data integration systems that com-
bine and expose rich information extracted from all kinds of sources like Web
Data Service, Social Networks, Digital Libraries or Media Collections, and make
it available in the proper format to different media devices. Also savvy users have
changed their attitudes and behaviors to take advantage of the many opportu-
nities of being “digital” and “social,” starting from the initial need to choose
information to support their own tasks, to the identification of the necessary
budget, up to managing negotiations and other sophisticated operations. How-
ever, this does not come at a low price, as finding information that is most
suitable to their current situation of use often requires a lot of time and effort.
What is missing today is support for the fast development of integrated,
personalized, real-time assistants that help users by providing context-aware
?
This research has been partially supported by the IT2Rail project, funded by Euro-
pean Union’s Horizon 2020 research and innovation program under grant agreement
No: 636078, and by the the Italian project SHELL – CTN01 00128 111357
2 F. Daniel, M. Matera, E. Quintarelli, L. Tanca and V. Zaccaria
information and friendly guidance and by signaling events that may be of interest
in view of their tastes and current needs. It is therefore important to define design
methodologies that natively support the dynamic filtering of pertinent resources
and the consequent tailoring of the retrieved content. In this respect, the different
dimensions characterizing the context of use can guide the definition of queries
over the set of available heterogeneous resources.
Context awareness was born in the realm of ubiquitous computing, with the
objective of perceiving changes in the environment and reacting on this basis.
Various definitions of context have been proposed in the past: notably, Dey et al.
[15] characterize the context of a person in terms of time, location, identity, and
current activity; others identify further parameters, such as user role, current
task, device type, managing to cover different usage scenarios. More recently,
context has been understood to be strongly related to the application domain
and to individual use cases and, as such, to be treated by the designer of the
app as a first-class design concern.
To respond to the need for a development methodology with native sup-
port for context-awareness, this paper presents a design framework for the fast
development of apps that revolves around (i) the explicit specification of the
context dimensions deemed relevant in a given application domain and (ii) their
mapping onto an integrated schema of the available resources. We model context
dimensions using the Context Dimension Model (CDM) [4], which provides an
intuitive way to visually represent context information and, more specifically, the
conceptual relationships that exist among the properties of context in a given
scenario. The CDM comes in the form of Context Dimension Trees (CDTs), i.e.,
trees with nodes of three kinds: dimensions, concepts, and parameters.
Structure of paper. We next introduce the concepts and artifacts of the proposed
methodology, then we go into the details of the resource schema (Section 3) and
the Context Dimension Trees (Section 4). Next, we show how to interpret and
execute queries (Section 5) and discuss related work before closing the paper.
Modeling Context-Aware Access to Heterogeneous Resources 3
R1 R2
D1
1 S1 S2
D2 2 S3
Local R3
D3
External
database
web services
Service registry
Data schema (descriptors)
3
4 Mapping
7
6 Query
Context rewriting
Dimension
Tree (CDT) CDT instance App views
2 Approach
In this paper we propose the use of the CDM in the development of context-
aware applications to achieve two goals: (i) the concise and human- and machine-
readable representation of all context dimensions and properties relevant to a
given development scenario and (ii) the simplification of the development of
context-aware application features. The approach turns the specification of all
the possible contexts of the considered scenario into a first-class development
artifact that not only serves a documentation purpose but also an operational
one. The context dimensions themselves can be aggregated into categories: in-
formation on the user (knowledge of habits, emotional state, physiological con-
ditions), user’s social environment (co-location of others, social interaction, cur-
rent tasks), physical environment (location, time, and physical conditions like
noise, light, pressure, air quality). Note that, while the dimensions of the latter
category can be automatically derived by appropriate sensors, the previous ones
may require to be inserted by the user or might be provided by default settings.
Figure 1 illustrates the resulting methodology and development steps. The
development process starts from the identification and description of the avail-
able resources, which can be both local data sources ¬, for example relational
data bases, or third-party Web services represented by their service descriptors
. An integrated schema of the available data is then defined, so as to present
the developer with one abstract model of the data only. We call this schema
4 F. Daniel, M. Matera, E. Quintarelli, L. Tanca and V. Zaccaria
is necessary to specify: (i) the service endpoints (one or more URIs), (ii) the op-
erations offered by the service, (iii) the respective input parameters and output
data schemas and serializations (e.g., JSON or XML), and (iv) possible authenti-
cation details (e.g., usernames/passwords or developer keys). Each resource has
an own registry entry.
For the sake of brevity, we do not further detail these technicalities here; they
represent state-of-the-art development practice. What is relevant in our frame-
work is the specification of the access patterns that can be used to access the
services. Indeed, most services support different input parameters to access same
or similar data, which can be mandatory or oprional. We defer this specification
to after the modeling of the resource schema (Section 3.2).
Once the different resources are registered in the system, it is possible to derive
the resource schema of the available data so as to present the developer with a
unique schema of the data. The schema aims to represent the data provided by
the resources and their relationships in a way that accommodates the require-
ments posed by the specific application domain. For example, we can think of
the tables introduced in our running example as the result of a modeling activity
that produces a data schema representing all the resources selected for the given
application domain.
Considering the resources identified for our running example, a possible re-
source schema could look like the following one, where Restaurant represents
the data accessible through the service ResSvc, Hotel represent the data stored
in the local database HotelTab, and Itinerary represent the itineraries com-
puted by the two services ItinSvc1 and ItinSvc2:
Restaurant(name, address, phone, type, cuisine type, playground)
Hotel(name, address, category, childcare)
Itinerary(from, to, type, itinerary, price)
The identification of the previous relations depends on opportunistic choices
in the app design. For example, the attribute itinerary is not further specified,
as it is not necessary to further split and query itinerary descriptions. itinerary
could however contain a map image, a list of instructions, e.g., about how to go
from a hotel to a restaurant, or similar. The resource schema also makes only use
of logical addresses (city, street, number), instead of physical GPS coordinates.
In addition to these application-specific design choices, the resource schema
keeps track of the provenance of each attribute in the defined relations. This is
achieved using an additional table: Source(id, attribute, registry entry) that
tracks the necessary, minimal meta-data: for each attribute in the resource
schema, it contains a link to the registry entry that may provide data for the
attribute. A query for the attribute Itinerary.itinerary will thus return two
entries, i.e., ItinSvc1 and ItinSvc2. This meta-data will be used only at query
execution time and is not accessible to the developer, who instead is now able
6 F. Daniel, M. Matera, E. Quintarelli, L. Tanca and V. Zaccaria
corresponds to the view of the application that, at interaction time, allows the
user to choose a type of cuisine: the user choice will replace the parameter $V AL,
and then the app will show the restaurants matching the cuisine choice along
with the itineraries to reach them.
In Section 4.2, we show how to inject context into Q1 obtaining a context-
aware version of it.
Given the above resource schema, each access pattern to a resource can now be
expressed as a view over it. This equips the pure technical registry entry, that
tells how to interact with the service, with a semantical mapping of the service
to the resource schema; it will be this mapping to enable context-aware service
selection at runtime. For instance, the chosen restaurant search service can be
expressed as follows:
ResSvc ≡ Π name,address,phone, σ address=$optional ∧ Restaurant
type,cuisine,playground type=$optional ∧
playground=$optional ∧
cuisine type=$optional
In bold we highlight two keywords that are needed to express a service’s
access pattern: the values $mandatory and $optional tell, respectively, if an
attribute is a mandatory or optional input of the service. Both keywords are
automatically replaced at runtime by their respective values. Without proper
values for mandatory inputs, the service cannot be invoked; optional inputs may
be used to restrict the output data produced by the service.
In addition to mandatory and optional inputs, it is also possible to specify
constant values for some input parameters. Doing so binds the view representing
the access pattern to the given value, expressing that the service is able to provide
only data that complies with this restriction. If we take, for instance, two services
that provide itinerary information (e.g., one service about a city local transport
network and one about a national railway network), we may obtain the following
two access patterns:
ItinSvc1 ≡ Π f rom,to,type, σf rom=$mandatory ∧ Itinerary
itinerary,price to=$mandatory
∧type=$optional
ItinSvc2 ≡ Π f rom,to,type, σf rom=$mandatory ∧to=$mandatory Itinerary
itinerary,price ∧type=“train”
Service ItinSvc1 is the local service, while ItinSvc2 is the national rail-
way service. view explicitly binds the attribute type to the value "train" as
that service is able to provide only data about the train connections, while the
other service may provide data about all among trains, undergrounds, busses
and trams within its geographical area of competence (for simplicity, we do not
represent this limitation here).
Modeling Context-Aware Access to Heterogeneous Resources 7
In this section we present the Context Dimension Model (CDM) [4] and the
automatic rewriting of context-agnostic queries into context-aware queries.
The Context Dimension Model allows one to represent Context Dimension Trees
- CDTs as trees with nodes of three kinds: dimensions, concepts, and parameters.
An example of CDT for the touristic scenario of the running example is shown
in Figure 2. Dimension nodes, depicted in black, represent the different perspec-
tives describing context (e.g., user type and transportation), while concepts,
depicted as white nodes, are the admissible values of each dimension (e.g., the
concepts adult, young adult and family with children are values for the
user type dimension). The root is a special concept node representing the most
general context capturing all the available resources; its children are the main di-
mensions. Every dimension has only concept children, and each concept has only
dimension children; the latter are subdimensions, further specifying the concept
(e.g., r type specializes the restaurant concept). Dimensions and concepts can
be connected to attributes, that are parameters whose values can be dynamically
derived from the environment or provided by the users themselves at execution
time. A dimension can be connected to at most one attribute, used to replace
a huge number of concepts when it is impractical to list them all (e.g., a GPS
location). If this is the case, the dimension does not have any concept child; e.g.,
the current position dimension has as child the attribute curr pos. One or
more attributes can be added to concepts too, and are used to select specific
instances from the set of values represented by a concept node (e.g., the age
of an adult traveller). Attributes are graphically represented in Figure 2(a) by
double circles.
A context instance is a subtree of a CDT where the parameter nodes have
been replaced with concrete values; assuming w.l.o.g. that node labels are unique
in the CDT, a context instance can also be represented as a set of dimension=va-
lue pairs. For each dimension, typically a context instance contains at most
one child value (e.g., the user type dimension can assume at most one value in the
current context instance); when it is reasonable to allow the selection of multiple
values for a dimension, the edges toward its children are connected by an arc (e.g.,
the interest topic can assume multiple values). Figure 2(b) shows an instance:
a family with children, currently located in Viale Romagna in Milan, moves
8 F. Daniel, M. Matera, E. Quintarelli, L. Tanca and V. Zaccaria
user transportation
type
current interest_zone time disability
interest_topic position
young family adult d_type bus car train
cur_pos zone time_val
adult with
children
restaurant show
hotel
r_type s_type
user current
interest_topic transportation
type position
restaurant cur_pos
cinema theater concert Milan bus
pizzeria cafe pub family
with r_type Viale Romagna
(a) children
(b)
pub
Fig. 2. The CDT of our example (a) and a context instance (b)
around by bus and prefers to eat at pubs. This instance can be equivalently repre-
sented as C = {user type = family with children, r type = pub, current
position = Milan Viale Romagna, time = now, transportation = bus}.
Πname,address,phone
o
naddress=to
σP 2
σP 1
restaurant itinerary
Note how the context contributes to contextualizing each part of the agnos-
tic query by adding conditions related to the contextual information (e.g., the
user’s current position or the type of user) to the selection and join operations: in
Table 1, the expression σf rom=“M ilan V iale Romagna”∧to=$V alue Itinerary, asso-
ciated with the context element current position = Milan Viale Romagna,
contains a parameter referring to the destination of the itinerary, that takes now
the value specified by the join condition of the agnostic query Q1 .
In this section we describe the synthesis of a query execution plan from the
context aware query and the consequent selection of the related data and services;
in the last subsection we then give an account of the real execution flow of our
framework, as it has been made concrete in a research prototype [9].
σ σ
∧ itinerary ∧ restaurant
* * * * * * *
(a) (b)
Fig. 4. Itinerary service tile (ItinSvc1) and restaurant service tile (ResSvc).
For example, let us consider query Q2 of Figure 3. To see how this query
can be mapped to an actual query execution plan involving service request, we
consider the services described in Section 3.2. In general, every service will expose
a potential set of filtering predicates to be used when accessing it. To capture this
information, the tile pattern will cover not only the abstract relational algebra
operation associated with the service, but also the syntactic structure of valid
predicates. Here and in the rest of this section we extend with a double-line arrow
the representation of the associated logical predicate. For example, Figure 4(a)
shows the subtree pattern in the original query the ItinSvc1 service can answer
to (section 3.2). The pattern specifies that such a service can be selected when
part of the original query aims to select itineraries where:
Figure 4(b) shows, similarly, the pattern associated with ResSvc. Itin-
Svc2’s pattern is not shown, as it’s restriction "type=train" is not compatible
with the query’s request for a bus ("type=bus").
We now can expand query Q2 by exposing the logical structure of its pred-
icates. We then note that the only registered access patterns that allow valid
matches are ResSvc and ItinSvc1 because ItinSvc2 cannot pattern match.
Figure 5 shows the result of the match operation; since we deal with a logically
correlated sub-query, we mark with a small circle each tile pattern leaf that cor-
responds to an attribute involved in a join condition appearing above it in the
tree.
After having identified the services by pattern matching, we schedule the
service invocation by traversing the tree in post-order and executing joins with
a nested join strategy. In particular, we use the convention that the left relation
is always the outer relation and exploit the commutativity of the join operator
to reorder the nodes in the tree and optimize the query execution. In particular,
we try to order nodes from left to right by ascending number of correlated
attributes. So, in this case, ResSvc is invoked first (by using, as parameters,
the values of the leafs that allowed the match), while ItinSvc1 is invoked for
dimensions using the Context Dimension Model
context (CDM) [4],
dimensions whichrelevant
deemed providesin an
a given application domain and (ii) their
intuitive way to visually represent context
mapping onto an integrated schema of the
information and, more specifically, the available resources. We model context
conceptual relationships that exist among the properties
dimensions using theof Context
context Dimension
in a given Model (CDM) [4], which provides an
scenario. The CDM comes in the form intuitive
of ContextwayDimension
to visuallyTrees (CDTs),
represent i.e., information and, more specifically, the
context
trees with nodes of three kinds: dimensions, concepts,
conceptual and parameters.
relationships that exist among the properties of context in a given
scenario. The CDM comes in the form of Context Dimension Trees (CDTs), i.e.,
Running Example. To illustrate our methodology, we make use of a tourism
trees with nodes of three kinds: dimensions, concepts, and parameters.
scenario where an app that personalizes contents on the basis of his/her con-
texts (e.g., current location and time,Running
possibleExample.
disabilities,
To user’s preferences
illustrate our methodology, we make use of a tourism
about topics and means of transportation) enhances a travelers’ experience.
scenario where an app that personalizes The contents on the basis of his/her con-
app gathers contents about restaurants, hotels
texts andcurrent
Modeling
(e.g., itineraries from di↵erent
Context-Aware
location and time, re-possible
Access to Heterogeneous Resources
disabilities, user’s preferences 11
sources, Web APIs and datasets that about may be public
topics andormeans
made ofavailable by the enhances a travelers’ experience. The
transportation)
service provider who o↵ers the app. We appmake a broad
gathers distinction
contents about between localhotels and itineraries from di↵erent re-
restaurants,
and remote data sources: local, proprietary data are,APIs
for instance, user profiles, ⇧MK2-//`2bb-T?QM2
sources, Web and datasets that may be public or made available by the
buying histories, or similar core assetsservice
of the provider
application to be developed. We
who o↵ers the app. We make a broad distinction between local
assume our app stores data about affiliated hotels and
and remote datadiscounts in a local
sources: local, table o
proprietary ndata
//`2bb4iQ
are, for instance, user profiles,
(Hotel). As for remote sources, we assume the app leverages
buying histories, or similar on core
two external
assets of the application to be developed. We
services for the calculation of itineraries (ItinSvc1
assume our app and ItinSvc2)
stores and on
data about one hotels and discounts in a local table
affiliated
service to search for restaurants (ResSvc). As there may be multiple providers
(Hotel). As for remote sources, we assume the app leverages on two external
o↵ering similar services, a service selection at runtime may be needed – again,
services for the calculation of itineraries (ItinSvc1 and ItinSvc2) and on one
taking into account the user’s context.
service to search for restaurants (ResSvc). As there may be multiple providers
o↵ering similar services, a service selection at runtime may be needed – again,
Structure of paper. We next introduce the concepts and artifacts of the proposed
^ `2bim`Mi
taking into account the user’s context. ^ BiBM2``v
methodology, then we go into the details of the resource schema (Section 3) and
the Context Dimension Trees (Section 4). Next, we show how to interpret and
Structure of paper. We next introduce the concepts and artifacts of the proposed
execute queries (Section 5) and discuss related work before closing the paper.
methodology, then we go into the details of the resource schema (Section 3) and
the Context Dimension Trees (Section 4). Next, we show how to interpret and
+mBbBM2hvT2 ivT2
execute THv;`QmM/
queries (Section 5) and //`2bb ivT2 before closing
discuss related work 7`QKthe paper. iQ
BM/BM Tm# v2b JBHM oBH2 _QK;M #mb JBHM oBH2 _QK;M
Fig. 5. Example context aware query where predicates have been expanded and services
have been verified to match (see annotation).
each tuple returned by ResSvc by using the “Address” attribute value as the
“to” parameter value.
As shown in other similar works on query execution plan generation (such as
[6]), one could extend this methodology to introduce more refined methods to
enlarge the space of solutions considered for tile pattern matching. For example,
we might have multiple valid services that could serve a specific query and then
either choose (i) to invoke them all and then merge their outputs or (ii) to apply
some ranking strategy and then select the best service.
services. This approach is very interesting, as the end users are empowered to
design by themselves how to access different resources. However, it does not
consider any mechanism to filter and/or recommend at runtime services that fit
the current context. MyService [14] instead provides expert designers with the
possibility to select pre-defined context-based rules on top of a service directory.
Based on the chosen rules, proper services are then selected at runtime depend-
ing on the gathered context, and the code of the final app invoking these services
is dynamically generated. This work is in line with our idea to filter services at
runtime on the basis of the identified context. However the adopted notion of
context is limited to the current location, while CDM is generic enough to cover
the specification of the dimensions that, in each given scenario, characterize the
various contexts of use. Moreover, in our approach the designers are not required
to care about which services have to be exploited at runtime. It is the system
that selects the services that best respond to the identified context instance.
Finally, some other works are characterized by the adoption of models to
guide the access to heterogeneous resources. One such work is described in [8].
The authors, using CDM to model the possible contexts, build a platform serving
the execution of a context-aware tourism app. The app flexibly collects non-
structured data from varying heterogeneous sources, and provides contextual
recommendations to the user. This work shows the feasibility of adopting CDM
to drive the context-aware selection of services to be invoked at runtime. With
respect to this work, in our paper we propose a full-fledged design methodology
clarifying how the services can be actually selected in an automatic manner.
In [3], the authors then present a Model-Driven Engineering (MDE) approach
where context meta-models and model-to-code transformations enable building
design frameworks where context models guide the automatic generation of code
for the final context-aware apps. The proposed techniques for model-to-code
transformations are interesting and are also in line with the goal of our research.
However, once meta-models are in place, context modeling for the generation
of a specific app requires the designer to define rules (i.e., OCL expressions)
specifying the context-aware behaviors to be shown at runtime. Our approach,
instead, does not need additional specifications on top of the context model;
strategies for service and content filtering are shaped up at runtime, depending
on the way the captured context guides the rewriting of context-agnostic queries.
The contribution of this paper is the systematic definition of the design method-
ology underlying CAMUS (Context-Aware Mobile mashUpS) [9], a research
project that aims at the conception of high-level abstractions for lightweight
data and service integration in the development of context-aware mobile apps.
The paper specifically focuses on data preparation and retrieval tasks in the de-
velopment life cycle and shows how to enable the automatic rewriting of context-
agnostic queries into context-aware ones by explicitly modeling what is consid-
ered context in a given application scenario. The proposed methodology turns
14 F. Daniel, M. Matera, E. Quintarelli, L. Tanca and V. Zaccaria
context into a first-class design concern and provides the conceptual and techno-
logical foundation for principled context management, assisting the work of the
developer. We did not discuss how data display is managed at runtime, which is
the focus of our current research. In addition, our future work will focus on the
discovery of services from large repositories and on improving the visual design
environments for modeling context and designing resource integration.
References
1. GraphQL. Draft RFC Specification, Facebook, https://facebook.github.io/
graphql, 2015.
2. React Native. React Native official page, Facebook, https://facebook.github.
io/react-native, 2015.
3. A. Achilleos, K. Yang, and N. Georgalas. Context modelling and a context-aware
framework for pervasive service creation: A model-driven approach. Pervasive and
Mobile Computing, 6(2):281–296, 2010.
4. C. Bolchini, E. Quintarelli, and L. Tanca. Carve: Context-aware automatic view
definition over relational databases. Information Systems, 38(1):45–67, 2013.
5. G. A. Bosetti, S. Firmenich, S. E. Gordillo, and G. Rossi. An approach for building
mobile web applications through web augmentation. J. Web Eng., 16(1&2):75–102,
2017.
6. D. Braga, S. Ceri, F. Daniel, and D. Martinenghi. Optimization of multi-domain
queries on the web. PVLDB, 1(1):562–573, 2008.
7. C. Cappiello, M. Matera, and M. Picozzi. A UI-Centric Approach for the End-User
Development of Multi-device Mashups. TWEB, 9(3):11, 2015.
8. M. Casillo, F. Colace, M. D. Santo, S. Lemma, and M. Lombardi. A context-aware
mobile solution for assisting tourists in a smart environment. In HICSS 2017. AIS
Electronic Library (AISeL), 2017.
9. V. Cassani, S. Gianelli, M. Matera, R. Medana, E. Quintarelli, L. Tanca, and
V. Zaccaria. On the role of context in the design of mobile mashups. In RMC
2016, pages 108–128. Springer, 2016.
10. F. Daniel and M. Matera. Mashing up context-aware web applications: A
component-based development approach. In Proc. of Web Information Systems
Engineering - WISE 2008, volume 5175 of LNCS, pages 250–263. Springer, 2008.
11. F. Daniel and M. Matera. Mashups - Concepts, Models and Architectures. Data-
Centric Systems and Applications. Springer, 2014.
12. R. Francese, M. Risi, G. Tortora, and M. Tucci. Visual mobile computing for
mobile end-users. IEEE Trans. Mob. Comput., 15(4):1033–1046, 2016.
13. A. Y. Halevy. Answering queries using views: A survey. VLDB J., 10(4):270–294,
2001.
14. E. Lee and H.-J. Joo. Developing lightweight context-aware service mashup ap-
plications. In Advanced Communication Technology (ICACT), 2013 15th Interna-
tional Conference on, pages 1060–1064, Jan 2013.
15. D. Salber, A. K. Dey, and G. D. Abowd. The context toolkit: Aiding the devel-
opment of context-enabled applications. In Proceeding of the CHI ’99 Conference,
pages 434–441. ACM, 1999.
16. R. Schaller. Mobile tourist guides: Bridging the gap between automation and
users retaining control of their itineraries. In Proceedings of the 5th Information
Interaction in Context Symposium, IIiX ’14, pages 320–323, New York, NY, USA,
2014. ACM.