Skip to main content

The 'Suggest' Call

Abstract

The 'Suggest' Call

The PoolParty Extractor offers a functionality to search for concepts within a project. The method used here 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.

Now enter the following request in the address bar of your browser.

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 of a word within the label that is not the first word > substring match within a label) and

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

The result contains information on which of the labels was matched ('matchingLabel') and the part of the label where the match occurred ('highlights').

This call returns the following:

Results

{
    "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 function is often used to implement auto-complete functionalities in applications and web pages, where users type in a text field and are supposed to select a concept from the thesaurus. Since this functionality is index-based and does not directly query the database of the project, it is quite fast and works well for such applications.