Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UnionGraph

An UnionGraph represents the dynamic union of several graphs. Addition only affects the left-most operand, deletion affects all graphs. Searching for RDF triple smatching a triple pattern in such Graph is equivalent as the Union of matching RDF triples in all graphs.

extends

Graph

author

Thomas Minier

Hierarchy

Index

Constructors

constructor

Properties

Private _graphs

_graphs: Graph[]

Accessors

iri

  • get iri(): string
  • set iri(value: string): void
  • Get the IRI of the Graph

    Returns string

    The IRI of the Graph

  • Set the IRI of the Graph

    Parameters

    • value: string

      The new IRI of the Graph

    Returns void

    The IRI of the Graph

Methods

_isCapable

clear

  • clear(): Promise<void>

delete

  • delete(triple: TripleObject): Promise<void>

estimateCardinality

  • estimateCardinality(triple: TripleObject): Promise<number>

evalBGP

evalUnion

find

fullTextSearch

  • fullTextSearch(pattern: TripleObject, variable: string, keywords: string[], matchAll: boolean, minRelevance: number | null, maxRelevance: number | null, minRank: number | null, maxRank: number | null, context: ExecutionContext): PipelineStage<[TripleObject, number, number]>
  • Get a PipelineStage which finds RDF triples matching a triple pattern and a set of keywords in the RDF Graph. The search can be constrained by min and max relevance (a 0 to 1 score signifying how closely the literal matches the search terms).

    The Graph class provides a default implementation that computes the relevance score as the percentage of words matching the list of input keywords. If the minRank and/or maxRanks parameters are used, then the graph materializes all matching RDF triples, sort them by descending rank and then selects the appropriates ranks. Otherwise, the rank is not computed and all triples are associated with a rank of -1.

    Consequently, the default implementation should works fines for a basic usage, but more advanced users should provides their own implementation, integrated with their own backend. For example, a SQL-based RDF Graph should rely on GIN or GIST indexes for the full text search.

    example

    const pattern = { subject: '?s', predicate: 'foaf:name', object: '?n'} const keywords = [ 'Ann' , 'Bob' ] // Find the top 100 RDF triples matching the pattern where ?n contains the keyword 'Ann' or 'Bob' // with a minimum relevance score of 0.25 and no maximum relevance score. const pipeline = graph.fullTextSearch(pattern, '?n', keywords, 0.25, null, null, 100, context) pipeline.subscribe(item => { console.log(Matching RDF triple ${item[0]} with score ${item[1]} and rank ${item[2]}) }, console.error, () => console.log('Search completed!'))

    Parameters

    • pattern: TripleObject

      Triple pattern to find

    • variable: string

      SPARQL variable on which the keyword search is performed

    • keywords: string[]

      List of keywords to seach for occurence

    • matchAll: boolean

      True if only values that contain all of the specified search terms should be considered.

    • minRelevance: number | null

      Minimum relevance score (set it to null to disable it)

    • maxRelevance: number | null

      Maximum relevance score (set it to null to disable it)

    • minRank: number | null

      Minimum rank of the matches (set it to null to disable it)

    • maxRank: number | null

      Maximum rank of the matches (set it to null to disable it)

    • context: ExecutionContext

      Execution options

    Returns PipelineStage<[TripleObject, number, number]>

    A PipelineInput which output tuples of shape [matching RDF triple, score, rank].

insert

  • insert(triple: TripleObject): Promise<void>

Generated using TypeDoc