Skip to main content

Search for Concepts in a PoolParty Project

Abstract

Search for Concepts in a PoolParty Project

The Extractor offers a functionality to search for concepts in a project.

The method is called 'suggest' and requires the parameters 'language', 'projectId' and 'searchString' for the actual search text.

The search text is matched to all (SKOS) labels in the thesaurus and all the matching concepts are returned with the most relevant matches first.

Request

{{url}}/extractor/api/suggest?language=en&projectId={{project}}&searchString=rasp

The score depends on the following conditions:

  • which label is matched (prefLabel > altLabel > hiddenLabel),

  • where in the label it happens (beginning of label > beginning a word in the label that is not the first word > substring match in a label) and

  • how many times the search string matches any label of a concept (more matches > less matches).

The result contains information about which of the labels was matched ('matchingLabel') and in which part of the label the match did happen ('highlights').

Click to expand the result:

{
    "suggestedConcepts": [
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/371797a7-e9a8-453b-8744-2e89f2fd30d2@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 9.5,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/371797a7-e9a8-453b-8744-2e89f2fd30d2",
            "language": "en",
            "prefLabel": "Raspberry syrup",
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/87384ce8-f20a-4201-b06d-3e0b8d832e5d",
                    "title": "Sweeteners"
                }
            ],
            "matchingLabel": "<em>Raspberry syrup</em>",
            "highlights": [
                {
                    "text": "<em>Raspberry</em> syruping",
                    "predicate": "prefLabel"
                }
            ]
        },
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/7c4a2cfe-6750-419a-87d1-dcb4919ff92b@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 5,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/7c4a2cfe-6750-419a-87d1-dcb4919ff92b",
            "language": "en",
            "prefLabel": "Blackberry",
            "altLabels": [
                "Blackberry Vines",
                "Rubus fruticosus",
                "Blackberry (fruit)",
                "Bush blackberry",
                "Culture of blackberry",
                "Black-berry",
                "Blackberry bush",
                "Bramble raspberry",
                "Bramble Raspberry",
                "Blackberries",
                "Black Berry",
                "Bush Blackberry"
            ],
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/eff672ac-6601-42c6-a3e9-0adda3b45df8",
                    "title": "Garnish and other ingredients"
                }
            ],
            "matchingLabel": "<em>Bramble raspberry</em>",
            "highlights": [
                {
                    "text": "Bramble <em>raspberries</em>",
                    "predicate": "altLabel"
                }
            ]
        },
        {
            "id": "1E034541-9963-0001-EE48-B5D068201D43:https://nextrelease-cons.semantic-web.at/cocktails/ee61817b-0d10-4862-b44b-740c990e676e@en",
            "project": "1E034541-9963-0001-EE48-B5D068201D43",
            "score": 4,
            "uri": "https://nextrelease-cons.semantic-web.at/cocktails/ee61817b-0d10-4862-b44b-740c990e676e",
            "language": "en",
            "prefLabel": "Chambord",
            "altLabels": [
                "Chambord Liqueur Royale de France",
                "Chambord Black Raspberry Liqueur",
                "Chambord Liqueur",
                "Chambord liqueur royale de france"
            ],
            "conceptSchemes": [
                {
                    "uri": "https://nextrelease-cons.semantic-web.at/cocktails/591cf89a-57af-49b8-9042-3fc77408c93e",
                    "title": "Beverages"
                }
            ],
            "matchingLabel": "<em>Chambord Black Raspberry Liqueur</em>",
            "highlights": [
                {
                    "text": "Chambord Black <em>Raspberry</em> Liqueur",
                    "predicate": "altLabel"
                }
            ]
        }
    ],
    "success": true,
    "total": 3
}

This functionality is often used to implement autocomplete functionalities in applications and web pages, where users type in a text field and should select a concept from the thesaurus. Because it is based on an index and does not query the database of the project directly, it is rather fast and works well for such applications.