Comunica
    Preparing search index...

    An RDF Metadata Extract Actor that extracts all Hydra controls from the metadata stream.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    beforeActors: Actor<
        IActionRdfMetadataExtract,
        IActorTest,
        IActorRdfMetadataExtractOutput,
        undefined,
    >[] = []

    Actor that must be registered in the bus before this actor.

    bus: Bus<
        Actor<
            IActionRdfMetadataExtract,
            IActorTest,
            IActorRdfMetadataExtractOutput,
            undefined,
        >,
        IActionRdfMetadataExtract,
        IActorTest,
        IActorRdfMetadataExtractOutput,
        undefined,
    >

    The bus this actor subscribes to.

    name: string

    The name for this actor.

    {<rdf:subject>}
    
    parsedUriTemplateCache: Record<string, UriTemplate> = {}
    HYDRA: string = 'http://www.w3.org/ns/hydra/core#'
    LINK_TYPES: string[] = ...

    Methods

    • Correct all URLs within the given Hydra properties that are exposed under the http protocol, while the page they were retrieved from is hosted over https.

      Occasionally, TPF servers are hosted over https, while their base URL is configured as http. This causes all URLs in their metadata to be exposed under the http protocol, which makes the Hydra controls unusable, as they can not be linked to the current page anymore. Since this is a common problem, we detect it, correct the invalid URLs, and emit a warning.

      Only URLs on the host of the page are corrected, as the controls legitimately refer to http URLs elsewhere, such as the rdf:subject, rdf:predicate and rdf:object values of hydra:property.

      Parameters

      • pageUrl: string

        The page URL in which the Hydra properties are defined.

      • hydraProperties: Record<string, Record<string, string[]>>

        The collected Hydra properties.

      • context: IActionContext

        The action context, in which a warning will be logged upon detecting an invalid protocol.

      Returns Record<string, Record<string, string[]>>

      The Hydra properties, with all invalidly exposed URLs corrected.

    • Determine the URL prefix under which servers with an invalidly configured base URL expose the controls of the given page.

      Concretely, this is the origin of the page URL with the https protocol replaced by http, including the trailing slash, so that only URLs on the host of the page are matched.

      Parameters

      • pageUrl: string

        The page URL in which the Hydra properties are defined.

      Returns string | undefined

      The invalid URL prefix, or undefined if the page URL is not an https URL with a path.

    • Collect all Hydra page links from the given Hydra properties object.

      Parameters

      • pageUrl: string

        The page URL in which the Hydra properties are defined.

      • hydraProperties: Record<string, Record<string, string[]>>

        The collected Hydra properties.

      Returns Record<string, any>

      The Hydra links

    • Check if any URL within the given Hydra properties starts with the given prefix.

      Parameters

      • hydraProperties: Record<string, Record<string, string[]>>

        The collected Hydra properties.

      • invalidPrefix: string

        The URL prefix of invalidly exposed controls.

      Returns boolean