Abstract
Web APIs are a prominent source of machine-readable information that remains insufficiently connected to the Web of Data. To enable automatic combination of Linked Data (LD) interfaces and Web APIs, we present the SPARQL Micro-Service architecture. A SPARQL micro-service is a lightweight SPARQL endpoint that provides access to a small, resource-centric, virtual graph, while dynamically assigning stable, dereferenceable URIs to Web API resources that do not have URIs in the first place. We believe that the emergence of an ecosystem of SPARQL micro-services could enable LD-based applications to glean pieces of data from a wealth of distributed, scalable and reliable services from independent providers. We describe an experimentation where we dynamically augment biodiversity-related LD resources with data from Flickr, MusicBrainz and the Macauley scientific media library.
You have full access to this open access chapter, Download conference paper PDF
Similar content being viewed by others
Keywords
1 Introduction
Web APIs are commonly used to enable HTTP-based, machine-processable access to all sorts of data. Similarly, Linked Data (LD) seek the publication of machine-readable data on the Web while connecting related resources across datasets. Several approaches have been proposed to bridge these two worlds, based on bespoke wrappers, SPARQL extensions or RESTful APIs. Until now however, several challenges hinder the definition of standard approaches to enable automatic reconciliation of LD and Web APIs. Firstly, Web APIs usually rely on proprietary vocabularies documented in Web pages meant for developers but hardly machine-readable. Secondly, on-the-fly SPARQL querying of non-RDF data sources proves to be difficult, as attested by the many works on SPARQL-based access to legacy databases.
The SPARQL Micro-Service architecture aims to address this issue. The term micro-service refers to an increasingly popular architectural style where an application consists of a collection of lightweight, loosely-coupled, fine-grained services that are deployed independently [2]. They improve applications modularity thereby speeding up the development, testing and deployment process. Leveraging these principles may help in the design of modular LD-based applications structured as a collection of services such as RDF stores, SPARQL endpoints, SPARQL micro-services or other services based on LD REST APIs for instance. A SPARQL micro-service is a lightweight method to query a Web API using SPARQL. It provides access to a small RDF graph describing the targeted resources from the data available at the API, while dynamically assigning dereferenceable URIs to Web API resources that do not have URIs beforehand.
2 SPARQL Micro-services Principles
A SPARQL micro-service \(S_{\mu }\) is a wrapper of a Web API service \(S_w\). It complies with the SPARQL Query Language and protocol, and accepts a set \(Arg_w\) of arguments that are specific to \(S_w\). These arguments are passed to \(S_{\mu }\) as parameters on the HTTP query string, e.g. “http://hostname/sparql?param=value”. \(S_{\mu }\) evaluates a SPARQL query Q against an RDF graph that it builds at run-time as follows: it invokes the Web API service \(S_w\) with the arguments in \(Arg_w\), translates the response into RDF triples (in an implementation-dependent manner), evaluates Q against these triples and returns the result to the client.
The semantics of a SPARQL micro-service differs from that of a standard SPARQL endpoint insofar as the SPARQL protocol treats a service URL as a black box, i.e. it does not interpret URL parameters. By contrast, a SPARQL micro-service is a configurable SPARQL endpoint whose arguments delineate the virtual graph being queried. Thence, each pair (\(S_{\mu }\), \(Arg_w\)) is a standard SPARQL endpoint. Arguably, other options may be adopted to pass the arguments to \(S_{\mu }\), that we discuss in details in [1].
Furthermore, bridging Web APIs and LD requires to create stable, dereferenceable URIs for Web API resources that are generally identified by mere proprietary identifiers. This is implemented quite easily with SPARQL micro-services: once a stable URI scheme is decided, a Web server is set up to handle look-ups for URIs matching that scheme: for each look-up, it invokes a suitable SPARQL micro-service along with an appropriate CONSTRUCT or DESCRIBE query form. Hence, by smartly designing services, we can come up with a consistent ecosystem where some micro-services respond to SPARQL queries while translating Web API identifiers into URIs that, in turn, are made dereferenceable by other micro-services.
3 Implementation and Experimentation
To evaluate this architecture, we have developed a prototype implementationFootnote 1 depicted in Fig. 1, that handles JSON-based Web APIs. It maps a Web API response to RDF triples in two steps. First, the response is translated to JSON-LD by applying a JSON-LD profile. The resulting graph G is stored in an in-memory triple store. Then, for mapping cases that JSON-LD cannot describe (involving e.g. string manipulations), a SPARQL INSERT query augments G with triples based on well-adopted or domain vocabularies. Lastly, \(S_{\mu }\) evaluates the client’s SPARQL query against G and returns the response following a regular content negotiation.
Listing 1.1 exemplifies the use of SPARQL micro-services in a biodiversity-related use case. The query retrieves the URI of a resource representing the common dolphin (species Delphinus delphis) from a taxonomic register. Then, it invokes SPARQL micro-services to retrieve additional data from three Web APIs: photos from the Flickr photography social networkFootnote 2, audio recordings from the Macaulay LibraryFootnote 3 and music tunes from MusicBrainzFootnote 4. Figure 2 portrays a snippet of the response to this query in the Turtle syntax, along with photos, audio recordings pictures and a MusicBrainz Web page.
4 Future Works
For an ecosystem of SPARQL micro-services to emerge from independent service providers, two crucial issues shall be tackled. Firstly, to enable services discovery, SPARQL micro-services should provide self-describing metadata such as the query string parameters or the types of triples generated. In this respect, the smartAPI metadata specification may be leveraged [4]. Secondly, it should be possible to retrieve fragments by smaller pieces using a paging mechanism. To tackle those issues, Triple Patterns Fragments (TPF) expose a self-describing, uniform interface consisting of metadata and hypermedia controls [3]. A perspective would be to extend this approach to the case of SPARQL micro-services, stemming some sort of Graph Pattern Fragment interface, i.e. a generalized TPF interface able to process regular graph patterns instead of only triple patterns, but still complying with the TPF metadata and hypermedia controls specification. Let us finally mention that we have focused specifically on consuming Web APIs data with SPARQL, although the principles presented in this work could apply to other types of APIs. Furthermore, many APIs empower users not only to read but more importantly to interact with data. Hence, an interesting perspective would be to think of SPARQL micro-services as a way to support distributed SPARQL Update over Web APIs, thus eventually contributing to build an actual read-write Web of Data.
References
Michel, F., Faron-Zucker, C., Gandon, F.: SPARQL micro-services: lightweight integration of web APIs and linked data. In: Proceedings of LDOW 2018 (2018)
Newman, S.: Building Microservices. O’Reilly Media, Sebastopol (2015)
Verborgh, R., et al.: Triple pattern fragments: a low-cost knowledge graph interface for the web. J. Web Semant. 37–38, 184–206 (2016)
Zaveri, A., et al.: smartAPI: towards a more intelligent network of web APIs. In: Blomqvist, E., Maynard, D., Gangemi, A., Hoekstra, R., Hitzler, P., Hartig, O. (eds.) ESWC 2017. LNCS, vol. 10250, pp. 154–169. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-58451-5_11
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2018 Springer Nature Switzerland AG
About this paper
Cite this paper
Michel, F., Faron-Zucker, C., Gandon, F. (2018). Bridging Web APIs and Linked Data with SPARQL Micro-Services. In: Gangemi, A., et al. The Semantic Web: ESWC 2018 Satellite Events. ESWC 2018. Lecture Notes in Computer Science(), vol 11155. Springer, Cham. https://doi.org/10.1007/978-3-319-98192-5_35
Download citation
DOI: https://doi.org/10.1007/978-3-319-98192-5_35
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-98191-8
Online ISBN: 978-3-319-98192-5
eBook Packages: Computer ScienceComputer Science (R0)