SparqlQueryWindow

The SPARQL query window class which provides the user interface for querying a SPARQL endpoint and displaying the endpoint response.

Constructor

new SparqlQueryWindow(sparqlProvider, configSparqlWidget, handleZoom)

Creates a SPARQL query window.

Parameters:
NameTypeDescription
sparqlProviderSparqlEndpointResponseProvider

The SPARQL Endpoint Response Provider

configSparqlWidgetobject

The sparqlModule view configuration.

Properties
NameTypeDescription
queriesobject

Query configurations

Properties
NameTypeDescription
titleobject

The query title

filepathobject

The path to the file which contains the query text

formatsobject

Configuration for which visualizations are allowed with this query. Should be an object of key, value pairs. The keys of these pairs should correspond with the cases in the updateDataView() function.

handleZoomfunction

Function to handle the zoom.

Classes

SparqlQueryWindow

Members

configSparqlWidget :object

The sparqlModule view configuration.

Type:
  • object

d3Graph :D3GraphCanvas

Contains the D3 graph view to display RDF data.

dataView :HTMLElement

Type:
  • HTMLElement

domElement :HTMLElement

Type:
  • HTMLElement

eventListeners :object

The event listeners for the graphs.

Type:
  • object

explorationQuery :string

The Sparql exploration query

Type:
  • string

form :HTMLElement

Type:
  • HTMLElement
Type:
  • HTMLElement
Type:
  • HTMLElement

queries :object

Store the queries of the SparqlQueryWindow from the config.

Type:
  • object

querySelect :HTMLElement

Type:
  • HTMLElement

queryTextArea :HTMLElement

Type:
  • HTMLElement

resetButton :HTMLElement

Type:
  • HTMLElement

resultSelect :HTMLElement

Type:
  • HTMLElement

sparqlProvider :SparqlEndpointResponseProvider

The SPARQL Endpoint Response Provider

table :Table

Contains the D3 table to display RDF data.

Type:

toggleQueryTextAreaButton :HTMLElement

Type:
  • HTMLElement

Methods

addEventListeners(eventListeners)

Add event listeners to the graphs

Parameters:
NameTypeDescription
eventListenersobject

An object containing event listeners to be added to the graph

clearDataView()

Clear the DataView of content

initHtml()

Initialize the html of the view

initQueryTextAreaForm()

Initialize the query text area of the view

initResultDisplay()

Initialize the displaying of the result

updateDataView(response, view_type)

Update the DataView

Parameters:
NameTypeDescription
responseobject

a JSON object returned by a SparqlEndpointResponseProvider.EVENT_ENDPOINT_RESPONSE_UPDATED event

view_typestring

the selected semantic data view type

updateExplorationQuery(node_id)

Update query to add node's children

Parameters:
NameTypeDescription
node_idstring

a node ID

updateQueryDropdown(queries)

Update this.querySelect options using an array of queries. For each element in the array, create an option element, set the innerText of the option to the query's title, set the value of the option to the index of the query in the array, then append the option to this.querySelect

Parameters:
NameTypeDescription
queriesArray.<object>

An array of objects that contain a query title and the query text itself

updateQueryTextArea(index)

Update the this.queryTextArea with the text of the query that was selected in the dropdown, or the exploration query

Parameters:
NameTypeDescription
indexnumber

the index of the query in the this.queries array

updateResultDropdown(index)

Remove all the children of this.resultSelect, then adds new children options based on the formats declared in each query configuration from from this.queries

Parameters:
NameTypeDescription
indexnumber

the index of the query in the queries array