---
# System prepended metadata

title: 'This page is created for help and Advice for #1212 issue(Create project from SPARQL query)'

---

# This page is created for help and Advice for #1212 issue(Create project from SPARQL query)

## Prior conversations
[Previous chat with Thad](https://hackmd.io/@m6qGJBBoSEaOdoYVIJ4Lqg/conversation)

[Issue #1212 on GitHub](https://github.com/OpenRefine/OpenRefine/issues/1212)

## Design Summary
The focus of this document is to discuss a solution for querying a SPARQL endpoint from OpenRefine to create a project.  The basic requirements are to have a custom importer for querying a SPARQL endpoint from OpenRefine.  It is possible that some existing code could be borrowed for example from the existing Database importer.  Where and how much can be borrowed needs further discussion and research.

## User Requirements
1. As a user, I want to query my institutions private authenticated SPARQL endpoint as well as public SPARQL endpoints like Wikidata.
2. As a user, I want to input a SPARQL query statement and get rows to import
3. As a user, I want to scroll and browse a timestamped local history of my executed SPARQL queries.
    * this might feel and work like other SQL editors like Postgres pgAdmin Query History https://www.pgadmin.org/docs/pgadmin4/latest/query_tool.html#query-history-panel
4. As a user, I want to star or favorite a query.
4. As a user, I want to filter my query history by Star, entering search keywords (SPARQL can have comments) and select them from my query history to load into the editor.
   * what does this look like, a 2 or 3 column table?
   * with a column for Star, Tag, to categorize queries similar to our existing tag mechanism of OpenRefine Projects?
5. (OPTIONAL?) As a user, I want to have a scratch pad panel of text snippets I save to paste later into queries.
    * Example: https://stackoverflow.com/questions/51173329/pgadmin-4-3-1-retiling-data-output-panel
7. As a user, I want to save and manage my SPARQL endpoint connections in a panel.  I can reuse them against any of my saved queries.  For example, I should be able to click and open a query from my history, and then see the last connection used (perhaps along top) and click it to open the connection panel and choose a different connection to run the query against.  Similar to how other SQL query tools work.
8. What else?  how does a user want query errors reported?  Text dialogs that can be copy/pasted easily for troubleshooting with others? Logs? Separate Logs?  Option for query request logging to a file like other SQL tools do?

## Backend

### Requirements



| Criteria    | Authentication[1,2,7] |History[3,4,5] | [6] |  Error handling[8]   |     
| ----------- | ------- | ------- | --- | --- | --- |
| RDF4J       | 3     | 2     | 1-3 |   1-3  | 1-3 |
| Apache jena | 1     | 2     | 1-3 |   1-3  | 1-3 |
| Snap-SPARQL | 1-3     | 1-3     | 1-3 |   1-3  | 1-3 |


(1-3 ranking depends who will be chosen and
Please comment if you want to add or subtract something from the table.)
please visit [Comparision between Apache Jena-TDB vs RDF4J](https://db-engines.com/en/system/Apache+Jena+-+TDB%3BRDF4J)

* support Java8+ 
*
*

### Possible Frameworks

1. Apache jena,Apache Jena Fuseki([Link](https://jena.apache.org/index.html))
2. RDF4J[(Link)](https://rdf4j.org/)
3. Snap-SPARQL
4. May be others..


## Frontend
### Requirements
Need to breakdown the UI elements needed, for example, are line numbers needed?  syntax highlighting, etc.?  List the requirements for frontend design.  Ideally written as User requirements

### UI Examples

#### What SPARQL query editor is this from? Change this header to explain what interface/tool this pic is from
![](https://i.imgur.com/toOKaZn.png)

Give other UI examples.
You might also need to create an evaluation/decision matrix to evaluate frontend libraries and discuss pros/cons?

## Some Wikidata Notes
The user doc for the SPARQL Editor for Wikidata is here:  https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/Wikidata_Query_Help/SPARQL_Editor
The editor utilizes Codemirror.js and code completion is a feature of it:  https://codemirror.net/mode/sparql/index.html