Search for URIs in Your Thesaurus Using Autocomplete

This section contains a short guide on how to adjust the default autocomplete query in PoolParty to enable a URI search.

Note

Your user needs to have the PoolPartySuperAdmin role assigned in order for you to be able to edit this query.

The previous section explains how to edit the autocomplete query in PoolParty.

You can edit that query as follows. The autocomplete function provided in the search bar at the top will then enable the search for URIs throughout the current thesaurus via autocomplete.

Use the following SPARQL query, which represents an extension on the default PoolParty is shipped with:

SPARL Query to Enable URI Search in PoolParty

PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
SELECT DISTINCT ?ID
FROM <%%%graph%%%>
WHERE {
{
?ID a skos:Concept.
FILTER(regex('%%%searchString%%%', '^https?://', 'i') = true)
FILTER(str(?ID) = replace('%%%searchString%%%', '\\\\\\.', '\\.'))
} UNION {
?ID a skos:Concept .
FILTER(regex('%%%searchString%%%', '^https?://', 'i') = false)
{
?ID skos:prefLabel ?searchLabel . 
FILTER(regex(LCASE(str(?searchLabel)), '^%%%searchString%%%', 'i') && lang(?searchLabel)='%%%lang%%%')
} UNION {
?ID skos:prefLabel ?searchLabel . 
FILTER(regex(LCASE(str(?searchLabel)), '%%%searchString%%%', 'i') && lang(?searchLabel)='%%%lang%%%')
} UNION {
?ID skos:altLabel ?searchLabel . 
FILTER(regex(LCASE(str(?searchLabel)), '^%%%searchString%%%', 'i') && lang(?searchLabel)='%%%lang%%%')
} UNION {
?ID skos:altLabel ?searchLabel . 
FILTER(regex(LCASE(str(?searchLabel)), '%%%searchString%%%', 'i') && lang(?searchLabel)='%%%lang%%%')
} UNION {
?ID skos:hiddenLabel ?searchLabel . 
FILTER(regex(LCASE(str(?searchLabel)), '^%%%searchString%%%', 'i') && lang(?searchLabel)='%%%lang%%%')
} UNION {
?ID skos:hiddenLabel ?searchLabel . 
FILTER(regex(LCASE(str(?searchLabel)), '%%%searchString%%%', 'i') && lang(?searchLabel)='%%%lang%%%')
}
}
} LIMIT %%%limit%%%

In order to make use of this query, expand the Tools menu, click the Admin Scripts menu entry, then click the Autocomplete Settings link. The editing field opens.

Follow these steps:

  1. Replace the whole entry in the Autocomplete Query field with this one.

  2. Click Submit.