GeistHaus
log in · sign up

Demigod's Blog

Part of wordpress.com

stories
TinySPARQL GSoC Final Report
GNOME
We have finally reached the final week of GSoC. It has been an amazing journey! Let’s summarize what was done, the current state of the project and what’s next. Introduction This summer, I had the opportunity to work as a student developer under the Google Summer of Code 2024 program with the GNOME Community. I […]
Show full content

We have finally reached the final week of GSoC. It has been an amazing journey! Let’s summarize what was done, the current state of the project and what’s next.

Introduction

This summer, I had the opportunity to work as a student developer under the Google Summer of Code 2024 program with the GNOME Community. I focused on creating a web-based Integrated Development Environment (IDE) specifically designed for writing and executing SPARQL queries within TinySPARQL (formerly Tracker).

This user-friendly interface empowers developers by allowing them to compose and edit multiline SPARQL queries directly in a code editor, eliminating the need for the traditional terminal approach. Once a query is written, it can be easily executed via the HTTP SPARQL endpoint, and the results will be displayed in a visually appealing format, enhancing readability and user experience.

By lowering the barrier to entry for newcomers, boosting developer productivity with visual editing, and fostering collaboration through easier query sharing, this web IDE aims to significantly improve the experience for those using libtracker-sparql to interact with RDF databases.

I would like to express my sincere gratitude to my mentors, Carlos and Sam, for their guidance and support throughout the internship period. Their expertise was invaluable in helping me navigate the project and gain a deeper understanding of the subject matter. I would also like to thank my co-mentee Rachel, for her excellent collaboration and contributions to making this project a reality and fostering a fast-paced development environment.

I’m excited to announce that as the internship concludes, we have a functional web IDE that enables users to run SPARQL queries and view the results directly in their web browser. Here is the working demo of the web IDE that was developed from scratch in this GSoC Project.

Working of TinySPARQL Web IDE
What was done

This project was divided into two primary components: the backend C code, which enabled the web IDE to be served and run from the command line, and the frontend JavaScript code, which enhanced the web IDE’s visual appeal and added all user-facing functionalities. I primarily focused on the backend C side of the project, while Rachel worked on the frontend. Therefore, this blog post will delve into the backend aspects of the project. To learn more about the frontend development, please check out Rachel’s blog.

The work done by me, could be divided into three major phases:

  • Pre-Development Phase
    • During the pre-development phase, I focused on familiarizing myself with the existing codebase and preparing it for easier development. This involved removing support for older versions of libraries, such as Libsoup.
    • TinySPARQL previously supported both Libsoup 2 and Libsoup 3 libraries, but these versions had different function names and macros.
    • This compatibility requirement could significantly impact development time. To streamline the process, we decided to drop support for Libsoup 2.
    • The following merge requests document the work done in this phase:
  • Setting Up the Basic Web IDE
    • In this phase, I extended the HTTP endpoint exposed by the tinysparql endpoint command to also serve the web IDE. The goal was to enable the endpoint to serve HTML, CSS, and JavaScript files, in addition to RDF data. This was a crucial step, as frontend development could only begin once the basic web IDE was ready.
    • During this phase, the HTTP module became more complex. To aid in debugging and diagnosing errors, we added a debugging functionality. By running TRACKER_DEBUG=http, one can now view logs of all GET and POST methods, providing valuable insights into the HTTP module’s behavior.
    • The following merge requests document the work done in this phase:
  • Separating the Web IDE
    • The web IDE added significant size (around 800KB-1MB) to the libtracker-sparql library. Since not all users might need the web IDE functionality, we decided to separate it from libtracker-sparql. This separation improves efficiency for users who won’t be using the web IDE.
    • To achieve this isolation, we implemented a dedicated subcommand tinysparql webide for the web IDE, allowing it to run independently from the SPARQL endpoint.
    • Here’s a breakdown of the process:
      1. Isolating HTTP Code: I started by extracting the HTTP code from libtracker-sparql into a new static library named libtracker-http. This library contains the abstraction TrackerHttpServer over the Libsoup server, which can be reused in the tinysparql webide subcommand.
      2. Creating a Subcommand: Following the isolation of the web IDE into its own library and the removal of relevant gresources from libtracker-sparql, we were finally able to create a dedicated subcommand for the web IDE. As a result, the size of libtinysparql.so.0.800.0 has been reduced by approximately 700KB.”
    • The following merge requests document the work done in this phase:
Final Result

This is the web IDE we developed during the internship. Check out this demo video to see some of the latest changes in action.

TinySPARQL Web IDE
SPARQL Query successfully executed
Error handling
Future Work

Despite having a functional web IDE and completing many of the tasks outlined in the proposal (even exceeding the original scope due to the collaborative efforts of two developers), there are still areas for improvement.

I plan to continue working on the web IDE in the future, focusing on the following enhancements:

  • Multi-Endpoint Support: Implement a mechanism for querying different SPARQL endpoints. This could involve adding a text box input to the frontend for dynamically entering endpoint URLs or providing a connection string option when creating the web IDE instance from the command line.
  • Unified HTTP Handling: Implement a consistent HTTP handler for all cases, allowing TrackerEndpointHttp to handle requests both inside and outside the /sparql path.
  • SPARQL Extraction: Extract the SPARQL query from POST requests in TrackerEndpointHttp or pass the raw POST data in the ::request signal, enabling TrackerEndpointHttp to determine if it contains a SPARQL query.
  • Avahi Configuration: Move the Avahi code for announcing server availability or assign TrackerEndpointHttp responsibility for managing the content and type of broadcasted data.
  • CORS Configuration: Make CORS settings configurable at the API level, allowing for more granular control and avoiding the default enforcement of the * wildcard.
GUADEC Experience

One of the highlights of my GSoC journey was the opportunity to present my project at GUADEC, the annual GNOME conference. It was an incredible experience to share my work with a diverse audience of developers and enthusiasts. Be sure to check out our presentation on the TinySPARQL Web IDE, delivered by Rachel and me at GUADEC.

Final Remarks

Thank you for taking the time to read this. Your support means a great deal to me. This internship was a valuable learning experience, as it was my first exposure to professional-level C code and working with numerous libraries solely based on official documentation. I am now more confident in my skills than ever. I gained a deeper understanding of the benefits of collaboration and how it can significantly accelerate development while maintaining high code quality.

Screenshot from 2024-08-26 03-32-22
divyanshjain2206
http://demiigood.wordpress.com/?p=53
Extensions
GSoC’24 Introductory Blog
GNOME
Hello GNOME Community! I am Divyansh Jain, a computer science student at IIT Roorkee, India. I also go by my hacker alias, Demigod, whenever I am programming. I really love tech, and any new advancements in technology excite me. When I’m not programming, I love to cook, sleep, and read about politics. I’m honored to […]
Show full content

Hello GNOME Community!

I am Divyansh Jain, a computer science student at IIT Roorkee, India. I also go by my hacker alias, Demigod, whenever I am programming. I really love tech, and any new advancements in technology excite me.

When I’m not programming, I love to cook, sleep, and read about politics.

I’m honored to join the GNOME community as a Google Summer of Code (GSoC) contributor this year. I’ll be developing a web-based tool for writing and running SPARQL queries within Tracker (now TinySPARQL). I will be mentored by Carlos Garnacho and Sam Thursfield.

Introducing the Tool

SPARQL is a query language used to retrieve data from databases that store information in a specific format (RDF). This tool aims to simplify writing and running these queries directly in a web browser, eliminating the need for the command line. Additionally, it will present the results in a visually appealing format, enhancing readability and user experience.

Benefits for Everyone

This project will significantly improve the experience for those using libtracker-sparql to interact with RDF databases. By lowering the barrier to entry for newcomers, boosting developer productivity with visual editing, and fostering collaboration through easier query sharing, this web IDE promises a more streamlined workflow.

Looking Forward!

I’m excited for a summer full of learning and collaborating with the GNOME community. Updates on the project’s progress will be shared soon!

gsoc_gnome
divyanshjain2206
http://demiigood.wordpress.com/?p=11
Extensions