crowd Technical Report: Visual Queries
Table of Contents
1. SPARQL-DL Engine
The SPARQL-DL query is available under the LGPLv3 License in the following URL https://github.com/protegeproject/SPARQL-DL-api.git, its main page is http://derivo.de/en/resources/SPARQL-DL-api/ and details are uploaded at the W3C Semantic Web page.
1.1. TODO Compiling
1.2. "Where" Query Patterns
A list of supported query patterns is available at the oficial Web page. The SPARQL-DL and the query patterns semantics is explained in SPARQL-DL-SQfOWLDL. Here is a list of queries availables:
- Class(a)
- Property(a)
- Individual(a)
- Type(a, b)
- PropertyValue(a, b, c)
- EquivalentClass(a, b)
- SubClassOf(a, b)
- EquivalentProperty(a, b)
- SubPropertyOf(a, b)
- InverseOf(a, b)
- ObjectProperty(a)
- DataProperty(a)
- Functional(a)
- InverseFunctional(a)
- Transitive(a)
- Symmetric(a)
- Reflexive(a)
- Irreflexive(a)
- SameAs(a, b)
- DisjointWith(a, b)
- DifferentFrom(a, b)
- ComplementOf(a, b)
- Annotation(a, b, c)
- StrictSubClassOf(a, b)
- DirectSubClassOf(a, b)
- DirectType(a, b)
- StrictSubPropertyOf(a, b)
- DirectSubPropertyOf(a, b)
2. A UML-based Language for SPARQL-DL
We can create a UML based visual query language. We consider only the following UML primitives depicted in figure fig:uml-primitives and the SPARQL-DL representation we propose for the WHERE section is on table tab:primitives-sparqldl.
Description | SPARQL-DL |
---|---|
Class Person | SELECT * WHERE Class("Person") |
Class ?x | SELECT * WHERE Class(?x) |
?x is subclass of ?y | SELECT * WHERE DirectSubclassOf(?x, ?y) |
Person is subclass of ?x | SELECT * WHERE DirectSubclassOf("Person", ?y) |
?x is in relation with ?y | SELECT * WHERE Class(?x), Class(?y), |
PropertyValue(?x, aRelation, ?y) |
2.1. TODO N-ary Association
2.2. TODO Association with Multiplicity
3. Client Implementation
The client should support the following features:
- Design the query in a UML class diagram.
- Import the ontology in OWL 2 which the user want to use the query with.
- Show the resulting SPARQL-DL query for the user debugging.
- Or, create the ontology in crowd and use it instead of importing.
The first feature is already implemented in crowd in the current version because it allows the user to design UML class diagrams. However, the second feature requires the creation of a dialog with a text area widget for typing or pasting the OWL 2 text. The third feature requires another dialog for displaying the result to the user making the possibility to use the query or return to the design screen.
The fourth feature requires a more complex modification to the interface. First, we need to implement a button and the code for switch between the query and the ontology diagram. Second, we should translate both diagrams into JSON for storing temporary or for sending to the back-end. The codification into OWL 2 of the ontology model is made by the server, using the explained strategies in the server part of this tecnical report, once it recieves the JSON representing the class diagram.
At the first stage of the development, we focus at the first, second and third features. The fourth feature can be achieved manually by creating a UML model, requesting the OWL 2 translation to the server and copying it into the text area above mentioned once implemented. Altogether, the user should be able to request a query result using an OWL 2 ontology created by another tool.
4. Server Implementation
The server should be able to translate the class diagram into a SPARQL-DL query, executing the reasoner and feed it with the query and the OWL 2 onthology. In this section, we explain the implementation according to these three steps.
4.1. UML Codification Into SPARQL-DL
Following the translation previously proposed, we design the server for processing the JSON representation of the UML diagram into the SPARQL-DL result.
We start to expand the Translation Module explained in the server part of this tech report by creating a new "Concrete Strategy" called SPARQLDLStrategy
. Also, we need new classes for the Builder pattern: SPARQLDLDocument
, SPARQLDLBuilder
. The resulting design is showed in diagram diag:codif-uml.
Figure 1: Translation Strategy for Codifying UML into SPARQL-DL. diag:codif-uml