Volume 13 Supplement 1
SPARQL Assist language-neutral query composer
© McCarthy et al. 2012
Published: 25 January 2012
SPARQL query composition is difficult for the lay-person, and even the experienced bioinformatician in cases where the data model is unfamiliar. Moreover, established best-practices and internationalization concerns dictate that the identifiers for ontological terms should be opaque rather than human-readable, which further complicates the task of synthesizing queries manually.
We present SPARQL Assist: a Web application that addresses these issues by providing context-sensitive type-ahead completion during SPARQL query construction. Ontological terms are suggested using their multi-lingual labels and descriptions, leveraging existing support for internationalization and language-neutrality. Moreover, the system utilizes the semantics embedded in ontologies, and within the query itself, to help prioritize the most likely suggestions.
To ensure success, the Semantic Web must be easily available to all users, regardless of locale, training, or preferred language. By enhancing support for internationalization, and moreover by simplifying the manual construction of SPARQL queries through the use of controlled-natural-language interfaces, we believe we have made some early steps towards simplifying access to Semantic Web resources.
The health care and life science sectors have been some of the most enthusiastic adopters of Semantic Web technologies. The benefits of the RDF/OWL data model are well-understood by bioinformaticians who have too long had to deal with the problem of integrating data from multiple sources with wildly different underlying schema. These benefits are less obvious, however, to clinicians and researchers who merely see one mysterious query language (SQL) exchanged for another (SPARQL). Even a Semantic Web-savvy informatician can be daunted when faced with the challenge of querying an unfamiliar data source whose particular RDF vocabulary is initially unknown.
The issue is compounded by the growing use of opaque, semantic-free URIs for ontological classes and properties (OBO , SIO , CWA ). While the meaning of rdf:type or dc:title is relatively clear to the human reader, the meaning of, for example, sio:SIO_010302 is considerably harder to glean without looking up its ontological definition. This becomes particularly acute in the context of SPARQL queries. While often the subject and object portions of a SPARQL WHERE clause contain variables, and therefore are inherently human-readable, the predicates are usually explicitly specified in the query. Thus while:
?gene SIO:is_homologous_to ?gene
is quite clear to both the query composer and the human reader, the opaque equivalent
?gene SIO:010302 ?gene
is effectively meaningless to the reader, and absurdly difficult for the query composer to remember. Nevertheless, there are many valid reasons for designing ontologies using opaque identifiers, not the least of which is language neutrality.
RDF/XML provides built-in language neutrality by way of the xml:lang attribute; an ontology can therefore easily be internationalized by providing multiple rdfs:label or rdfs:comment properties with appropriate xml:lang attributes. However, even those projects who have, in principle, adopted language neutrality for their classes (e.g. OBO), most have not done so for their properties (OBO Relationship Ontology ). This is no-doubt due, at least in part, to the already discussed difficulty of composing SPARQL queries in which predicates have opaque identifiers. Nevertheless, it is crucial that we do not allow convenience to direct the development of a core global resource (the Semantic Web) and thus the problem should be solved at the level of the tools provided, rather than the resources themselves.
SPARQL Assist is a web application that facilitates the construction of SPARQL queries by providing context-sensitive type-ahead completion. In addition to assistance with basic syntax, ontological terms are indexed by their labels, using the xml:lang attribute to record the language of each label for each term. Ontological terms and their labels, are read on-the-fly from any ontology specified in a SPARQL FROM clause, but SPARQL Assist can also be configured to pre-load terms from particular ontologies or SPARQL endpoints, reducing the burden on the user to know the existence and location of all relevant vocabularies.
The entire query, as it is being constructed, is used to provide context for the type-ahead suggestions. Previously declared variables or known individuals (i.e. values) are suggested during type-ahead for the subject or object position of the WHERE clause. In the predicate position, indexed ontological predicates are suggested, with preference given to properties that an individual is known to have if this information is available from ontological indexing and/or other query clauses. Similarly, if a clause contains a variable that can ultimately be connected to a known individual in another part of the query, that connection is used to find the most likely properties in the current clause.
Together, these functionalities should simplify the manual construction of SPARQL queries by (a) making the query more similar to natural language, and (b) supporting any language in which the required terms have been labeled. Moreover, in so doing, SPARQL Assist also provides ontology designers more freedom to follow best-practices in ontology design and internationalization by reducing the barrier to query construction using opaque terms. SPARQL Assist thus represents one alternative, alongside visual query builders and faceted browsers, for helping unfamiliar users explore semantic data.
Our initial implementation of SPARQL Assist was undertaken in the context of creating queries that will be resolved by the Semantic Health and Research Environment (SHARE ), and we present here both the core SPARQL Assist software, as well as the extension specific to SHARE. SHARE is an advanced SPARQL query client built on top of the SADI Framework  for Semantic Web Services. SADI services attach properties to input OWL instances and these services are indexed in a central registry based on the properties they attach. SHARE maps the triple patterns presented in the WHERE clauses of a SPARQL query onto these indexed properties, in order to discover SADI Web Services capable of generating the required triples. The RDF data required to answer a given query is thus dynamically generated through the invocation of SADI services in response to the query being posed.
In the context of SPARQL Assist, the fact that properties do not exist at query composition time might be considered a barrier, since there is no pre-existing RDF Store to inspect for candidate properties and individuals. To compensate for this, the SADI extension to SPARQL Assist uses the SADI registry, in addition to any loaded ontologies, to suggest properties to be used in a query. As in the generic case, if a clause contains a named individual or a variable previously connected to an individual, this information is used to further refine the suggestions; in this case by filtering out properties generated by services that cannot accept a particular individual as input and highlighting properties generated by services that can. Thus, not only is the lack of a static triple store not a barrier to query composition, but the ability to construct a likely-successful query is, in fact, enhanced by utilization of the underlying SADI infrastructure.
The results of this software engineering project are best described by a demonstrative walk-through using our public SPARQL Assist interface available at . In this demonstration we will be answering the question:
select the genes that participate in the human caffeine metabolism pathway and the proteins that they encode.
Three additional features of the SPARQL Assist software, and its SADI extension -- internationalization, dynamic ontology indexing, and dynamic predicate-validation -- will be demonstrated by a second walk-through. In this example, we attempt to resolve the same query as above, but will construct the query clauses slightly differently to allow these additional features to be revealed (in SPARQL, equivalent queries can be constructed in a wide variety of ways, particularly when the desired predicates have an owl:inverse predicate).
The two walk-through scenarios above reveal the behaviours of the SPARQL Assist software and demonstrate what we believe is an environment that assists query construction not only by "naïve" end-users, but also by experienced informaticians already comfortable with the SPARQL language. While these behaviours (e.g. type-ahead) are not themselves novel, the utility comes in the way they have been applied, particularly with respect to dynamic indexing of ontological terms, predicates, and individuals, and explicit support for internationalization.
We are aware that it may seem unsustainable and/or excessive to index individuals, such that "real things" (molecules, structures, genes, etc) can be referred-to during construction of the query and resolved by SPARQL Assist to their native identifiers, but we don't think this is necessarily the case. First, we believe it is crucial to do so since (as with browser bookmarks for URLs) we cannot and should not expect users to know or remember the URI of their data-of-interest. Second, the amount of storage required to achieve this (a URI and it's various labels) is minimal and lookups over this data can be quite rapid. Third, we anticipate that SPARQL Assist will be deployed by specific communities or on specific portals, where the individuals of greatest interest to that community can be anticipated and selectively indexed to minimize lookup time and index size.
SPARQL Assist does not aim to be a query interface that understands natural language. It relies on ontology authors creating "obvious" labels for their predicates and, even in that case, a user will often need to try several "words" before discovering the phrase that the ontology author used. However, we believe that this is nevertheless better than the status quo and, moreover, makes it easier for ontology authors to justify following best-practices of ontology design and internationalization by reducing the resulting burden of complexity placed on their end-users.
SPARQL Assist provides prototype solutions for two important problems. First, to hasten the uptake of Semantic Web technologies, it is important to improve access to, and usability of, Semantic Web resources for the lay-end-user while still maintaining best-practices in the way these resources are modeled. Opaque identifiers for both classes and properties are important, as they allow us to avoid "churn" as an ontology evolves over time. We must therefore support the end-user in constructing queries over resources formatted in this way. Second, the Semantic Web is intended to be a global resource, of use to all. As such, a respect for internationalization is also critical, even at these early stages in Semantic Web evolution. We believe that SPARQL Assist provides motivation to more widely adopt what are clearly best-practices in Semantic Web data provision.
Availability and requirements
Project name: SPARQL Assist
Project home page: http://code.google.com/p/sadi/
Operating system(s): Platform independent
Programming language: Java
License: New BSD
List of abbreviations
Concept Web Alliance
Kyoto Encyclopaedia of Genes and Genomes
Open Biomedical Ontologies
Web Ontology Language
Resource Description Framework
Semantic Automated Discovery and Integration
Semantic Health And Research Environment
Semantic Science Integrated Ontology
SPARQL Protocol and RDF Query Language
Structured Query Language
Uniform Resource Identifier
Uniform Resource Locator
Extensible Markup Language.
This work has been supported by the Heart + Stroke Foundation of BC and Yukon, Microsoft Research, The Canadian Institutes for Health Research, The Natural Sciences and Engineering Research Council of Canada, and CANARIE. Thank you to Anna-Lena Lamprecht for assisting us with the German translations of the SIO and KEGG terms.
This article has been published as part of BMC Bioinformatics Volume 13 Supplement 1, 2012: Semantic Web Applications and Tools for Life Sciences (SWAT4LS) 2010. The full contents of the supplement are available online at http://www.biomedcentral.com/bmcbioinformatics/supplements/13/S1.
- Smith B, Ashburner M, Rosse C, Bard J, Bug W, Ceusters W, Goldberg LJ, Eilbeck K, Ireland A, Mungall CJ, The OBI Consortium, Leontis N, Rocca-Serra P, Ruttenberg A, Sansone S-A, Scheuermann RH, Shah N, Whetze PL, Lewis S: The OBO Foundry: coordinated evolution of ontologies to support biomedical data integration. Nature Biotechnology 2007, 25: 1251–1255. 10.1038/nbt1346PubMed CentralView ArticlePubMedGoogle Scholar
- Semantic Science - Scientific Knowledge Discovery[http://semanticscience.org/]
- NBIC Declaration Concept Web Alliance[http://www.nbic.nl/about-nbic/affiliated-organisations/cwa/declaration/]
- OBO Relationship Ontology[http://www.berkeleybop.org/ontologies/obo-all/relationship/relationship.owl]
- Vandervalk BP, McCarthy EL, Wilkinson MD: SHARE: A Semantic Web Query Engine for Bioinformatics. In Fourth Asian Conference, ASWC 6–9 December 2009; Singapore. Volume LNCS 5926. Edited by: Asunción Gómez-Pérez, Yong Yu, Ying Ding. Heidelberg: Springer; 2009:367–369.Google Scholar
- Wilkinson MD, Vandervalk BP, McCarthy L: SADI Semantic Web Services - 'cause you can't always GET what you want! Proceedings of the 2009 IEEE Asia-Pacific Services Computing Conference 2010, 13–18.Google Scholar
- SPARQL Assist language-neutral query composer[http://sadiframework.org/sparql-assist]
This article is published under license to BioMed Central Ltd. This is an open access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.