The GEOSS Discovery And Access Broker APIs
Authors: Fabrizio Papeschi, Mattia Santoro, Stefano Nativi
API version: 1.4.3-beta

TermFrequency

Module: Refinement
Parent Module: ResultSet

This object is optionally provided as property of a result set.
It allows to refine the related result set using as constraints one or more term frequency items related to a term frequency target. The available term frequency targets are:

// creates a new DAB instance with the given endpoint
                        var dab = GIAPI.DAB('https://api.geodab.eu/dab');
// set to true after the first refinement var refined = false;
// defines discover response callback function var onResponse = function(response){
var resultSet = response[0];
// retrieves the TermFrequency object var tf = resultSet.termFrequency;
// retrieves the term frequency items of // all the available term frequency targets var kwdTerms = tf.items('keyword'); var frmTerms = tf.items('format'); var proTerms = tf.items('protocol'); var srcTerms = tf.items('source');
if(refined){// exit return; }
// checks the first term of the keyword target tf.checkItems('keyword',[ kwdTerms[0] ]);
// refines the discover; the new result set contains only // nodes matching the first term of the keyword target tf.refine();
refined = true; };
// setting the termFrequency option var options = { "termFrequency": "keyword,format,protocol,source" };
// starts discover dab.discover(onResponse, options);

This API provides a widget which allows to refine the discover using check boxes to select the term frequency items.

See also TermFrequencyWidget

Methods

checkedItems

(
  • target
)
TermFrequencyItem[]

Return an array of all the checked term frequency items related to the given term frequency target.

See also checkItems method

Parameters:

  • target String

    a term frequency target. Available targets are:

    • keyword
    • format
    • source
    • protocol

Returns:

checkItems

(
  • target
  • targetItems
)

Checks the term frequency items of the given term frequency target. Once the items are checked, the refine method is ready to be called.

See also refine method

Parameters:

clearCheckedItems

(
  • target
)

Clear all the checked term frequency items related to the given term frequency target.

See also checkItems method

Parameters:

  • target String

    a term frequency target. Available targets are:

    • keyword
    • format
    • source
    • protocol

isCheckedItem

(
  • target
  • item
)

Return true if the given term frequency items related to the given term frequency target is checked.

See also checkItems method

Parameters:

items

(
  • target
)
TermFrequencyItem[]

Returns an array of all the available term frequency items related to the given target

Parameters:

  • target String

    a term frequency target. Available targets are:

    • keyword
    • format
    • source
    • protocol

Returns:

TermFrequencyItem[]:

array of all the available term frequency items related to the given target

itemsCount

(
  • target
)
Integer

Returns the number of all the available term frequency items related to the given target

Parameters:

  • target String

    a term frequency target. Available targets are:

    • keyword
    • format
    • source
    • protocol

Returns:

Integer:

the number of all the available term frequency items related to the given target

refine

()

Refines the related result set by adding constraints basing on the currently checked term frequency items.

See also checkItems method.
See also items method

targets

() String[]

Return an array of all the available term frequency targets. Available targets are:

  • keyword
  • format
  • source
  • protocol

See also termFrequency option

Returns:

String[]:

array of all the available term frequency targets

targetsCount

() Integer

Returns the number of all the available term frequency targets.

See also targets method

Returns:

Integer:

the number of all the available term frequency targets