Bug 184183 - Simple SPARQL Query Builder
Summary: Simple SPARQL Query Builder
Alias: None
Product: nepomuk
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Packages Linux
: NOR wishlist (vote)
Target Milestone: ---
Assignee: Sebastian Trueg
Depends on:
Reported: 2009-02-12 23:45 UTC by Kjetil Kjernsmo
Modified: 2013-05-28 15:56 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Kjetil Kjernsmo 2009-02-12 23:45:53 UTC
Version:            (using KDE 4.2.0)
OS:                Linux
Installed from:    Ubuntu Packages

It would be very nice to have a simple query builder on the top of NEPOMUK. 

What I have in mind is a query builder that can build simple graphs and therefore queries, based on the actual data on an endpoint. 

There are a few applications that can serve as sources of inspiration: First one is Protege, where you have a "query tab" plugin, that can help you query data on the local graph. 

Then, there is Amarok, where the Smart Playlist generator is very interesting. Amarok has no clear concept of class and property. For example, in RDF you would typically have a class Artist with a property name. In Amarok, Artist is simply a name. This needs to be extended to the RDF model.

There are many complex issues, but let us focus on the most ideal case for a first version, as I suspect that will allready be very useful.

First, the user enters the URL of a SPARQL Endpoint, or uses the default local graph, then hits a "connect" button. When the user does that, the following query is launched:

  ?resource a ?class .
  ?class <http://www.w3.org/2000/01/rdf-schema#label> ?label

This will select all the classes that has a label.

Thus, the leftmost column will then have a list of classes, where the labels of each class is in a dropdown. 

When the user selects a class, the following query is launched:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT ?property ?label ?range WHERE 
  ?property rdfs:domain <http://dbpedia.org/ontology/Artist> ;
            rdfs:label ?label .
  OPTIONAL { ?property rdfs:range ?range . } 

In this example, I've used <http://dbpedia.org/ontology/Artist> as an example of a class the user may have selected. (Try this query at http://dbpedia.org/sparql ! :-) ). 

This will select the labels of all properties that have this class in their domain, which means that this is the property that can be used for the selected class. The user may then select a property from the dropdown. If, then, the range was given, the object dropdown is a list of the possible classes, which can be used to connect this triple to the subject of the next, should the user choose to add another triple.

If no range is returned (or if the range is a datatype), then it is  assumed that we should match on a literal here. Thus a box with stuff like "contains", "exact match", etc should be given with an open textbox, much like what Amarok does. The user may also select a "variable" here, in which case a variable is inserted.

This way, the triples can be added, each with an appropriate class. The query is also data-driven and it explores the actual data is it builds, so finding out what the endpoint has to offer is much easier with this approach.

I hope the idea was reasonably well explained :-)
Comment 1 Vishesh Handa 2013-05-28 15:17:57 UTC
I'm sorry but I'm going to close this as a WONTFIX.

This is something that might be useful for developers, but not for end users. We currently need to focus on end users, who do not care about SPARQL or know about end points.

Also, it has been 4 years and nobody seems to have stepped up to implement this, so I doubt anyone will now.
Comment 2 Kjetil Kjernsmo 2013-05-28 15:56:58 UTC
Actually, it has been done: http://code.google.com/p/vqb/ but I can see the point, somebody has to make it smooth enough too.