Options
All
  • Public
  • Public/Protected
  • All
Menu

sparql-engine - v0.8.3

Index

Modules

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

CompiledExpression

CompiledExpression: function

A SPARQL expression compiled as a function

Type declaration

CustomFunctions

CustomFunctions: object

Type alias to describe the shape of custom functions. It's basically a JSON object from an IRI (in string form) to a function of 0 to many RDFTerms that produces an RDFTerm.

Type declaration

  • [key: string]: function
      • (...args: (null | NamedNode<string> | BlankNode | Literal | Variable | DefaultGraph | BaseQuad | (NamedNode<string> | BlankNode | Literal | Variable | DefaultGraph | BaseQuad)[])[]): ExpressionOutput
      • Parameters

        • Rest ...args: (null | NamedNode<string> | BlankNode | Literal | Variable | DefaultGraph | BaseQuad | (NamedNode<string> | BlankNode | Literal | Variable | DefaultGraph | BaseQuad)[])[]

        Returns ExpressionOutput

ExpressionOutput

ExpressionOutput: Term | Term[] | Iterable<Term | null> | null

The output of a SPARQL expression's evaluation, one of the following

  • A RDFJS Term.
  • An array of RDFJS Terms.
  • An iterator that yields RDFJS Terms or null values.
  • A null value, which indicates that the expression's evaluation has failed.

InputExpression

InputExpression: Expression | string | string[]

An input SPARQL expression to be compiled

PipelineInput

PipelineInput<T>: PipelineStage<T> | StreamPipelineInput<T> | Iterable<T> | PromiseLike<T> | ArrayLike<T>

The input of a PipelineStage, either another PipelineStage, an array, an iterable or a promise.

Type parameters

  • T

QueryOutput

QueryOutput: Bindings | TripleObject | boolean

Output of a physical query execution plan

RDFBindings

RDFBindings: object

Type declaration

  • [key: string]: Term

TermRows

TermRows: object

Type declaration

  • [key: string]: Term[]

Variables

Const BOUND_JOIN_BUFFER_SIZE

BOUND_JOIN_BUFFER_SIZE: 15 = 15

Const HINT_PREFIX

HINT_PREFIX: "http://callidon.github.io/sparql-engine/hints#" = "http://callidon.github.io/sparql-engine/hints#"

Let _currentEngine

_currentEngine: PipelineEngine = new RxjsPipeline()

Const csvFormatter

csvFormatter: (Anonymous function) = genericFormatter(',')

Formats query solutions (bindings or booleans) from a PipelineStage in W3C SPARQL CSV format

see

https://www.w3.org/TR/2013/REC-sparql11-results-csv-tsv-20130321/

author

Thomas Minier

param

Input pipeline

returns

A pipeline that yields results in W3C SPARQL CSV format

Const tsvFormatter

tsvFormatter: (Anonymous function) = genericFormatter('\t')

Formats query solutions (bindings or booleans) from a PipelineStage in W3C SPARQL TSV format

see

https://www.w3.org/TR/2013/REC-sparql11-results-csv-tsv-20130321/

author

Thomas Minier

param

Input pipeline

returns

A pipeline that yields results in W3C SPARQL TSV format

Functions

HINT

  • HINT(suffix: string): string

Private _compileComparators

  • _compileComparators(comparators: OrderComparator[]): (Anonymous function)
  • Build a comparator function from an ORDER BY clause content

    Parameters

    • comparators: OrderComparator[]

      ORDER BY comparators

    Returns (Anonymous function)

    A comparator function

Private _hash

Private _hashBindings

  • _hashBindings(variables: string[], bindings: Bindings): string
  • Hash functions for set of bindings

    Parameters

    • variables: string[]

      SPARQL variables to hash

    • bindings: Bindings

      Set of bindings to hash

    Returns string

    Hashed set of bindings

_writeBindings

  • _writeBindings(input: Bindings, results: any): void

_writeBoolean

  • _writeBoolean(input: boolean, root: any): void

Private allBGP

  • allBGP(): BGPNode

Private allPattern

  • allPattern(): TripleObject
  • Create a triple pattern that matches all RDF triples in a graph

    Returns TripleObject

    A triple pattern that matches all RDF triples in a graph

applyBindings

  • applyBindings(triple: TripleObject, bindings: Bindings): TripleObject
  • Bound a triple pattern using a set of bindings, i.e., substitute variables in the triple pattern using the set of bindings provided

    Parameters

    • triple: TripleObject

      Triple pattern

    • bindings: Bindings

      Set of bindings

    Returns TripleObject

    An new, bounded triple pattern

applyHash

  • applyHash(hashType: string): function
  • Return a high-orderpply a Hash function to a RDF and returns the corresponding RDF Literal

    Parameters

    • hashType: string

      Type of hash (md5, sha256, etc)

    Returns function

    A function that hashes RDF term

      • (v: Term): Term
      • Parameters

        • v: Term

        Returns Term

ask

Private bgpEvaluation

bind

bindArgument

  • bindArgument(variable: string): function
  • Get a function that, given a SPARQL variable, fetch the associated RDF Term in an input set of bindings, or null if it was not found.

    Parameters

    • variable: string

      SPARQL variable A fetch the RDF Term associated with the variable in an input set of bindings, or null if it was not found.

    Returns function

      • Parameters

        Returns Term | null

boundJoin

Private boundPathTriple

  • boundPathTriple(triple: PathTripleObject, bindings: Bindings): PathTripleObject
  • A fork of Bindings#bound specialized for triple patterns with property paths

    Parameters

    • triple: PathTripleObject

      A triple pattern with a property path

    • bindings: Bindings

      Set of bindings used to bound the triple

    Returns PathTripleObject

    The bounded triple pattern

Private buildGroupClause

  • buildGroupClause(source: UpdateGraphTarget, dataset: Dataset, isSilent: boolean): BGPNode | UpdateGraphNode
  • Build a SPARQL GROUP that selects all RDF triples from the Default Graph or a Named Graph

    Parameters

    • source: UpdateGraphTarget

      Source graph

    • dataset: Dataset

      RDF dataset used to select the source

    • isSilent: boolean

      True if errors should not be reported

    Returns BGPNode | UpdateGraphNode

    The SPARQL GROUP clasue

Private buildWhereClause

  • buildWhereClause(source: UpdateGraphTarget, dataset: Dataset, isSilent: boolean): BGPNode | GraphNode
  • Build a SPARQL WHERE that selects all RDF triples from the Default Graph or a Named Graph

    Parameters

    • source: UpdateGraphTarget

      Source graph

    • dataset: Dataset

      RDF dataset used to select the source

    • isSilent: boolean

      True if errors should not be reported

    Returns BGPNode | GraphNode

    The SPARQL GROUP clasue

construct

deepApplyBindings

  • deepApplyBindings(group: PlanNode, bindings: Bindings): PlanNode
  • Recursively apply bindings to every triple in a SPARQL group pattern

    Parameters

    • group: PlanNode

      SPARQL group pattern to process

    • bindings: Bindings

      Set of bindings to use

    Returns PlanNode

    A new SPARQL group pattern with triples bounded

exists

extendByBindings

extractPropertyPaths

  • extractPropertyPaths(bgp: BGPNode): [TripleObject[], PathTripleObject[], string[]]
  • Extract property paths triples and classic triples from a set of RDF triples. It also performs a first rewriting of some property paths.

    Parameters

    • bgp: BGPNode

      Set of RDF triples

    Returns [TripleObject[], PathTripleObject[], string[]]

    A tuple [classic triples, triples with property paths, set of variables added during rewriting]

Private findKey

  • findKey(variables: IterableIterator<string>, maxValue?: number): number
  • Find a rewriting key in a list of variables For example, in [ ?s, ?o_1 ], the rewriting key is 1

    Parameters

    • variables: IterableIterator<string>
    • Default value maxValue: number = 15

    Returns number

genericFormatter

  • genericFormatter(separator: string): (Anonymous function)
  • Create a function that formats query solutions in CSV/TSV using a separator

    author

    Thomas Minier

    Parameters

    • separator: string

      Separator to use

    Returns (Anonymous function)

    A function that formats query results in a pipeline fashion

halfHashJoin

hashBasicGraphPattern

hashJoin

indexJoin

  • Perform a join between a source of solution bindings (left relation) and a triple pattern (right relation) using the Index Nested Loop Join algorithm. This algorithm is more efficient if the cardinality of the left relation is smaller than the cardinality of the right one.

    author

    Thomas Minier

    Parameters

    Returns PipelineStage<Bindings>

    A PipelineStage which evaluate the join

isAggregation

  • isAggregation(expr: Expression): expr is AggregateExpression
  • Test if a SPARQL expression is a SPARQL aggregation

    Parameters

    • expr: Expression

      SPARQL expression, in sparql.js format

    Returns expr is AggregateExpression

    True if the SPARQL expression is a SPARQL aggregation, False otherwise

isFunctionCall

  • isFunctionCall(expr: Expression): expr is FunctionCallExpression
  • Test if a SPARQL expression is a SPARQL function call (like a custom function)

    Parameters

    • expr: Expression

      SPARQL expression, in sparql.js format

    Returns expr is FunctionCallExpression

    True if the SPARQL expression is a SPARQL function call, False otherwise

isIterable

  • isIterable(obj: Object): obj is Iterable<Term | null>
  • Test if an object is an iterator that yields RDF Terms or null values

    Parameters

    • obj: Object

      Input object

    Returns obj is Iterable<Term | null>

    True if the input obkect is an iterator, False otherwise

isOperation

  • isOperation(expr: Expression): expr is SPARQLExpression
  • Test if a SPARQL expression is a SPARQL operation

    Parameters

    • expr: Expression

      SPARQL expression, in sparql.js format

    Returns expr is SPARQLExpression

    True if the SPARQL expression is a SPARQL operation, False otherwise

jsonFormat

minus

optional

orderby

parseCapabilities

parseHints

precision

  • precision(expected: Term[], predicted: Term[]): number

recall

  • recall(expected: Term[], predicted: Term[]): number

Private revertBinding

  • revertBinding(key: number, input: Bindings, variables: IterableIterator<string>): Bindings

rewriteAdd

  • rewriteAdd(addQuery: UpdateCopyMoveNode, dataset: Dataset): UpdateQueryNode

rewriteCopy

  • rewriteCopy(copyQuery: UpdateCopyMoveNode, dataset: Dataset): [UpdateClearNode, UpdateQueryNode]

rewriteMove

  • rewriteMove(moveQuery: UpdateCopyMoveNode, dataset: Dataset): [UpdateClearNode, UpdateQueryNode, UpdateClearNode]

Private rewriteSolutions

rewriteTriple

  • rewriteTriple(triple: TripleObject, key: number): TripleObject
  • Rewrite a triple pattern using a rewriting key, i.e., append "_key" to each SPARQL variable in the triple pattern

    author

    Thomas Minier

    Parameters

    • triple: TripleObject
    • key: number

      Rewriting key

    Returns TripleObject

    The rewritten triple pattern

Private rewritingOp

  • A special operator used to evaluate a UNION query with a RDF Graph, and then rewrite bindings generated and performs union with original bindings. It is designed to be used in the bound join algorithm

    author

    Thomas Minier

    Parameters

    • graph: Graph

      Graph queried

    • bgpBucket: TripleObject[][]

      List of BGPs to evaluate

    • rewritingTable: Map<number, Bindings>

      Map <rewriting key -> original bindings>

    • builder: BGPStageBuilder
    • context: ExecutionContext

      Query execution context

    Returns PipelineStage<Bindings>

    A pipeline stage which evaluates the query.

select

sparqlDistinct

sparqlFilter

sparqlGroupBy

symHashJoin

union

  • union(setA: Set<number>, setB: Set<number>): Set<number>
  • Perform the union of two sets

    author

    Arthur Trottier

    author

    Charlotte Cogan

    author

    Julien Aimonier-Davat

    Parameters

    • setA: Set<number>

      first set

    • setB: Set<number>

      second set

    Returns Set<number>

    The union of the two sets

Private writeBindings

Private writeHead

xmlFormat

Object literals

Const QUERY_MODIFIERS

QUERY_MODIFIERS: object

ASK

ASK: ask = ask

CONSTRUCT

CONSTRUCT: construct = construct

SELECT

SELECT: select = select

Const stages

stages: object

AggregateStageBuilder

AggregateStageBuilder: AggregateStageBuilder

BGPStageBuilder

BGPStageBuilder: BGPStageBuilder

BindStageBuilder

BindStageBuilder: BindStageBuilder

DistinctStageBuilder

DistinctStageBuilder: DistinctStageBuilder

FilterStageBuilder

FilterStageBuilder: FilterStageBuilder

GlushkovStageBuilder

GlushkovStageBuilder: GlushkovStageBuilder

GraphStageBuilder

GraphStageBuilder: GraphStageBuilder

MinusStageBuilder

MinusStageBuilder: MinusStageBuilder

OptionalStageBuilder

OptionalStageBuilder: OptionalStageBuilder

OrderByStageBuilder

OrderByStageBuilder: OrderByStageBuilder

SPARQL_OPERATION

SPARQL_OPERATION: SPARQL_OPERATION

ServiceStageBuilder

ServiceStageBuilder: ServiceStageBuilder

UnionStageBuilder

UnionStageBuilder: UnionStageBuilder

UpdateStageBuilder

UpdateStageBuilder: UpdateStageBuilder

Generated using TypeDoc