Custom searches in PoolParty

This short technical note shows a couple of less well-known PoolParty features that should help you with finding information in your taxonomies.

Customising auto-complete

The PoolParty user interface includes a very capable auto-complete search component, which makes it easy to find concepts using string properties such as preferred, alternative and hidden labels. Here's an example, using the MeSH 2016 taxonomy. I wanted to find concepts about acupuncture. Using the search box I can type in the first few characters and the auto-complete function shows me all of the concepts that match the text.

 

 

Clicking on one of these takes me to the relevant concept.

 

 

This auto-complete is also useful when you are creating a new concept. Here, I am on the concept Acupuncture and I think it would be good to have a narrower concept from this defining Meridians. So I would click on the plus sign under Narrower concepts and start to type the preferred label:

 

PoolParty pops up a list of matches and I can see that there is already a concept with the preferred label "Meridians". A key design point in taxonomies is to avoid duplicate concepts where you can, so this is a very good tool to help avoid that. At this point, knowing that my need for a Meridians concept is already covered, I could just cancel the addition. If I really do want Meridians to be a narrower concept from Acupuncture (as well as from Acupuncture Therapy and Qi) then I could just choose it here and it would then exist as a narrower concept of three concepts (perfectly legal in taxonomies).

So far, there's probably nothing here that you don't already know. But what if you were looking for text in a Definition or Scope Note or other property? It turns out that you can't search these properties directly, because the auto-complete function by default only searches in preferred labels, alternative labels and hidden labels. However, there is something that you can do about this.

As a PoolParty administrator, you can configure the auto-complete function. Go to Advanced > Admin Scripts:

 

and choose Autocomplete Settings.

You will see this slightly alarming form.

This page contains a SPARQL query that configures how auto-complete works in PoolParty. You can see that it defines the scope of its behaviour (searchLabel) as skos:prefLabel, skos:altLabel and skos:hiddenLabel. If you want to extend the auto-complete functionality to include, say, the skos:definition, this is the place to do it. Simply add a clause that refers to the property (say, skos:definition) that you want to include in the auto-complete.

Warning! Get this query wrong and you could have unpredictable results! I offer this as information only; don't come to me if you get the syntax wrong and your auto-completes don't work properly!

Finding concepts by URI

There may be circumstances where you only have a URI, and want to find where the concept is in PoolParty. I have had to do this many times, particularly in very big taxonomy projects. Here is how to find your concept; it's simple, but not obvious. Let's suppose we know there is a concept with the URI http://id.nlm.nih.gov/mesh/2016/D055870. Now, as it happens, the MeSH 2016 taxonomy is a very well designed structure and it's URIs are all deferenced. That is, you can follow the URI and see concrete information about that concept. You won't always have that luxury in a real-life in-house taxonomy, so let's see what else we could do. We can't put the id D055870 into the auto-complete search, because URIs are not searchable in this way. However, we can use a SPARQL query, via the SPARQL tab in the PoolParty UI.

You can type a SPARQL query into this form and run it to get the triples you want. In this case we want to get back information about this concept. So we use a query like this:

PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
SELECT * WHERE {
<http://id.nlm.nih.gov/mesh/2016/D055870> ?p ?o
}

This means "retrieve every triple that has this URI in the subject position and anything in the predicate and object positions". This is how it looks in the SPARQL editor:

When we click the Run Query button, here is the response:

Now we have the information we need; we can see prefLabel ("Drug Chronotherapy") and altLabel properties, which we know we can use to find the concept in the UI. We could have narrowed the results list down by changing the query to:

PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
SELECT * WHERE {
<http://id.nlm.nih.gov/mesh/2016/D055870> skos:prefLabel ?o .
}

in which case the response would look like this:

Typing this into the auto-complete field gets us to the concept (which I'm going to leave as an exercise for the reader).

You could elaborate this kind of search to find almost anything in your taxonomy; for example, you could retrieve every concept in a particular concept scheme, using the inScheme predicate with the object as the URI of the concept scheme; this example shows this for the "B - Organisms" concept scheme, and I've limited the query to the first 10 results.

PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
SELECT * WHERE {
?s skos:inScheme <http://vocabulary.semantic-web.at/mesh/1> .
} limit 10

Here is the response:

By the way, this assumes that you have enabled the inScheme property in your taxonomy. This is not enabled by default, so you have to go to the Advanced > inScheme Settings menu and choose the option to add inScheme to all concepts (warning; this can take a while for a big taxonomy).

OK, that's it for this short note. I hope you find it useful in your work with PoolParty. Keep watching here for more technical notes.