GraphPattern Class
Defined in:
src/sparql/graph-pattern.js:6
The GraphPattern represents a list of Triples, Filters and Queries
Constructor
GraphPattern
(
-
elements -
optional -
union -
allowedTypes
Parameters:
-
elementsObject | Array- Initial item(s) for the GraphPattern
-
optionalBoolean- Set the OPTIONAL flag (for use within GroupGraphPatterns)
-
unionBoolean- Set the UNION flag (for use within GroupGraphPatterns)
-
allowedTypesBoolean- Override the default allowed types (Triple, Filter and Query)
Item Index
Methods
addElement
(
-
element -
atIndex
Adds an element to the pattern
Parameters:
-
elementObject- Single item to add
-
atIndexNumber- 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:
-
atIndexNumber- Index of item to remove (default is first)
-
countNumber- Number of elements to remove (default is 1)
toString
()
String
Retrieves the SPARQL string representation of the current instance
Returns:
String: