Show:

The GraphPattern represents a list of Triples, Filters and Queries

Constructor

GraphPattern

(
  • elements
  • optional
  • union
  • allowedTypes
)

Parameters:

  • elements Object | Array
    • Initial item(s) for the GraphPattern
  • optional Boolean
    • Set the OPTIONAL flag (for use within GroupGraphPatterns)
  • union Boolean
    • Set the UNION flag (for use within GroupGraphPatterns)
  • allowedTypes Boolean
    • Override the default allowed types (Triple, Filter and Query)

Methods

addElement

(
  • element
  • atIndex
)

Adds an element to the pattern

Parameters:

  • element Object
    • Single item to add
  • atIndex Number
    • Optional index for the added element (default is end of list)

clear

()

Clear the pattern

countElements

() Number

Get the element count

Returns:

Number:

getElements

() Array

Retrieves the elements from the pattern

Returns:

Array:

removeElements

(
  • atIndex
  • count
)

Removes one or more elements from the pattern

Parameters:

  • atIndex Number
    • Index of item to remove (default is first)
  • count Number
    • Number of elements to remove (default is 1)

toString

() String

Retrieves the SPARQL string representation of the current instance

Returns:

String: