EEA Sparql has a wide array of APIs that let you extend it’s functionality.
This tutorial assumes that the EEA Sparql product has already been installed. For information about this topic, please check README.rst. The tutorial will, however, provide information about how to create and edit a Sparql with no, one or multiple arguments.
Within your working Folder add a new Sparql (Add new -> Sparql)
The main fields to edit in the Default tab are:
To create a simple SPARQL with no arguments, simply fill in the required fields:
Arguments are added to the Sparql from the “add new argument” button.
This will add a new input: the argument. The argument has two fields:
The first field of the argument requires a name and a type for it. Without this field, an argument is invalid and it will not be considered further on. The name is something that the user choses and it can be anything. However, the type of the argument may have one of the following values:
Therefore, if the user wants the argument to be a string named “text” he will fill in with the value: text:string and if he needs a URI named “myURI” he will fill in with myURI:iri.
The original query should be changed when arguments are added. Arguments are identified in the query by the prefix “$” so the argument defined like myURI:iri will be $myURI in the query. $argumentName will be replaced with real values only when the user choses a value for it and the “Execute” button is pushed.
This field is optional. If the user does not provide a query for an argument, the argument can take any value from an input field.
When needed, this field should be filled with a query whose results should be values for the argument defined. The query may return one or two columns. When it returns only one, the results of the argument query become values in a dropdown list from which values are chosen for the argument. When two columns are returned in the argument query, the first one will be the real value, while the second one will be the displayed value. This option is useful in the case of URIs, to have the second column as the labels of the first column’s URIs.
Queries and arguments can be tested in the “Test and preview the query” form. In case the query has no arguments, nothing is to be filled. When the query has arguments, they sould be given values in the following form:
- one argument: arg=value
- more arguments: arg1=value1&arg2=value2&...
Therefore, if the user defines two arguments, name:text and uri:iri, he will have to fill in with values like:
name=Iulia&uri=http://iulia.com
By pushing the “Test and preview query” button he will be able to see the query’s output with the defined argument values.